/* 顶栏不继承公共内容的居中限宽；两侧等宽轨道保证导航真正居中。 */
.public-header { width:100%; box-sizing:border-box; padding:0 28px; display:grid; grid-template-columns:minmax(210px,1fr) auto minmax(340px,1fr); gap:24px; }
.public-header .public-links { justify-content:center; white-space:nowrap; }
.public-header .public-tools { justify-content:flex-end; gap:12px; }
.public-navigation-row { display:contents; }
.preference-control { position:relative; display:flex; color:#536789; }
.preference-trigger { display:grid; place-items:center; width:40px; height:40px; padding:9px; border:0; border-radius:10px; color:inherit; background:transparent; cursor:pointer; }
.preference-trigger svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.preference-language { display:flex; justify-content:center; gap:6px; width:66px; font:inherit; font-size:14px; font-weight:600; }
.preference-trigger [hidden],.preference-menu[hidden] { display:none; }
.preference-trigger:hover,.preference-trigger[aria-expanded="true"] { color:#4264ed; background:#edf1ff; }
.preference-menu { position:absolute; top:calc(100% + 8px); right:0; z-index:50; width:168px; padding:6px; border:1px solid #dce3f3; border-radius:12px; background:#fff; box-shadow:0 12px 32px #17264326; }
.preference-menu button { display:flex; align-items:center; justify-content:space-between; width:100%; min-height:40px; padding:8px 12px; border:0; border-radius:7px; background:transparent; color:inherit; font:inherit; font-size:14px; cursor:pointer; }
.preference-menu button:hover,.preference-menu button:focus-visible,.preference-menu [aria-checked="true"] { background:#edf1ff; color:#4264ed; }
.preference-menu [aria-checked="true"]::after { content:"✓"; margin-left:12px; }
.preference-trigger:focus-visible,.preference-menu button:focus-visible { outline:2px solid #819bff; outline-offset:2px; }
html[data-theme="dark"] .preference-menu { background:var(--surface); border-color:var(--line); color:var(--ink); box-shadow:var(--portal-glow); }
html[data-theme="dark"] .preference-trigger:hover,html[data-theme="dark"] .preference-trigger[aria-expanded="true"],html[data-theme="dark"] .preference-menu button:hover,html[data-theme="dark"] .preference-menu button:focus-visible,html[data-theme="dark"] .preference-menu [aria-checked="true"] { background:var(--panel); color:var(--ink); }
.model-prices>header { justify-content:space-between; }.model-prices h2 { margin:0; }
.model-prices input { padding:10px 14px; border:1px solid #dce3f3; border-radius:8px; font:inherit; color:inherit; background:transparent; max-width:100%; box-sizing:border-box; }
.model-prices label { display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
@media(max-width:1150px) {
  .public-header { height:auto; min-height:80px; padding:14px 20px; grid-template-columns:minmax(0,1fr) auto; gap:12px; }
  .public-header .public-links { grid-column:1/-1; grid-row:2; }
  .public-header .public-tools { grid-column:2; grid-row:1; }
}
@media(max-width:760px) {
  .public-header { grid-template-columns:minmax(0,1fr); padding:12px; gap:10px; }
  .public-header .portal-brand { justify-content:center; font-size:18px; min-height:40px; padding:0 40px; }
  .public-navigation-row { display:flex; grid-column:1; grid-row:2; align-items:center; gap:8px; min-width:0; padding-bottom:4px; }
  .public-header .public-tools { justify-content:flex-end; flex-wrap:nowrap; gap:4px; flex-shrink:0; margin-left:auto; }
  .public-header .public-links { gap:10px; font-size:12px; flex:1; min-width:0; overflow-x:auto; flex-wrap:nowrap; justify-content:flex-start; }
  .public-header .public-links a { flex-shrink:0; }
  .public-header .public-entry { min-width:64px; padding:9px 8px; font-size:12px; white-space:nowrap; }
  .preference-menu { position:fixed; top:124px; left:auto; right:12px; width:150px; }
}
/* 浅色只强化外层容器；内层表格、指标及状态提示不叠加光晕，深色沿用独立规则。 */
html:not([data-theme="dark"]) {
  --portal-edge:rgba(98,135,255,.24);
  --portal-glow:0 0 8px rgba(98,135,255,.055),0 6px 18px rgba(35,55,100,.04);
  --portal-button-rgb:71,110,245;
}
html:not([data-theme="dark"]) :is(.console-stats article,.console-card,.portal-key-card,.portal-plan,.portal-quotas article,.portal-steps article,.portal-code,.portal-dialog,.auth-card,.preference-menu),
html:not([data-theme="dark"]) [data-content]>.portal-table {
  border-color:var(--portal-edge); box-shadow:var(--portal-glow);
}
html:not([data-theme="dark"]) .portal-plan.featured { border-color:rgba(83,116,250,.55); }
/* 仅操作入口使用轻投影，避免退出、关闭、表格明细和分页等小控件形成杂乱光点。 */
html:not([data-theme="dark"]) :is(.public-entry,.auth-primary,.console-link,[data-content]>button,.portal-heading>button,.console-card>header>button,.portal-key-card-heading>button,.portal-plan>button,.portal-code>header>button,.portal-key-actions>button,.portal-dialog button:not(.key-dialog-close)):not(:disabled) {
  box-shadow:0 0 6px rgba(var(--portal-button-rgb),.06),0 3px 9px rgba(var(--portal-button-rgb),.09);
}
html:not([data-theme="dark"]) .portal-key-actions [data-status="active"] { --portal-button-rgb:22,131,74; }
html:not([data-theme="dark"]) .portal-key-actions [data-status="disabled"] { --portal-button-rgb:169,98,0; }
html:not([data-theme="dark"]) :is(.portal-key-actions .danger,[data-delete-confirm]) { --portal-button-rgb:196,52,69; }
html:not([data-theme="dark"]) :is(.public-entry,.auth-primary,.console-link,.portal-heading>button,.portal-key-actions>button,.portal-dialog button):disabled { box-shadow:none; }
html:not([data-theme="dark"]) .model-prices input:focus-visible { outline:2px solid #819bff; outline-offset:2px; }
/* body沿用根节点的实时主题，避免历史theme-light类让内部原生滚动条保持浅色。 */
html[data-theme] body { color-scheme:inherit; }
/* 页面及控制台主滚动区使用细灰滑块和透明轨道，保留原生拖动与系统辅助功能。 */
html[data-theme] { --scroll-thumb:#a8a8ae; scrollbar-width:thin; scrollbar-color:var(--scroll-thumb) transparent; }
html[data-theme="dark"] { --scroll-thumb:#626268; }
html[data-theme] .portal-main { scrollbar-width:thin; scrollbar-color:var(--scroll-thumb) transparent; }
html[data-theme]::-webkit-scrollbar,html[data-theme] .portal-main::-webkit-scrollbar { width:6px; height:6px; }
html[data-theme]::-webkit-scrollbar-track,html[data-theme] .portal-main::-webkit-scrollbar-track { background:transparent; }
html[data-theme]::-webkit-scrollbar-thumb,html[data-theme] .portal-main::-webkit-scrollbar-thumb { background:var(--scroll-thumb); border-radius:8px; }
/* 深色采用中性灰黑分层；外卡微光与内层灰边分离，不改变品牌图标和状态色含义。 */
html[data-theme="dark"],html[data-theme="dark"] body { --surface:#222224; --panel:#2b2b2e; --ink:#f2f2f2; --muted:#b8b8bc; --line:#3b3b40; --surface-soft:#2b2b2e; --quota-track:#45454d; --portal-glow:0 0 8px #ffffff06,0 6px 18px #00000026; background:#111; }
html[data-theme="dark"] body { background:#111; color:var(--ink); }
html[data-theme="dark"] .public-header { background:#191919; border-color:var(--line); }
html[data-theme="dark"] .public-header a { color:var(--ink); }
html[data-theme="dark"] .public-header .public-entry { background:#4264ed; color:white; }
html[data-theme="dark"] .preference-control { color:var(--muted); }
html[data-theme="dark"] select,html[data-theme="dark"] option { background:var(--surface); color:var(--ink); border-color:var(--line); }
html[data-theme="dark"] [data-portal],html[data-theme="dark"] [data-portal].portal-authenticated:not([hidden]),html[data-theme="dark"] .session-gate { background:#111; color:var(--ink); }
html[data-theme="dark"] [data-portal] :is(h1,h2,h3,strong,dt,dd,td,th),html[data-theme="dark"] .session-gate { color:var(--ink); }
html[data-theme="dark"] [data-portal] :is(.portal-muted,.portal-empty,small),html[data-theme="dark"] .portal-footer { color:var(--muted); }
html[data-theme="dark"] [data-portal] a { color:var(--ink); }
html[data-theme="dark"] :is(.console-card,.console-stats article,.portal-key-card,.portal-plan,.portal-code,.portal-dialog,.portal-steps article,.portal-table,.portal-quotas article,.portal-sidebar) { background:var(--surface); color:var(--ink); border-color:var(--line); box-shadow:none; }
html[data-theme="dark"] :is(.console-card>header,.portal-table td,.portal-table th,.portal-user,.console-chart,.portal-plan dl,.portal-footer,.portal-faq details) { border-color:var(--line); }
html[data-theme="dark"] .portal-table table { background:var(--surface); }
html[data-theme="dark"] :is(.console-mini-stats article,.subscription-banner,.quota-tile,.console-chart,.console-note,.portal-info,.portal-tag,.portal-table th) { background:var(--panel); color:var(--muted); border-color:var(--line); }
html[data-theme="dark"] :is(.console-mini-stats article>span,.console-stats article>span,.console-card header p,.quota-tile p,.quota-tile span,.console-footnote,.portal-plan p,.portal-plan dt,.portal-plan ul,.portal-steps p,.console-log-table td small,.console-pagination) { color:var(--muted); }
html[data-theme="dark"] :is(.console-card,.console-stats article,.portal-key-card,.portal-plan,.portal-code,.portal-dialog,.portal-steps article,.portal-quotas article),html[data-theme="dark"] [data-content]>.portal-table { box-shadow:var(--portal-glow); }
html[data-theme="dark"] .portal-plan.featured { border-color:#787880; }
/* 选中是用户选择，区别于目录推荐；不改变卡片尺寸，避免切换时抖动。 */
html[data-theme] .portal-plan:has(.plan-choice:checked) { border-color:#5374fa; box-shadow:0 0 0 2px #5374fa,0 4px 18px #5374fa20; }
html[data-theme="dark"] .portal-plan:has(.plan-choice:checked) { border-color:#86a4ff; box-shadow:0 0 0 2px #86a4ff,0 4px 18px #5374fa18; }
html[data-theme="dark"] [data-portal] :is(.portal-sidebar,.portal-mobile-tabs) { background:#191919; border-color:var(--line); }
html[data-theme="dark"] :is(.portal-sidebar,.portal-mobile-tabs) a { color:#a8a8ae; transition:color .15s,background-color .15s; }
html[data-theme="dark"] :is(.portal-sidebar,.portal-mobile-tabs) a:is(:hover,.active,[aria-current]) { background:#2c2c30; color:var(--ink); }
html[data-theme="dark"] [data-portal] .portal-user button.secondary { background:transparent; color:#a8a8ae; border-color:var(--line); }
html[data-theme="dark"] [data-portal] .portal-user button.secondary:hover { color:var(--ink); }
html[data-theme="dark"] [data-portal] :is(button.secondary,input,select) { background:var(--panel); color:var(--ink); border-color:var(--line); }
html[data-theme="dark"] .portal-key-secret { background:#122e29; border-color:#2d7462; color:var(--ink); }
html[data-theme="dark"] .portal-key-secret pre { background:#0e211e; color:#b7f5df; border-color:#2d7462; }
html[data-theme="dark"] [data-portal] .console-detail { background:var(--surface); }
html[data-theme="dark"] .console-detail dl>div { border-color:var(--line); }
html[data-theme="dark"] .portal-dialog::backdrop { background:#0009; }
html[data-theme="dark"] .chart-grid text { fill:var(--muted); }html[data-theme="dark"] .chart-grid line { stroke:var(--line); }
html[data-theme="dark"] .auth-shell { background:#111; color-scheme:dark; }
html[data-theme="dark"] .auth-stage { background:#191919; border-color:var(--line); box-shadow:none; }
html[data-theme="dark"] :is(.auth-card,.auth-panel,.auth-login-panel,.auth-model-node,.auth-feature-stack>span,.auth-capabilities) { background:var(--surface); border-color:var(--line); color:var(--ink); }
html[data-theme="dark"] .auth-shell :is(h1,h2,b,label,strong) { color:var(--ink); }
html[data-theme="dark"] .auth-shell :is(p,small,.auth-subtitle,.auth-steps,.auth-security,.auth-console-note) { color:var(--muted); }
html[data-theme="dark"] .auth-shell input { background:var(--panel); color:var(--ink); border-color:#62626c; }
html[data-theme="dark"] .auth-shell input::placeholder { color:var(--muted); }
html[data-theme="dark"] .auth-shell .auth-form input:is(:focus,.is-filled) { background:var(--panel); border-color:#819bff; }
html[data-theme="dark"] .auth-shell a { color:var(--ink); }
html[data-theme="dark"] .auth-ambient-lines { opacity:.14; }
html[data-theme="dark"] .auth-disclaimer { color:var(--muted); }
html[data-theme="dark"] .pricing-hero { background:none; }
html[data-theme="dark"] .pricing-hero p { color:var(--muted); }
html[data-theme="dark"] .portal-user { color:var(--muted); }
html[data-theme="dark"] .console-link { background:var(--panel); border-color:var(--line); }
html[data-theme="dark"] .console-icon { border-color:#ffffff12; box-shadow:none; }
html[data-theme="dark"] .console-icon.blue { background:#22375e; color:#82b1ff; }
html[data-theme="dark"] .console-icon.teal { background:#163d42; color:#65dccd; }
html[data-theme="dark"] .console-icon.purple { background:#372855; color:#c0a0ff; }
html[data-theme="dark"] .console-icon.orange { background:#453322; color:#ffbd70; }
html[data-theme="dark"] .auth-steps li { color:var(--muted); }
html[data-theme="dark"] .auth-steps li[aria-current="step"] { color:var(--ink); }
html[data-theme="dark"] :is(.auth-card,.auth-model-node,.auth-feature-stack>span,.auth-capabilities) { box-shadow:var(--portal-glow); }
html[data-theme="dark"] .auth-router-core-art { opacity:.72; filter:brightness(.75) saturate(1.15); }
/* 辅助文字与代码区不残留浅色背景；彩色标签保留含义并降低底色亮度。 */
html[data-theme="dark"] :is(.chart-legend,.console-chart details,.portal-key-table td code,.portal-steps p,.portal-key-card-heading h2 span) { color:var(--muted); }
html[data-theme="dark"] .portal-code pre { background:#191919; color:var(--ink); }
html[data-theme="dark"] .console-log-table tr:hover td { background:var(--panel); }
html[data-theme="dark"] .console-log-table td .log-source { background:var(--panel); color:var(--muted); border-color:var(--line); }
html[data-theme="dark"] .token-chips .teal { background:#183438; color:#65dccd; border-color:#34555a; }
html[data-theme="dark"] .token-chips .purple { background:#30273d; color:#c0a0ff; border-color:#554366; }
html[data-theme="dark"] .token-chips .orange { background:#3a3022; color:#ffbd70; border-color:#665235; }
html[data-theme="dark"] .log-status { color:var(--muted); border-color:var(--line); }
html[data-theme="dark"] .log-status.success { background:#193529; color:#75dda4; border-color:#386b51; }
html[data-theme="dark"] .log-status.failed { background:#382b18; color:#f4c779; border-color:#806239; }
html[data-theme="dark"] [data-portal] .portal-key-actions button.secondary { background:var(--panel); }
html[data-theme="dark"] [data-portal] .portal-key-actions [data-action="assistant"] { background:#345bff; }
html[data-theme="dark"] .public-header .public-entry[aria-current="page"] { box-shadow:0 0 8px #4264ed26; }
