/* Existing dark colors remain the fallback; light mode changes color tokens only. */
:root{--yellow:#f4d56b;color-scheme:dark;--sector-heading-bg:#cefa6c;--sector-heading-ink:#172338;--sector-heading-hover:#c0ec5e}
:root[data-theme="light"]{
  color-scheme:light;
  --bg:#f4f6fa;
  --panel:#ffffff;
  --border:#d1d9e4;
  --ink:#172338;
  --muted:#4c5e75;
  --subtle:#5b6b7f;
  --lime:#426b0b;
  --orange:#985009;
  --blue:#1e5fbb;
  --red:#bb2f40;
  --yellow:#806500;
  --surface-inset:#f0f4f9;
  --surface-raised:#eaf0f7;
  --surface-hover:#eaf1f8;
  --surface-selected:#e3edf8;
  --surface-accent:#f0f6e5;
  --surface-warning:#fff3e5;
  --border-soft:#d9e0e9;
  --border-strong:#76869b;
  --border-accent:#739746;
  --border-warning:#b7813e;
  --text-primary:var(--ink);
  --text-secondary:var(--muted);
  --text-subtle:var(--subtle);
  --accent-text:var(--lime);
  --warning-text:var(--orange);
  --negative-text:var(--blue);
  --neutral-meter:#9caabc;
  --link-decoration:#8aa6c9;
  --on-accent:#ffffff;
  --dialog-shadow:#24374e26;
  --dialog-backdrop:#18283b66;
  --chart-grid:#d0d9e6;
  --chart-axis:var(--muted);
  --chart-ink:#253750;
  --chart-accent:var(--lime);
  --chart-warning:var(--orange);
  --chart-up:var(--red);
  --chart-down:var(--blue);
  --chart-cursor:#64758d;
}
/* Follow the device even if scripting is unavailable. */
@media(prefers-color-scheme:light){
  :root:not([data-theme]){
    color-scheme:light;
  --bg:#f4f6fa;
  --panel:#ffffff;
  --border:#d1d9e4;
  --ink:#172338;
  --muted:#4c5e75;
  --subtle:#5b6b7f;
  --lime:#426b0b;
  --orange:#985009;
  --blue:#1e5fbb;
  --red:#bb2f40;
  --yellow:#806500;
  --surface-inset:#f0f4f9;
  --surface-raised:#eaf0f7;
  --surface-hover:#eaf1f8;
  --surface-selected:#e3edf8;
  --surface-accent:#f0f6e5;
  --surface-warning:#fff3e5;
  --border-soft:#d9e0e9;
  --border-strong:#76869b;
  --border-accent:#739746;
  --border-warning:#b7813e;
  --text-primary:var(--ink);
  --text-secondary:var(--muted);
  --text-subtle:var(--subtle);
  --accent-text:var(--lime);
  --warning-text:var(--orange);
  --negative-text:var(--blue);
  --neutral-meter:#9caabc;
  --link-decoration:#8aa6c9;
  --on-accent:#ffffff;
  --dialog-shadow:#24374e26;
  --dialog-backdrop:#18283b66;
  --chart-grid:#d0d9e6;
  --chart-axis:var(--muted);
  --chart-ink:#253750;
  --chart-accent:var(--lime);
  --chart-warning:var(--orange);
  --chart-up:var(--red);
  --chart-down:var(--blue);
  --chart-cursor:#64758d;
  }
}
.theme-control{--theme-select-inset:13px;position:relative;display:flex;align-items:center;gap:8px;flex-shrink:0;font-size:14px;color:var(--muted)}
.theme-control select{appearance:none;width:148px;min-height:44px;padding:8px 28px 8px var(--theme-select-inset);border:1px solid var(--border-strong,#526174);border-radius:0;background:var(--panel);color:var(--ink);font:inherit;cursor:pointer}
.theme-control::after{
  content:"";
  position:absolute;
  inset-inline-end:calc(var(--theme-select-inset) + 1px);
  top:50%;
  transform:translateY(-50%);
  width:9px;
  height:5px;
  background:currentColor;
  clip-path:polygon(0 0, 50% 75%, 100% 0, 100% 24%, 50% 100%, 0 24%);
  pointer-events:none;
}
@media(forced-colors:active){.theme-control::after{forced-color-adjust:none;background:ButtonText}}
.theme-control select:disabled{cursor:default}
select:focus-visible{outline:2px solid var(--lime);outline-offset:3px}
.top-right{gap:20px}
@media(max-width:1150px){.top-right .edition{display:none}}
@media(max-width:750px){
  .topbar{flex-wrap:wrap;gap:10px;padding-top:12px;padding-bottom:12px}
  .top-right{width:100%;justify-content:flex-start;gap:10px;min-width:0}
  .theme-control select{width:138px}
  .theme-control>span{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
  .top-right .text-button{min-height:44px}
}
