/* BizsOn design tokens — the ONLY global stylesheet in the system.
   All module UI must read colors/spacing/typography from these vars.

   COLOUR SOURCE OF TRUTH: Metronic (task 317 / GitLab #166).
   The colour tokens below are DERIVED from the semantic tokens the compiled
   Metronic theme declares on :root and .dark (--background, --foreground,
   --card, --primary, --border, …). Metronic flips the `dark` class on <html>,
   which re-computes ITS tokens, which re-computes these — so the --bz-* layer
   needs no dark palette of its own, and the two palettes can no longer drift
   apart. The one dark override is of Metronic's OWN semantic tokens (the
   charcoal block below, task 343), so everything still flows from one place.
   The data-theme hook is kept for server-side/theme-state callers.

   A token Metronic has no equivalent for (a third elevation step, a chip pair)
   is derived with color-mix against --foreground: that always pushes the colour
   AWAY from the current background, so ONE declaration reads correctly in both
   themes — darker on white, lighter on charcoal.

   THE PALETTE (redesign 2026-12, "Cobalt on graphite"): every literal colour of the product lives in three blocks
   further down — `html:root` (light), `html.dark` (dark) and `html .dark` (the dark sidebar surface).
   Each block re-declares Metronic's own semantic tokens plus the few --bz-* bases Metronic has no slot
   for (accent text, the status hues, the counter-accent, the categorical set, text on a solid status
   fill); everything else in this file derives from those. Designed in OKLCH: one vivid cobalt primary
   (hue 260–261), a cyan counter-accent for small marks only, four status hues spread round the wheel,
   neutral greys (chroma ≤ 0.004, a trace of cool at hue 260), a graphite sidebar, and an 8-colour
   categorical set at one lightness per theme. No purple: no hue between 270 and 340 anywhere in the palette. Dark mode is its own palette, not the light one dimmed: lighter, softer hues on
   a neutral charcoal ramp, and status fills light enough to carry dark text. Measured contrast is in
   docs/dev/guides/design-system.md.

   A tenant theme (redesign branding) re-declares the SAME semantic tokens as the three palette blocks — --primary, the
   link step, the counter-accent, the sidebar block and the radius scale — in a <style> that BrandStyle emits
   after this file (BizsOn.BuildingBlocks.Branding.BrandCss). Status hues, neutrals and the categorical set are
   never tenant-controlled. --bz-brand-primary follows the themed primary.

   The derived block below also matches the preview panes .bz-theme-light / .bz-theme-dark, so a scoped theme
   (the branding page's live preview) re-derives every --bz-* token inside its own container.

   See docs/dev/guides/design-system.md. */
