/* Shared palette. Literal fallback colors in the existing styles preserve light mode. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand-slate: #aab6ca;
  --brand-light: #303a49;
  --brand-blue: #b2c3e2;
  --brand-dark: #e0e7f1;
  --action: #526a9d;
  --action-hover: #627bad;
  --focus: #a6bbdf;
  --ink: #e8edf4;
  --muted: #aab4c2;
  --muted-strong: #d0d8e3;
  --line: #394555;
  --paper: #1b222c;
  --surface: #11161e;
  --surface-soft: #242d39;
  --green: #88c6a2;
  --green-bg: #20382f;
  --amber: #d8bd82;
  --amber-bg: #3b3426;
  --red: #e29da5;
  --red-bg: #3d2930;
  --theme-ink: var(--ink);
  --theme-paper: var(--paper);
  --theme-muted: var(--muted);
  --theme-green: var(--green);
  --theme-amber: var(--amber);
  --theme-red: var(--red);
  --theme-line: var(--line);
  --theme-focus: var(--focus);
  --theme-panel: #232c38;
  --theme-soft-blue: #293548;
  --theme-soft-purple: #2a303b;
  --theme-soft-green: #20382f;
  --theme-soft-amber: #3b3426;
  --theme-soft-red: #3d2930;
  --theme-solid-blue: #526a9d;
  --theme-solid-purple: #50566a;
  --theme-solid-green: #35694f;
  --theme-solid-amber: #795f31;
  --theme-solid-red: #813f4b;
  --theme-text-blue: #b6c8e8;
  --theme-text-purple: #c2cada;
  --theme-line-blue: #4b5c78;
  --theme-line-purple: #4a5566;
  --theme-line-green: #476b59;
  --theme-line-amber: #736343;
  --theme-line-red: #70464f;
}

:root[data-theme="dark"] body { background-color: var(--surface); color: var(--ink); }
:root[data-theme="dark"] .sidebar { background: linear-gradient(165deg, #1a222d, #121820); }
:root[data-theme="dark"] :is(input, select, textarea) { color-scheme: dark; }
:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder { color: #929fb8; opacity: 1; }
:root[data-theme="dark"] input:autofill { box-shadow: 0 0 0 1000px var(--theme-panel) inset; -webkit-text-fill-color: var(--ink); }
:root[data-theme="dark"] option { background: var(--paper); color: var(--ink); }
:root[data-theme="dark"] :is(input[type="checkbox"], input[type="radio"], progress) { accent-color: #8d9fed; }
:root[data-theme="dark"] dialog { color: var(--ink); background-color: var(--paper); }
:root[data-theme="dark"] dialog::backdrop { background: #020610b8; }
:root[data-theme="dark"] ::selection { background: #40516b; color: #fff; }
:root[data-theme="dark"] .dash-hero { background: radial-gradient(ellipse at 95% 0%, #7589a522, transparent 55%), linear-gradient(120deg, #202a37, #2a394b); }
:root[data-theme="dark"] :is(.dash-bar-fill, .report-bar-fill) { background: #91a8cf; }
:root[data-theme="dark"] .dash-bar-fill.muted { background: #76829f; }
:root[data-theme="dark"] :is(.dash-bar-fill.green, .report-bar-fill.success) { background: #6fc69a; }
:root[data-theme="dark"] :is(.dash-bar-fill.amber, .report-bar-fill.partial) { background: #e3ba69; }
:root[data-theme="dark"] :is(.dash-bar-fill.red, .report-bar-fill.failed) { background: #e78898; }
:root[data-theme="dark"] .sh-sku-group { background:#242c37; border-color:#3b4655; }
:root[data-theme="dark"] .sh-sku-group .sh-badge { background:#303b49; color:#d2dbe8; }
:root[data-theme="dark"] .sh-sku-order { background:#1d2530; border-color:#3a4554; }

/* Shared, icon-only appearance control. */
.theme-toggle { display:inline-flex; align-items:center; justify-content:center; flex:0 0 44px; width:44px; height:44px; min-height:44px; padding:0; border:1px solid var(--line,#dce2f3); border-radius:12px; background:var(--theme-panel,#f4f6fc); color:var(--ink,#010937); cursor:pointer; }
body:has(.login-card) { position:relative; padding-top:88px; padding-bottom:88px; }
.login-theme-toggle { position:absolute; top:max(16px,env(safe-area-inset-top)); right:max(16px,env(safe-area-inset-right)); }
.topbar-icon-actions { display:flex; align-items:center; gap:10px; flex:0 0 auto; margin-left:auto; }
.topbar-icon-actions > button { position:static; box-sizing:border-box; flex:0 0 44px; width:44px; height:44px; min-height:44px; padding:0; }
.topbar-icon-actions > .sku-audit-topbar-button { display:inline-flex; align-items:center; justify-content:center; border:1px solid #efc8c8; border-radius:12px; background:#fff5f5; color:#a3232d; cursor:pointer; }
.sku-audit-topbar-button svg { width:19px; height:19px; flex-shrink:0; }
.topbar-icon-actions > .sku-audit-topbar-button[hidden] { display:none; }
.topbar-icon-actions > .sku-audit-topbar-button:hover { background:#ffe9e9; }
.topbar-icon-actions > .sku-audit-topbar-button:focus-visible { outline:3px solid #c43641; outline-offset:3px; }
:root[data-theme="dark"] .topbar-icon-actions > .sku-audit-topbar-button { border-color:#633b42; background:#302126; color:#ffb5b8; }
:root[data-theme="dark"] .topbar-icon-actions > .sku-audit-topbar-button:hover { background:#41292f; }
:root[data-theme="dark"] .topbar-icon-actions > .sku-audit-topbar-button:focus-visible { outline-color:#ff9299; }
.theme-toggle:hover { background: var(--theme-soft-blue, #eaf0ff); }
.theme-toggle:focus-visible { outline: 3px solid var(--focus, #1c31a5); outline-offset: 3px; }
.theme-toggle svg { width: 19px; height: 19px; flex-shrink: 0; }
.theme-sun, :root[data-theme="dark"] .theme-moon { display: none; }
:root[data-theme="dark"] .theme-sun { display: block; }
:root[data-theme="dark"]:has(.login-card) { background: var(--surface); color: var(--ink); }
:root[data-theme="dark"] .login-card { box-shadow: 0 24px 70px #00000045; }
