/* The theme script resolves System before styles load to avoid a light flash. */
:root{color-scheme:light}
:root[data-theme="dark"]{
 color-scheme:dark;
 --bg:#121416;--paper:#1d2125;--ink:#f0f2f4;--muted:#b5bdc6;--line:#3b424a;
 --green:#89c9a0;--action-green:#356449;--action-red:#a74c3c;--dark:#171a1d;--pale:#262b30;--red:#f29e8d;
 --notification-dot:#ff9b8f;--notification-halo:#ff9b8f33;
 --theme-surface:#1d2125;--theme-surface-soft:#262b30;
 --theme-surface-green:#262b30;--theme-surface-amber:#413622;
 --theme-surface-red:#442c29;--theme-surface-blue:#253547;--theme-surface-purple:#382c46;
 --theme-text:#f0f2f4;--theme-text-muted:#b5bdc6;--theme-edge:#3b424a;
 --theme-text-green:#89c9a0;--theme-text-amber:#edca82;--theme-text-red:#f5aa99;
 --theme-text-blue:#a0c8f7;--theme-text-purple:#cfb0ee;
}
:root[data-theme="dark"] .button.primary{background:#356449;border-color:#527f60;color:#fff}
:root[data-theme="dark"] .button.primary:hover{background:#427957}
:root[data-theme="dark"] dialog{background:var(--paper)}
:root[data-theme="dark"] :is(input,select,textarea){color:var(--ink)}
:root[data-theme="dark"] :is(input,textarea)::placeholder{color:var(--muted);opacity:1}
/* Neutral navigation and controls; green remains an action/status accent. */
:root[data-theme="dark"] .sidebar{color:var(--ink)}
:root[data-theme="dark"] .sidebar nav a{color:var(--muted)}
:root[data-theme="dark"] .sidebar nav a:hover{background:var(--pale)}
:root[data-theme="dark"] .sidebar nav a.selected{background:#30363d;color:var(--ink);border-color:var(--gold)}
:root[data-theme="dark"] .sidebar nav b:not(.chat-nav-dot):not(.alliance-nav-dot){background:#3b424a;color:var(--ink)}
:root[data-theme="dark"] .brand{color:var(--ink)}
:root[data-theme="dark"] .account-card,:root[data-theme="dark"] .account-card:has(.account-switch:disabled):hover{background:var(--pale);border-color:var(--line);color:var(--ink)}
:root[data-theme="dark"] .account-card:hover,:root[data-theme="dark"] .account-card-avatar{background:#30363d}
:root[data-theme="dark"] :is(.account-card-text small,.account-card-chevron,.sidebar-collapse){color:var(--muted)}
:root[data-theme="dark"] .sidebar-collapse:hover{background:var(--pale);color:var(--ink)}
:root[data-theme="dark"] .nav-divider{border-color:var(--line)}
:root[data-theme="dark"] .user-menu-button{background:var(--pale);color:var(--ink)}
:root[data-theme="dark"] .user-menu-panel{box-shadow:0 12px 40px #0009}
:root[data-theme="dark"] .brand small{color:var(--muted)}
:root[data-theme="dark"] .brand-mark{background:var(--pale);border-color:var(--line)}
:root[data-theme="dark"] :is(h1 span,.tech-effect,.rs-num,.kvk-squad-total,.chat-avatar,.chat-sender-avatar,.group-info-sender,.group-info-chip){color:var(--ink)}
:root[data-theme="dark"] :focus-visible{outline-color:var(--gold)}
.theme-control{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--muted);flex-wrap:wrap}
.theme-switch{max-width:100%;min-width:0;border:1px solid var(--line);border-radius:6px;padding:6px 9px;background:var(--paper);color:var(--ink);font:inherit}
.sidebar{overflow-y:auto}
@media(max-width:760px){[data-view="settings"]>.section-heading{flex-wrap:wrap}[data-view="settings"]>.section-heading>.heading-buttons{width:100%;justify-content:flex-start}}