:root,
.bz-theme-light,
.bz-theme-dark {
  /* Palette — every value follows Metronic's own token for the active theme. */
  --bz-color-bg: var(--background);
  /* In light mode page and card are the same white, separated by --border plus a small shadow,
     shadcn-style. In dark mode the card is one charcoal step lighter than the page (the html.dark
     block below, task 343), so borderless panels separate too. */
  --bz-color-surface: var(--card);
  /* Floating surfaces — drop-downs, pop-overs, dialogs — one elevation step above a card in dark
     mode, exactly as Metronic's own .kt-dropdown / .kt-modal-content use --popover. White in light. */
  --bz-color-popover: var(--popover);
  --bz-color-surface-2: var(--secondary);
  /* A third elevation step: Metronic stops at two, so this is one step further
     from the page than surface-2, in whichever direction the theme runs. */
  --bz-color-surface-3: color-mix(in oklab, var(--secondary) 92%, var(--foreground));
  --bz-color-fg: var(--foreground);
  /* Secondary body text (redesign 2026-12): a step quieter than the foreground but still reading
     text, unlike muted. zinc-700-like in light, zinc-300-like in dark. */
  --bz-color-fg-secondary: color-mix(in oklab, var(--foreground) 78%, var(--background));
  --bz-color-fg-muted: var(--muted-foreground);
  --bz-color-fg-subtle: color-mix(in oklab, var(--muted-foreground) 78%, var(--background));
  --bz-color-border: var(--border);
  /* Hairlines between rows and list items: lighter than the border that frames a surface. */
  --bz-color-border-subtle: color-mix(in oklab, var(--border) 60%, var(--card));
  --bz-color-border-strong: color-mix(in oklab, var(--border) 62%, var(--foreground));
  --bz-color-accent: var(--primary);
  /* A darker step of the fill in both themes (the canvas's 88% + black): a hover that darkens reads
     as pressed-in, and white on it only gains contrast. Never use it as text: accent text hovers stay
     --bz-color-accent-text. */
  --bz-color-accent-hover: color-mix(in oklab, var(--primary) 88%, var(--color-black));
  --bz-color-accent-fg: var(--primary-foreground);
  /* The accent used AS TEXT — links, link buttons, accent labels: --bz-color-accent-text, declared with
     the palette below (a darker step of the primary in light mode, a soft sky blue in dark).
     Fills, badges and backgrounds keep --bz-color-accent.
     Status hues: --bz-color-danger follows Metronic's --destructive; warn, ok and info are declared
     with the palette below, one value per theme. Each is readable AS TEXT on every surface of its
     theme and is the fill of a solid status badge or button. */
  --bz-color-danger: var(--destructive);
  /* The counter-accent (cyan) and the categorical set (--bz-color-cat-1 … -8) are declared with the
     palette below. */
  /* Deliberately brand-tinted rather than Metronic's grey --ring: a grey ring on
     charcoal is barely visible, and a focus indicator that cannot be seen is a
     missing focus indicator. */
  --bz-color-focus-ring: color-mix(in srgb, var(--primary) 40%, transparent);
  /* Text selection and scroll-bar thumbs (the canvas's polish layer). */
  --bz-color-selection: color-mix(in srgb, var(--bz-color-accent-text) 24%, transparent);
  --bz-color-scrollbar: color-mix(in srgb, var(--muted-foreground) 40%, transparent);

  /* Status tones as a tinted chip: a pale fill of the hue with a deep step of it as text in light mode,
     a dark fill with a light step in dark mode — one declaration each, because mixing towards
     --foreground moves away from whichever background is current. Measured ≥ 5:1 in both themes. */
  --bz-color-ok-bg: color-mix(in srgb, var(--bz-color-ok) 14%, var(--bz-color-surface));
  --bz-color-ok-fg: color-mix(in oklab, var(--bz-color-ok) 60%, var(--foreground));
  --bz-color-warn-bg: color-mix(in srgb, var(--bz-color-warn) 16%, var(--bz-color-surface));
  --bz-color-warn-fg: color-mix(in oklab, var(--bz-color-warn) 60%, var(--foreground));
  --bz-color-danger-bg: color-mix(in srgb, var(--bz-color-danger) 13%, var(--bz-color-surface));
  --bz-color-danger-fg: color-mix(in oklab, var(--bz-color-danger) 60%, var(--foreground));
  --bz-color-info-bg: color-mix(in srgb, var(--bz-color-info) 14%, var(--bz-color-surface));
  --bz-color-info-fg: color-mix(in oklab, var(--bz-color-info) 60%, var(--foreground));
  --bz-color-neutral-bg: var(--bz-color-surface-2);
  --bz-color-neutral-fg: var(--bz-color-fg-secondary);

  /* Rows: a faint hover and an accent-tinted selection, both with the normal foreground on top. */
  --bz-color-row-hover: color-mix(in srgb, var(--foreground) 4%, var(--bz-color-surface));
  --bz-color-selected: color-mix(in srgb, var(--bz-color-accent-text) 12%, var(--bz-color-surface));
  --bz-color-selected-hover: color-mix(in srgb, var(--bz-color-accent-text) 18%, var(--bz-color-surface));

  /* Workspace layers (redesign 2026-12): a neutral zinc canvas behind one white content frame, as on
     every board of the design canvas. Dark mode uses the page colour itself (html.dark below), so the
     card-coloured frame sits one charcoal step above it. */
  --bz-color-canvas: color-mix(in oklab, var(--background) 96%, var(--foreground));
  /* What paints directly behind page content: the canvas, and the content frame's surface where the
     desktop frame exists (workspace.css). Sticky page chrome paints this so it never looks cut out. */
  --bz-color-page: var(--bz-color-canvas);
  /* A quiet neutral sub-surface: card heads, totals rows, hover wells. */
  --bz-color-wash: color-mix(in oklab, var(--card) 97%, var(--foreground));
  --bz-color-grid-head: color-mix(in oklab, var(--card) 98%, var(--foreground));
  /* The hero: a deep blue gradient from the primary, dark in both themes. */
  --bz-color-hero: color-mix(in oklab, var(--primary) 24%, var(--color-zinc-950));
  --bz-color-hero-end: color-mix(in oklab, var(--primary) 48%, var(--color-zinc-950));
  --bz-color-hero-fg: var(--color-white);
  --bz-color-hero-muted: color-mix(in srgb, var(--color-white) 78%, transparent);
  --bz-color-hero-line: color-mix(in srgb, var(--color-white) 16%, transparent);

  /* Painted ON the sidebar surface from outside its `.dark` scope (the phone sign-in strip's controls): light on
     the dark surface; a tenant with a light sidebar re-declares them as the page's own text (BrandCss). */
  --bz-on-sidebar-fg: var(--bz-color-hero-fg);
  --bz-on-sidebar-muted: var(--bz-color-hero-muted);
  --bz-on-sidebar-line: var(--bz-color-hero-line);

  /* Brand: the themed primary. A tenant theme re-declares --primary, so this follows it everywhere. */
  --bz-brand-primary: var(--bz-color-accent);
  /* Derived from the brand colour itself (the accent-hover formula), so a tenant's own colour darkens on
     hover instead of switching to the product accent. */
  --bz-brand-primary-hover: color-mix(in oklab, var(--bz-brand-primary) 88%, var(--color-black));
  --bz-brand-accent: var(--bz-color-accent);
  /* Compatibility aliases — several pages/components reference these shorthand names.
     They indirect to the canonical --bz-color-* tokens, which in turn follow Metronic,
     so any code using them follows the theme with no duplication anywhere.
     Prefer the --bz-color-* names in new code. */
  --bz-text-1: var(--bz-color-fg);
  --bz-text-2: var(--bz-color-fg-muted);
  --bz-text-3: var(--bz-color-fg-subtle);
  --bz-text-muted: var(--bz-color-fg-muted);
  --bz-surface: var(--bz-color-surface);
  --bz-surface-2: var(--bz-color-surface-2);
  --bz-surface-3: var(--bz-color-surface-3);
  --bz-border: var(--bz-color-border);
  --bz-border-soft: var(--bz-color-border);
  --bz-primary: var(--bz-color-accent);
  --bz-primary-active: var(--bz-color-accent-hover);
  --bz-primary-600: var(--bz-color-accent);
  --bz-primary-50: color-mix(in srgb, var(--bz-color-accent) 14%, transparent);

  /* Radius (redesign 2026-12): 6 for small inner parts, 8 for controls (buttons, fields, menu items),
     12 for cards, pop-overs and the content frame, 16 for the floating phone dock. */
  --bz-radius-sm: 6px;
  --bz-radius-md: 8px;
  --bz-radius-lg: 12px;
  --bz-radius-xl: 16px;
  --bz-radius-pill: 999px;

  /* Spacing scale */
  --bz-space-1: 4px;
  --bz-space-2: 8px;
  --bz-space-3: 12px;
  --bz-space-4: 16px;
  --bz-space-5: 24px;
  --bz-space-6: 32px;
  --bz-space-8: 48px;

  /* Type — Inter when available, otherwise fall back to the OS UI stack
     (Segoe UI Variable on Windows 11, San Francisco on macOS/iOS, Roboto
     on Android). Inter is NOT bundled; if a tenant wants to guarantee
     it, they can self-host the font and inject an @font-face via the
     TenantBrandOverride. Until then the fallback stack renders cleanly
     across all platforms. */
  --bz-font-sans: "Inter", "Segoe UI Variable", "Segoe UI", system-ui,
                  -apple-system, BlinkMacSystemFont, Roboto,
                  "Helvetica Neue", Arial, sans-serif;
  --bz-font-mono: ui-monospace, "Cascadia Mono", SFMono-Regular, Menlo,
                  Consolas, "Liberation Mono", monospace;
  --bz-fs-xs: 12px;
  --bz-fs-sm: 13px;
  --bz-fs-md: 14px;
  --bz-fs-lg: 16px;
  --bz-fs-xl: 20px;
  --bz-fs-2xl: 28px;
  --bz-fs-3xl: 34px;
  /* A KPI figure: large enough to scan, small enough that a row of zeros does not shout. */
  --bz-fs-kpi: 22px;
  --bz-fw-regular: 400;
  --bz-fw-medium: 500;
  --bz-fw-semibold: 600;
  --bz-fw-bold: 700;
  --bz-lh: 1.5;
  --bz-lh-tight: 1.25;
  /* Headings (h1/h2) close up slightly; body text keeps the font's own spacing. */
  --bz-tracking-tight: -0.012em;

  /* Motion — durations by element weight, easings by intent.
     ease-out is the default: it starts fast, so the UI reacts in the exact
     moment the user is watching. Never ease-in on an entrance or a hover —
     it delays the first frame and reads as sluggish at identical duration. */
  --bz-duration-press: 120ms;   /* button press feedback */
  --bz-duration-fast: 120ms;    /* hover, color, small state changes */
  --bz-duration-base: 180ms;    /* dropdowns, popovers, toasts */
  --bz-duration-slow: 280ms;    /* modals, panels, drawers */
  --bz-duration-reveal: 460ms; /* slow ambient loops only (a skeleton pulse); arrivals use --bz-duration-slow since the motion pass */
  --bz-ease: cubic-bezier(0.23, 1, 0.32, 1);          /* strong ease-out — the default */
  --bz-ease-out: cubic-bezier(0.23, 1, 0.32, 1);      /* explicit alias for new code */
  --bz-ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);  /* movement across the screen */
  --bz-ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);   /* sheets/panels, iOS-like */

  /* Elevation — soft, layered shadows. sm lifts the content frame off the canvas, lg is every
     floating surface (menus, drop-downs, dialogs); cards inside the frame carry a border, no shadow. */
  --bz-shadow-sm: 0 1px 2px rgba(15, 23, 42, .05),
                  0 2px 8px rgba(15, 23, 42, .04);
  --bz-shadow-md: 0 2px 4px rgba(15, 23, 42, .04),
                  0 6px 16px rgba(15, 23, 42, .08);
  --bz-shadow-lg: 0 2px 4px rgba(15, 23, 42, .04),
                  0 12px 32px rgba(15, 23, 42, .12);

  /* Scrim: the veil behind a dialog, sheet or overlay. Black in both themes on purpose: a
     foreground-based mix would turn into a white veil in dark mode. DevExpress popups, the
     cropper, the record context sheet and hand-rolled page dialogs all use this one value. */
  --bz-color-scrim: rgb(0 0 0 / .45);

  /* Layout */
  --bz-nav-width: 264px;
  --bz-nav-rail-width: 68px;
  --bz-layout-gutter: var(--bz-space-3);
  --bz-layout-gap: var(--bz-space-2);
  --bz-panel-padding: var(--bz-space-3);
  --bz-grid-cell-padding-y: var(--bz-space-1);
  /* Row density a user can choose where a grid offers it (task 678); the line above is "Compact", the default. */
  --bz-grid-cell-padding-y-comfortable: var(--bz-space-2);
  --bz-grid-cell-padding-y-dense: 1px;
  --bz-grid-cell-padding-x: var(--bz-space-2);
  --bz-header-height: 56px;
  --bz-control-height: 32px;
  --bz-control-height-lg: 40px;
  --bz-workspace-bar-height: 48px;
  --bz-workspace-height: calc(100dvh - 2 * var(--bz-layout-gap) - var(--bz-layout-gutter));
}

