/* The design system's values. Everything else in the console's CSS refers
   to these roles, never to raw colours or sizes, so light and dark swap here
   and nowhere else.

   Dark is declared twice: once for the system setting and once for the
   theme chosen in the console, which wins in both directions (the
   :not([data-theme="light"]) guard lets a chosen light theme beat a dark
   system; :where() keeps the media block weaker than the chosen one). */
:root {
  /* Spacing: a 4px scale. */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;
  --sp-9: 56px;

  /* Type: one sans for everything, a mono for identifiers and content. */
  --font-sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 30px;
  --lh-tight: 1.25;
  --lh-normal: 1.55;

  /* Radii and motion. */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 999px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-fast: 120ms;
  --t-med: 200ms;

  --sidebar-width: 248px;
  --content-width: 1280px;

  /* Light: warm near-white planes, near-black ink, one blue accent. */
  color-scheme: light;
  --page: #f5f5f2;
  --sidebar: #fafaf8;
  --surface: #fcfcfb;
  --raised: #ffffff;
  --sunken: #f0f0ec;
  --overlay: rgba(20, 20, 18, 0.38);
  --ink-1: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #6b6a64;
  --ink-on-accent: #ffffff;
  --line: rgba(11, 11, 11, 0.09);
  --line-strong: rgba(11, 11, 11, 0.16);
  --control-border: #8f8d85;
  --grid: #e9e8e2;
  --axis: #c3c2b7;
  --hover: rgba(11, 11, 11, 0.045);
  --press: rgba(11, 11, 11, 0.08);

  --accent: #2a78d6;
  --accent-hover: #256abf;
  --accent-ink: #1c5cab;
  /* Filled buttons take a deeper step so white words on them stay legible. */
  --accent-fill: #256abf;
  --accent-fill-hover: #1c5cab;
  --accent-wash: rgba(42, 120, 214, 0.09);
  --accent-wash-strong: rgba(42, 120, 214, 0.16);
  --focus-ring: 0 0 0 3px rgba(42, 120, 214, 0.28);

  /* Chart series: the validated blue, a de-emphasis grey, and the fixed
     categorical order for the parts of a whole (token kinds). */
  --series-1: #2a78d6;
  --series-muted: #c3c2b7;
  --cat-1: #2a78d6;
  --cat-2: #eb6834;
  --cat-3: #1baf7a;
  --cat-4: #eda100;

  /* Status: a colour for the symbol, an ink for words, a wash behind them. */
  --good: #0ca30c;
  --good-ink: #006300;
  --good-wash: rgba(12, 163, 12, 0.10);
  --warn: #fab219;
  --warn-ink: #8a5a00;
  --warn-wash: rgba(250, 178, 25, 0.16);
  --bad: #d03b3b;
  --bad-ink: #a32222;
  --bad-wash: rgba(208, 59, 59, 0.09);
  --off: #898781;
  --off-wash: rgba(11, 11, 11, 0.05);

  --shadow-1: 0 1px 2px rgba(11, 11, 11, 0.04), 0 1px 1px rgba(11, 11, 11, 0.02);
  --shadow-2: 0 1px 2px rgba(11, 11, 11, 0.05), 0 8px 24px -10px rgba(11, 11, 11, 0.14);
  --shadow-3: 0 2px 6px rgba(11, 11, 11, 0.06), 0 24px 64px -16px rgba(11, 11, 11, 0.28);
  --brand-a: #3987e5;
  --brand-b: #1c5cab;
  --glow: rgba(42, 120, 214, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0e0e0d;
    --sidebar: #121211;
    --surface: #1a1a19;
    --raised: #222220;
    --sunken: #151514;
    --overlay: rgba(0, 0, 0, 0.6);
    --ink-1: #f0efec;
    --ink-2: #c3c2b7;
    --ink-3: #9a988f;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.15);
    --control-border: #6e6d66;
    --grid: #2c2c2a;
    --axis: #45453f;
    --hover: rgba(255, 255, 255, 0.05);
    --press: rgba(255, 255, 255, 0.09);
    --accent: #3987e5;
    --accent-hover: #5598e7;
    --accent-ink: #86b6ef;
    --accent-fill: #256abf;
    --accent-fill-hover: #2870cb;
    --accent-wash: rgba(57, 135, 229, 0.14);
    --accent-wash-strong: rgba(57, 135, 229, 0.24);
    --focus-ring: 0 0 0 3px rgba(57, 135, 229, 0.38);
    --series-1: #3987e5;
    --series-muted: #45453f;
    --cat-1: #3987e5;
    --cat-2: #d95926;
    --cat-3: #199e70;
    --cat-4: #c98500;
    --good-ink: #3fc23f;
    --good-wash: rgba(12, 163, 12, 0.16);
    --warn-ink: #fab219;
    --warn-wash: rgba(250, 178, 25, 0.13);
    --bad-ink: #e66767;
    --bad-wash: rgba(208, 59, 59, 0.16);
    --off: #898781;
    --off-wash: rgba(255, 255, 255, 0.06);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px -12px rgba(0, 0, 0, 0.7);
    --shadow-3: 0 2px 8px rgba(0, 0, 0, 0.5), 0 28px 72px -18px rgba(0, 0, 0, 0.85);
    --glow: rgba(57, 135, 229, 0.16);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0e0e0d;
  --sidebar: #121211;
  --surface: #1a1a19;
  --raised: #222220;
  --sunken: #151514;
  --overlay: rgba(0, 0, 0, 0.6);
  --ink-1: #f0efec;
  --ink-2: #c3c2b7;
  --ink-3: #9a988f;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --control-border: #6e6d66;
  --grid: #2c2c2a;
  --axis: #45453f;
  --hover: rgba(255, 255, 255, 0.05);
  --press: rgba(255, 255, 255, 0.09);
  --accent: #3987e5;
  --accent-hover: #5598e7;
  --accent-ink: #86b6ef;
  --accent-fill: #256abf;
  --accent-fill-hover: #2870cb;
  --accent-wash: rgba(57, 135, 229, 0.14);
  --accent-wash-strong: rgba(57, 135, 229, 0.24);
  --focus-ring: 0 0 0 3px rgba(57, 135, 229, 0.38);
  --series-1: #3987e5;
  --series-muted: #45453f;
  --cat-1: #3987e5;
  --cat-2: #d95926;
  --cat-3: #199e70;
  --cat-4: #c98500;
  --good-ink: #3fc23f;
  --good-wash: rgba(12, 163, 12, 0.16);
  --warn-ink: #fab219;
  --warn-wash: rgba(250, 178, 25, 0.13);
  --bad-ink: #e66767;
  --bad-wash: rgba(208, 59, 59, 0.16);
  --off: #898781;
  --off-wash: rgba(255, 255, 255, 0.06);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px -12px rgba(0, 0, 0, 0.7);
  --shadow-3: 0 2px 8px rgba(0, 0, 0, 0.5), 0 28px 72px -18px rgba(0, 0, 0, 0.85);
  --glow: rgba(57, 135, 229, 0.16);
}
