/* Deskmates design tokens — the single source of truth for every colour, size and timing in the UI.
   Version 1.0.0 (2026-12-02). Layer 1 = primitives (raw values, never used by components directly).
   Layer 2 = semantic tokens (what components use). Dark theme only re-points layer 2.
   Theme: <html data-theme="light|dark">; without it the OS preference (prefers-color-scheme) decides.
   Density: <html data-density="compact"> tightens controls; targets never drop below 24px.
   Docs and live contrast ratios: docs/styleguide.html. */

:root {
  /* ---------- primitives: colour ---------- */
  --violet-50: #f6f2ff; --violet-100: #efe9ff; --violet-200: #e2d8ff; --violet-300: #c4b2ff; --violet-400: #b39dfa;
  --violet-500: #8b5cf6; --violet-600: #7c3aed; --violet-700: #6d28d9; --violet-800: #5b21b6; --violet-900: #3b1d7a; --violet-950: #170b33;
  --ink-0: #ffffff; --ink-25: #fbfaff; --ink-50: #f6f4fb; --ink-100: #eeecf3; --ink-200: #e3e0ec; --ink-300: #cfcbdc;
  --ink-400: #a29cba; --ink-450: #8b85a0; --ink-500: #7f7896; --ink-600: #575270; --ink-650: #4a4560; --ink-700: #3a3650;
  --ink-800: #282440; --ink-850: #1e1b31; --ink-900: #1b1930; --ink-925: #15122a; --ink-950: #120f22;
  --green-100: #dcfce7; --green-300: #86efac; --green-400: #4ade80; --green-600: #16a34a; --green-800: #166534; --green-950: #12301f;
  --amber-100: #fef3c7; --amber-300: #fcd34d; --amber-500: #f59e0b; --amber-800: #854d0e; --amber-950: #33270a;
  --red-100: #fee4e2; --red-300: #fca5a5; --red-600: #d92d20; --red-700: #b42318; --red-950: #3a1418;
  --blue-100: #dbe8ff; --blue-300: #9cc3ff; --blue-700: #1e4fb8; --blue-950: #142542;
  --aurora-lavender: #e7dcff; --aurora-peach: #ffe2d4; --aurora-mint: #d3f4e8; --aurora-sky: #dbe7ff; --aurora-base: #f3efff;

  /* ---------- primitives: type ---------- */
  --font-sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
  --text-xs: 0.75rem;   /* 12px: badges, axis labels only */
  --text-sm: 0.8125rem; /* 13px: table cells, helper text */
  --text-base: 0.875rem;/* 14px: body, controls */
  --text-md: 1rem;      /* 16px: card titles */
  --text-lg: 1.125rem;  /* 18px: section titles */
  --text-xl: 1.375rem;  /* 22px: stat values */
  --text-2xl: 1.75rem;  /* 28px: page titles */
  --text-3xl: 2.125rem; /* 34px: hero */
  --weight-regular: 400; --weight-medium: 500; --weight-semibold: 600; --weight-bold: 700;
  --leading-tight: 1.2; --leading-normal: 1.5;

  /* ---------- primitives: space (4px grid), radius, borders ---------- */
  --space-0: 0; --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-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-xl: 20px; --radius-2xl: 24px; --radius-pill: 999px;
  --border-width: 1px; --border-width-strong: 2px; --focus-width: 3px; --focus-offset: 2px;

  /* ---------- primitives: motion, layers, layout ---------- */
  --duration-fast: 120ms; --duration-base: 200ms; --duration-slow: 320ms;
  --ease-standard: cubic-bezier(.2, 0, 0, 1); --ease-emphasized: cubic-bezier(.3, 0, 0, 1.15); --ease-exit: cubic-bezier(.4, 0, 1, 1);
  --z-base: 0; --z-sticky: 10; --z-dropdown: 20; --z-overlay: 40; --z-modal: 50; --z-toast: 60; --z-tooltip: 70;
  /* Breakpoints (CSS cannot use variables in media queries; these document the values used in style.css):
     sm 640px · md 900px · lg 1200px · xl 1440px */
  --bp-sm: 640px; --bp-md: 900px; --bp-lg: 1200px; --bp-xl: 1440px;
  --sidebar-width: 264px; --content-max: 1480px;

  /* ---------- density ---------- */
  --control-height: 40px; --control-height-sm: 32px; --control-pad-x: 14px; --target-min: 24px; --card-pad: var(--space-5);

  /* ---------- semantic: light theme (default) ---------- */
  color-scheme: light;
  --color-canvas: var(--aurora-base);
  --color-aurora-1: var(--aurora-lavender); --color-aurora-2: var(--aurora-peach); --color-aurora-3: var(--aurora-mint); --color-aurora-4: var(--aurora-sky);
  --color-surface: var(--ink-0); --color-surface-raised: var(--ink-0); --color-surface-sunken: var(--ink-50); --color-surface-hover: var(--violet-50);
  --color-surface-selected: var(--violet-100); --color-scrim: rgb(27 25 48 / .45);
  --color-text: var(--ink-900); --color-text-muted: var(--ink-600); --color-text-subtle: #6b6684; --color-text-inverse: var(--ink-0);
  --color-border: var(--ink-200);          /* decorative card edges (not a control boundary) */
  --color-border-strong: var(--ink-450);   /* control boundaries: 3:1 or more against surfaces */
  --color-accent: var(--violet-700); --color-accent-hover: var(--violet-800); --color-on-accent: var(--ink-0);
  --color-accent-soft: var(--violet-100); --color-accent-text: var(--violet-700);
  --color-focus: var(--violet-700); --color-focus-halo: var(--ink-0);
  --color-success-bg: var(--green-100); --color-success-text: var(--green-800); --color-success-solid: var(--green-600);
  --color-warning-bg: var(--amber-100); --color-warning-text: var(--amber-800); --color-warning-solid: var(--amber-500);
  --color-danger-bg: var(--red-100); --color-danger-text: var(--red-700); --color-danger-solid: var(--red-700);
  --color-info-bg: var(--blue-100); --color-info-text: var(--blue-700);
  --color-neutral-bg: var(--ink-100); --color-neutral-text: var(--ink-650);
  --color-chart-grid: var(--ink-200); --color-chart-axis: var(--ink-450);
  /* Chart series: each 3:1 or more against the card surface; adjacent bars are also split by a 2px gap. */
  --chart-1: #2f6fd6; --chart-2: #c2410c; --chart-3: #0f766e; --chart-4: #a16207; --chart-5: #be185d; --chart-6: #15803d; --chart-7: #7c3aed; --chart-other: #6b6684;
  --shadow-1: 0 1px 2px rgb(46 16 101 / .06), 0 2px 10px rgb(46 16 101 / .06);
  --shadow-2: 0 6px 20px rgb(46 16 101 / .10), 0 1px 3px rgb(46 16 101 / .06);
  --shadow-3: 0 24px 64px rgb(46 16 101 / .22), 0 4px 12px rgb(46 16 101 / .10);
  --office-night: rgb(18 14 52);
}