/* ── Light palette (redesign 2026-12, "Cobalt on graphite") ─────────────────────────────────────
   Re-declares Metronic's own semantic tokens here, not in the vendor stylesheet; `html:root` (0,1,1)
   out-ranks Metronic's `:root` whatever the load order, and html.dark below out-ranks this block in
   dark mode. Neutrals are neutral greys (chroma ≤ 0.004, a trace of cool at hue 260), no blue cast;
   cards and pop-overs stay pure white, the canvas is #f4f4f5. Contrast on white, measured on the 8-bit colour:

     primary        #115bd8  white on it 5.9:1; ≥ 5.4:1 on every light surface as a focus ring or checked box
     accent text    #0c57c9  links, a darker step of the fill, ≥ 5.4:1 on every light surface incl. a selected row
     foreground     #17181a  body text; secondary text ≥ 7.5:1, muted #5b5c5e ≥ 5.0:1 on any surface
     danger #ce2930 · warn #8c6802 · ok #227c45 · info #3a5f7d — each ≥ 4.6:1 as text on every light
       surface and as the fill under white text (--bz-color-on-solid); their chip pairs ≥ 7.2:1.
       Warn leans yellow-amber (hue 85) and info is a calm steel blue (hue 245, chroma 0.065, darker and
       far less saturated than the cobalt primary, 23° of hue from the cyan counter-accent).
     counter-accent #0f91b2 (cyan) — small marks only, ≥ 3.3:1 on every light surface
     categorical set — eight hues at one lightness (L 0.50–0.51), ≥ 5.0:1 on the canvas, ≥ 4.6:1 on their
       own 12% tint
     unchecked check box / switch outline (--bz-color-border-strong) 3.2:1 */
