:root {
  color-scheme: light dark;

  /* Color: light. Pairs and ratios are listed in the table below. */
  --ink: #0f172a;          /* text, outlines */
  --surface: #ffffff;      /* cards, inputs, dialogs */
  --canvas: #f8fafc;       /* page background */
  --sunken: #f1f5f9;       /* code, table stripe, skeleton */
  --text: var(--ink);
  --text-2: #334155;       /* secondary text */
  --muted: #475569;        /* hints, captions; never lighter */
  --border: #64748b;       /* passive container edge, 4.76:1 */
  --divider: #cbd5e1;      /* decorative rules only; carries no meaning */
  --accent: #cf0f5c;
  --accent-hover: #a90b48;
  --accent-soft: #fff1f5;
  --on-accent: #ffffff;
  --highlight: #fef08a;    /* selected chip, tier, "you are here" */
  --success: #047857;  --success-soft: #ecfdf5;
  --warning: #92400e;  --warning-soft: #fef3c7;
  --danger:  #b91c1c;  --danger-soft:  #fef2f2;
  --info:    #1d4ed8;  --info-soft:    #eff6ff;
  --focus: #1d4ed8;
  --disabled-bg: #e2e8f0;  --disabled-text: #64748b; /* exempt from contrast (WCAG 1.4.3) */
  --scrim: rgba(15, 23, 42, 0.6);

  /* Type: Inter only */
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --fs-sm: 0.875rem;  --lh-sm: 1.5;    /* 14 */
  --fs-md: 1rem;      --lh-md: 1.5;    /* 16 body */
  --fs-lg: 1.125rem;  --lh-lg: 1.5;    /* 18 lead */
  --fs-h3: 1.5rem;    --lh-h3: 1.25;   /* 24 */
  --fs-h2: 2rem;      --lh-h2: 1.2;    /* 32 */
  --fs-h1: clamp(2rem, 1.4rem + 2.6vw, 2.75rem); --lh-h1: 1.15; /* 32-44 */
  --fw-regular: 400;  --fw-strong: 700;  --fw-heavy: 800;
  --measure: 65ch;

  /* Spacing: 4px scale */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-6: 24px; --s-8: 32px; --s-12: 48px; --s-16: 64px;

  /* Radius */
  --r-sm: 6px;     /* inputs, chips, table, tags */
  --r-md: 12px;    /* buttons, cards, dialogs, banners */
  --r-pill: 9999px;/* badges, switch only */

  /* Elevation */
  --border-w: 2px;
  --lift-1: 2px 2px 0 var(--ink);  /* buttons, chips */
  --lift-2: 4px 4px 0 var(--ink);  /* cards, dialog, popover */

  /* Motion */
  --dur-1: 120ms; --dur-2: 200ms;  /* nothing above 300ms */
  --ease: cubic-bezier(0.2, 0, 0, 1);

  /* z-index */
  --z-base: 0; --z-sticky: 100; --z-popover: 200;
  --z-dialog: 300; --z-toast: 400; --z-skip: 500;

  /* Layout */
  --w-read: 45rem;   /* 720px */
  --w-app: 75rem;    /* 1200px */
  --gutter: 16px;
  --target: 44px;
  --header-h: 56px;
  /* Breakpoints (media queries cannot use var(); write literally): 640px, 1024px, min-width, mobile first */
  --on-highlight: #0f172a;
}
@media (min-width: 640px) { :root { --gutter: 24px; } }

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f8fafc; --surface: #141b2d; --canvas: #0b1020; --sunken: #1f2942;
  --text-2: #cbd5e1; --muted: #cbd5e1; --border: #7b8aa5; --divider: #2a3756;
  --accent: #ff6b9d; --accent-hover: #ff8fb5; --accent-soft: #3a1426; --on-accent: #0b1020;
  --highlight: #fde047;
  --success: #34d399; --success-soft: #0c2a22; --warning: #fbbf24; --warning-soft: #33260a;
  --danger: #ff8a8a; --danger-soft: #3a1414; --info: #7cb2ff; --info-soft: #0f2347;
  --focus: #93c5fd; --disabled-bg: #1f2942; --disabled-text: #94a3b8;
  --scrim: rgba(0, 0, 0, 0.7);
  --on-highlight: #0f172a;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
  color-scheme: dark;
  --ink: #f8fafc; --surface: #141b2d; --canvas: #0b1020; --sunken: #1f2942;
  --text-2: #cbd5e1; --muted: #cbd5e1; --border: #7b8aa5; --divider: #2a3756;
  --accent: #ff6b9d; --accent-hover: #ff8fb5; --accent-soft: #3a1426; --on-accent: #0b1020;
  --highlight: #fde047;
  --success: #34d399; --success-soft: #0c2a22; --warning: #fbbf24; --warning-soft: #33260a;
  --danger: #ff8a8a; --danger-soft: #3a1414; --info: #7cb2ff; --info-soft: #0f2347;
  --focus: #93c5fd; --disabled-bg: #1f2942; --disabled-text: #94a3b8;
  --scrim: rgba(0, 0, 0, 0.7);
  --on-highlight: #0f172a;
  }
}
