/*
 * @luxfi/ui — THE canonical token set.
 *
 * Lux is monochrome. One achromatic ladder, plus exactly two hues reserved for
 * state (error, success). Nothing else carries colour: no orange, no amber, no
 * gold, no tan. Every value below either IS a ladder rung or is `var()`-derived
 * from one — so a hostname can retheme the fleet by overriding a handful of
 * custom properties, with no rebuild.
 *
 * Layers, in resolution order:
 *   1. ladder      --lux-n-*     achromatic, hue-free (Tailwind `neutral`)
 *   2. brand hooks --lux-accent  white-label-by-hostname overrides ONLY these
 *   3. state       --lux-state-* the only permitted hues (error / success)
 *   4. semantic    --color-*     what components actually name
 *   5. aliases     shadcn (--background … --chart-*) so a Tailwind surface can
 *                  drop its hand-rolled palette and import this instead
 *
 * Light mode is :root. Dark mode activates via `.dark` (next-themes class
 * strategy) or [data-theme='dark'].
 *
 * Rule: a component may not contain a colour literal. If a value is missing
 * here, add it here.
 */

/* ================================================================
   1 — THE LADDER. Achromatic: R = G = B at every rung.
   ================================================================ */
:root {
  --lux-n-0:    #FFFFFF;
  --lux-n-50:   #F9F9F9;
  --lux-n-100:  #F5F5F5;
  --lux-n-200:  #E5E5E5;
  --lux-n-300:  #D4D4D4;
  --lux-n-400:  #A3A3A3;
  --lux-n-500:  #737373;
  --lux-n-600:  #525252;
  --lux-n-700:  #404040;
  --lux-n-800:  #262626;
  --lux-n-900:  #131313;
  --lux-n-950:  #0A0A0A;
  --lux-n-1000: #000000;

  /* The opacity ladder — the real palette for overlays and hairlines. */
  --lux-ink-04:  rgba(19, 19, 19, 0.04);
  --lux-ink-06:  rgba(19, 19, 19, 0.06);
  --lux-ink-08:  rgba(19, 19, 19, 0.08);
  --lux-ink-10:  rgba(19, 19, 19, 0.10);
  --lux-ink-16:  rgba(19, 19, 19, 0.16);
  --lux-ink-24:  rgba(19, 19, 19, 0.24);
  --lux-ink-36:  rgba(19, 19, 19, 0.36);
  --lux-ink-48:  rgba(19, 19, 19, 0.48);
  --lux-ink-64:  rgba(19, 19, 19, 0.64);
  --lux-ink-80:  rgba(19, 19, 19, 0.80);
  --lux-ink-92:  rgba(19, 19, 19, 0.92);
  --lux-paper-04: rgba(255, 255, 255, 0.04);
  --lux-paper-06: rgba(255, 255, 255, 0.06);
  --lux-paper-08: rgba(255, 255, 255, 0.08);
  --lux-paper-10: rgba(255, 255, 255, 0.10);
  --lux-paper-12: rgba(255, 255, 255, 0.12);
  --lux-paper-16: rgba(255, 255, 255, 0.16);
  --lux-paper-24: rgba(255, 255, 255, 0.24);
  --lux-paper-36: rgba(255, 255, 255, 0.36);
  --lux-paper-48: rgba(255, 255, 255, 0.48);
  --lux-paper-64: rgba(255, 255, 255, 0.64);
  --lux-paper-80: rgba(255, 255, 255, 0.80);
  --lux-paper-92: rgba(255, 255, 255, 0.92);

  /* ------------------------------------------------------------
     1b — GEOMETRY. Radii were literals inside components — the same
     thing this file forbids for colour, and for the same reason: a
     surface could not be reshaped without editing every component
     that draws a corner.

     Square is the default and by far the most common rung; the
     rounded ones are for cards and controls, and `pill` is the
     fully-round one used on chips and segmented controls.
     ------------------------------------------------------------ */
  --lux-r-0:    0;
  --lux-r-sm:   10px;
  --lux-r-md:   12px;
  --lux-r-lg:   16px;
  --lux-r-xl:   20px;
  /* The rung a sheet's own list of steps takes, and the only one the
     ladder was missing: measured 12 / 16 / 20 / 24 across the four
     corner sizes a screen draws at once. */
  --lux-r-2xl:  24px;
  --lux-r-pill: 9999px;

  /* ------------------------------------------------------------
     1c — TYPE. One family, named here so no surface picks its own.

     Zen and Zen Mono, from @hanzo/font, and nothing else. Not Inter,
     not Basel, not a system stack that resolves to whatever the
     machine happens to have — a face is part of the identity, and a
     fallback that silently substitutes one makes a different product
     on a different computer.
     ------------------------------------------------------------ */
  --lux-font-sans: Zen, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lux-font-mono: Zen Mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  /* ------------------------------------------------------------
     2 — BRAND HOOKS. resolveWhiteLabel(host) writes these two and
     nothing else. Default is monochrome: the accent is the ink.
     ------------------------------------------------------------ */
  --lux-accent:    var(--lux-n-900);
  --lux-accent-fg: var(--lux-n-0);

  /* ------------------------------------------------------------
     3 — STATE. The ONLY permitted hues. Both meet WCAG AA (>=4.5:1)
     as text on the --lux-n-50 card fill.
     ------------------------------------------------------------ */
  --lux-state-error:   #B91C1C;
  --lux-state-success: #0C8410;
  /* Attention/pending is NOT a hue in Lux. It is the loudest neutral. */
  --lux-state-notice:  var(--lux-n-600);
}

/* ================================================================
   4 — SEMANTIC (light). Every value is a var() off the ladder.
   ================================================================ */
