/* Shared palette: existing colors remain the light-theme fallbacks. */
:root[data-theme=dark]{
 color-scheme:dark;
 --theme-ink:#e0eaf0;
 --theme-muted-ink:#b2c4ce;
 --theme-accent-ink:#86e0ce;
 --theme-success-ink:#9be1b8;
 --theme-warning-ink:#f5d497;
 --theme-danger-ink:#ffb9b0;
 --theme-surface:#192c37;
 --theme-surface-alt:#203641;
 --theme-success-surface:#183e35;
 --theme-warning-surface:#443522;
 --theme-info-surface:#28394e;
 --theme-line:#3e5865;
 --theme-accent-line:#508d81;
 --theme-warning-line:#806b45;
 --navy:#11222c;
 --teal:#86e0ce;
 --muted:#b2c4ce;
 --border:#3e5865;
 --mint:#7be1ca;
 background:#10212b;
 color:#e0eaf0;
}
html[data-theme=dark] body{background:#10212b;color:#e0eaf0}
html[data-theme=dark] .primary{background:#086b60;border-color:#428f83;color:#fff}
html[data-theme=dark] input,html[data-theme=dark] select,html[data-theme=dark] textarea{color-scheme:dark}
html[data-theme=dark] input::placeholder,html[data-theme=dark] textarea::placeholder{color:#9bb0bc;opacity:1}
html[data-theme=dark] .sidebar{background:#11222c}
html[data-theme=dark] .mark{color:#11222c}
html[data-theme=dark] dialog{background:#192c37}
html[data-theme=dark] dialog::backdrop{background:#07131dcc}
html[data-theme=dark] :focus-visible{outline-color:#91e6d6}
/* Small visual switch with a full-size keyboard/touch target. */
.theme-control{width:52px;margin:0 0 12px}
.theme-switch{display:flex;align-items:center;justify-content:center;width:52px;height:44px;padding:0;border:0;border-radius:8px;background:transparent;color:#263f48;cursor:pointer}
.theme-track{position:relative;width:44px;height:24px;background:#283d49;border:1px solid #657d8a;border-radius:20px;transition:background .16s,border-color .16s}
.theme-thumb{position:absolute;left:2px;top:2px;width:18px;height:18px;display:grid;place-items:center;border-radius:50%;background:#d8e4e8;transition:transform .16s,background .16s}
.theme-thumb svg{position:absolute;width:14px;height:14px}
.theme-moon{display:none}
.theme-switch[aria-checked=true] .theme-track{background:#294b45;border-color:#63877d}
.theme-switch[aria-checked=true] .theme-thumb{transform:translateX(20px);background:#b3d5c9}
.theme-switch[aria-checked=true] .theme-sun{display:none}
.theme-switch[aria-checked=true] .theme-moon{display:block}
.theme-switch:hover .theme-track{border-color:#add2c8}
.theme-switch:focus-visible{outline:2px solid #8be3d0;outline-offset:1px}
@media(max-width:820px){
 body .sidebar{position:relative}
 body .sidebar>.brand{max-width:calc(100% - 60px)}
 body .sidebar-bottom{display:block;position:absolute;right:12px;top:9px;width:52px;padding:0;border:0;margin:0}
 body .sidebar-bottom>.version,body .sidebar-bottom>p,body .sidebar-bottom>.small{display:none}
 .theme-control{margin:0}
}
@media(prefers-reduced-motion:reduce){.theme-track,.theme-thumb{transition:none}}
@media print{.theme-control{display:none!important}}
@media(min-width:821px){.sidebar{overflow-y:auto}.sidebar>.brand,.sidebar>nav,.sidebar>.sidebar-bottom{flex-shrink:0}}
