/* ── Design tokens ──
   One source of truth for colour, type, radius and elevation.
   The legacy variable names (--card, --line, --accent-light …) are mapped here too,
   so older rules in styles.css follow the same palette and the dark theme.
   Theme: <html data-theme="light|dark">; "system" removes the attribute and follows the OS. */

:root {
  /* Surfaces */
  --c-bg: #eef2f7;
  --c-surface: #ffffff;
  --c-surface-2: #f6f8fb;
  --c-sidebar: #f8fafc;
  --c-line: #e2e8f0;
  --c-line-strong: #cbd5e1;

  /* Text */
  --c-text: #0f172a;
  --c-text-2: #334155;
  --c-muted: #5b6b80;

  /* Accent */
  --c-accent: #0a6fe0;
  --c-accent-hover: #075fc2;
  --c-accent-ink: #ffffff;
  --c-accent-soft: #e3effd;

  /* Status */
  --c-ok: #157a3d;
  --c-ok-soft: #e4f5ea;
  --c-warn: #9a5b00;
  --c-warn-soft: #fdf1dc;
  --c-bad: #b42318;
  --c-bad-soft: #fde8e6;
  --c-info: #3d4fb5;
  --c-info-soft: #e9ecfb;

  /* Elevation */
  --c-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 6px 18px rgba(15, 23, 42, 0.06);
  --c-shadow-pop: 0 12px 32px rgba(15, 23, 42, 0.22);
  --c-ring: 0 0 0 3px rgba(10, 111, 224, 0.28);
  --c-scrim: rgba(15, 23, 42, 0.36);

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-xs: 11.5px;
  --fs-sm: 12.5px;
  --fs-label: 13px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  /* One big figure people read at arm's length, such as a quantity on the warehouse phone screen. */
  --fs-figure: 30px;
  /* Fields on touch screens: iPhone zooms into any field under 16px when it is focused. */
  --fs-field-touch: 16px;

  /* Shape */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --control-h: 36px;
  /* Fields on touch screens, where their text is --fs-field-touch. */
  --control-h-touch: 40px;

  /* Legacy names used across styles.css */
  --sidebar-w: 248px;
  --bg: var(--c-bg);
  --bg-secondary: var(--c-surface-2);
  --card: var(--c-surface);
  --card-strong: var(--c-surface);
  --text: var(--c-text);
  --text-2: var(--c-text-2);
  --muted: var(--c-muted);
  --line: var(--c-line);
  --line-2: var(--c-surface-2);
  --accent: var(--c-accent);
  --accent-light: var(--c-accent-soft);
  --accent-dark: var(--c-accent-hover);
  --danger: var(--c-bad);
  --danger-light: var(--c-bad-soft);
  --success: var(--c-ok);
  --success-light: var(--c-ok-soft);
  --warn: var(--c-warn);
  --warn-light: var(--c-warn-soft);
  --sidebar-bg: var(--c-sidebar);
  --sidebar-text: var(--c-text-2);
  --sidebar-hover: var(--c-surface);
  --sidebar-active: var(--c-accent);
  --radius: var(--r-sm);
  --radius-md: var(--r-md);
  --radius-lg: var(--r-md);
  --surface: var(--c-surface);
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: var(--c-shadow);
  --shadow: var(--c-shadow);
  --shadow-md: var(--c-shadow-pop);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --c-bg: #0b1017;
    --c-surface: #121924;
    --c-surface-2: #17202d;
    --c-sidebar: #0f151e;
    --c-line: #233042;
    --c-line-strong: #314055;
    --c-text: #e8eef6;
    --c-text-2: #c3cedb;
    --c-muted: #8d9cb0;
    --c-accent: #4d9cff;
    --c-accent-hover: #73b2ff;
    --c-accent-ink: #06121f;
    --c-accent-soft: #15283f;
    --c-ok: #5fd08a;
    --c-ok-soft: #12291c;
    --c-warn: #f0b75a;
    --c-warn-soft: #2d2311;
    --c-bad: #ff8a80;
    --c-bad-soft: #2f1716;
    --c-info: #9aa8ff;
    --c-info-soft: #1b2040;
    --c-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.3);
    --c-shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.5);
    --c-ring: 0 0 0 3px rgba(77, 156, 255, 0.35);
    --c-scrim: rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --c-bg: #0b1017;
  --c-surface: #121924;
  --c-surface-2: #17202d;
  --c-sidebar: #0f151e;
  --c-line: #233042;
  --c-line-strong: #314055;
  --c-text: #e8eef6;
  --c-text-2: #c3cedb;
  --c-muted: #8d9cb0;
  --c-accent: #4d9cff;
  --c-accent-hover: #73b2ff;
  --c-accent-ink: #06121f;
  --c-accent-soft: #15283f;
  --c-ok: #5fd08a;
  --c-ok-soft: #12291c;
  --c-warn: #f0b75a;
  --c-warn-soft: #2d2311;
  --c-bad: #ff8a80;
  --c-bad-soft: #2f1716;
  --c-info: #9aa8ff;
  --c-info-soft: #1b2040;
  --c-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.3);
  --c-shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.5);
  --c-ring: 0 0 0 3px rgba(77, 156, 255, 0.35);
  --c-scrim: rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}
