/* 附加页面共享主题；登录与看盘不加载此文件。 */
:root[data-ui-theme] {
  color-scheme:light;
  color:var(--text); background:var(--bg);
  --shadow:color-mix(in srgb,var(--text) 12%,transparent); --backdrop:color-mix(in srgb,var(--bg) 60%,#13243588); --selected-line:var(--muted); --blue:var(--accent); --cyan:var(--accent);
  --on-accent:#fff; --active-text:var(--accent); --button-bg:var(--panel); --other-text:var(--muted);
  --soft-accent:color-mix(in srgb,var(--accent) 11%,var(--panel));
  --accent-border:color-mix(in srgb,var(--accent) 35%,var(--line));
  --accent-hover:color-mix(in srgb,var(--accent) 88%,#000);
  --pending-dot:#a57522; --reviewing-dot:#3b78b8; --verifying-dot:#8660af; --resolved-dot:#4b8761;
  --error:#ac3f3c; --priority-high:#966026;
  --bug-bg:#fbe9e6; --bug-text:#a44235; --suggestion-bg:#eee9f8; --suggestion-text:#684b90;
  --badge-bg:#edf0f3; --badge-line:#c8d1da; --badge-text:#536779;
  --pending-bg:#fff3d6; --pending-text:#82560e; --pending-line:#e2c881;
  --reviewing-bg:#e6f0fd; --reviewing-text:#255d97; --reviewing-line:#aec8e9;
  --verifying-bg:#f0e9fa; --verifying-text:#70449c; --verifying-line:#cdb9e4;
  --resolved-bg:#e3f2e7; --resolved-text:#2e6c45; --resolved-line:#a7cfb4;
}
:root[data-ui-theme]:not([data-theme]), :root[data-theme="sky"], .theme-option[data-theme-option="sky"] .theme-preview {
  --bg:#f2f6fb; --panel:#ffffff; --raised:#e8eff7; --line:#cedbe8; --muted:#4d657d; --text:#20364c; --accent:#2b6cb0; --subtle:#526b82; --sidebar:#e9f0f8; --input:#fbfdff; --hover:#edf4fc;
}
:root[data-theme="paper"], .theme-option[data-theme-option="paper"] .theme-preview {
  --bg:#f5f1e8; --panel:#fffdf7; --raised:#eee7d9; --line:#dbd1bf; --muted:#6a5c48; --text:#3f382e; --accent:#8b623b; --subtle:#72634f; --sidebar:#ece5d7; --input:#fffdf8; --hover:#f3eddf;
}
:root[data-theme="sage"], .theme-option[data-theme-option="sage"] .theme-preview {
  --bg:#eef4ef; --panel:#fcfefb; --raised:#e2ece3; --line:#cadacf; --muted:#4e6856; --text:#263e30; --accent:#397052; --subtle:#566e5c; --sidebar:#e1ebe3; --input:#f9fcf8; --hover:#eaf2e9;
}
:root[data-theme="mist"], .theme-option[data-theme-option="mist"] .theme-preview {
  --bg:#e4eaf2; --panel:#f2f5fa; --raised:#d7e1ed; --line:#b7c8da; --muted:#425c75; --text:#20374f; --accent:#4a658a; --subtle:#4d637c; --sidebar:#d9e3ef; --input:#f9fbfe; --hover:#e3ebf6;
}
:root[data-theme="pearl"], .theme-option[data-theme-option="pearl"] .theme-preview {
  --bg:#f2f3f4; --panel:#fdfdfc; --raised:#e8ebed; --line:#cdd3d8; --muted:#58646e; --text:#303c46; --accent:#4c6174; --subtle:#5e6c76; --sidebar:#e9edef; --input:#fff; --hover:#edf0f3;
}
:root[data-theme="night"], .theme-option[data-theme-option="night"] .theme-preview {
  --bg:#141c27; --panel:#1d2936; --raised:#253443; --line:#3c5063; --muted:#a7b9ca; --text:#eaf1f7; --accent:#a8e3d7; --subtle:#9cb2c5; --sidebar:#182330; --input:#15212e; --hover:#2a3c4c;
}
:root[data-theme="night"] {
  color-scheme:dark; --on-accent:#12352e; --accent-hover:#bdece2;
  --pending-dot:#dfbb70; --reviewing-dot:#90bbea; --verifying-dot:#c5abe4; --resolved-dot:#9dd5b2;
  --error:#f1aaa2; --priority-high:#edbc88;
  --bug-bg:#453033; --bug-text:#f2b4aa; --suggestion-bg:#3d3551; --suggestion-text:#d1c0f0;
  --badge-bg:#2e3c49; --badge-line:#516575; --badge-text:#bdcbd7;
  --pending-bg:#423a28; --pending-text:#f1d492; --pending-line:#71613b;
  --reviewing-bg:#283f58; --reviewing-text:#aed1fb; --reviewing-line:#4c6c91;
  --verifying-bg:#3d3451; --verifying-text:#d8c1f6; --verifying-line:#6e568b;
  --resolved-bg:#28483e; --resolved-text:#b1e3c4; --resolved-line:#4d8069;
}
.theme-control { position:relative; }
.theme-toggle { display:flex; align-items:center; gap:7px; min-height:34px; padding:6px 10px; border:1px solid var(--line); border-radius:6px; background:var(--panel); color:var(--text); font-size:11px; white-space:nowrap; }
.theme-toggle:hover,.theme-toggle[aria-expanded="true"] { border-color:var(--accent-border); background:var(--soft-accent); }
.theme-toggle svg { width:16px; height:16px; stroke:var(--accent); stroke-width:1.5; stroke-linecap:round; }
#theme-current { padding-left:7px; border-left:1px solid var(--line); color:var(--muted); }
.theme-panel { position:fixed; inset:auto; margin:0; z-index:1000; box-sizing:border-box; font-family:inherit; line-height:1.5; width:408px; max-width:calc(100vw - 24px); max-height:calc(100dvh - 24px); overflow:auto; overscroll-behavior:contain; padding:18px; border:1px solid var(--accent-border); border-radius:12px; background:var(--panel); color:var(--text); box-shadow:0 18px 60px color-mix(in srgb,var(--text) 20%,transparent); }
.theme-panel-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:16px; }
.theme-panel-heading h2 { font-size:15px; font-weight:600; color:var(--text); }
.theme-panel-heading p { margin-top:6px; color:var(--muted); font-size:11px; }
#theme-close { padding:0; min-width:24px; min-height:24px; font-size:23px; line-height:1; }
.theme-options { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.theme-option { position:relative; display:flex; flex-direction:column; align-items:stretch; gap:7px; min-width:0; padding:8px; border:1px solid var(--line); border-radius:7px; background:var(--panel); text-align:left; color:var(--text); }
.theme-option:hover { border-color:var(--accent-border); background:var(--hover); }
.theme-option[aria-pressed="true"] { border-color:var(--accent); background:var(--soft-accent); box-shadow:0 0 0 1px var(--accent); }
.theme-option[aria-pressed="true"]::after { content:'✓'; position:absolute; right:12px; top:12px; width:15px; height:15px; border-radius:50%; background:var(--accent); color:var(--on-accent); text-align:center; font-size:10px; line-height:15px; }
.theme-option-name { font-size:12px; font-weight:600; margin-top:2px; }
.theme-option small { color:var(--muted); font-size:10px; line-height:1.4; }
.theme-preview { display:grid; grid-template-columns:20% 1fr; height:51px; overflow:hidden; border:1px solid var(--line); border-radius:4px; background:var(--bg); }
.theme-preview>i { background:var(--sidebar); border-right:1px solid var(--line); }
.theme-preview>i::before { content:''; display:block; width:7px; height:4px; margin:8px auto; border-radius:1px; background:var(--accent); }
.theme-preview>span { display:flex; flex-direction:column; gap:5px; padding:8px 6px; }
.theme-preview b { display:block; flex:1; min-height:3px; margin:0; background:var(--panel); border:1px solid var(--line); border-radius:1px; }
.theme-preview b:first-child { flex:0 0 3px; width:55%; background:var(--accent); border:0; }
.theme-note { margin:15px 0 0; color:var(--muted); font-size:10px; line-height:1.7; }

.theme-control { flex-shrink:0; }
.theme-panel[hidden] { display:none!important; }
.theme-panel button { font-family:inherit; cursor:pointer; }
.theme-panel :focus-visible,.theme-toggle:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
.theme-panel h2,.theme-panel p { margin:0; }.theme-panel-heading p { margin-top:6px; }
.theme-panel .theme-note { margin-top:15px; }
.theme-panel #theme-close { border:0; background:transparent; color:var(--muted); border-radius:4px; }

@media(max-width:650px) {
  .theme-toggle { padding:6px 8px; min-height:32px; gap:5px; font-size:11px; }
  #theme-current { display:none; }.theme-toggle svg { width:15px; height:15px; }
}
@media(max-width:450px) {
  .theme-panel { padding:16px; }.theme-options { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .theme-preview { height:46px; }.theme-option { gap:5px; }
}

/* 门户表单、管理表格和手册共用语义颜色，避免浅底上残留深色文字/输入框。 */
:root[data-ui-theme] { color:var(--text); background:var(--bg); }
[data-ui-theme] body { background:var(--bg); }
[data-ui-theme] a { transition:none; }
[data-ui-theme] body::before,[data-ui-theme] body::after { display:none; }
[data-ui-theme]:not([data-theme="night"]) .portal-universe { display:none; }
[data-ui-theme] .masthead { border-color:var(--line); }
[data-ui-theme] .wordmark strong { background:var(--text); }
[data-ui-theme] .wordmark span { color:var(--accent); }
[data-ui-theme]:not([data-theme="night"]) :is(.wordmark-symbol,.guide-header .brand img) { filter:brightness(.38) saturate(.8); }
[data-ui-theme] :is(.motion-toggle,.reveal) { background:transparent; border-color:var(--line); color:var(--muted); }
[data-ui-theme] :is(.setup,.login-panel) { background:var(--panel); border-color:var(--line); box-shadow:0 16px 55px var(--shadow); }
[data-ui-theme] :is(.setup,.login-panel)::before { background:linear-gradient(90deg,var(--accent),transparent); }
[data-ui-theme] :is(.eyebrow,.edition) { color:var(--accent); }
[data-ui-theme] :is(label,.help,.privacy-note,.login-links) { color:var(--muted); border-color:var(--line); }
[data-ui-theme] :is(input,select,.ui-select,textarea) { background:var(--input); color:var(--text); border-color:var(--line); caret-color:var(--text); transition:border-color .2s,box-shadow .2s; }
[data-ui-theme] :is(input,select,.ui-select,textarea):hover { border-color:var(--accent-border); }
[data-ui-theme] :is(input,select,.ui-select,textarea):focus { background:var(--input); border-color:var(--accent); box-shadow:0 0 0 3px var(--soft-accent); }
[data-ui-theme] :is(input,textarea)::placeholder { color:var(--subtle); }
[data-ui-theme] select option { background:var(--panel); color:var(--text); }
[data-ui-theme] input[readonly] { color:var(--muted); }
[data-ui-theme] input:-webkit-autofill { -webkit-text-fill-color:var(--text); box-shadow:0 0 0 1000px var(--input) inset; caret-color:var(--text); }
[data-ui-theme] .primary { color:var(--on-accent); background:var(--accent); border-color:var(--accent); box-shadow:none; transition:none; }
[data-ui-theme] .primary:hover:not(:disabled) { color:var(--on-accent); background:var(--accent-hover); box-shadow:none; }
[data-ui-theme] .secondary { color:var(--text); background:var(--panel); border-color:var(--line); transition:none; }
[data-ui-theme] .secondary:hover { background:var(--hover); }
[data-ui-theme] .status { color:var(--error); }
[data-ui-theme] .status[data-kind="success"] { color:var(--accent); }
[data-ui-theme] :is(.help,.guide-entry,.foot) { border-color:var(--line); }
[data-ui-theme] :is(.guide-entry,.guide-entry span,.foot,.capabilities) { color:var(--muted); }
[data-ui-theme] .trial-banner { background:var(--soft-accent); border-color:var(--accent-border); }
[data-ui-theme] .trial-banner p { color:var(--muted); }
[data-ui-theme] :focus-visible { outline-color:var(--accent); }
.authorization-tools { display:flex; align-items:center; justify-content:space-between; gap:12px; }
[data-ui-theme] #steps button[aria-current="step"], [data-ui-theme] #steps button[aria-current="step"]>span:first-child { color:var(--accent); }
[data-ui-theme] .masthead nav { flex-wrap:wrap; }
@media(max-width:1000px) {
  [data-ui-theme] .guide-header { height:112px; flex-wrap:wrap; gap:8px 12px; padding-block:8px; }
  [data-ui-theme] .guide-header>.guide-controls { order:3; flex-basis:100%; margin:0; justify-content:space-between; }
  [data-ui-theme] .guide-header .guide-edition { display:none; }
  :root[data-ui-theme]:has(.guide-header) { --guide-header-height:112px; }
}
@media(max-width:700px) {
  [data-ui-theme] .masthead nav { width:100%; }
  [data-ui-theme] .masthead { column-gap:12px; }
  [data-ui-theme] .masthead>.theme-control { margin-left:auto; }
  [data-ui-theme] .guide-header>.theme-control { margin-left:auto; }
}