html:root,
.bz-theme-light {
  --primary: oklch(0.51 0.205 261);
  --foreground: oklch(0.21 0.004 260);
  --card-foreground: var(--foreground);
  --popover-foreground: var(--foreground);
  --secondary: oklch(0.968 0.002 260);
  --muted: var(--secondary);
  --accent: var(--secondary);
  --secondary-foreground: oklch(0.28 0.004 260);
  --accent-foreground: var(--secondary-foreground);
  /* 6.6:1 on white: muted labels, grid headers and captions clear AA on every light surface. */
  --muted-foreground: oklch(0.475 0.004 260);
  --border: oklch(0.918 0.003 260);
  --input: oklch(0.89 0.004 260);
  --ring: oklch(0.71 0.004 260);
  --destructive: oklch(0.555 0.2 25);
  /* A darker step than the fill, so a link reads as text and differs from a button (and from body text). */
  --bz-color-accent-text: oklch(0.49 0.19 260);
  --bz-color-warn: oklch(0.54 0.11 85);
  --bz-color-ok: oklch(0.52 0.12 152);
  --bz-color-info: oklch(0.47 0.065 245);
  /* Text and icons on a SOLID status fill (danger / ok / warn badges, counters, realm pills). White
     here, dark ink in dark mode, where the status fills are light. On the accent use --bz-color-accent-fg. */
  --bz-color-on-solid: var(--color-white);
  /* The counter-accent: a cyan for SMALL highlights only (the current-nav marker, small marks, data
     emphasis). Never a fill for large areas, never text, never a status. */
  --bz-color-highlight: oklch(0.61 0.11 222);
  /* The categorical set: charts, avatars, tags and module marks (the .bz-accent-* classes), in this
     order — 1 azure, 2 teal, 3 amber, 4 rose, 5 lime, 6 green, 7 orange, 8 sky. Neighbours in the
     series sit ≥ 33° of hue apart (lime/green is the closest pair), so a chart reads in series order.
     No purple. Status meaning stays with the status hues. */
  --bz-color-cat-1: oklch(0.51 0.18 258);
  --bz-color-cat-2: oklch(0.51 0.085 190);
  --bz-color-cat-3: oklch(0.51 0.105 75);
  --bz-color-cat-4: oklch(0.51 0.17 10);
  --bz-color-cat-5: oklch(0.51 0.12 125);
  --bz-color-cat-6: oklch(0.5 0.115 158);
  --bz-color-cat-7: oklch(0.51 0.15 42);
  --bz-color-cat-8: oklch(0.51 0.095 225);
}