:root {
  /* --- Backgrounds --- */
  --color-bg-primary: var(--lux-n-0);
  --color-bg-info: var(--lux-n-50);
  --color-bg-body: var(--lux-n-0);

  /* --- Foregrounds --- */
  --color-fg-info: var(--lux-n-600);

  /* --- Text --- */
  /* The ink, and two fractions of it. Running text is set at three
     strengths and no more: the ink itself, sixty-five hundredths, and
     a third rung under that. Both lower rungs are written as fractions
     rather than as greys, so a tenant that publishes another ink keeps
     its own two rungs instead of inheriting ours.

     The third rung takes a different fraction on this ground than on
     the dark one, and the difference is arithmetic rather than a
     second opinion. Luminance is not linear in the channel, so one
     alpha over two grounds is two contrasts: the reference's
     thirty-eight hundredths paints #616161 on black and reads at
     3.4:1, and the same fraction of black on white paints #9e9e9e and
     reads at 2.68:1 — under the 3:1 floor WCAG sets for anything at
     all, text or boundary. Forty-five hundredths puts this ground back
     on 3.4:1. What is held equal across the two modes is the contrast,
     because contrast is what the rung is for; holding the fraction
     equal instead is what published an illegible rung on one of
     them. */
  --color-text-primary: var(--lux-n-1000);
  --color-text-secondary: color-mix(in srgb, var(--color-text-primary) 65%, transparent);
  --color-text-faint: color-mix(in srgb, var(--color-text-primary) 45%, transparent);
  --color-text-disabled: var(--lux-ink-24);
  --color-text-error: var(--lux-state-error);
  --color-text-success: var(--lux-state-success);

  /* --- Status foreground (AA >=4.5:1 on the --lux-n-50 card bg) --- */
  --color-status-good: var(--lux-state-success);
  --color-status-warn: var(--lux-state-notice);
  --color-status-bad: var(--lux-state-error);

  /* --- Headings --- */
  --color-heading: var(--lux-ink-80);

  /* --- Icons --- */
  --color-icon-primary: var(--lux-n-500);
  --color-icon-secondary: var(--lux-n-400);

  /* --- Borders ---

     The hairline is the 10 rung, and it is the whole of what draws a
     surface: a card here is the page's own ground inside one line,
     with no fill, no wash and no shadow, so a line that is 40% lighter
     than the brand's is a card with no edge. Measured over the ground
     in both themes — the 10 rung paints #1a1a1a on black and #e7e7e7
     on white; the 06 rung that stood here painted #0f0f0f, at 1.10:1
     against its own ground. `--border` below, the same role under the
     engine's name, was already at 10 and disagreed with this one by a
     rung in every card in the fleet. ------------------------------ */
  --color-border-divider: var(--lux-ink-10);
  --color-border-error: var(--lux-state-error);
  --color-border-info: var(--lux-n-400);

  /* --- Links --- */
  --color-link-primary: var(--lux-n-700);
  --color-link-primary-hover: var(--lux-n-600);
  --color-link-secondary: var(--lux-n-500);
  --color-link-subtle: var(--lux-ink-80);
  --color-link-subtle-hover: var(--lux-ink-80);
  --color-link-menu: var(--lux-ink-80);
  --color-link-underlaid-bg: var(--lux-n-100);
  --color-link-nav-fg: var(--lux-ink-80);
  --color-link-nav-fg-hover: var(--lux-n-600);
  --color-link-nav-fg-selected: var(--lux-n-900);
  --color-link-nav-fg-active: var(--lux-n-600);
  --color-link-nav-bg-selected: var(--lux-n-100);

  /* --- Buttons --- */
  --color-button-solid-bg: var(--lux-accent);
  --color-button-solid-text: var(--lux-accent-fg);
  --color-button-outline-fg: var(--lux-n-900);
  --color-button-subtle-fg: var(--lux-ink-80);
  --color-button-subtle-bg: var(--lux-ink-08);
  /* The ground under a control while it is the one that is open or on —
     a menu whose panel is showing, a toggle that is pressed. It is the
     shadcn `--accent` pair under the `--color-*` spelling the Lux
     components use, so both names resolve to one value. */
  --color-accent-bg: var(--accent);
  --color-accent-fg: var(--accent-foreground);
  --color-button-dropdown-fg: var(--lux-ink-80);
  --color-button-dropdown-border: var(--lux-n-100);
  --color-button-header-fg: var(--lux-ink-80);
  --color-button-header-fg-selected: var(--lux-ink-80);
  --color-button-header-fg-highlighted: var(--lux-ink-80);
  --color-button-header-border: var(--lux-n-100);
  --color-button-header-bg-selected: var(--lux-ink-04);
  --color-button-header-bg-highlighted: var(--lux-n-200);
  --color-button-pagination-fg: var(--lux-ink-80);
  --color-button-pagination-border: var(--lux-n-100);
  --color-button-icon-background-bg: var(--lux-n-50);
  --color-button-hero-bg: var(--lux-accent);
  --color-button-hero-fg: var(--lux-accent-fg);
  --color-button-hero-bg-hover: var(--lux-n-600);
  --color-button-hero-fg-hover: var(--lux-n-0);
  --color-button-hero-bg-selected: var(--lux-paper-06);
  --color-button-hero-fg-selected: var(--lux-ink-80);
  --color-button-danger-bg: var(--lux-state-error);
  --color-button-danger-bg-hover: #DC2626;
  --color-button-danger-fg: var(--lux-n-0);
  --color-button-segmented-fg: var(--lux-ink-80);
  --color-button-icon-bg: var(--lux-ink-04);

  /* --- Hover / Selected --- */
  --color-hover: var(--lux-n-600);
  --color-selected-control-bg: var(--lux-n-100);
  --color-selected-control-text: var(--lux-n-900);
  --color-selected-option-bg: var(--lux-n-700);

  /* --- Navigation --- */
  --color-nav-bg-selected: var(--lux-n-100);
  --color-nav-text-selected: var(--lux-n-900);

  /* --- Inputs --- */
  --color-input-fg: var(--lux-n-800);
  --color-input-bg: var(--lux-n-0);
  --color-input-bg-readonly: var(--lux-n-200);
  --color-input-border: var(--lux-n-100);
  --color-input-border-hover: var(--lux-n-200);
  --color-input-border-focus: var(--lux-n-600);
  /* Three states that were being ASKED for and never answered: input.tsx and
     textarea.tsx reference these, and nothing declared them. Their written
     fallback was `theme(colors.red.500)`-style, which is a Tailwind 3 function
     that v4 does not resolve inside an arbitrary value — so the whole
     declaration was discarded. An invalid field drew no error border and the
     `filled` variant drew no fill, in both themes. */
  --color-input-border-error: var(--lux-state-error);
  --color-input-filled-bg: var(--lux-n-50);
  /* n-400 on white is 2.5:1 — under the 3:1 non-text minimum. n-500 clears it. */
  --color-input-placeholder: var(--lux-n-500);
  --color-input-placeholder-focus: var(--lux-n-400);

  /* --- Tags --- */
  --color-tag-subtle-bg: var(--lux-ink-04);
  --color-tag-subtle-fg: var(--lux-ink-80);
  --color-tag-clickable-bg: var(--lux-n-100);
  --color-tag-clickable-fg: var(--lux-ink-80);
  --color-tag-filter-bg: var(--lux-n-100);
  --color-tag-select-bg: var(--lux-n-100);
  --color-tag-select-fg: var(--lux-n-500);
  --color-tag-select-selected-bg: var(--lux-n-700);
  --color-tag-select-selected-fg: var(--lux-paper-80);

  /* --- Badges ---
     The colour NAMES are a legacy API (call sites say colorScheme="orange").
     They are one monochrome ramp now; only green/red keep a hue, because they
     carry state rather than decoration. */
  --color-badge-gray-bg: var(--lux-ink-04);
  --color-badge-gray-fg: var(--lux-ink-80);
  --color-badge-green-bg: #F0FFF4;
  --color-badge-green-fg: var(--lux-state-success);
  --color-badge-red-bg: #FFF5F5;
  --color-badge-red-fg: var(--lux-state-error);
  --color-badge-purple-bg: var(--lux-n-100);
  --color-badge-purple-fg: var(--lux-n-600);
  --color-badge-orange-bg: var(--lux-n-100);
  --color-badge-orange-fg: var(--lux-n-600);
  --color-badge-blue-bg: var(--lux-n-100);
  --color-badge-blue-fg: var(--lux-n-600);
  --color-badge-yellow-bg: var(--lux-n-100);
  --color-badge-yellow-fg: var(--lux-n-600);
  --color-badge-teal-bg: var(--lux-n-100);
  --color-badge-teal-fg: var(--lux-n-600);
  --color-badge-cyan-bg: var(--lux-n-100);
  --color-badge-cyan-fg: var(--lux-n-600);
  --color-badge-pink-bg: var(--lux-n-100);
  --color-badge-pink-fg: var(--lux-n-600);
  --color-badge-purple-alt-bg: var(--lux-n-100);
  --color-badge-purple-alt-fg: var(--lux-ink-80);
  --color-badge-blue-alt-bg: var(--lux-n-100);
  --color-badge-blue-alt-fg: var(--lux-ink-80);
  --color-badge-bright-gray-bg: var(--lux-n-100);
  --color-badge-bright-gray-fg: var(--lux-n-600);
  --color-badge-bright-green-bg: #C6F6D5;
  --color-badge-bright-green-fg: #25855A;
  --color-badge-bright-red-bg: #FED7D7;
  --color-badge-bright-red-fg: #C53030;
  --color-badge-bright-blue-bg: var(--lux-n-200);
  --color-badge-bright-blue-fg: var(--lux-n-700);
  --color-badge-bright-yellow-bg: var(--lux-n-200);
  --color-badge-bright-yellow-fg: var(--lux-n-700);
  --color-badge-bright-teal-bg: var(--lux-n-200);
  --color-badge-bright-teal-fg: var(--lux-n-700);
  --color-badge-bright-cyan-bg: var(--lux-n-200);
  --color-badge-bright-cyan-fg: var(--lux-n-700);
  --color-badge-bright-orange-bg: var(--lux-n-200);
  --color-badge-bright-orange-fg: var(--lux-n-700);
  --color-badge-bright-purple-bg: var(--lux-n-200);
  --color-badge-bright-purple-fg: var(--lux-n-700);
  --color-badge-bright-pink-bg: var(--lux-n-200);
  --color-badge-bright-pink-fg: var(--lux-n-700);

  /* --- Alerts --- */
  --color-alert-fg: var(--lux-ink-80);
  --color-alert-bg-info: var(--lux-ink-04);
  --color-alert-bg-warning: var(--lux-n-200);
  --color-alert-bg-warning-table: var(--lux-n-50);
  --color-alert-bg-success: #C6F6D5;
  --color-alert-bg-error: #FED7D7;

  /* --- Dialogs / Popovers / Drawers --- */
  --color-dialog-bg: var(--lux-n-0);
  --color-dialog-fg: var(--lux-ink-80);
  --color-popover-bg: var(--lux-n-0);
  --color-popover-border: var(--lux-ink-10);
  --color-popover-shadow: var(--lux-ink-08);
  --color-drawer-bg: var(--lux-n-0);

  /* --- Tooltip --- */
  --color-tooltip-bg: var(--lux-n-900);
  --color-tooltip-fg: var(--lux-n-0);

  /* --- Table --- */
  --color-table-header-bg: var(--lux-ink-06);
  --color-table-header-fg: var(--lux-ink-64);

  /* --- Tabs --- */
  --color-tabs-solid-fg: var(--lux-n-900);
  --color-tabs-solid-bg: var(--lux-n-0);
  --color-tabs-solid-fg-selected: var(--lux-n-0);
  --color-tabs-solid-bg-selected: var(--lux-n-900);
  --color-tabs-secondary-fg: var(--lux-n-500);
  --color-tabs-secondary-fg-selected: var(--lux-n-900);
  --color-tabs-radio-fg: var(--lux-n-500);
  --color-tabs-radio-bg-selected: var(--lux-n-0);
  --color-tabs-radio-fg-selected: var(--lux-n-900);

  --color-tabs-secondary-border: var(--lux-n-300);

  /* --- Controls --- */
  --color-switch-bg: var(--lux-n-300);
  --color-progress-track: var(--lux-n-100);
  /* The FILL. Referenced by progress.tsx and never declared, so the bar drew
     its track and nothing else. */
  --color-progress-indicator: var(--lux-n-900);
  /* The row highlight shared by every menu and popover list. */
  --color-popover-item-hover: var(--lux-ink-06);

  /* --- Chrome / charts --- */
  /* The parts of a divided whole, ordered by contrast rather than by hue.

     Under this package's own prefix, and not the `--chart-N` five in the
     shadcn block below. Those names belong to the wider ecosystem: an
     application's theme sheet declares them too, at the same `:root`, and
     whichever sheet a bundler puts last wins. Ours retunes them for anything
     that reads them; a drawing that names them gets whatever the host decided,
     and on the site that is a saturated blue and an amber — hue on a brand that
     spends it on exactly two meanings. A drawing names these instead, which
     nothing outside this package declares. */
  --color-part-1: var(--lux-n-900);
  --color-part-2: var(--lux-n-600);
  --color-part-3: var(--lux-n-400);
  --color-part-4: var(--lux-n-700);
  --color-part-5: var(--lux-n-300);

  --color-stats-bg: var(--lux-n-50);
  --color-topbar-bg: var(--lux-n-50);
  /* What a dialog is laid over: black at three tenths, so the screen
     behind reads at seventy per cent and stays legible — which is what
     says the sheet is a step inside something rather than a place of
     its own. One value in both themes, because the job is to dim what
     is behind and neither ground changes that. Here rather than in the
     component: a scrim is a colour, and a colour written into a
     component is a colour a tenant cannot move. */
  --color-veil: rgba(0, 0, 0, 0.3);
  --color-graph-line: var(--lux-n-500);
  --color-graph-gradient-start: rgba(163, 163, 163, 0.3);
  --color-graph-gradient-stop: rgba(163, 163, 163, 0);

  /* --- Skeleton --- */
  --color-skeleton-start: var(--lux-n-100);
  --color-skeleton-end: var(--lux-n-200);

  /* --- Scrollbar --- */
  --color-scrollbar-thumb: var(--lux-ink-16);

  /* --- Selection --- */
  --color-selection-bg: var(--lux-n-200);

  /* --- Raw palette (an alias surface; the ladder is the source) --- */
  --color-gray-50: var(--lux-n-50);
  --color-gray-100: var(--lux-n-100);
  --color-gray-200: var(--lux-n-200);
  --color-gray-300: var(--lux-n-300);
  --color-gray-400: var(--lux-n-400);
  --color-gray-500: var(--lux-n-500);
  --color-gray-600: var(--lux-n-600);
  --color-gray-700: var(--lux-n-700);
  --color-gray-800: var(--lux-n-800);
  --color-gray-900: var(--lux-n-900);
  --color-white: var(--lux-n-0);
  --color-black: var(--lux-n-1000);
  /* The two state ramps — the only rungs in this file that carry a hue.
     Monotone, like the warm ramps, and likewise not flipped in `.dark`. */
  --color-green-50:  #F0FFF4;
  --color-green-100: #C6F6D5;
  --color-green-200: #9AE6B4;
  --color-green-500: var(--lux-state-success);
  --color-green-800: #22543D;
  --color-red-50:  #FFF5F5;
  --color-red-100: #FED7D7;
  --color-red-200: #FEB2B2;
  --color-red-500: var(--lux-state-error);
  --color-red-600: #C53030;
  --color-red-800: #822727;
  /* ------------------------------------------------------------
     THE WARM RAMPS, DEFANGED.
     Tailwind v4 compiles `bg-orange-100` to `background-color:
     var(--color-orange-100)`, so redefining the rung here retints every
     warm utility on every surface that imports this file — no component
     edit, no rebuild. The ramps stay MONOTONE (low rung = light, high rung
     = dark) in both modes, exactly like Tailwind's, so an author's
     `bg-orange-50 dark:bg-yellow-900` still reads pale-on-light and
     dark-on-dark. They are therefore NOT overridden in `.dark` below.
     A rung is a rung; a warning is `--color-status-warn`.
     ------------------------------------------------------------ */
  --color-orange-50:  var(--lux-n-50);
  --color-orange-100: var(--lux-n-100);
  --color-orange-200: var(--lux-n-200);
  --color-orange-300: var(--lux-n-300);
  --color-orange-400: var(--lux-n-400);
  --color-orange-500: var(--lux-n-500);
  --color-orange-600: var(--lux-n-600);
  --color-orange-700: var(--lux-n-700);
  --color-orange-800: var(--lux-n-800);
  --color-orange-900: var(--lux-n-900);
  --color-orange-950: var(--lux-n-950);
  --color-amber-50:  var(--color-orange-50);
  --color-amber-100: var(--color-orange-100);
  --color-amber-200: var(--color-orange-200);
  --color-amber-300: var(--color-orange-300);
  --color-amber-400: var(--color-orange-400);
  --color-amber-500: var(--color-orange-500);
  --color-amber-600: var(--color-orange-600);
  --color-amber-700: var(--color-orange-700);
  --color-amber-800: var(--color-orange-800);
  --color-amber-900: var(--color-orange-900);
  --color-amber-950: var(--color-orange-950);
  --color-yellow-50:  var(--color-orange-50);
  --color-yellow-100: var(--color-orange-100);
  --color-yellow-200: var(--color-orange-200);
  --color-yellow-300: var(--color-orange-300);
  --color-yellow-400: var(--color-orange-400);
  --color-yellow-500: var(--color-orange-500);
  --color-yellow-600: var(--color-orange-600);
  --color-yellow-700: var(--color-orange-700);
  --color-yellow-800: var(--color-orange-800);
  --color-yellow-900: var(--color-orange-900);
  --color-yellow-950: var(--color-orange-950);
  /* Tailwind's warm neutral. Lux has exactly one neutral, and it is not warm. */
  --color-stone-50:  var(--lux-n-50);
  --color-stone-100: var(--lux-n-100);
  --color-stone-200: var(--lux-n-200);
  --color-stone-300: var(--lux-n-300);
  --color-stone-400: var(--lux-n-400);
  --color-stone-500: var(--lux-n-500);
  --color-stone-600: var(--lux-n-600);
  --color-stone-700: var(--lux-n-700);
  --color-stone-800: var(--lux-n-800);
  --color-stone-900: var(--lux-n-900);
  --color-stone-950: var(--lux-n-950);
  --color-blackAlpha-50: var(--lux-ink-04);
  --color-blackAlpha-100: var(--lux-ink-06);
  --color-blackAlpha-200: var(--lux-ink-08);
  --color-blackAlpha-300: var(--lux-ink-16);
  --color-blackAlpha-400: var(--lux-ink-24);
  --color-blackAlpha-500: var(--lux-ink-36);
  --color-blackAlpha-600: var(--lux-ink-48);
  --color-blackAlpha-700: var(--lux-ink-64);
  --color-blackAlpha-800: var(--lux-ink-80);
  --color-blackAlpha-900: var(--lux-ink-92);
  --color-whiteAlpha-50: var(--lux-paper-04);
  --color-whiteAlpha-100: var(--lux-paper-06);
  --color-whiteAlpha-200: var(--lux-paper-08);
  --color-whiteAlpha-300: var(--lux-paper-16);
  --color-whiteAlpha-400: var(--lux-paper-24);
  --color-whiteAlpha-500: var(--lux-paper-36);
  --color-whiteAlpha-600: var(--lux-paper-48);
  --color-whiteAlpha-700: var(--lux-paper-64);
  --color-whiteAlpha-800: var(--lux-paper-80);
  --color-whiteAlpha-900: var(--lux-paper-92);

  /* --- Chakra legacy aliases (used by migrated components) --- */
  --chakra-colors-bg-primary: var(--color-bg-primary);
  --chakra-colors-text-primary: var(--color-text-primary);
  --chakra-colors-text-secondary: var(--color-text-secondary);
  --chakra-colors-icon-secondary: var(--color-icon-secondary);
  --chakra-colors-border-divider: var(--color-border-divider);
  --chakra-colors-link-primary: var(--color-link-primary);
  --chakra-colors-link-primary-hover: var(--color-link-primary-hover);
  --chakra-colors-hover: var(--color-hover);
  --chakra-colors-gray-100: var(--color-gray-100);
  --chakra-colors-whiteAlpha-50: var(--color-whiteAlpha-50);
  --chakra-colors-whiteAlpha-100: var(--color-whiteAlpha-100);

  /* --- Shadows --- */
  /* The two elevation steps small controls need — a switch thumb, a slider
     handle, a focused pin cell. They were inlined at their LIGHT values in
     three components, so those rendered a barely-visible black shadow on a
     black canvas. A shadow is a theme value like any colour. */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-action-bar: 0 4px 4px -4px rgb(0 0 0 / 10%), 0 2px 4px -4px rgb(0 0 0 / 6%);
  /* The lit top edge and dark bottom edge that make a surface read as raised
     glass rather than as a flat panel. */
  --shadow-bezel: inset 0 2px 20px rgba(255, 255, 255, 0.1), inset 0 -2px 20px rgba(0, 0, 0, 0.5);
  /* A soft darkening at the frame's edge, to hold the eye in the middle. */
  --shadow-vignette: inset 0 0 120px 60px rgba(0, 0, 0, 0.8);
  --shadow-popover: 0px 15px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-drawer: 0px 4px 6px -2px rgba(0, 0, 0, 0.05), 0px 10px 15px -3px rgba(0, 0, 0, 0.1);

  /* ------------------------------------------------------------
     5 — SHADCN / TAILWIND ALIASES (light).
     A surface imports this file and deletes its own palette block.
     ------------------------------------------------------------ */
  --background: var(--lux-n-0);
  --foreground: var(--lux-n-900);
  --card: var(--lux-n-0);
  --card-foreground: var(--lux-n-900);
  --popover: var(--lux-n-0);
  --popover-foreground: var(--lux-n-900);
  --primary: var(--lux-accent);
  --primary-foreground: var(--lux-accent-fg);
  --secondary: var(--lux-n-100);
  --secondary-foreground: var(--lux-n-900);
  --muted: var(--lux-n-100);
  --muted-foreground: var(--lux-n-500);
  --accent: var(--lux-n-100);
  --accent-foreground: var(--lux-n-900);
  --destructive: var(--lux-state-error);
  --destructive-foreground: var(--lux-n-0);
  /* success / warning / info as shadcn-style pairs. `warning` is achromatic —
     it used to be hsl(38 96% 57%), which is where lux.market got its tan. */
  --success: var(--lux-state-success);
  --success-foreground: var(--lux-n-0);
  --warning: var(--lux-state-notice);
  --warning-foreground: var(--lux-n-0);
  --info: var(--lux-n-700);
  --info-foreground: var(--lux-n-0);
  /* The engine's name for the hairline, at the value the Lux name carries.
     An opaque rung stood here, which is right on white and wrong on every
     other ground a line is drawn over — a card set on the quoted-figure
     ground took a line mixed for the page instead of for the surface under
     it. The alpha rung composites wherever it lands, which is also the shape
     the design layer publishes this name in. */
  --border: var(--lux-ink-10);
  --input: var(--lux-n-200);
  --ring: var(--lux-n-400);
  /* Charts: five achromatic steps, ordered by contrast, not by hue. */
  --chart-1: var(--lux-n-900);
  --chart-2: var(--lux-n-600);
  --chart-3: var(--lux-n-400);
  --chart-4: var(--lux-n-700);
  --chart-5: var(--lux-n-300);
  --sidebar: var(--lux-n-50);
  --sidebar-foreground: var(--lux-n-900);
  --sidebar-primary: var(--lux-accent);
  --sidebar-primary-foreground: var(--lux-accent-fg);
  --sidebar-accent: var(--lux-n-100);
  --sidebar-accent-foreground: var(--lux-n-900);
  --sidebar-border: var(--lux-n-200);
  --sidebar-ring: var(--lux-n-400);
}

