/* dark.css — dark theme token overrides + dark-only fixes for colours that
   are hardcoded in base/shell/views.css. Loaded LAST so it always wins.
   Everything not listed here inherits the light palette but those rules are
   token-driven, so they follow the variables below automatically. */
html[data-theme="dark"] {
  color-scheme: dark;

  /* Base canvas + surfaces (warm charcoal, keeps the paper tint alive) */
  --bg: #1D211C;
  --bg-card: #262B24;
  --bg-inset: #2C3229;
  --border: #41493C;
  --border-strong: #5C6653;
  --ink-primary: #E9E6DB;
  --ink-secondary: #A9AE9F;
  --ink-tertiary: #8C9282;

  /* Accent flips to a light sage so it keeps contrast as text-on-dark and
     dark-on-light for filled buttons. */
  --accent: #A3AC85;
  --accent-deep: #CAD3B3;
  --accent-light: #33392E;

  /* Status hues lightened for dark fills */
  --ok: #8FB67F;
  --warn: #D9A94E;
  --err: #D97B5A;

  /* Text-on-tint variants — paired with the dark chip fills below.
     (Contrast mirrors the light-mode foreach: ≥4.5:1 on its tint.) */
  --ok-ink: #A9CE95;
  --warn-ink: #D9B36B;
  --err-ink: #E8A188;
  --amber-bg: #39301C;

  /* On-accent inverts: light accent buttons carry dark ink now */
  --on-accent: #1D211C;
  --focus-ring: var(--accent);
  --border-light: #31372D;
  --bg-hover: rgba(255, 255, 255, 0.05);

  /* Chip & status fills */
  --chip-ok-bg: #2C3A28;
  --chip-ok-border: #46543E;
  --chip-err-bg: #3E2A22;
  --chip-err-border: #5E3F30;
  --chip-run-bg: #24304A;
  --chip-run-ink: #9DB4E8;
  --chip-run-border: #3A4763;
  --chip-warn-border: #6B582E;
  --chip-embedding-bg: #392A3E;
  --chip-embedding-ink: #CDA7DA;
  --chip-embedding-border: #544060;

  /* Alert & row states */
  --warn-border: #5C4E26;
  --info-bg: #2B331F;
  --info-border: #4A573A;
  --row-err-bg: #3A2620;

  /* Role badges */
  --role-owner-bg: #3A3116;
  --role-owner-ink: #E3B64F;
  --role-owner-border: #5C4D1E;
  --role-admin-bg: #20381F;
  --role-admin-ink: #92C98B;
  --role-admin-border: #37603A;

  /* Topbar run pulse */
  --run-blue: #6FB1F2;
}
/* Dark-only fixes for colours hardcoded outside the token system.
   Flat selectors (no CSS nesting dependency — OCR 2026-09-02). */
html[data-theme="dark"]::-webkit-scrollbar-thumb,
html[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
}
html[data-theme="dark"]::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.26);
}
html[data-theme="dark"] * {
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}
/* Light-mode green tints read muddy on dark fills — retint the two tinted
   labels that use a raw rgba() instead of a chip token. */
html[data-theme="dark"] .status-badge.ok,
html[data-theme="dark"] .msg-role.assistant {
  background: rgba(143, 182, 127, 0.16);
}
/* Modal / palette scrims: dim more aggressively on dark so the layered
   surface stays clearly separated. */
html[data-theme="dark"] .modal-back,
html[data-theme="dark"] .cmd-palette-backdrop {
  background: rgba(0, 0, 0, 0.55);
}