/* A light preview pane inside a dark page: Metronic's light surfaces, which html:root takes from Metronic's own
   :root and a pane would otherwise inherit from the dark page. */
.bz-theme-light {
  --background: var(--color-white);
  --card: var(--color-white);
  --popover: var(--color-white);
  --destructive-foreground: var(--color-white);
}

/* Dark mode shadows. A shadow is always black, and on a near-black surface it needs more opacity
   to register at all.

   There is deliberately NO @media (prefers-color-scheme: dark) copy of any dark block.
   Metronic switches on the `dark` CLASS only, so an OS-preference block would
   darken these tokens while Metronic stayed light — a half-dark page. The
   bootstrap script in App.razor already resolves a stored `system` preference
   into an explicit class before first paint, which is what actually honours the
   OS setting. */
html.dark,
html[data-theme="dark"],
.bz-theme-dark {
  --bz-shadow-sm: 0 1px 2px rgba(0,0,0,.45);
  --bz-shadow-md: 0 2px 4px rgba(0,0,0,.30), 0 6px 16px rgba(0,0,0,.45);
  --bz-shadow-lg: 0 2px 4px rgba(0,0,0,.30), 0 12px 32px rgba(0,0,0,.50);
}

/* ── Dark palette (redesign 2026-12, "Cobalt on graphite") ───────────────────────────────────────
   A neutral charcoal elevation ramp (task 343 introduced the ramp: Metronic's .dark ships zinc-950 for
   page, card AND pop-over, which read as pitch black). Each step is one visible luminance step above
   the one below, as the contrast suite requires:

     page       --background   #1e1f21   L .014   foreground 15.1:1, muted 7.6:1
     card       --card         #242527   L .018   foreground 14.0:1, muted 7.1:1
     pop-over   --popover      #2a2b2d   L .024   foreground 12.9:1, muted 6.5:1  (drop-downs, dialogs)
     hover      --muted/accent #303234   L .032
     surface-2  --secondary    #353739   L .038   foreground 10.9:1, muted 5.5:1  (read-only, wells)
     border #3c3d3f, input border #48494b

   Colour is its own set, not the light one dimmed: a brighter cobalt fill #2970e4 (white on it 4.6:1;
   3.55 / 3.31 / 3.05:1 against page, card and pop-over, so the same fill serves as focus ring and
   checked box), sky-blue link text #8fbcff (≥ 6.1:1 on every surface, a selected row included), a light
   cyan counter-accent #4cd1ee (≥ 6.6:1), and status hues light enough to read as text on every surface
   (≥ 4.5:1 on surface-2; info is a steel blue #86aac4, 4.8:1) — which makes them light fills, so text on
   a solid status fill is dark ink here (≥ 6.8:1); chip pairs ≥ 6.8:1. `html.dark` (0,1,1) out-ranks
   Metronic's `.dark` (0,1,0) whatever the load order. */