/* ================================================================
   DARK MODE
   ================================================================ */
.dark,
[data-theme='dark'] {
  /* Brand hooks invert: on ink, the accent is the paper. */
  --lux-accent: var(--lux-n-0);
  --lux-accent-fg: var(--lux-n-900);

  /* State, lightened for a dark ground (AA >=4.5:1 on --lux-n-900). */
  --lux-state-error:   #FCA5A5;
  --lux-state-success: #6EE7A8;
  --lux-state-notice:  var(--lux-n-300);

  /* --- Backgrounds --- */
  --color-bg-primary: var(--lux-n-900);
  --color-bg-info: var(--lux-n-800);
  --color-bg-body: var(--lux-n-1000);

  /* --- Foregrounds --- */
  --color-fg-info: var(--lux-n-300);

  /* --- Text --- */
  --color-text-primary: var(--lux-n-0);
  --color-text-secondary: color-mix(in srgb, var(--color-text-primary) 65%, transparent);
  --color-text-faint: color-mix(in srgb, var(--color-text-primary) 38%, transparent);
  --color-text-disabled: var(--lux-paper-24);
  --color-text-error: var(--lux-state-error);
  --color-text-success: var(--lux-state-success);

  /* --- Status foreground --- */
  --color-status-good: var(--lux-state-success);
  --color-status-warn: var(--lux-state-notice);
  --color-status-bad: var(--lux-state-error);

  /* --- Headings --- */
  --color-heading: var(--lux-paper-80);

  /* --- Icons --- */
  --color-icon-primary: var(--lux-n-400);
  --color-icon-secondary: var(--lux-n-500);

  /* --- Borders --- */
  --color-border-divider: var(--lux-paper-10);
  --color-border-error: var(--lux-state-error);
  --color-border-info: var(--lux-n-500);

  /* --- Links --- */
  --color-link-primary: var(--lux-n-300);
  --color-link-primary-hover: var(--lux-n-200);
  --color-link-secondary: var(--lux-n-400);
  --color-link-subtle: var(--lux-paper-80);
  --color-link-subtle-hover: var(--lux-paper-80);
  --color-link-menu: var(--lux-paper-80);
  --color-link-underlaid-bg: var(--lux-n-800);
  --color-link-nav-fg: var(--lux-paper-80);
  --color-link-nav-fg-hover: var(--lux-n-200);
  --color-link-nav-fg-selected: var(--lux-n-0);
  --color-link-nav-fg-active: var(--lux-n-200);
  --color-link-nav-bg-selected: var(--lux-n-800);

  /* --- Buttons --- */
  --color-button-solid-bg: var(--lux-accent);
  --color-button-solid-text: var(--lux-accent-fg);
  --color-button-outline-fg: var(--lux-n-0);
  --color-button-subtle-fg: var(--lux-paper-80);
  --color-button-subtle-bg: var(--lux-paper-08);
  --color-accent-bg: var(--accent);
  --color-accent-fg: var(--accent-foreground);
  --color-button-dropdown-fg: var(--lux-paper-80);
  --color-button-dropdown-border: var(--lux-n-800);
  --color-button-header-fg: var(--lux-paper-80);
  --color-button-header-fg-selected: var(--lux-paper-80);
  --color-button-header-fg-highlighted: var(--lux-paper-80);
  --color-button-header-border: var(--lux-n-800);
  --color-button-header-bg-selected: var(--lux-paper-04);
  --color-button-header-bg-highlighted: var(--lux-n-700);
  --color-button-pagination-fg: var(--lux-paper-80);
  --color-button-pagination-border: var(--lux-n-800);
  --color-button-icon-background-bg: var(--lux-n-800);
  --color-button-hero-bg: var(--lux-accent);
  --color-button-hero-fg: var(--lux-accent-fg);
  --color-button-hero-bg-hover: var(--lux-n-200);
  --color-button-hero-fg-hover: var(--lux-n-900);
  --color-button-hero-bg-selected: var(--lux-paper-06);
  --color-button-hero-fg-selected: var(--lux-paper-80);
  --color-button-danger-bg: var(--lux-state-error);
  --color-button-danger-bg-hover: #F87171;
  --color-button-danger-fg: var(--lux-n-900);
  --color-button-segmented-fg: var(--lux-paper-80);
  --color-button-icon-bg: var(--lux-paper-04);

  /* --- Hover / Selected --- */
  --color-hover: var(--lux-n-200);
  --color-selected-control-bg: var(--lux-n-800);
  --color-selected-control-text: var(--lux-n-0);
  --color-selected-option-bg: var(--lux-n-700);

  /* --- Navigation --- */
  --color-nav-bg-selected: var(--lux-n-800);
  --color-nav-text-selected: var(--lux-n-0);

  /* --- Inputs --- */
  --color-input-fg: var(--lux-n-200);
  --color-input-bg: var(--lux-n-900);
  --color-input-bg-readonly: var(--lux-n-800);
  --color-input-border: var(--lux-n-800);
  --color-input-border-hover: var(--lux-n-700);
  --color-input-border-focus: var(--lux-n-400);
  --color-input-border-error: var(--lux-state-error);
  --color-input-filled-bg: var(--lux-n-800);
  --color-input-placeholder: var(--lux-n-500);
  --color-input-placeholder-focus: var(--lux-n-600);

  /* --- Tags --- */
  --color-tag-subtle-bg: var(--lux-paper-06);
  --color-tag-subtle-fg: var(--lux-paper-80);
  --color-tag-clickable-bg: var(--lux-n-800);
  --color-tag-clickable-fg: var(--lux-paper-80);
  --color-tag-filter-bg: var(--lux-n-800);
  --color-tag-select-bg: var(--lux-n-800);
  --color-tag-select-fg: var(--lux-n-400);
  --color-tag-select-selected-bg: var(--lux-n-700);
  --color-tag-select-selected-fg: var(--lux-paper-80);

  /* --- Badges --- */
  --color-badge-gray-bg: var(--lux-paper-06);
  --color-badge-gray-fg: var(--lux-paper-80);
  --color-badge-green-bg: #22543D;
  --color-badge-green-fg: #9AE6B4;
  --color-badge-red-bg: #822727;
  --color-badge-red-fg: #FEB2B2;
  --color-badge-purple-bg: var(--lux-n-800);
  --color-badge-purple-fg: var(--lux-n-300);
  --color-badge-orange-bg: var(--lux-n-800);
  --color-badge-orange-fg: var(--lux-n-300);
  --color-badge-blue-bg: var(--lux-n-800);
  --color-badge-blue-fg: var(--lux-n-300);
  --color-badge-yellow-bg: var(--lux-n-800);
  --color-badge-yellow-fg: var(--lux-n-300);
  --color-badge-teal-bg: var(--lux-n-800);
  --color-badge-teal-fg: var(--lux-n-300);
  --color-badge-cyan-bg: var(--lux-n-800);
  --color-badge-cyan-fg: var(--lux-n-300);
  --color-badge-pink-bg: var(--lux-n-800);
  --color-badge-pink-fg: var(--lux-n-300);
  --color-badge-purple-alt-bg: var(--lux-n-800);
  --color-badge-purple-alt-fg: var(--lux-paper-80);
  --color-badge-blue-alt-bg: var(--lux-n-800);
  --color-badge-blue-alt-fg: var(--lux-paper-80);
  --color-badge-bright-gray-bg: var(--lux-n-800);
  --color-badge-bright-gray-fg: var(--lux-n-200);
  --color-badge-bright-green-bg: #22543D;
  --color-badge-bright-green-fg: #9AE6B4;
  --color-badge-bright-red-bg: #822727;
  --color-badge-bright-red-fg: #FEB2B2;
  --color-badge-bright-blue-bg: var(--lux-n-700);
  --color-badge-bright-blue-fg: var(--lux-n-200);
  --color-badge-bright-yellow-bg: var(--lux-n-700);
  --color-badge-bright-yellow-fg: var(--lux-n-200);
  --color-badge-bright-teal-bg: var(--lux-n-700);
  --color-badge-bright-teal-fg: var(--lux-n-200);
  --color-badge-bright-cyan-bg: var(--lux-n-700);
  --color-badge-bright-cyan-fg: var(--lux-n-200);
  --color-badge-bright-orange-bg: var(--lux-n-700);
  --color-badge-bright-orange-fg: var(--lux-n-200);
  --color-badge-bright-purple-bg: var(--lux-n-700);
  --color-badge-bright-purple-fg: var(--lux-n-200);
  --color-badge-bright-pink-bg: var(--lux-n-700);
  --color-badge-bright-pink-fg: var(--lux-n-200);

  /* --- Alerts --- */
  --color-alert-fg: var(--lux-paper-80);
  --color-alert-bg-info: var(--lux-paper-06);
  --color-alert-bg-warning: var(--lux-paper-08);
  --color-alert-bg-warning-table: var(--lux-paper-06);
  --color-alert-bg-success: #1C4532;
  --color-alert-bg-error: #63171B;

  /* --- Dialogs / Popovers / Drawers --- */
  --color-dialog-bg: var(--lux-n-900);
  --color-dialog-fg: var(--lux-paper-80);
  --color-popover-bg: var(--lux-n-900);
  --color-popover-border: var(--lux-paper-12);
  --color-popover-shadow: var(--lux-paper-16);
  --color-drawer-bg: var(--lux-n-900);

  /* --- Tooltip --- */
  --color-tooltip-bg: var(--lux-n-900);
  --color-tooltip-fg: var(--lux-n-0);

  /* --- Table --- */
  --color-table-header-bg: var(--lux-paper-06);
  --color-table-header-fg: var(--lux-paper-64);

  /* --- Tabs --- */
  --color-tabs-solid-fg: var(--lux-n-0);
  --color-tabs-solid-bg: var(--lux-n-900);
  --color-tabs-solid-fg-selected: var(--lux-n-900);
  --color-tabs-solid-bg-selected: var(--lux-n-0);
  --color-tabs-secondary-fg: var(--lux-n-400);
  --color-tabs-secondary-fg-selected: var(--lux-n-0);
  --color-tabs-radio-fg: var(--lux-n-400);
  --color-tabs-radio-bg-selected: var(--lux-n-800);
  --color-tabs-radio-fg-selected: var(--lux-n-0);

  --color-tabs-secondary-border: var(--lux-n-600);

  /* --- Controls --- */
  --color-switch-bg: var(--lux-paper-24);
  --color-progress-track: var(--lux-paper-06);
  --color-progress-indicator: var(--lux-n-0);
  --color-popover-item-hover: var(--lux-paper-06);

  /* --- Chrome / charts --- */
  --color-part-1: var(--lux-n-50);
  --color-part-2: var(--lux-n-400);
  --color-part-3: var(--lux-n-500);
  --color-part-4: var(--lux-n-300);
  --color-part-5: var(--lux-n-600);

  --color-stats-bg: var(--lux-paper-04);
  --color-topbar-bg: var(--lux-paper-04);
  --color-veil: rgba(0, 0, 0, 0.3);
  --color-graph-line: var(--lux-paper-48);
  --color-graph-gradient-start: rgba(255, 255, 255, 0.15);
  --color-graph-gradient-stop: rgba(255, 255, 255, 0);
  /* On a dark canvas a 5%-black shadow is invisible, so the small steps carry
     a hairline rim as well as depth — the rim is what actually separates a
     control from the surface behind it. */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-md: 0 4px 8px -1px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-drawer: 0px 15px 40px 0px rgba(0, 0, 0, 0.4), 0px 5px 10px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 1px rgba(0, 0, 0, 0.1);

  /* --- Skeleton --- */
  --color-skeleton-start: var(--lux-n-800);
  --color-skeleton-end: var(--lux-n-700);

  /* --- Scrollbar --- */
  --color-scrollbar-thumb: var(--lux-paper-16);

  /* --- Selection --- */
  --color-selection-bg: var(--lux-n-700);

  /* The warm ramps are NOT redefined here on purpose — see the light block.
     They are monotone in both modes so `dark:bg-yellow-900` still means
     "dark". A call site that needs ink that FLIPS with the mode wants
     --color-status-warn, which is a semantic token, not a palette rung. */

  /* ------------------------------------------------------------
     SHADCN / TAILWIND ALIASES (dark)
     ------------------------------------------------------------ */
  --background: var(--lux-n-1000);
  --foreground: var(--lux-n-50);
  --card: var(--lux-n-950);
  --card-foreground: var(--lux-n-50);
  --popover: var(--lux-n-950);
  --popover-foreground: var(--lux-n-50);
  --primary: var(--lux-accent);
  --primary-foreground: var(--lux-accent-fg);
  --secondary: var(--lux-n-900);
  --secondary-foreground: var(--lux-n-50);
  --muted: var(--lux-n-900);
  --muted-foreground: var(--lux-n-400);
  --accent: var(--lux-n-900);
  --accent-foreground: var(--lux-n-50);
  --destructive: var(--lux-state-error);
  --destructive-foreground: var(--lux-n-950);
  --success: var(--lux-state-success);
  --success-foreground: var(--lux-n-950);
  --warning: var(--lux-state-notice);
  --warning-foreground: var(--lux-n-950);
  --info: var(--lux-n-300);
  --info-foreground: var(--lux-n-950);
  --border: var(--lux-paper-10);
  --input: var(--lux-paper-12);
  --ring: var(--lux-n-500);
  --chart-1: var(--lux-n-50);
  --chart-2: var(--lux-n-400);
  --chart-3: var(--lux-n-500);
  --chart-4: var(--lux-n-300);
  --chart-5: var(--lux-n-600);
  --sidebar: var(--lux-n-950);
  --sidebar-foreground: var(--lux-n-50);
  --sidebar-primary: var(--lux-accent);
  --sidebar-primary-foreground: var(--lux-accent-fg);
  --sidebar-accent: var(--lux-n-900);
  --sidebar-accent-foreground: var(--lux-n-50);
  --sidebar-border: var(--lux-paper-10);
  --sidebar-ring: var(--lux-n-500);
}

