/* Design tokens for every niche product, on the structure of Lance's own token set:
   an ink scale, materials, lines, interaction states, status tones, control heights, radii,
   shadows and one motion curve. Feature code never invents a color, a size or a curve.

   Brand values (accent, fonts, logo) come from /brand.css, generated per niche from brand.json.
   The brand accent is one color used sparingly (the mark, a progress fill, the AI dot). Most of
   the interface is neutral ink, and the primary action is the inverse material (black in light,
   near white in dark), never the accent, so contrast holds whatever accent a pack picks.

   Themes: light by default. The app sets data-theme="dark" on <html> when the person picks dark,
   or follows the system (js/theme-boot.js resolves it before first paint). Other pages that load
   this file (pad, admin) stay light unless they set data-theme themselves. */

:root {
  color-scheme: light;

  /* ink */
  --ink: #0b0b0b;
  --ink-muted: #545454;      /* 7.4:1 on canvas */
  --ink-subtle: #646464;     /* 5.6:1 on canvas, 4.9:1 on fill: meta text, counts, keys */
  --ink-faint: #8f8f8f;      /* placeholders and disabled only */
  --ink-inverse: #ffffff;

  /* materials */
  --canvas: #f7f7f7;         /* page background */
  --raised: #fdfdfd;         /* cards, panels, rail */
  --paper-0: #ffffff;        /* fields, menus, drawers */
  --sunken: #f1f1f1;         /* wells, table heads */
  --fill: #ebebeb;           /* chips, quiet buttons */
  --fill-hover: #e4e4e4;
  --inverse: #141414;        /* primary button */
  --inverse-hover: #262626;
  --scrim: rgba(0, 0, 0, 0.36);

  /* lines */
  --line: #e9e9e9;
  --line-strong: #dcdcdc;
  --line-control: #cdcdcd;
  --line-focus: #0b0b0b;

  /* interaction states */
  --state-hover: rgba(0, 0, 0, 0.04);
  --state-pressed: rgba(0, 0, 0, 0.08);
  --state-selected: rgba(0, 0, 0, 0.06);
  --focus-ring: 0 0 0 2px var(--canvas), 0 0 0 4px rgba(20, 20, 20, 0.52);

  /* status tones: ink on surface. Urgency is always words plus color. */
  --tone-green: #177a5b;   --tone-green-bg: #e5f3ed;   /* done, ready, in progress */
  --tone-red: #9e3c55;     --tone-red-bg: #f8e9ed;     /* overdue, blocked, urgent */
  --tone-amber: #7d5f2c;   --tone-amber-bg: #f3ecdf;   /* due soon, waiting */
  --tone-clay: #96502f;    --tone-clay-bg: #f5e8e0;    /* high priority, move-out */
  --tone-blue: #2f5fd0;    --tone-blue-bg: #edf2fd;    /* info, open */
  --tone-gray: #545454;    --tone-gray-bg: #ededed;
  --tone-red-solid: #9e3c55;

  /* brand (overridden by /brand.css) */
  --accent: #1f4d3a;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--raised));
  --accent-line: color-mix(in srgb, var(--accent) 34%, var(--line));

  /* type */
  --font-display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --font-ui: "Plus Jakarta Sans", "Helvetica Neue", Helvetica, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --t-2xs: 11px;    /* badges */
  --t-xs: 12px;     /* meta, table heads */
  --t-sm: 13px;     /* secondary */
  --t-base: 14px;   /* rows, body: compact desktop density */
  --t-md: 15px;
  --t-lg: 17px;
  --t-xl: 20px;
  --t-2xl: 26px;    /* page titles, display face */
  --t-3xl: 34px;    /* big numbers */
  --lh-tight: 1.15;
  --lh: 1.45;
  --track-label: 0.04em;

  /* space (4px grid) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px;
  --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;

  /* control heights: compact density on desktop */
  --h-xs: 24px;
  --h-dense: 28px;
  --h-control: 32px;
  --h-large: 40px;
  --tap: 44px;

  /* radii */
  --r-sm: 4px;
  --r-control: 6px;
  --r: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-pill: 999px;

  /* elevation: surfaces are flat, menus and dialogs float */
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-menu: 0 1px 2px rgba(16, 24, 40, 0.06), 0 12px 32px -8px rgba(16, 24, 40, 0.18);
  --shadow-dialog: 0 16px 48px rgba(0, 0, 0, 0.18);

  /* motion: one curve, two speeds */
  --ease: cubic-bezier(.2, 0, 0, 1);
  --ease-exit: cubic-bezier(.4, 0, 1, 1);
  --dur-1: 120ms;
  --dur-2: 180ms;
  --dur-3: 320ms;

  /* layout */
  --rail-w: 252px;
  --rail-collapsed: 48px;
  --topbar-h: 52px;
  --content-max: 1360px;
  --panel-w: 440px;

  /* quiet panels: the assistant rail and the notification center (Lance's copilot material) */
  --glass-bg: #fcfcfcdb;
  --glass-edge: #00000014;
  --glass-shadow: 0 16px 48px -8px #00000029;
  --q-ink: #0a0a0a;
  --q-body: #3b3b3b;
  --q-dim: #6f6f6f;
  --q-line: #e7e7e7;
  --q-bubble: #0000000d;
  --q-hover: #0000000a;
  --q-card: #ffffff;
  --q-field: #f6f6f6;
  --q-field-line: #e2e2e2;
  --q-send: #0a0a0a;
  --q-send-ink: #ffffff;

  /* legacy names (the pad, the admin console and older pages read these) */
  --paper: var(--canvas);
  --surface: var(--raised);
  --surface-2: var(--sunken);
  --surface-3: var(--fill);
  --ink-2: #333333;
  --muted: var(--ink-muted);
  --faint: var(--ink-subtle);
  --line-2: var(--line-strong);
  --night: #141414;
  --night-2: #1f1f1f;
  --night-line: #2c2c2c;
  --night-ink: #ededed;
  --night-muted: #a4a4a4;
  --green: var(--tone-green); --green-bg: var(--tone-green-bg);
  --amber: var(--tone-amber); --amber-bg: var(--tone-amber-bg);
  --red: var(--tone-red);     --red-bg: var(--tone-red-bg);
  --blue: var(--tone-blue);   --blue-bg: var(--tone-blue-bg);
  --gray: var(--tone-gray);   --gray-bg: var(--tone-gray-bg);
  --shadow-1: var(--shadow-card);
  --shadow-2: var(--shadow-menu);
  --shadow-3: var(--shadow-dialog);
  --ring: var(--focus-ring);
  --ease-in-out: var(--ease);
  --sidebar-w: var(--rail-w);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --ink: #ededed;
  --ink-muted: #a8a8a8;
  --ink-subtle: #939393;
  --ink-faint: #6e6e6e;
  --ink-inverse: #0b0b0b;

  --canvas: #121212;
  --raised: #181818;
  --paper-0: #1c1c1c;
  --sunken: #151515;
  --fill: #262626;
  --fill-hover: #2e2e2e;
  --inverse: #e8e8e8;
  --inverse-hover: #ffffff;
  --scrim: rgba(0, 0, 0, 0.6);

  --line: #242424;
  --line-strong: #2e2e2e;
  --line-control: #3d3d3d;
  --line-focus: #ededed;

  --state-hover: rgba(255, 255, 255, 0.05);
  --state-pressed: rgba(255, 255, 255, 0.09);
  --state-selected: rgba(255, 255, 255, 0.07);
  --focus-ring: 0 0 0 2px var(--canvas), 0 0 0 4px rgba(255, 255, 255, 0.5);

  --tone-green: #4fd1a5;   --tone-green-bg: rgba(53, 212, 165, 0.12);
  --tone-red: #e0889d;     --tone-red-bg: rgba(212, 115, 138, 0.15);
  --tone-amber: #d2b07a;   --tone-amber-bg: rgba(201, 164, 107, 0.14);
  --tone-clay: #dc9a78;    --tone-clay-bg: rgba(220, 154, 120, 0.14);
  --tone-blue: #93b2f2;    --tone-blue-bg: rgba(134, 168, 240, 0.14);
  --tone-gray: #a8a8a8;    --tone-gray-bg: #262626;
  --tone-red-solid: #b34155;

  --accent-soft: color-mix(in srgb, var(--accent) 18%, var(--raised));
  --accent-line: color-mix(in srgb, var(--accent) 40%, var(--line));

  --shadow-card: none;
  --shadow-menu: 0 0 0 1px #2a2a2a, 0 16px 40px rgba(0, 0, 0, 0.55);
  --shadow-dialog: 0 0 0 1px #2a2a2a, 0 16px 48px rgba(0, 0, 0, 0.55);

  --glass-bg: #141414db;
  --glass-edge: #ffffff12;
  --glass-shadow: 0 16px 48px -8px #00000099;
  --q-ink: #ffffff;
  --q-body: #d4d4d4;
  --q-dim: #8a8a8a;
  --q-line: #1c1c1c;
  --q-bubble: #ffffff12;
  --q-hover: #ffffff0d;
  --q-card: #181818;
  --q-field: #141414;
  --q-field-line: #262626;
  --q-send: #ededed;
  --q-send-ink: #000000;

  --ink-2: #cfcfcf;
  --night: #0d0d0d;
  --night-2: #1a1a1a;
  --night-line: #262626;
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-1: 0ms; --dur-2: 0ms; --dur-3: 0ms; }
}