html.dark,
.bz-theme-dark {
  --background: oklch(0.238 0.004 260);
  --card: oklch(0.265 0.004 260);
  --popover: oklch(0.289 0.004 260);
  --muted: oklch(0.315 0.004 260);
  --accent: var(--muted);
  --secondary: oklch(0.335 0.004 260);
  --foreground: oklch(0.97 0.002 260);
  --secondary-foreground: oklch(0.92 0.003 260);
  --accent-foreground: var(--secondary-foreground);
  --muted-foreground: oklch(0.76 0.004 260);
  --border: oklch(0.36 0.004 260);
  --input: oklch(0.405 0.004 260);
  --ring: oklch(0.55 0.004 260);
  --primary: oklch(0.568 0.19 260);
  --destructive: oklch(0.72 0.15 22);
  --destructive-foreground: var(--bz-color-on-solid);
  --bz-color-accent-text: oklch(0.79 0.11 258);
  --bz-color-warn: oklch(0.83 0.14 88);
  --bz-color-ok: oklch(0.77 0.14 152);
  --bz-color-info: oklch(0.72 0.055 240);
  --bz-color-on-solid: oklch(0.2 0.004 260);
  --bz-color-highlight: oklch(0.8 0.12 215);
  --bz-color-cat-1: oklch(0.76 0.12 258);
  --bz-color-cat-2: oklch(0.78 0.11 190);
  --bz-color-cat-3: oklch(0.8 0.13 80);
  --bz-color-cat-4: oklch(0.75 0.14 10);
  --bz-color-cat-5: oklch(0.8 0.14 125);
  --bz-color-cat-6: oklch(0.77 0.13 158);
  --bz-color-cat-7: oklch(0.76 0.13 45);
  --bz-color-cat-8: oklch(0.78 0.1 225);
  /* The canvas is the page colour and the content frame (a card) sits one step above it; the light
     formula would lift the canvas to card level here. The grid header takes the pop-over step, so it
     stays separate from card-coloured rows. */
  --bz-color-canvas: var(--background);
  --bz-color-grid-head: var(--popover);
}

