/* AFTECH app tokens v1.1 (27 Nov 2026). Master rules: .claude/ui-design-system.md
   Same values as design/aftech_tokens.dart (tests/test_ui_tokens.py checks both).
   v1.1: Imperial blue set with blue-toned neutrals (Ande's pick, 27 Nov A/B test). Status colors unchanged.
   Copy this file into an app when you touch its screens (migrate on touch). */

:root {
  color-scheme: light dark;

  /* color: light */
  --brand: #1c3aa9;          /* main button fill, header bar; white text 9.4:1 */
  --brand-hover: #1b3696;
  --brand-tint: #e9eefc;     /* selected row, active tab */
  --link: #1b3696;           /* links and brand-colored text */
  --focus: #1c3aa9;
  --ink: #0f1b3d;
  --muted: #47526b;
  --line: #d9dfee;
  --surface: #ffffff;
  --surface-alt: #f6f8fd;    /* page background */
  --raised: #ffffff;
  --danger-bg: #fee2e2;  --danger-ink: #991b1b;
  --warn-bg: #fef3c7;    --warn-ink: #92400e;
  --ok-bg: #dcfce7;      --ok-ink: #166534;
  --neutral-bg: #eceff7; --neutral-ink: #36405a;

  /* charts: categorical order (Okabe-Ito). Status colors never used for categories.
     Light: chart-2 (orange) and chart-6 (sky) are fill-only (bars/areas + labels), 2.2:1 as lines.
     Dark: chart-1 (blue) is fill-only on dark surfaces (3.4:1 is ok, but use chart-6 for thin lines). */
  --chart-1: #0072b2; --chart-2: #e69f00; --chart-3: #009e73;
  --chart-4: #cc79a7; --chart-5: #d55e00; --chart-6: #56b4e9; --chart-other: #6b7280;

  /* type */
  --font-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-num: "DM Mono", ui-monospace, monospace;  /* all numbers that line up */
  --font-code: "JetBrains Mono", ui-monospace, monospace;  /* code and logs only */
  --text-label: 12px; --text-body: 14px; --text-body-phone: 16px;
  --text-section: 16px; --text-title: 20px; --text-kpi: 28px;

  /* space, size, radius */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px;
  --tap-min: 44px; --tap-main: 54px;
  --radius-sm: 6px; --radius-md: 10px; --radius-pill: 999px;

  /* elevation: mostly flat */
  --shadow-1: 0 1px 2px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.10);
  --shadow-2: 0 4px 12px rgba(0,0,0,.12);

  /* motion */
  --motion-fast: 100ms; --motion-base: 200ms; --motion-moderate: 250ms;
  --motion-slow: 300ms; --motion-exit: 150ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-enter: cubic-bezier(0, 0, 0, 1);
  --ease-exit: cubic-bezier(0.3, 0, 1, 1);
}

[data-theme="dark"] {
  --brand: #2f55d4;          /* lighter than the light fill: #1c3aa9 is only 2.0:1 against the dark page */
  --brand-hover: #2447c0;
  --brand-tint: #1a2550;
  --link: #8fa8ff;
  --focus: #8fa8ff;
  --ink: #eef1fa;
  --muted: #a3acc4;
  --line: #27304a;
  --surface: #121829;
  --surface-alt: #0c1120;
  --raised: #1a2138;
  --danger-bg: #450a0a;  --danger-ink: #fca5a5;
  --warn-bg: #451a03;    --warn-ink: #fcd34d;
  --ok-bg: #052e16;      --ok-ink: #86efac;
  --neutral-bg: #222a40; --neutral-ink: #cfd5e6;
  --shadow-1: none; --shadow-2: 0 0 0 1px #27304a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #2f55d4; --brand-hover: #2447c0; --brand-tint: #1a2550;
    --link: #8fa8ff; --focus: #8fa8ff;
    --ink: #eef1fa; --muted: #a3acc4; --line: #27304a;
    --surface: #121829; --surface-alt: #0c1120; --raised: #1a2138;
    --danger-bg: #450a0a; --danger-ink: #fca5a5;
    --warn-bg: #451a03;   --warn-ink: #fcd34d;
    --ok-bg: #052e16;     --ok-ink: #86efac;
    --neutral-bg: #222a40; --neutral-ink: #cfd5e6;
    --shadow-1: none; --shadow-2: 0 0 0 1px #27304a;
  }
}

/* base behaviour every app gets */
/* native controls (select, input, scrollbars) follow the app theme, not the phone/OS theme:
   without this a light page on a dark-mode phone draws black selects (28 Nov 2026) */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num, td.num, .kpi { font-family: var(--font-num); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; scroll-behavior: auto !important;
  }
}
