/* =============================================================================
   Design tokens — Shadcn-inspired semantic system (pure CSS, no framework).
   Light theme only for now. Dark theme (.dark overrides) will follow.

   Theory: every surface is a background/foreground pair. The surface token
   omits the "-background" suffix; "-foreground" is the text/icon color on it.
   Components consume tokens, never raw colors. Change a token -> app changes.
   ========================================================================== */

:root {
  /* ---- Base font stacks ---- */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;

  /* ---- Color pairs (oklch) — near-neutral, cool-tinted like Linear/Zinc ---- */
  --background: oklch(0.97 0 0);            /* app surface (light grey) */
  --foreground: oklch(0.21 0 0);            /* default text/icons */

  --card: oklch(1 0 0);                     /* elevated panels */
  --card-foreground: oklch(0.21 0 0);

  --popover: oklch(1 0 0);                  /* floating overlays */
  --popover-foreground: oklch(0.21 0 0);

  --primary: oklch(0.38 0.18 355);              /* high-emphasis actions (grenat) */
  --primary-foreground: oklch(0.985 0 0);

  --secondary: oklch(0.97 0 0);             /* low-emphasis fills */
  --secondary-foreground: oklch(0.205 0 0);

  --muted: oklch(0.97 0 0);                /* subdued surfaces */
  --muted-foreground: oklch(0.556 0 0);     /* helper/description text */

  --accent: oklch(0.95 0 0);               /* hover/focus/active surfaces */
  --accent-foreground: oklch(0.205 0 0);

  --destructive: oklch(0.577 0.245 27.325); /* errors, destructive actions */
  --destructive-foreground: oklch(0.985 0 0);

  --system: oklch(0.945 0 0);               /* machine-authored surfaces — recessed, below the card plane */
  --system-foreground: oklch(0.21 0 0);
  --system-border: oklch(0.9 0 0);

  --border: oklch(0.92 0 0);               /* default 1px separators */
  --input: oklch(0.92 0 0);                 /* form control borders */
  --ring: oklch(0.708 0 0);                 /* focus rings */

  --selection: oklch(0.38 0.18 355 / 0.18);     /* text selection highlight (grenat) */
  --scrollbar-thumb: oklch(0 0 0 / 0.18);   /* scrollbar idle */
  --scrollbar-thumb-hover: oklch(0 0 0 / 0.3); /* scrollbar on hover */

  /* ---- Sidebar (Linear-style app shell) ---- */
  --sidebar: oklch(0.985 0 0);
  --sidebar-foreground: oklch(0.21 0 0);
  --sidebar-primary: oklch(0.38 0.18 355);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.95 0 0);
  --sidebar-accent-foreground: oklch(0.205 0 0);
  --sidebar-border: oklch(0.92 0 0);
  --sidebar-ring: oklch(0.708 0 0);
  --sidebar-grenat: oklch(0.7 0.07 355);
  --sidebar-grenat-foreground: oklch(0.21 0 0);

  /* ---- Claim & request status palette (maps to Claim::Event + request enums) ----
     Each is a surface/foreground pair so badges/chips stay legible. */
  --status-expected: oklch(0.55 0.18 255);          /* blue — anticipated */
  --status-expected-foreground: oklch(0.985 0 0);

  --status-running: oklch(0.62 0.16 220);           /* indigo — in progress */
  --status-running-foreground: oklch(0.985 0 0);

  --status-paused: oklch(0.78 0.16 75);             /* amber — insurer's own pause */
  --status-paused-foreground: oklch(0.32 0.08 75);

  --status-suspended: oklch(0.52 0.11 40);          /* burnt orange — frozen from outside */
  --status-suspended-foreground: oklch(0.985 0 0);

  --status-covered: oklch(0.6 0.14 150);            /* green — resolved ok */
  --status-covered-foreground: oklch(0.985 0 0);

  --status-uncovered: oklch(0.58 0.22 25);          /* red — not covered */
  --status-uncovered-foreground: oklch(0.985 0 0);

  --status-pending: oklch(0.78 0.16 75);             /* amber — awaiting */
  --status-pending-foreground: oklch(0.32 0.08 75);

  --status-consumed: oklch(0.6 0.14 150);            /* green — used */
  --status-consumed-foreground: oklch(0.985 0 0);

  --status-triage: oklch(0.6 0.02 260);              /* slate — intake */
  --status-triage-foreground: oklch(0.985 0 0);

  --status-in-liquidation: oklch(0.55 0.2 300);      /* violet — payout in progress */
  --status-in-liquidation-foreground: oklch(0.985 0 0);

  --status-liquidated: oklch(0.48 0.15 145);         /* deep green — paid out */
  --status-liquidated-foreground: oklch(0.985 0 0);

  --status-finished: oklch(0.5 0.12 180);            /* teal — definitively done */
  --status-finished-foreground: oklch(0.985 0 0);

  --status-cancelled: oklch(0.45 0.02 260);          /* dark slate — voided */
  --status-cancelled-foreground: oklch(0.985 0 0);

  /* ---- Chart palette (reserved for future dashboards) ---- */
  --chart-1: oklch(0.646 0.222 41.116);
  --chart-2: oklch(0.6 0.118 184.704);
  --chart-3: oklch(0.398 0.07 227.392);
  --chart-4: oklch(0.828 0.189 84.429);
  --chart-5: oklch(0.769 0.188 70.08);

  /* ---- Radius scale — single source of truth ---- */
  --radius: 0.5rem;                          /* Linear-crisp base */
  --radius-sm: calc(var(--radius) * 0.6);
  --radius-md: calc(var(--radius) * 0.8);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) * 1.4);
  --radius-2xl: calc(var(--radius) * 1.8);
  --radius-3xl: calc(var(--radius) * 2.2);
  --radius-full: 9999px;

  /* ---- Type scale ---- */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;

  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  --tracking-tight: -0.011em;
  --tracking-normal: 0;

  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* ---- Spacing scale (4px base) ---- */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* ---- Elevation (soft, Linear-style) ---- */
  --shadow-xs: 0 1px 2px 0 oklch(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 oklch(0 0 0 / 0.07), 0 1px 2px -1px oklch(0 0 0 / 0.07);
  --shadow-md: 0 4px 6px -1px oklch(0 0 0 / 0.08), 0 2px 4px -2px oklch(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px oklch(0 0 0 / 0.08), 0 4px 6px -4px oklch(0 0 0 / 0.05);

  /* ---- Motion ---- */
  --duration-fast: 100ms;
  --duration: 150ms;
  --duration-slow: 200ms;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* =============================================================================
   Dark theme — override the surface tokens under a `.dark` selector on <html>.
   Same semantic names, near-black Linear-style palette. Status token pairs are
   reused unchanged (colored chips read correctly on either surface). Toggling
   is driven by theme_controller.js + a no-FOUC inline script in the layout.
   The radius/type/spacing/motion tokens above are inherited unchanged.
   ========================================================================== */
.dark {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);

  --card: oklch(0.205 0 0);
  --card-foreground: oklch(0.985 0 0);

  --popover: oklch(0.205 0 0);
  --popover-foreground: oklch(0.985 0 0);

  --primary: oklch(0.48 0.2 355);
  --primary-foreground: oklch(0.985 0 0);

  --secondary: oklch(0.269 0 0);
  --secondary-foreground: oklch(0.985 0 0);

  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);

  --accent: oklch(0.269 0 0);
  --accent-foreground: oklch(0.985 0 0);

  --destructive: oklch(0.704 0.191 22.216);
  --destructive-foreground: oklch(0.985 0 0);

  --system: oklch(0.175 0 0);
  --system-foreground: oklch(0.985 0 0);
  --system-border: oklch(1 0 0 / 14%);

  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.556 0 0);

  --selection: oklch(0.48 0.2 355 / 0.22);
  --scrollbar-thumb: oklch(1 0 0 / 0.18);
  --scrollbar-thumb-hover: oklch(1 0 0 / 0.3);

  --sidebar: oklch(0.205 0 0);
  --sidebar-foreground: oklch(0.985 0 0);
  --sidebar-primary: oklch(0.48 0.2 355);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.269 0 0);
  --sidebar-accent-foreground: oklch(0.985 0 0);
  --sidebar-border: oklch(1 0 0 / 10%);
  --sidebar-ring: oklch(0.556 0 0);
  --sidebar-grenat: oklch(0.35 0.07 355);
  --sidebar-grenat-foreground: oklch(0.985 0 0);
}