/* Design tokens for the dashboard: every color, size and timing lives here, light first, then dark under both
   scopes (the OS setting, and the theme menu's data-theme, which wins both ways). Pages and components only
   use these names, never raw values, so the themes stay in one place. Values are the spec's (admin-spec.md §4);
   chart colors are validated with the dataviz validator. */

:root {
  color-scheme: light;

  /* Surfaces */
  --page: #f9f9f7;                       /* the page plane */
  --surface: #fcfcfb;                    /* sections, cards, dialogs, chart surface */
  --control: #ffffff;                    /* inputs, secondary buttons */
  --border: rgba(11, 11, 11, 0.10);      /* hairlines around and between sections */
  --border-strong: rgba(11, 11, 11, 0.22); /* hovered controls */
  --hover: rgba(11, 11, 11, 0.04);       /* ghost wash under a hovered row or menu item */
  --selected: rgba(42, 120, 214, 0.10);  /* the chosen option, a highlighted suggestion */
  --backdrop: rgba(11, 11, 11, 0.40);

  /* Ink */
  --ink: #0b0b0b;
  --ink-2: #52514e;                      /* secondary text */
  --ink-3: #6b6a65;                      /* muted text: meta, axis labels (palette.md's #898781 is marks only) */
  --ink-on-fill: #ffffff;                /* text inside a saturated fill */

  /* Accent */
  --accent: #2a78d6;                     /* marks, the focus ring */
  --accent-text: #256abf;                /* links and selected text */
  --button: #256abf;                     /* primary button */
  --button-ink: #ffffff;
  --accent-track: #cde2fb;               /* the unfilled part of an accent meter */
  --focus: #2a78d6;

  /* Versions: v2 wears the accent, v1 the context gray (both modes) */
  --v2: #2a78d6;
  --v1: #898781;
  --mark-muted: #898781;                 /* de-emphasis marks ("Other", context series) */

  /* Ordinal blue ramp for ordered tiers (lookup and search paths), light to dark = earlier to later */
  --ramp3-1: #86b6ef;
  --ramp3-2: #2a78d6;
  --ramp3-3: #104281;
  --ramp4-1: #86b6ef;
  --ramp4-2: #3987e5;
  --ramp4-3: #256abf;
  --ramp4-4: #104281;

  /* Status (fixed, never themed): always an icon shape plus a word */
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --info: #2a78d6;
  --neutral: #898781;
  --glyph-on-warning: #0b0b0b;           /* the warning triangle's glyph: yellow is 1.79:1 on the light surface */
  --glyph-on-status: #ffffff;
  --critical-wash: #fbeaea;
  --warning-wash: #fdf2df;
  --info-wash: #eef4fc;

  /* Delta text: direction x whether up is good */
  --delta-good: #006300;
  --delta-bad: #b8352f;

  /* Chart chrome: solid hairlines, never dashed */
  --grid: #e1e0d9;
  --baseline: #c3c2b7;

  /* Type: the system sans only, no web fonts */
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-body: 14px;
  --text-meta: 12px;
  --text-secondary: 13px;
  --text-section: 16px;
  --text-page: 20px;
  --text-stat: 28px;
  --text-hero: 52px;
  --leading: 1.5;

  /* Spacing: a 4-pt scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --gutter: 16px;
  --section-gap: 24px;
  --max-width: 1200px;

  /* Shape */
  --radius-section: 10px;
  --radius-control: 8px;
  --radius-tag: 999px;
  --radius-mark: 4px;                    /* the rounded data end of bars and columns */

  /* Frame */
  --header-height: 56px;
  --bottom-bar-height: 56px;
  --touch: 44px;                         /* minimum touch target on phones */
  --control-height: 32px;

  /* Motion: 120 ms opacity fades only; none under prefers-reduced-motion (app.css) */
  --fade: 120ms;

  /* Layers */
  --z-header: 30;
  --z-bottom-bar: 30;
  --z-menu: 40;
  --z-tooltip: 60;
}

@media (max-width: 767px) {
  :root {
    --text-body: 15px;
    --header-height: 48px;
    --control-height: var(--touch);
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --control: #141413;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.24);
    --hover: rgba(255, 255, 255, 0.06);
    --selected: rgba(57, 135, 229, 0.18);
    --backdrop: rgba(0, 0, 0, 0.60);
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --ink-3: #b0afa7;
    --accent: #3987e5;
    --accent-text: #86b6ef;
    --button: #86b6ef;
    --button-ink: #0d0d0d;
    --accent-track: #1c3a5e;
    --focus: #3987e5;
    --v2: #3987e5;
    --ramp3-1: #184f95;
    --ramp3-2: #3987e5;
    --ramp3-3: #9ec5f4;
    --ramp4-1: #184f95;
    --ramp4-2: #256abf;
    --ramp4-3: #5598e7;
    --ramp4-4: #9ec5f4;
    --info: #3987e5;
    --critical-wash: #3a1c1c;
    --warning-wash: #3a2c12;
    --info-wash: #16263a;
    --delta-good: #0ca30c;
    --delta-bad: #f07a73;
    --grid: #2c2c2a;
    --baseline: #383835;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --control: #141413;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.24);
  --hover: rgba(255, 255, 255, 0.06);
  --selected: rgba(57, 135, 229, 0.18);
  --backdrop: rgba(0, 0, 0, 0.60);
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --ink-3: #b0afa7;
  --accent: #3987e5;
  --accent-text: #86b6ef;
  --button: #86b6ef;
  --button-ink: #0d0d0d;
  --accent-track: #1c3a5e;
  --focus: #3987e5;
  --v2: #3987e5;
  --ramp3-1: #184f95;
  --ramp3-2: #3987e5;
  --ramp3-3: #9ec5f4;
  --ramp4-1: #184f95;
  --ramp4-2: #256abf;
  --ramp4-3: #5598e7;
  --ramp4-4: #9ec5f4;
  --info: #3987e5;
  --critical-wash: #3a1c1c;
  --warning-wash: #3a2c12;
  --info-wash: #16263a;
  --delta-good: #0ca30c;
  --delta-bad: #f07a73;
  --grid: #2c2c2a;
  --baseline: #383835;
}