/* ── The dark surface: sidebar (and any `.dark` panel) ─────────────────────────────────────────────
   <aside class="dark"> re-declares Metronic's .dark tokens on itself, so neither block above reaches
   it, and every --bz-* token in it is the value computed on <html> (light ones in the light theme).
   It is a neutral graphite in both themes (near-black with a trace of cool, not navy): dark enough to
   be a large surface, quiet enough that the cobalt actions and the cyan mark carry the colour. Every
   step is derived from its own --background; text steps are mixed from it too, so secondary text reads
   as a neutral grey: #15171c (#101215 in dark mode) with labels 16.4:1, body 12.4:1, muted 6.5:1
   (5.0:1 on the current item), links 9.2:1 (7.0:1 on the current item), the cyan current-item icon
   7.6:1 on the current item (cyan rather than the sky-blue link colour: the one hue the cobalt
   primary does not already carry). The same block serves a large brand panel (the
   sign-in page): headline --foreground, body --secondary-foreground, muted --muted-foreground, icon
   squares --bz-nav-current-bg (or --bz-nav-field-bg with --bz-nav-field-border) with the icon in
   --bz-color-highlight, links --bz-color-accent-text, a solid button --primary with
   --primary-foreground. Never --bz-color-fg or the light status hues in here: they are the page's.
   `html .dark` (0,1,1) out-ranks Metronic's `.dark`. */
html .dark {
  --primary: oklch(0.568 0.19 260);
  --background: oklch(0.205 0.01 260);
  --card: var(--background);
  --popover: var(--background);
  --foreground: oklch(0.97 0.006 260);
  --muted: color-mix(in oklab, var(--background) 90%, var(--foreground));
  --accent: var(--muted);
  --secondary: color-mix(in oklab, var(--background) 84%, var(--foreground));
  --border: var(--secondary);
  --input: var(--secondary);
  --muted-foreground: color-mix(in oklab, var(--foreground) 64%, var(--background));
  --secondary-foreground: color-mix(in oklab, var(--foreground) 88%, var(--background));
  --bz-color-accent-text: oklch(0.79 0.11 258);
  --bz-color-highlight: oklch(0.8 0.12 215);
  /* The current page: a raised translucent step of the surface, and its icon in the cyan
     counter-accent (a fixed product colour: an arbitrary tenant brand colour cannot promise
     contrast on the ink). */
  --bz-nav-current-bg: color-mix(in oklab, var(--foreground) 12%, var(--background));
  --bz-nav-current-icon: var(--bz-color-highlight);
  /* Quiet fields on the ink (search, Assistant entry): a translucent panel with a hairline. */
  --bz-nav-field-bg: color-mix(in oklab, var(--foreground) 7%, var(--background));
  --bz-nav-field-border: color-mix(in oklab, var(--foreground) 16%, var(--background));
}

/* In dark mode the sidebar stays a step DARKER than the charcoal page (and in a dark preview pane). */
html.dark .dark,
html .bz-theme-dark .dark {
  --background: oklch(0.18 0.008 260);
}

/* A light preview pane inside a dark page keeps the light-page sidebar ink. */
html .bz-theme-light .dark {
  --background: oklch(0.205 0.01 260);
}

/* Reduced motion: movement and infinite loops stop; the opacity fades that
   carry meaning (a toast arriving, the activity bar) keep a short duration.
   Reduced motion means fewer and gentler animations, not zero — killing the
   fades too would make state changes jarring rather than calmer, so
   --bz-duration-base is deliberately left intact. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --bz-duration-press: 1ms;
    --bz-duration-fast: 1ms;
    --bz-duration-slow: var(--bz-duration-base);
  }

  .bz-ai-chat-panel { animation: none; }
  .bz-progress-fill--indeterminate { animation: none; width: 100%; opacity: .55; }
  .bz-spinner { animation-duration: 1.6s; }
}