/* ================================================================
   THE SYSTEM'S KNOBS, AT LUX'S VALUES.

   @hanzo/design publishes a full ramp — corners, spacing, type,
   elevation, measure — and every one of those names is a knob a
   surface or a person can move. This block adds no names to that
   set. It writes Lux's values into the ones the brand has an
   opinion about, and leaves the rest where the design layer put
   them: spacing, elevation, the containers and the reflow points
   are not brand facts and are not restated here.

   Import order is the whole mechanism. Both sheets declare at
   :root, so the later one wins, and this file is imported after
   @hanzo/design — or after @hanzo/ui/styles.css, which carries the
   same tokens. @hanzo/appearance writes these same names INLINE on
   <html>, and an inline style outranks any sheet, so a knob a
   person has moved keeps its value; what stands here is only what
   is there before anybody moves one.
   ================================================================ */
:root {
  /* --- Corners. The Lux ladder, in the names everything reads.

     The two ladders disagreed by a rung. --lux-r-* is 10 / 12 / 16 /
     20 / 24 and the design layer's default is 6 / 8 / 12 / 16 / 24,
     so a card asking for --radius-md was drawn at 8 where the brand
     draws 12, and the four corner sizes a sheet shows at once landed
     on three. ------------------------------------------------- */
  --radius-sm:   var(--lux-r-sm);
  --radius-md:   var(--lux-r-md);
  --radius-lg:   var(--lux-r-lg);
  --radius-xl:   var(--lux-r-xl);
  --radius-2xl:  var(--lux-r-2xl);
  --radius-full: var(--lux-r-pill);

  /* --- The face, in the names the design layer reads it under. */
  --font-sans: var(--lux-font-sans);
  --font-mono: var(--lux-font-mono);

  /* --- The type ramp.

     The design layer builds every rung from one anchor and one
     spread:

       --text-base = 0.875rem * --type-scale
       --text-N    = (0.875rem +/- delta * --type-ratio) * --type-scale

     so the anchor says how big the interface reads and the spread
     says how far a heading stands above a label. Both are live, and
     the whole page moves together because there is one anchor rather
     than a size written per component.

     Three numbers put the Lux ramp on those two knobs. 8/7 lifts the
     anchor from 14 to 16; 7/4 is the spread that carries the rung
     below it to 14 and the one above to 18; and --type-root is the
     fraction Lux draws every rem rung at, so what renders is
     11.544 / 13.468 / 15.392 / 17.316 / 21.164 rather than the whole
     numbers the ramp is written from.

     --type-root is a Lux fact and --type-scale is the knob, so the
     root is folded into the knob rather than kept beside it: a
     person moving the size control writes --type-scale and expects
     the page to answer, and a second multiplier the control cannot
     see would be a value nobody can reach. ------------------- */
  --type-root: 0.962;
  --type-scale: calc(8 / 7 * var(--type-root));
  --type-ratio: calc(7 / 4);

  /* The two anchors as a fraction, so a rung below can be written at
     the number Lux means and converted once. A rung of T renders at
     T * --type-root, and --type-scale lifts it back. */
  --type-anchor: calc(14 / 16);

  /* The four rungs the anchor and the spread cannot reach.

     Written in Lux's own whole numbers, the two ladders agree at sm,
     base, lg and xl -- 14 / 16 / 18 / 22 -- and nowhere else. One step
     under sm the ramp is at 12 where the spread is at 10. At the
     display end the spread climbs 30 / 40 / 52 / 68 where the ramp
     climbs 36 / 48 / 70, and no single ratio lands both ends: solving
     for either moves sm off 14. So these say their own number, which
     is what the design layer publishes these names to be overridden
     for, and each rides --type-scale like every other rung -- a rung
     written flat is a rung the size control cannot move. The floor and
     the ceiling are the design layer's own, because the two knobs
     compound and a rung that states its own number is exactly as able
     to run away as one the ratio produced.

     2xl is not restated, so it stands where the spread puts it: 30 in
     whole numbers, 28.86 rendered, between xl at 22 and 3xl at 36.
     That is the one rung on this ladder whose size the brand did not
     choose. harness/material.spec.ts measures it with the rest, so it
     is at least a number somebody would notice moving.

     --text-xs is the disclosure under a card and the fine print in a
     sheet, and the size is what decides where a measure wraps, so it
     is a rung and not a detail. --text-3xl is the figure a person
     types on a leg of a trade and the title over a task; its leading
     is unitless because at that size the rung is display type, which
     is how the design layer sets its own display rungs. */
  --text-xs:  clamp(var(--text-floor), calc(12px * var(--type-anchor) * var(--type-scale)), var(--text-ceiling));
  --text-3xl: clamp(var(--text-floor), calc(36px * var(--type-anchor) * var(--type-scale)), var(--text-ceiling));
  --leading-3xl: 1.2;
  --text-4xl: clamp(var(--text-floor), calc(48px * var(--type-anchor) * var(--type-scale)), var(--text-ceiling));
  --text-5xl: clamp(var(--text-floor), calc(70px * var(--type-anchor) * var(--type-scale)), var(--text-ceiling));

  /* --- Weight. Four names, three values.

     The design layer publishes the four static cuts, 400 / 500 / 600
     / 700. Zen is variable across 100-900, so Lux states the weights
     it actually draws rather than the nearest cut, and every painted
     string is at one of three: the ordinary weight for what is read,
     a half step up for the smallest rung, where a face at the
     ordinary weight goes thin, and a firmer one for a string that is
     pressed or names a value. `bold` stands with `semibold` because
     nothing on this surface draws a fourth.

     Two variable faces at one numeric weight are not necessarily
     equally dark — apparent weight is a property of the drawing — so
     a change here is decided by looking, not by arithmetic. -- */
  --weight-normal:   497;
  --weight-medium:   500;
  --weight-semibold: 606;
  --weight-bold:     606;

  /* The face and the weight the document itself carries.

     A custom property does nothing where no rule reads it, and
     nothing reads --weight-normal: the engine's font scope sets a
     line height and no weight at all, so every unstyled string on the
     page inherits the browser's 400 against a ladder that publishes
     497. Both inherit, so the document states them once and anything
     that chooses its own still wins. */
  font-family: var(--font-sans);
  font-weight: var(--weight-normal);
}

