/* =============================================================================
   Design tokens — black & white base, shades of blue for progress and emphasis.
   Light theme ("Morning") is the default; dark ("Night") follows the OS setting.
   Force a theme with <html data-theme="light"> or <html data-theme="dark">.
   ============================================================================= */
:root {
  /* Gray ramp — every neutral is one of these */
  --gray-50: #fafafa; --gray-100: #f5f5f5; --gray-200: #e5e5e5; --gray-300: #d4d4d4; --gray-400: #a3a3a3;
  --gray-500: #737373; --gray-600: #525252; --gray-700: #404040; --gray-800: #262626; --gray-900: #171717; --gray-950: #0a0a0a;

  /* Blue ramp — light blue → navy. The only hue besides `danger`. */
  --blue-50: #f0f6ff; --blue-100: #dce9fb; --blue-200: #b9d3f6; --blue-300: #8bb5ee; --blue-400: #5b92e2;
  --blue-500: #3a72cf; --blue-600: #2a5ab3; --blue-700: #234890; --blue-800: #1e3a72; --blue-900: #172c55; --blue-950: #0e1b36;

  /* Surfaces */
  --canvas: var(--gray-100);          /* page background */
  --surface: #ffffff;                 /* rows, cards, sheets */
  --surface-2: var(--gray-200);       /* recessed: tracks, quiet buttons, inputs */
  --material: rgba(245, 245, 245, 0.72); /* frosted header / tab bar, with backdrop blur */
  --hairline: var(--gray-200);        /* decorative 1px dividers */
  --hairline-strong: #8a8a8a;         /* borders that carry meaning (3:1+) */

  /* Text */
  --ink: var(--gray-950);             /* primary text */
  --ink-muted: var(--gray-600);       /* secondary text */
  --ink-faint: #6e6e6e;               /* tertiary text, hints (4.5:1 on canvas/surface) */

  /* Actions — black & white */
  --primary: var(--gray-950);         /* primary button, checked state, focus ring */
  --primary-pressed: var(--gray-700);
  --on-primary: var(--gray-50);

  /* Blue — progress, emphasis, the "earned" color */
  --accent: var(--blue-700);          /* rings, bars, chips, links (8.8:1 on white) */
  --accent-strong: var(--blue-800);   /* hover / pressed accent, big numbers */
  --accent-soft: var(--blue-100);     /* chip background; text on it is --accent */
  --on-accent: #ffffff;               /* text on an --accent fill */

  /* Heat scale (calendars, intensity) — steps in lightness so it reads without hue */
  --heat-0: var(--gray-200); --heat-1: var(--blue-200); --heat-2: var(--blue-400); --heat-3: var(--blue-600); --heat-4: var(--blue-800);

  --danger: #b42318;                  /* errors / missed — always with a word, never color alone */
  --danger-soft: #fdf1f0;             /* tint behind unassigned / error areas */

  /* Job status — darker blue the further a job has progressed. Always shown with its word + icon. */
  --status-scheduled-bg: var(--blue-100);  --status-scheduled-fg: var(--blue-700);
  --status-enroute-bg: var(--blue-300);    --status-enroute-fg: var(--blue-900);
  --status-inprogress-bg: var(--blue-700); --status-inprogress-fg: #ffffff;
  --status-completed-bg: var(--blue-950);  --status-completed-fg: #ffffff;

  /* Tints (ADR-0297, "a mix"): four soft hues that only tell tiles and chips apart (green done/paid, amber waiting,
     teal leads, violet automations). Always with a word; blue stays the main colour and red the only problem colour. */
  --t-green: #047857; --t-blue: var(--blue-600); --t-teal: #0c7889; --t-violet: #6d28d9; --t-amber: #b45309; --t-red: #c0392b;

  /* Depth */
  --shadow-card: 0 1px 2px rgba(10, 10, 10, 0.04), 0 8px 24px rgba(10, 10, 10, 0.05);
  --shadow-sheet: 0 -8px 40px rgba(10, 10, 10, 0.12);

  /* Space (4px grid) */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px; --space-12: 48px;

  /* Radius */
  --radius-sm: 4px; --radius-md: 10px; --radius-lg: 16px; --radius-pill: 999px;

  /* Type */
  --font-sans: "Geist", -apple-system, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", monospace;

  /* Motion */
  --spring: cubic-bezier(0.22, 1, 0.36, 1);          /* critically damped feel — default */
  --spring-bounce: cubic-bezier(0.34, 1.4, 0.64, 1); /* the one overshoot, reserved for "complete" */

  color-scheme: light dark;
}

/* Night — follows the OS unless the page forces light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: var(--gray-950); --surface: #121212; --surface-2: #1c1c1c;
    --material: rgba(10, 10, 10, 0.72);
    --hairline: var(--gray-800); --hairline-strong: #6b6b6b;
    --ink: var(--gray-100); --ink-muted: var(--gray-400); --ink-faint: #8a8a8a;
    --primary: var(--gray-100); --primary-pressed: var(--gray-300); --on-primary: var(--gray-950);
    --accent: var(--blue-300); --accent-strong: var(--blue-200); --accent-soft: var(--blue-900); --on-accent: var(--gray-950);
    --heat-0: #1c1c1c; --heat-1: var(--blue-900); --heat-2: var(--blue-700); --heat-3: var(--blue-500); --heat-4: var(--blue-300);
    --danger: #f97066;
    --danger-soft: #2a1514;
    --status-scheduled-bg: var(--blue-900);  --status-scheduled-fg: var(--blue-300);
    --status-enroute-bg: var(--blue-700);    --status-enroute-fg: var(--blue-100);
    --status-inprogress-bg: var(--blue-300); --status-inprogress-fg: var(--gray-950);
    --status-completed-bg: var(--blue-100);  --status-completed-fg: var(--gray-950);
    --shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-sheet: 0 -8px 40px rgba(0, 0, 0, 0.6);
    --t-green: #34d399; --t-blue: var(--blue-300); --t-teal: #5fd0e0; --t-violet: #a78bfa; --t-amber: #fbbf24; --t-red: #f87171;
  }
}
:root[data-theme="dark"] {
  --canvas: var(--gray-950); --surface: #121212; --surface-2: #1c1c1c;
  --material: rgba(10, 10, 10, 0.72);
  --hairline: var(--gray-800); --hairline-strong: #6b6b6b;
  --ink: var(--gray-100); --ink-muted: var(--gray-400); --ink-faint: #8a8a8a;
  --primary: var(--gray-100); --primary-pressed: var(--gray-300); --on-primary: var(--gray-950);
  --accent: var(--blue-300); --accent-strong: var(--blue-200); --accent-soft: var(--blue-900); --on-accent: var(--gray-950);
  --heat-0: #1c1c1c; --heat-1: var(--blue-900); --heat-2: var(--blue-700); --heat-3: var(--blue-500); --heat-4: var(--blue-300);
  --danger: #f97066;
  --danger-soft: #2a1514;
  --status-scheduled-bg: var(--blue-900);  --status-scheduled-fg: var(--blue-300);
  --status-enroute-bg: var(--blue-700);  --status-enroute-fg: var(--blue-100);
  --status-inprogress-bg: var(--blue-300); --status-inprogress-fg: var(--gray-950);
  --status-completed-bg: var(--blue-100);  --status-completed-fg: var(--gray-950);
  --shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-sheet: 0 -8px 40px rgba(0, 0, 0, 0.6);
  --t-green: #34d399; --t-blue: var(--blue-300); --t-teal: #5fd0e0; --t-violet: #a78bfa; --t-amber: #fbbf24; --t-red: #f87171;
}