/* ---------- semantic: dark theme ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --color-canvas: var(--ink-950);
  --color-aurora-1: #2a1d57; --color-aurora-2: #3a1f3a; --color-aurora-3: #10343a; --color-aurora-4: #1a2650;
  --color-surface: var(--ink-850); --color-surface-raised: var(--ink-800); --color-surface-sunken: var(--ink-925); --color-surface-hover: #2b2647;
  --color-surface-selected: #342c5c; --color-scrim: rgb(5 4 14 / .7);
  --color-text: #f3f1fa; --color-text-muted: #b8b3cc; --color-text-subtle: var(--ink-400); --color-text-inverse: var(--ink-950);
  --color-border: #34304b; --color-border-strong: var(--ink-500);
  --color-accent: var(--violet-400); --color-accent-hover: var(--violet-300); --color-on-accent: var(--violet-950);
  --color-accent-soft: #2f2756; --color-accent-text: var(--violet-300);
  --color-focus: var(--violet-300); --color-focus-halo: var(--ink-950);
  --color-success-bg: var(--green-950); --color-success-text: var(--green-300); --color-success-solid: var(--green-400);
  --color-warning-bg: var(--amber-950); --color-warning-text: var(--amber-300); --color-warning-solid: var(--amber-300);
  --color-danger-bg: var(--red-950); --color-danger-text: var(--red-300); --color-danger-solid: var(--red-300);
  --color-info-bg: var(--blue-950); --color-info-text: var(--blue-300);
  --color-neutral-bg: #2c2843; --color-neutral-text: #d6d2e4;
  --color-chart-grid: #34304b; --color-chart-axis: var(--ink-500);
  --chart-1: #6ea8ff; --chart-2: #fb923c; --chart-3: #2dd4bf; --chart-4: #facc15; --chart-5: #f472b6; --chart-6: #4ade80; --chart-7: #b39dfa; --chart-other: #8f89a6;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .4); --shadow-2: 0 6px 20px rgb(0 0 0 / .45); --shadow-3: 0 24px 64px rgb(0 0 0 / .6);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-canvas: var(--ink-950);
    --color-aurora-1: #2a1d57; --color-aurora-2: #3a1f3a; --color-aurora-3: #10343a; --color-aurora-4: #1a2650;
    --color-surface: var(--ink-850); --color-surface-raised: var(--ink-800); --color-surface-sunken: var(--ink-925); --color-surface-hover: #2b2647;
    --color-surface-selected: #342c5c; --color-scrim: rgb(5 4 14 / .7);
    --color-text: #f3f1fa; --color-text-muted: #b8b3cc; --color-text-subtle: var(--ink-400); --color-text-inverse: var(--ink-950);
    --color-border: #34304b; --color-border-strong: var(--ink-500);
    --color-accent: var(--violet-400); --color-accent-hover: var(--violet-300); --color-on-accent: var(--violet-950);
    --color-accent-soft: #2f2756; --color-accent-text: var(--violet-300);
    --color-focus: var(--violet-300); --color-focus-halo: var(--ink-950);
    --color-success-bg: var(--green-950); --color-success-text: var(--green-300); --color-success-solid: var(--green-400);
    --color-warning-bg: var(--amber-950); --color-warning-text: var(--amber-300); --color-warning-solid: var(--amber-300);
    --color-danger-bg: var(--red-950); --color-danger-text: var(--red-300); --color-danger-solid: var(--red-300);
    --color-info-bg: var(--blue-950); --color-info-text: var(--blue-300);
    --color-neutral-bg: #2c2843; --color-neutral-text: #d6d2e4;
    --color-chart-grid: #34304b; --color-chart-axis: var(--ink-500);
    --chart-1: #6ea8ff; --chart-2: #fb923c; --chart-3: #2dd4bf; --chart-4: #facc15; --chart-5: #f472b6; --chart-6: #4ade80; --chart-7: #b39dfa; --chart-other: #8f89a6;
    --shadow-1: 0 1px 2px rgb(0 0 0 / .4); --shadow-2: 0 6px 20px rgb(0 0 0 / .45); --shadow-3: 0 24px 64px rgb(0 0 0 / .6);
  }
}

:root[data-density="compact"] { --control-height: 32px; --control-height-sm: 28px; --control-pad-x: 10px; --card-pad: var(--space-4); }

@media (prefers-reduced-motion: reduce) {
  :root { --duration-fast: 0ms; --duration-base: 0ms; --duration-slow: 0ms; }
}