/* The engine keys weight to the size rung.

   Its atomic classes read --f-weight-N, one rung per size rung, and its
   font scopes declare that whole ladder on themselves: `:root .font_body`
   sets rung 4 to 400 and `:root .font_heading` sets it to 600. A value on
   :root alone cannot reach past either, which is why naming the weights
   above does nothing until the ladder points at them. The doubled
   :root:root out-specifies a two-class selector without reaching for an
   !important, and is the idiom @hanzo/design uses on its own hover rules.

   One ladder across all three scopes. The engine's distinction is
   body-light and heading-heavy, and Lux does not draw that: a heading
   takes its rank from size, at the same weight as the body it sits over.
   So weight says pressable-or-named and size says rank, and a string that
   wants emphasis asks for it where it stands.

   Rung 1 is the 10px rung and takes the half step. Every rung above it
   takes the ordinary weight. */
:root:root .font_body,
:root:root .font_mono,
:root:root .font_heading {
  --f-weight-0:  var(--weight-medium);
  --f-weight-1:  var(--weight-medium);
  --f-weight-2:  var(--weight-normal);
  --f-weight-3:  var(--weight-normal);
  --f-weight-4:  var(--weight-normal);
  --f-weight-5:  var(--weight-normal);
  --f-weight-6:  var(--weight-normal);
  --f-weight-7:  var(--weight-normal);
  --f-weight-8:  var(--weight-normal);
  --f-weight-9:  var(--weight-normal);
  --f-weight-10: var(--weight-normal);
  --f-weight-11: var(--weight-normal);
  --f-weight-12: var(--weight-normal);
  --f-weight-13: var(--weight-normal);
  --f-weight-14: var(--weight-normal);
  --f-weight-15: var(--weight-normal);
  --f-weight-16: var(--weight-normal);
  --f-weight-true: var(--weight-normal);
}

