/* TalyxOS design tokens — tokens.css (production, v1.0, 2026-11-11)
   Source: docs/brand/talyxos-brand-book.md as on PR #7 (head d9910fdd, "Additions approved
   2026-11-10") + tokens.json of the live brand book. Generated; edit the brand book, not this file.
   Light theme ships in WS-0.3. Dark theme ([data-theme="dark"]) is Phase 1 (ADR-0008) and gets its
   own contrast pass then. Entities override ONLY the primary family, served as
   /branding/<entity code>.css (ADR-0008): --primary, --primary-hover, --primary-soft,
   --on-primary-soft, --tenant-accent. Everything else here is fixed for every tenant. */

:root,
[data-theme="light"] {
  /* -- Brand core (same in both themes) ------------------------------- */
  --brand-midnight: #0A0F2E;
  --brand-navy: #0B1437;
  --brand-indigo: #4F46E5;
  --brand-blue: #3B82F6;
  --brand-cyan: #22D3EE; /* dark backgrounds only */
  --brand-violet: #8B5CF6; /* gradient and illustration only */
  --os-dark-start: #38BDF8;
  --os-dark-mid: #22D3EE;
  --os-dark-end: #2DE5E1;
  --os-light-start: #0284C7;
  --os-light-end: #0891B2;

  /* -- Grounds and navigation ----------------------------------------- */
  --bg: #F7F8FB;
  --surface: #FFFFFF;
  --surface-raised: #FFFFFF;
  --hero: #0A0F2E;
  --sidebar: #0B1033;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-marker: #EEF0F6; /* brand book #7 · approved 2026-11-10 · bar on the current sidebar item; not tenant-branded */
  --text-on-dark: #FFFFFF;
  --text-on-dark-muted: #C9D1F0;
  --focus-on-dark: #22D3EE; /* shell addition = brand-cyan · focus ring on the sidebar and hero (book: Sidebar spec) */

  /* -- Text, lines, actions -------------------------------------------- */
  --text: #0B1437;
  --text-muted: #5F6672;
  --link: #4F46E5; /* brand book #7 · approved 2026-11-10 · = brand-indigo; fixed for every tenant (dark: tokens.json value, indigo fails on dark) */
  --border: #E3E6EF; /* cards and dividers only */
  --border-strong: #848DA1; /* form controls at rest; 3:1 on bg and surface (tokens.json #8A91A8 gave 2.95:1 on bg, so #7's #848DA1 is used) */
  --primary: #4F46E5; /* tenant-branded through /branding/<entity>.css */
  --primary-hover: #4338CA; /* tenant-branded */
  --primary-soft: #EEF0FD; /* tenant-branded */
  --on-primary: #FFFFFF;
  --on-primary-soft: #4F46E5; /* brand book #7 · approved 2026-11-10 · primary-colored words on primary-soft; tenants get theirs from deriveTenantTheme */
  --tenant-accent: #4F46E5; /* shell addition (#7 handoff §2) · the colour the entity typed, before contrast fixes; graphics only */
  --accent: #0891B2; /* icons and graphics on light, never words */
  --focus: #4F46E5; /* 2px ring, 2px offset; not tenant-branded */

  /* -- Neutrals --------------------------------------------------------- */
  --gray-900: #1E2440;
  --gray-700: #3B4262;
  --gray-500: #5F6672;
  --gray-300: #C3C8D9;
  --gray-100: #EEF0F6;
  --gray-50: #F7F8FB;
  --table-header: #F3F4F8;
  --overlay: rgba(10, 15, 46, 0.55);

  /* -- Status (fixed for every tenant; always with the word) ------------ */
  --success: #15803D;
  --success-bg: #DCFCE7;
  --warning: #B45309;
  --warning-bg: #FEF3C7;
  --danger: #B91C1C;
  --danger-bg: #FEE2E2;
  --info: #1D4ED8;
  --info-bg: #DBEAFE;
  --danger-hover: #991B1B; /* shell addition · Danger button hover (danger mixed ~15 % with black); not in the book yet */

  /* -- Charts ------------------------------------------------------------ */
  --chart-1: #4F46E5;
  --chart-2: #0891B2;
  --chart-3: #D97706;
  --chart-4: #DB2777;
  --chart-5: #7C3AED;
  --chart-6: #64748B;
  --seq-1: #EEF0FD;
  --seq-2: #C7CBF7;
  --seq-3: #9A9FF0;
  --seq-4: #6C70E8;
  --seq-5: #4F46E5;
  --seq-6: #312E81;

  /* -- Elevation --------------------------------------------------------- */
  --shadow-sm: 0 1px 2px rgba(11, 20, 55, 0.06);
  --shadow-md: 0 6px 16px rgba(11, 20, 55, 0.10);
  --shadow-lg: 0 16px 40px rgba(11, 20, 55, 0.16);

  /* -- Typography: Montserrat = logo, page titles, marketing; Inter = everything else --- */
  --font-brand: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-code: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; /* ADR-0008: system mono until a screen needs JetBrains Mono */
  --fs-display-xl: 3.5rem;   --lh-display-xl: 3.75rem;  /* 56/60 Montserrat 700, -0.02em · marketing, login splash */
  --fs-display: 2.5rem;      --lh-display: 3rem;        /* 40/48 Montserrat 700, -0.02em · empty states, onboarding */
  --fs-headline: 1.75rem;    --lh-headline: 2.25rem;    /* 28/36 Montserrat 700, -0.01em · page titles */
  --fs-tagline: 1.125rem;    --lh-tagline: 1.625rem;    /* 18/26 Montserrat 500 */
  --fs-title: 1.25rem;       --lh-title: 1.75rem;       /* 20/28 Inter 600 · card and dialog titles */
  --fs-subtitle: 1rem;       --lh-subtitle: 1.5rem;     /* 16/24 Inter 600 */
  --fs-body-lg: 1rem;        --lh-body-lg: 1.5rem;      /* 16/24 Inter 400 · employee pages; inputs (no iOS zoom) */
  --fs-body: 0.875rem;       --lh-body: 1.25rem;        /* 14/20 Inter 400 · default UI text */
  --fs-label: 0.8125rem;     --lh-label: 1.125rem;      /* 13/18 Inter 500 · labels, buttons, badges, nav */
  --fs-caption: 0.75rem;     --lh-caption: 1rem;        /* 12/16 Inter 400 · smallest size allowed */
  --fs-overline: 0.75rem;    --lh-overline: 1rem;       /* 12/16 Inter 600, uppercase, +0.08em */
  --fs-code: 0.8125rem;      --lh-code: 1.25rem;        /* 13/20 mono */
  --lh-tight: 1.15;          /* headings that wrap, tiles' big numbers (kept from #7) */
  --ls-display: -0.02em; --ls-headline: -0.01em; --ls-wordmark: -0.025em; --ls-overline: 0.08em;

  /* -- Space: 4px grid ------------------------------------------------------ */
  --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; --space-16: 64px;

  /* -- Radius ------------------------------------------------------------------ */
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 16px; --radius-xl: 20px; --radius-pill: 999px;
  --radius-app-icon: 22.5%;

  /* -- Layout --------------------------------------------------------------------- */
  --touch-target: 44px;
  --sidebar-width: 248px;
  --sidebar-collapsed: 72px;
  --sidebar-marker-width: 3px;  /* brand book #7 · approved 2026-11-10 */
  --topbar-height: 64px;
  --content-max: 1280px;
  --breakpoint-shell: 768px;    /* reference only: CSS can't read it in @media; the shell writes 768px */
  /* Phone navigation (docs/brand/talyxos-phone-navigation.md, 2026-11-11) */
  --topbar-height-phone: 56px;
  --tabbar-height: 60px;        /* + env(safe-area-inset-bottom) */
  --tabbar-indicator-width: 24px;
  --tabbar-indicator-height: 3px;
  --sheet-max-height: 88dvh;

  /* -- Motion: 150 to 250 ms; none under prefers-reduced-motion ------------------ */
  --duration: 160ms;
  --duration-slow: 220ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  --focus-ring: 0 0 0 2px var(--surface), 0 0 0 4px var(--focus);
  --focus-ring-on-dark: 0 0 0 2px var(--sidebar), 0 0 0 4px var(--focus-on-dark);
}

