/* 全站主题令牌。亮色保留各页面原配色，暗色复用相同组件与布局。 */
:root[data-theme="dark"] {
  color-scheme: dark;
  --blue: #82adff;
  --ink: #e0e7f2;
  --muted: #a0adc1;
  --line: #304057;
  --surface: #192332;
  --background: #101722;
  --theme-text: #e0e7f2;
  --theme-muted: #a0adc1;
  --theme-surface: #192332;
  --theme-raised: #1c293b;
  --theme-subtle: #26354b;
  --theme-line: #304057;
  --theme-blue: #91b6f5;
  --theme-green: #80c9b2;
  --theme-amber: #e6bc78;
  --theme-red: #f09b92;
  --theme-blue-soft: #203451;
  --theme-green-soft: #1d3835;
  --theme-amber-soft: #3c3222;
  --theme-red-soft: #3d292e;
}
.theme-switch { display:inline-flex; align-items:center; gap:2px; padding:3px; border:1px solid var(--line); background:var(--background); border-radius:9px; flex:none; }
.theme-switch button { display:flex; align-items:center; justify-content:center; gap:5px; padding:7px 9px; border-radius:6px; background:transparent; color:var(--muted); font-size:11px; white-space:nowrap; }
.theme-switch button[aria-pressed="true"] { background:var(--surface); color:var(--blue); box-shadow:0 1px 4px #00000014; }
.theme-switch button:hover { color:var(--ink); }
.theme-switch svg { width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
dialog { background:var(--surface); }
:root[data-theme="dark"] .btn-primary { background:#356cdc; color:#fff; }
:root[data-theme="dark"] .skeleton { background-image:linear-gradient(100deg,#26354b 30%,#344760 50%,#26354b 70%); }
:root[data-theme="dark"] input::placeholder, :root[data-theme="dark"] textarea::placeholder { color:#8c9ab0; }
:root[data-theme="dark"] ::selection { background:#385e98; color:#fff; }
.login-theme { display:flex; justify-content:flex-end; margin-top:16px; }
@media(max-width:760px) {
  .topbar-inner .userbar { gap:6px; }
  .theme-switch button { padding:7px; }
  .theme-switch button span { display:none; }
}
@media(max-width:480px) {
  .topbar-inner .userbar { width:100%; justify-content:flex-end; }
  .topbar-inner .demo-roles { flex:1; }
  .topbar-inner .demo-roles button { flex:1; }
}

/* Platform and theme use the same segmented-control dimensions. */
.platform-switch { box-sizing:border-box; position:relative; display:inline-flex; align-items:center; gap:0; width:228px; height:38px; padding:3px; border:1px solid var(--line); background:var(--background); border-radius:9px; flex:none; }
.topbar-inner .theme-switch { box-sizing:border-box; position:relative; display:inline-flex; align-items:center; gap:8px; width:154px; height:38px; padding:3px; border:1px solid var(--line); background:var(--background); border-radius:9px; flex:none; }
.platform-switch button,.topbar-inner .theme-switch button { display:flex; align-items:center; justify-content:center; flex:1; min-width:0; box-sizing:border-box; height:30px; padding:0; white-space:nowrap; font-size:11px; border-radius:6px; background:transparent; color:var(--muted); }
.platform-switch button[aria-pressed="true"] { background:var(--surface); color:var(--blue); box-shadow:0 1px 4px #00000014; }
.platform-switch button:hover,.topbar-inner .theme-switch button:hover { color:var(--ink); }
.platform-switch button + button { border-left:1px solid var(--line); }
.platform-switch.platform-single { width:auto; max-width:none; min-width:0; flex:none; }
.platform-switch.platform-single button { padding:0 14px; cursor:default; }
@media(max-width:1000px){
 .topbar-inner .brand small { display:none; }
 .topbar-inner .userbar { flex:1; min-width:0; flex-wrap:wrap; justify-content:flex-end; }
}
@media(max-width:760px){
 .topbar-inner { align-items:flex-start; gap:8px; }
 .topbar-inner .platform-switch,.topbar-inner .theme-switch { width:200px; max-width:200px; min-width:100px; height:36px; padding:2px; gap:0; flex:1 1 calc(50% - 3px); }
 .topbar-inner .theme-switch button span { display:inline; }
 .topbar-inner .demo-roles { flex-basis:100%; justify-content:flex-end; }
 .topbar-inner .platform-switch.platform-single { width:auto; max-width:none; min-width:0; flex:none; }
}
@media(max-width:760px) {
  .viewport-app .topbar-inner { display:grid; grid-template-columns:40px minmax(0,1fr); gap:8px; align-items:start; }
  .viewport-app .topbar-inner .userbar { width:auto; min-width:0; flex-wrap:wrap; }
  .viewport-app .topbar-inner .platform-switch { order:1; flex:1 1 100%; width:100%; max-width:none; height:auto; min-height:36px; }
  .viewport-app .topbar-inner .theme-switch { order:2; flex:1 1 140px; max-width:200px; }
  .viewport-app .topbar-inner .demo-roles { order:4; flex-basis:100%; }
  .viewport-app .topbar-inner .platform-switch button { min-height:32px; height:auto; padding:4px 2px; }
}