/* A heading is a heading, not a weight.

   The ladder above decides what a text primitive is set in, and a bare h1
   through h6 never reaches it: an element rendered through `asChild` keeps
   its place in the document outline and carries no rung class, nothing
   authored names its weight, and the browser's own `font-weight: bold`
   stands — above every name in the ladder.

   One element of specificity is the whole trick. Author origin beats the
   browser at any specificity, and one element loses to every rung class,
   so a heading that asks for a weight keeps it and a heading that asks for
   nothing takes the ladder. */
h1, h2, h3, h4, h5, h6 { font-weight: inherit }

/* ================================================================
   6 — MOTION. One system: five durations, four curves, six moves.

   Two rules make "smooth" measurable. Both were established by
   benchmark, not by taste, and the second one is the one that bites.

   1. WHAT you animate. A decorative animation may touch `transform`
      and `opacity` and nothing else. Those two are the only properties
      the compositor can run off the main thread, so they survive a
      busy CPU. Animating width / height / top / left / margin /
      background-position forces layout or paint every frame. Worse,
      the layout ones also register as layout shift: the explorer's
      mobile drawer animated `left` and scored CLS 0.726 every time it
      opened — Google calls anything over 0.25 "poor". The same drawer
      on `transform` scores 0.

   2. HOW MANY things animate. Keep it O(1) in the size of the page.
      Every independently animated element is a compositor layer to
      allocate, rasterise and composite. Past a few hundred, that count
      — not the property — is the bottleneck, and rule 1 alone will
      happily walk you off a cliff. The measurements are in 6c.

   The one deliberate exception is a disclosure widget (accordion,
   collapsible). There the box change IS the content the user asked
   for, not decoration, so animating its height is correct. Decoration
   animates transform; disclosure animates the box it discloses.

   Durations are named for their ROLE so a caller cannot pick "300ms
   because it felt right". Exits are shorter than entrances — by the
   time a thing leaves the user has already decided, and waiting on it
   reads as lag.
   ================================================================ */