/* Dark theme — Phase 1 (ADR-0008). Values from tokens.json; contrast pass due before it ships. */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080C24;
  --surface: #10163A;
  --surface-raised: #161D47;
  --hero: #161D47;
  --sidebar: #060920;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --text: #EEF0F6;
  --text-muted: #A3AAC4;
  --link: #A5B4FC; /* tokens.json dark value; #4F46E5 is too dark on dark surfaces */
  --border: #252C57;
  --border-strong: #5A6390;
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-soft: #1E2463;
  --on-primary-soft: #908AEF; /* provisional (Phase 1): book rule mirrored — lightened until 4.5:1 on the dark tint */
  --accent: #22D3EE;
  --focus: #22D3EE;
  --table-header: #161D47;
  --overlay: rgba(0, 0, 0, 0.65);
  --success: #4ADE80;
  --success-bg: #0F2E1D;
  --warning: #FBBF24;
  --warning-bg: #33240A;
  --danger: #F87171;
  --danger-bg: #3A1414;
  --info: #93C5FD;
  --info-bg: #13234A;
  --chart-1: #818CF8;
  --chart-2: #22D3EE;
  --chart-3: #FBBF24;
  --chart-4: #F472B6;
  --chart-5: #A78BFA;
  --chart-6: #94A3B8;
  --seq-1: #1E2463;
  --seq-2: #2E3592;
  --seq-3: #4338CA;
  --seq-4: #6366F1;
  --seq-5: #A5B4FC;
  --seq-6: #E0E7FF;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
}

/* Follow the operating system when no data-theme is set. Enable in Phase 1 only:
   WS-0.3 ships light, so this block stays commented until the dark contrast pass.
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { ...same values as [data-theme="dark"]... } }
*/

:root { color-scheme: light; }
@media (prefers-reduced-motion: reduce) {
  :root { --duration: 0ms; --duration-slow: 0ms; }
}