:root {
  /* --- Durations -------------------------------------------------- */
  --lux-dur-press: 80ms;   /* tap acknowledgement                      */
  --lux-dur-hover: 120ms;  /* pointer feedback                         */
  --lux-dur-exit:  140ms;  /* something leaves                         */
  --lux-dur-enter: 200ms;  /* something appears                        */
  --lux-dur-move:  280ms;  /* a panel travels across the viewport      */

  /* --- Curves ----------------------------------------------------- */
  --lux-ease:        cubic-bezier(0.4, 0, 0.2, 1);      /* A -> B      */
  --lux-ease-out:    cubic-bezier(0.16, 1, 0.3, 1);     /* entering    */
  --lux-ease-in:     cubic-bezier(0.7, 0, 0.84, 0);     /* leaving     */
  --lux-ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);  /* press       */

  /* --- Distances. Enter offsets are one value, not a per-component
         guess. Both collapse to 0 under reduced motion. -------------- */
  --lux-lift: 2px;         /* hover raise                              */
  --lux-rise: 8px;         /* enter offset                             */
}

/* --- The six moves. transform + opacity only. --------------------- */
@keyframes lux-fade-in  { from { opacity: 0 } to { opacity: 1 } }
@keyframes lux-fade-out { from { opacity: 1 } to { opacity: 0 } }

@keyframes lux-rise-in {
  from { opacity: 0; transform: translate3d(0, var(--lux-rise), 0) }
  to   { opacity: 1; transform: translate3d(0, 0, 0) }
}

@keyframes lux-scale-in {
  from { opacity: 0; transform: scale(0.96) }
  to   { opacity: 1; transform: scale(1) }
}

@keyframes lux-scale-out {
  from { opacity: 1; transform: scale(1) }
  to   { opacity: 0; transform: scale(0.96) }
}

/* The loading sweep — ONE per page, never one per skeleton. See 6c. */
@keyframes lux-sweep {
  from { transform: translate3d(-100%, 0, 0) }
  to   { transform: translate3d(350%, 0, 0) }
}

@keyframes lux-spin { to { transform: rotate(360deg) } }

/* ================================================================
   6b — The primitives. Every surface reaches for these, never for a
   hand-rolled keyframe.
   ================================================================ */

.lux-enter { animation: lux-rise-in  var(--lux-dur-enter) var(--lux-ease-out) both }
.lux-exit  { animation: lux-fade-out var(--lux-dur-exit)  var(--lux-ease-in)  both }

/* Floating surfaces — menu, popover, tooltip, dialog. They grow from
   where they were summoned rather than sliding in from nowhere. */
.lux-pop      { animation: lux-scale-in  var(--lux-dur-enter) var(--lux-ease-out) both }
.lux-pop-exit { animation: lux-scale-out var(--lux-dur-exit)  var(--lux-ease-in)  both }

/* A list cascades by setting --lux-i on each row; one property, no JS. */
.lux-stagger { animation-delay: calc(var(--lux-i, 0) * 40ms) }

/* Hover / press feedback. `transform` and `opacity` are the only
   transitioned properties, so this is safe on any element. */
.lux-interactive {
  transition:
    transform var(--lux-dur-hover) var(--lux-ease-out),
    opacity   var(--lux-dur-hover) var(--lux-ease-out);
}
.lux-interactive:hover        { transform: translate3d(0, calc(-1 * var(--lux-lift)), 0) }
.lux-interactive:active       { transform: scale(0.98); transition-duration: var(--lux-dur-press) }
.lux-interactive:disabled,
.lux-interactive[aria-disabled='true'] { transform: none }

/* The floating field label. This is CSS rather than a gui prop because it keys
   off the state of a SIBLING (`:focus` / `:placeholder-shown` of the control),
   and a sibling combinator is a selector — there is no prop that expresses it.
   The label rests centred over the empty control and rises into the top of the
   frame once the control is focused or holds a value. */
.lux-field-float {
  transform: translateY(-50%);
  transform-origin: top left;
  transition: top var(--lux-dur-hover) var(--lux-ease-out),
              transform var(--lux-dur-hover) var(--lux-ease-out);
}
.lux-field-control:focus ~ .lux-field-float,
.lux-field-control:not(:placeholder-shown) ~ .lux-field-float {
  top: 4px;
  transform: translateY(0) scale(0.75);
}

/* An accordion row's label brightens while the ROW is hovered. Also a
   selector — the state belongs to the row, the colour to the label inside it —
   so the row sets a colour and its contents inherit. */
.lux-accordion-trigger { color: var(--color-text-primary) }
.lux-accordion-trigger:hover { color: var(--color-hover) }

/* A segmented control is ONE control drawn as N buttons. Where a button sits in
   the row decides which of its corners are round and which of two touching
   borders survives — and a button cannot know it is the third of four. That is
   a sibling relationship, so it is a selector. Two neighbours share one border:
   each drops its right one, and a selected button takes its right border back
   while the neighbour to its right drops its left, so the fill reads as a solid
   block with an edge. */
.lux-segment:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0 }
.lux-segment:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right-width: 0;
}
.lux-segment[data-selected]:not(:last-child) { border-right-width: 2px }
.lux-segment[data-selected] + .lux-segment { border-left-width: 0 }

/* A link that claims its whole card. The ::before covers the nearest positioned
   ancestor (a LinkBox), so a click anywhere on the row follows the link while
   the link's own box stays inline where the text is. A pseudo-element belongs
   to the selector, not to the element, so no prop reaches it. */
.lux-overlay { position: static }
.lux-overlay::before { content: ''; position: absolute; inset: 0; z-index: 0 }

/* Text controls: the two states no prop reaches. `::placeholder` styles a
   pseudo-element the input owns rather than the input, and `:read-only` is a
   selector with no prop counterpart — gui offers disabled, hover and focus, not
   this. Everything else about an Input or Textarea is a prop. */
/* A keyframe is not a prop — gui's transitions interpolate between two states,
   they do not loop. The spinner rotates forever, so it is CSS. */
.lux-spin { animation: lux-spin 0.8s linear infinite }

/* A scrolling strip with no visible scrollbar. The scrollbar is a
   pseudo-element on the box, so this is the only place it can be said. */
/* One-line truncation. `text-overflow` and `white-space` are not in gui's Text
   style base, and the three declarations only mean anything together. */
.lux-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap }


.lux-no-scrollbar { scrollbar-width: none; -ms-overflow-style: none }
.lux-no-scrollbar::-webkit-scrollbar { display: none }

/* Drop an element under a breakpoint. A viewport query is an at-rule and the
   element it applies to is a plain DOM node, so no style prop reaches it. The
   widths are the config's own min-widths, read from the other side: below sm
   means narrower than the first screen sm describes. */
@media (max-width: 639px)  { .lux-hide-below-sm { display: none } }
@media (max-width: 767px)  { .lux-hide-below-md { display: none } }
@media (max-width: 1023px) { .lux-hide-below-lg { display: none } }

/* Size the ICON inside a control. A descendant selector has no prop form, so
   the control publishes its icon size and this rule applies it. */
.lux-icon svg { width: var(--icon-size, 20px); height: var(--icon-size, 20px) }

.lux-control::placeholder { color: var(--color-input-placeholder) }
.lux-control:focus::placeholder { color: var(--color-input-placeholder-focus) }
.lux-control:read-only { opacity: 0.7 }
.lux-control[data-invalid] { border-color: var(--color-input-border-error) }

/* ================================================================
   6c — The loading state. Two primitives, one job each.

   `.lux-skeleton` RESERVES SPACE. `.lux-loading` SAYS WORK IS IN
   FLIGHT. Keeping those apart is what makes the whole thing cheap,
   because only the second one moves — once for the page, not once per
   skeleton.

   This is the part that is counter-intuitive, so here are the numbers
   that settled it. Chromium, 390x844 @3x, 4x CPU throttle, 5s samples,
   n = concurrently-mounted skeletons:

     n=600   bgpos 79.6fps   sheen 57.2fps   pulse 115.4fps   bar 120fps
     n=1460  bgpos 33.6fps   sheen 23.0fps   pulse  39.0fps   bar 120fps
     n=3000  bgpos 13.8fps   sheen  5.4fps   pulse  18.2fps   bar 120fps

     bgpos = per-element background-position gradient (what we shipped)
     sheen = per-element transform on a ::after   (the "obvious" fix)
     pulse = per-element opacity keyframe
     bar   = flat skeletons + ONE page-level sweep  (what we ship now)

   Read the middle column twice. Rewriting the shimmer as a per-element
   `transform` — obeying "animate transform and opacity only" to the
   letter — made it 32% SLOWER than the background-position version it
   replaced, and at n=3000 it produced a single 2.5-SECOND frame.

   The property rule is necessary and not sufficient. Past a few
   hundred elements the dominant cost is the NUMBER of independently
   animated elements: each one is a compositor layer to allocate,
   rasterise and composite, and `overflow:hidden` on each adds a
   render surface on top. Only the O(1) design is flat in n — 120fps
   at 600, at 1460 and at 3000, identical to animating nothing.

   So: a skeleton is a promise about layout and nothing else. It
   occupies exactly the space the real content will (zero CLS) and it
   holds still.
   ================================================================ */
.lux-skeleton {
  background: var(--color-skeleton-start);
  /* The corner belongs beside the fill. A skeleton promises the SHAPE of what
     is coming and a corner is part of that shape, so it is stated in the
     stylesheet the package ships rather than left to whatever the consuming
     app happens to have loaded. */
  border-radius: 4px;
  /* Nothing inside a skeleton is readable yet; say so once, here. */
  color: transparent;
  user-select: none;
}

/* A skeleton wrapping real content (asChild, or loading with children already
   mounted) must mask it — an <img> or an icon doesn't pick up `color:
   transparent` above. `visibility` rather than `display:none` so the masked
   subtree keeps its layout instead of collapsing it, which is the zero-CLS
   promise this component makes. A descendant selector has no prop form. */
.lux-skeleton * {
  visibility: hidden;
}

/* The one moving part. Fixed, 2px, above everything, out of flow — so it
   cannot shift layout and cannot tint content. Mount it while any request
   is in flight; unmount it when they land. One per page. */
.lux-loading {
  position: fixed;
  inset: 0 0 auto;
  height: 2px;
  z-index: 60;
  overflow: hidden;
  background: var(--color-skeleton-start);
  pointer-events: none;
}

.lux-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 40%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--color-skeleton-end) 50%,
    transparent 100%
  );
  animation: lux-sweep 1.1s var(--lux-ease) infinite;
}

/* ================================================================
   6d — Reduced motion.

   Belt AND braces, because either alone leaks:
     - zeroing the TOKENS catches anything that reads them, including
       inline styles and the Web Animations API, which !important
       cannot reach;
     - the global override catches every hand-rolled transition that
       never adopted a token.
   Unscoped on purpose. A reduced-motion rule that only applies inside
   one component is a rule the rest of the app ignores.

   Motion goes; FEEDBACK stays. State changes still land, instantly.
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
  :root {
    --lux-dur-press: 1ms;
    --lux-dur-hover: 1ms;
    --lux-dur-exit:  1ms;
    --lux-dur-enter: 1ms;
    --lux-dur-move:  1ms;
    --lux-lift: 0px;
    --lux-rise: 0px;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }

  /* A sweep that runs once and freezes mid-track is a smear. Drop the
     motion; the bar itself stays, so "work in flight" is still visible. */
  .lux-loading::after { animation: none; width: 100%; opacity: 0.5 }
}

/* The month grid. react-day-picker names its own parts; these style them. */
.lux-calendar {
  padding: .75rem;
  --rdp-cell-size: 2.25rem;
  --rdp-accent-color: var(--primary);
  --rdp-accent-background-color: var(--accent);
}
.lux-calendar .rdp-month_caption { font-size: .875rem; font-weight: 500 }
.lux-calendar .rdp-weekday { color: var(--muted-foreground); font-weight: 400; font-size: .8rem }
.lux-calendar .rdp-day_button {
  width: var(--rdp-cell-size);
  height: var(--rdp-cell-size);
  border-radius: var(--radius, .5rem);
}
.lux-calendar .rdp-day_button:hover { background: var(--accent); color: var(--accent-foreground) }
.lux-calendar .rdp-selected .rdp-day_button { background: var(--primary); color: var(--primary-foreground) }
.lux-calendar .rdp-today:not(.rdp-selected) .rdp-day_button { background: var(--accent); color: var(--accent-foreground) }
.lux-calendar .rdp-outside { color: var(--muted-foreground); opacity: .5 }
.lux-calendar .rdp-disabled { color: var(--muted-foreground); opacity: .5 }
.lux-calendar .rdp-hidden { visibility: hidden }
