/* ─────────────────────────────────────────────────────────────────────────
   LumicIQ design system: tokens + primitives, the single source of truth for every app.
   Mercury / Resend restraint: cool off-white surfaces, near-black ink, hairline borders, soft shadows,
   one saturated accent (emerald) used sparingly, warm priority colors so urgency reads, tabular-nums.
   Light by default; dark via data-theme="dark" on <html>.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  color-scheme: light; /* native scrollbars + form controls render light */
  --scrollbar-thumb: rgba(0, 0, 0, 0.22);
  --scrollbar-thumb-hover: rgba(0, 0, 0, 0.38);
  --scroll-shadow: rgba(0, 0, 0, 0.22); /* the edge shadow of a table that scrolls sideways */

  /* ── Color scale — TRUE neutral (R=G=B, zero warm or cool cast) ── */
  /* Tailwind 'neutral'. Mercury / Resend territory. */
  --gray-0: #ffffff;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e5e5e5;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;
  --gray-950: #0a0a0a;

  /* ── Brand: emerald — confident, financial, deliberately not amber. ── */
  --brand-50: #ecfdf5;
  --brand-100: #d1fae5;
  --brand-200: #a7f3d0;
  --brand-300: #6ee7b7;
  --brand-400: #34d399;
  --brand-500: #10b981;
  --brand-600: #059669;
  --brand-700: #047857;
  --brand-800: #065f46;

  /* ── Priority on the three states (decided 2026-11-28, D-22): Critical and High are both the high red (the chip's word tells them
     apart), Medium the amber, Low the grey. ── */
  --p-critical: var(--state-high-text);
  --p-high: var(--state-high-text);
  --p-medium: var(--state-medium-text);
  --p-low: var(--gray-600); /* 7.2:1 on its wash */
  --p-critical-bg: var(--state-high-wash);
  --p-high-bg: var(--state-high-wash);
  --p-medium-bg: var(--state-medium-wash);
  --p-low-bg: var(--state-low-wash);

  /* ── Status (signal colors used across apps): the older names, each read from the meaning palette below ── */
  --success: var(--state-ok);
  --success-text: var(--state-ok-text);
  --warning: var(--state-medium); /* a "needs a look" mark is the medium state's amber */
  --danger: #dc2626;
  --info: var(--state-info);

  /* ── Fixed washes/glows: the same rgba in both themes, while --danger/--brand flip per theme ── */
  --danger-wash: rgba(220, 38, 38, 0.07); /* error banner / form-error fills */
  --danger-wash-hi: rgba(220, 38, 38, 0.08); /* the slightly stronger fill (monitor banner, danger-btn hover) */
  --danger-wash-border: rgba(220, 38, 38, 0.22); /* the wash's hairline */
  --danger-wash-border-hi: rgba(220, 38, 38, 0.2); /* the monitor banner's hairline */
  --danger-glow: rgba(220, 38, 38, 0.16); /* the red status-dot halo */
  --brand-glow: rgba(23, 23, 23, 0.12); /* the live dot's halo, in ink; the dark theme's is white */
  --warning-glow: rgba(202, 138, 4, 0.16); /* the amber status-dot halo */

  /* ── Light-theme surface tokens (DEFAULT) ── */
  /* Pure white page; cards same as page so they float on hairline border. */
  --bg: var(--gray-0);
  --surface: var(--gray-0);
  --surface-2: var(--gray-50);
  --surface-3: var(--gray-100);
  /* A neutral chip is an outline (step 6): no fill, the hairline edge, ink that reads on the surface. */
  --chip-neutral-bg: rgba(255, 255, 255, 0);
  --chip-neutral-fg: var(--gray-700);
  --surface-hi: var(--gray-100);
  --line: var(--gray-200);
  --line-hi: var(--gray-300);
  /* The edge of an editable field (styleguide D-15). A field has the page's own fill, so its border is its only
     edge and must hold 3:1 (WCAG 1.4.11): #8a8a8a is 3.45:1 on white, 3.17:1 on --surface-3. --line-hi (1.48:1)
     stays for decorative and card hairlines. Hover firms it one step. */
  --line-field: #8a8a8a;
  --line-field-hover: var(--gray-600);
  --fg: var(--gray-900);
  --fg-soft: var(--gray-700);
  --fg-muted: var(--gray-500);
  /* --fg-faint is a text tier and must hold AA (4.5:1), which pins light-theme faint to ~gray-500, so
     faint==muted in light. Decorative ink lives in --fg-deco. */
  --fg-faint: var(--gray-500);
  --fg-deco: var(--gray-400); /* decorative ONLY — dots, separators, glyph accents. NEVER text. */
  /* The "brand" roles are ink since the UI refresh (2026-11-27, ink everywhere): the main action, the selected item, focus and the
     live dot read in near-black, and colour is left to state. The emerald scale above stays for the logo's dot; checked and
     protected outcomes keep their green through --success. The names stay so no call site has to change. */
  --brand: var(--gray-900);
  /* The selected item's fill: a step darker than every neutral surface, so a selection never vanishes. */
  --brand-soft: var(--gray-200);
  --brand-hi: var(--gray-700);
  /* Brand and warning as small text: ink, and the medium state's text (AA on white and on its wash); never the high red, so
     "needs a look" never reads as "failing". */
  --brand-text: var(--gray-900);
  --warning-text: var(--state-medium-text);
  /* The same for info and danger: #2563eb on its own 12% tint is 4.4:1 and #dc2626 on --p-critical-bg 4.4:1. */
  --info-text: var(--state-info-text);
  --danger-text: #b91c1c;
  /* The field focus ring (styleguide D-01): a soft ink halo (a white one on the canvas). Fields pair it with the border turning
     --brand (ink); together they replace the 2px outline. */
  --focus-ring: rgba(23, 23, 23, 0.16);

  /* ── State (UI refresh, 2026-11-27): the only colour the refreshed surfaces use ──
     Three levels, and colour never decorates: high is red, medium is amber, low has no colour at all. Each level has
     its mark (a dot, a bar, a zone on the scene), its text, and the wash behind a pill. */
  --state-high: #dc2626;
  --state-high-text: #b91c1c;
  --state-high-wash: rgba(220, 38, 38, 0.08);
  --state-medium: #d97706;
  --state-medium-text: #92400e;
  --state-medium-wash: rgba(217, 119, 6, 0.1);
  --state-low: var(--gray-500); /* 4.7:1 on white: a low dot or bar holds 3:1 (WCAG 1.4.11) */
  --state-low-text: var(--gray-700);
  --state-low-wash: var(--gray-100);

  /* ── The meaning palette (2026-11-30): colour where it says something, and only there ──
     Six meanings, one colour each, the same in every app (the styleguide's "What colour means"):
       ok      running, live, connected, on, done         green   a filled dot
       medium  needs a look, waiting on a person          amber   a triangle   (the medium state above)
       high    a problem: failed, stopped unexpectedly    red     a square     (the high state above)
       info    information, on its way, a selection       blue    an open ring
       low     settled, paused, off: nothing to do        grey    a filled dot (the low state above)
       test    test data, not a real store's              violet  a dashed outline
     Never colour alone: every mark has its shape and every state its word, so red and green read apart for a person who
     can't tell them apart, and in forced colours, where the marks take system colours. A mark (a dot, a tick, a track)
     holds 3:1 on the surface; text holds 4.5:1 on its wash and on the surface (contrast.test.ts, palette.test.ts). Body
     text, headings and borders stay ink and hairline: no colour decorates. */
  /* Green 700, not 600: #16a34a and the red are too close in lightness for deuteranopia (1.14:1); #15803d holds 1.3:1 for
     both red-green blindnesses, so the dot and the square differ in lightness as well as in shape. */
  --state-ok: #15803d; /* 5.0:1 on white */
  --state-ok-text: #15803d;
  --state-ok-wash: rgba(21, 128, 61, 0.08);
  --state-ok-glow: rgba(21, 128, 61, 0.2); /* the live dot's breathing ring */
  --state-ok-hover: #166534; /* an on switch under the pointer */
  --state-info: #2563eb; /* 5.2:1 on white */
  --state-info-text: #1d4ed8; /* 6.7:1 on white */
  --state-info-wash: rgba(37, 99, 235, 0.08);
  --state-test: #7c3aed; /* 5.7:1 on white */
  --state-test-text: #6d28d9; /* 7.1:1 on white */
  --state-test-wash: rgba(124, 58, 237, 0.07);

  /* ── Panel (UI refresh): the fill of a panel that floats over a scene, where the scene just shows through ── */
  --panel-float-bg: rgba(255, 255, 255, 0.92);
  /* Glass and the lit panel (the measured pass, 2026-11-28; the brief's step 6). Glass is a panel over a scene: a fill that
     darkens or lightens toward its foot with the scene just showing, a hairline edge, a bright top edge. A lit panel sits on a
     page: the surface with a faint light from the top. Dividers inside either are a step quieter than their edge. */
  --glass-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.92));
  --glass-edge: rgba(10, 10, 10, 0.08);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 12px 32px -12px rgba(10, 10, 10, 0.18);
  --panel-lit: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0));
  --divider: rgba(10, 10, 10, 0.06);
  --bar-track: var(--gray-200); /* the track under a ranked bar */

  /* ── Shadows — soft, almost imperceptible ── */
  --shadow-card: 0 0 0 1px rgba(10, 10, 10, 0.02), 0 1px 2px rgba(10, 10, 10, 0.04);
  --shadow-elevated: 0 0 0 1px rgba(10, 10, 10, 0.03), 0 8px 24px -12px rgba(10, 10, 10, 0.16);
  --shadow-overlay: 0 0 0 1px rgba(10, 10, 10, 0.04), 0 24px 48px -16px rgba(10, 10, 10, 0.22);

  /* ── Spacing — 4-base ── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  /* Between a switch and the words beside it, its own label or a row's text: one gap everywhere, so no switch sits close to a word
     that could read as its label or as a second control. */
  --switch-gap: var(--space-4);
  /* A switch's track, which a column of bare switches lines up on. */
  --switch-width: 36px;
  --switch-height: 20px;

  /* ── Radius: gentle rounding, not razor-square ──
     The ladder (styleguide D-12/D-13) tracks element scale; don't fork it:
       overlays (sheets/drawers)              → --radius-2xl (14)
       containers (table wraps, big panels)   → --radius-xl  (10)
       cards + full-size fields (~36px)       → --radius-lg  (8)
       compact controls (≤32px tall)          → --radius-md  (6)
       micro chips                            → --radius-sm  (4) */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 10px;
  --radius-2xl: 14px;

  /* The ONE select/dropdown chevron (styleguide D-02): every dropdown-shaped control — native
     select or popover trigger — wears the same boxed field + this 14px stroke chevron. Fixed
     stroke hexes = --fg-muted's value per theme (a data URI can't read custom properties). */
  --chevron: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23737373" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>');

  /* The ✕ a search field's clear button is drawn with (a mask, so it takes the ink it is painted in). */
  --clear-glyph: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg>');

  /* ── Type ── */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* ── Type scale: the font sizes. New rules use these steps. ── */
  --text-2xs: 10px; /* decorative only (eyebrows, step numbers); readable text starts at --text-sm */
  --text-xs: 10.5px; /* decorative only (section eyebrows) */
  --text-sm: 11.5px; /* status pills, meta rows */
  --text-md: 12.5px; /* buttons, secondary body */
  --text-base: 13.5px; /* body (the base font-size below) */
  --text-lg: 15px; /* emphasized body, sheet titles */
  --text-xl: 16px; /* section heads */
  --text-2xl: 18px; /* panel titles */
  --text-3xl: 22px; /* page titles */
  /* Named off-scale sizes: each has one job, so a rule says which job it does instead of a raw px. */
  --text-label: 12px; /* form labels */
  --text-read: 14px; /* primary reading text: console body, manager cards and chat */
  --text-display: 17px; /* manager header summary and empty-state titles */
  --text-stat: 20px; /* stat numerals */
  --text-4xl: 24px; /* large numerals and logo glyphs */
  --text-glyph: 34px; /* decorative display glyphs */
  --text-hero: clamp(28px, 3.3vw, 44px); /* the simulator home headline */
  /* Numerals (UI refresh): a key value is the largest thing on its panel, light and tabular. Numbers may be large;
     labels may not. The weight is Inter 300 (fonts.css bundles it for the numerals). */
  --numeral-xl: 52px; /* a page's exposure-style headline, beside its words (measured, step 6) */
  --numeral-lg: 44px; /* the one headline figure of a page or panel */
  --numeral-md: 28px; /* the value on a card or a callout */
  --numeral-sm: 18px; /* a reading in a row */
  --numeral-weight: 300;
  /* One leading and one tracking per size, so every figure that does not use .px-numeral itself still reads as one. */
  --numeral-leading: 1.1;
  --numeral-tracking-lg: -0.03em;
  --numeral-tracking-md: -0.02em;
  --numeral-tracking-sm: -0.01em;

  /* ── Fixed colours: the same in both themes ── */
  --fg-on-fill: #ffffff; /* text on a solid coloured fill: logo marks, avatars, filled buttons */
  --mark-dark: #000000; /* a brand mark's own dark tile */
  --mark-light: #ffffff; /* a brand mark's own light tile */
  --mark-neutral: #334039; /* the tile for a vendor with no logo of its own */
  --ring-on-dark: rgba(255, 255, 255, 0.08);
  --ring-on-light: rgba(0, 0, 0, 0.1);
  --scrim: rgba(10, 10, 10, 0.34); /* behind a sheet or modal */
  --scrim-strong: rgba(10, 10, 10, 0.45); /* over imagery or a busy canvas */
  --scrim-heavy: rgba(10, 10, 10, 0.65); /* captions and overlays on video */
  --stage: #0b0e14; /* the camera stage, dark in both themes */
  /* The canvas (UI refresh, 2026-11-27): the dark ground a scene sits on, the same in both themes. True neutral.
     .px-canvas (below) turns these into the role tokens for everything inside it. */
  /* Measured off the reference (step 6): the page is pure black, a panel on it #040404 to #0b0b0b, a hairline of white
     at 5 to 8 %, the faint grey about #6b6b6b (raised to #8a8a8a for 4.5:1). */
  --canvas-0: #050505; /* the scene's own ground, under the store */
  --canvas-1: #000000; /* the page around the scene */
  --canvas-2: #0a0a0a; /* a panel */
  --canvas-3: #141414; /* an inset, or a hover inside a panel */
  --canvas-4: #1f1f1f; /* a track, a pressed control */
  --canvas-panel: rgba(10, 10, 10, 0.9); /* a panel floating over the scene: --canvas-2 with the scene just showing */
  --canvas-line: rgba(255, 255, 255, 0.08); /* the hairline around a panel */
  --canvas-line-hi: rgba(255, 255, 255, 0.16); /* the edge of a control */
  --canvas-ink: #f5f5f5;
  --canvas-ink-soft: #d4d4d4;
  --canvas-ink-muted: #a3a3a3;
  --canvas-ink-faint: #8a8a8a; /* 5.3:1 on --canvas-3, the lightest ground text sits on */
  --canvas-ink-deco: #5c5c5c; /* decorative only, never text */
  /* The shadow a panel floating over the scene casts: wide and soft, and a near one under its edge (none on the dark canvas, where
     the wide one is enough). A shadow is dark on either canvas; the canvas's own colour is never one (it glowed white in Light). */
  --canvas-shadow: rgba(0, 0, 0, 0.5);
  --canvas-shadow-near: rgba(0, 0, 0, 0);
  /* Line work drawn on the scene itself: zone outlines, lanes, routes, leader lines. White at three strengths. */
  --scene-line: rgba(255, 255, 255, 0.86);
  --scene-line-soft: rgba(255, 255, 255, 0.4);
  --scene-line-faint: rgba(255, 255, 255, 0.14);
  /* A panel's inner padding (UI refresh), so text never touches a border, and the blur behind a floating panel. */
  --panel-pad: 16px;
  --panel-blur: 20px;
  --radius-glass: 12px; /* glass and a lit panel's corners, measured */
  /* Provenance dot (UI refresh): the mark beside Measured, Derived or Simulated. */
  --prov-dot: 7px;
  /* Detection boxes drawn over camera footage (the console's recordings), the same in both themes: they sit on video. */
  --cctv-person: #34d399;
  --cctv-other: #fbbf24;
  --cctv-selected: #ffffff; /* the object being traced, apart from both detection colours */
  --cctv-area: rgba(52, 211, 153, 0.08); /* the fill of an area a camera watches, in --cctv-person's colour */
  --cctv-text: #e5e5e5; /* labels and staff-post outlines over footage, on --scrim-heavy */
  --kind-video: #7c3aed;
  --kind-weather: #0891b2;
  --map-equipment: #3b8a93; /* simulator map key: matches the 3D view's equipment colour */
  --map-equipment-edge: #173d49;
  --map-pallet: #b09265;
  --map-pallet-edge: #674b2c;
  --crowd: #c026d3; /* the 3D view's crowd tint: where shoppers stood, never the warning orange of a lane that wants a look */

  /* ── Control heights (styleguide D-17): every button variant, every field, the touch target ──
     The console's field tiers (36 full, 31 compact) are unchanged. An app that lifts its controls for a coarse
     pointer does so to --touch-target. */
  --control-h-button: 28px; /* .px-btn-sm, .px-btn-primary, .px-btn-outline, the ⋮ trigger */
  --control-h-field: 36px; /* a full-size field */
  --control-h-field-compact: 31px; /* a compact select or dropdown trigger in a toolbar */
  --touch-target: 44px; /* the minimum hit area under a coarse pointer */
  --disclosure-glyph-size: 1.3em; /* the ▸/▾ beside a disclosure's label, a touch larger than the label */

  /* ── The main action's look (.px-btn-primary): the solid brand button (D1, 2026-11-05). Five tokens; they follow the --fill-* tokens, which flip per theme. ── */
  --primary-bg: var(--fill-bg);
  --primary-bg-hover: var(--fill-bg-hover);
  --primary-fg: var(--fill-fg);
  --primary-border: var(--fill-bg);
  --primary-border-hover: var(--fill-bg-hover);
  /* The one filled look (.px-btn-filled, sign-in, the main action): ink, white on near-black in light and near-black on near-white
     in dark (the canvas block), 17:1 or better. A glyph on a filled shape uses this pair, never a fixed white on --brand. */
  --fill-bg: var(--gray-900);
  --fill-bg-hover: var(--gray-700);
  --fill-fg: var(--fg-on-fill);
  /* The product's one selection treatment, for a pressed toggle or segment as for the current nav item: the selected fill
     (--brand-soft, a step darker than every surface) and ink at 500, never a coloured edge. */
  --pressed-bg: var(--brand-soft);
  --pressed-fg: var(--brand-text);

  /* ── Motion: one short duration and easing for everything that opens, closes or changes state ── */
  --motion: 160ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  /* The slower, named moves (UI refresh, 2026-11-27). Each has one job. Nothing bounces, nothing moves without a
     reason, and only the pulse repeats. */
  --motion-panel: 220ms; /* a panel or callout card arriving: a fade and a --slide-distance slide, on --ease */
  --slide-distance: 6px;
  --motion-fly: 900ms; /* the camera easing to a place ("Fly to"), on --ease-fly */
  --ease-fly: cubic-bezier(0.65, 0, 0.35, 1); /* leaves slowly, arrives slowly */
  --motion-draw: 1200ms; /* a route or an outline drawing itself once, on --ease-fly */
  --motion-pulse: 2600ms; /* one breath of a live point's ring, on --ease-pulse */
  --ease-pulse: cubic-bezier(0.2, 0.6, 0.35, 1);

  /* ── Keyboard focus: one ring for everything focusable (fields swap it for the boxed --focus-ring halo) ── */
  --focus-outline: 2px solid var(--brand);
  --focus-offset: 2px;

  /* ── Sortable headers: a faint cue on every sortable column, an arrow on the sorted one ── */
  --sort-glyph-idle: "↕";
  --sort-glyph-asc: "↑";
  --sort-glyph-desc: "↓";

  /* ── Mark shapes (the meaning palette): needs a look is a triangle, wherever its mark is drawn ── */
  --mark-triangle: polygon(50% 0, 100% 100%, 0 100%);

  /* ── Status dots: the dot beside a status word. Large in lists and cards, small inside a compact pill ── */
  --status-dot: 7px;
  --status-dot-sm: 5px;

  /* ── Z scale ── */
  --z-nav: 6; /* sticky chrome — tabbar, topbar, controls strips */
  --z-overlay: 20; /* sheet/modal backdrops */
  --z-toast: 30; /* toasts + undo — ABOVE overlays: the undo window keeps running under an open sheet */
}

/* The admin console's type scale (styleguide D-16): four text sizes, set on the console's <html>. Small 12.5 (labels,
   help, meta, table headers, chips), body 14 (reading text, fields, cells), heading 15 (section and sheet titles),
   title 22 (the page title). Numerals (--text-stat, --text-4xl) and glyphs keep their own sizes. The old 10-11.5px
   steps were readable only by us; every console rule still names its job through the shared token names. */
html.type-console {
  --text-2xs: 12.5px;
  --text-xs: 12.5px;
  --text-sm: 12.5px;
  --text-label: 12.5px;
  --text-md: 12.5px;
  --text-base: 14px;
  --text-read: 14px;
  --text-lg: 15px;
  --text-xl: 15px;
  --text-2xl: 15px;
  --text-display: 15px;
}

/* The manager app, the simulator and the 3D view (html.type-app): only the two smallest steps rise to readable sizes,
   12 and 12.5px, since 10.5 and 11.5px were readable only by us. The larger steps keep their own sizes. */
html.type-app {
  --text-xs: 12px;
  --text-sm: 12.5px;
}

/* A canvas that follows the theme (Dennis, 2026-11-30: "the light mode doesn't seem to work inside of the simulator"). A page whose
   canvas is the dark ground only in Dark marks those surfaces [data-canvas] (the simulator's store page and its 3D view): in Dark
   the whole page's tokens are the canvas's (`:root[data-theme="dark"]` below), and in Light the canvas tokens take these values,
   the grey scale with dark ink, the line work drawn on the scene black at the strengths the dark values draw white (the 3D view
   reads the alpha).
   Everywhere else the canvas stays dark in both themes, so a .px-canvas panel on a light page is still dark. */
:root[data-theme="light"]:has([data-canvas]) {
  --canvas-0: var(--gray-100);
  --canvas-1: var(--gray-50);
  --canvas-2: var(--gray-0);
  --canvas-3: var(--gray-100);
  --canvas-4: var(--gray-200);
  --canvas-panel: color-mix(in srgb, var(--gray-0) 92%, transparent);
  --canvas-line: color-mix(in srgb, var(--gray-950) 8%, transparent);
  --canvas-line-hi: color-mix(in srgb, var(--gray-950) 16%, transparent);
  --canvas-ink: var(--gray-900);
  --canvas-ink-soft: var(--gray-700);
  --canvas-ink-muted: var(--gray-600);
  --canvas-ink-faint: var(--gray-500);
  --canvas-ink-deco: var(--gray-400);
  /* As macOS draws a window on a light desktop: a soft dark shadow, wide and faint, with a nearer one at its edge. */
  --canvas-shadow: rgba(10, 10, 10, 0.14);
  --canvas-shadow-near: rgba(10, 10, 10, 0.08);
  --scene-line: rgba(0, 0, 0, 0.8);
  --scene-line-soft: rgba(0, 0, 0, 0.4);
  --scene-line-faint: rgba(0, 0, 0, 0.14);
}

/* ─────────────────────────────── The canvas (UI refresh, 2026-11-27) ───────────────────────────────
   A dark scene with its chrome floating over it, in either theme: the simulator's store view, a map, a camera wall.
   Inside .px-canvas every role token takes its canvas value, so the shared primitives need no second set of rules.

   A custom property that reads another one is worked out where it is declared, so a token such as --primary-bg, which
   reads --fill-bg on :root, would keep :root's answer in here. The canvas therefore restates everything the dark theme
   sets and every token that reads one of those (contrast.test.ts holds both). Its surfaces, lines and ink sit
   on the canvas scale: the main action is ink on the canvas, focus is a white ring, and only state is coloured. */
/* The dark theme is the canvas (decision 2026-11-27): the same block, so every LumicIQ screen in dark sits on the reference's
   near-black and a canvas panel inside a dark page is no different from the page. */
:root[data-theme="dark"],
.px-canvas {
  color-scheme: dark;
  --kind-video: #a78bfa;
  --kind-weather: #22d3ee;
  --crowd: #a3a3a3; /* where shoppers stood, in ink: a gathering is not a state */
  --scrollbar-thumb: rgba(255, 255, 255, 0.16);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.3);
  --scroll-shadow: rgba(0, 0, 0, 0.6);
  --bg: var(--canvas-1);
  --surface: var(--canvas-2);
  --surface-2: var(--canvas-3);
  --surface-3: var(--canvas-4);
  --chip-neutral-bg: rgba(255, 255, 255, 0);
  --chip-neutral-fg: var(--canvas-ink-muted);
  --surface-hi: var(--canvas-3);
  --line: var(--canvas-line);
  --line-hi: var(--canvas-line-hi);
  --line-field: var(--gray-500); /* 3.9:1 on --canvas-2 */
  --line-field-hover: var(--gray-400);
  --chevron: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23a3a3a3" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>');
  --fg: var(--canvas-ink);
  --fg-soft: var(--canvas-ink-soft);
  --fg-muted: var(--canvas-ink-muted);
  --fg-faint: var(--canvas-ink-faint);
  --fg-deco: var(--canvas-ink-deco);
  --brand: var(--canvas-ink);
  --brand-soft: rgba(255, 255, 255, 0.1); /* the selected item: #1a1a1a on the black page, measured */
  --brand-hi: var(--gray-0);
  --brand-text: var(--canvas-ink);
  --brand-glow: rgba(255, 255, 255, 0.16); /* the live dot's halo, white here */
  --focus-ring: rgba(255, 255, 255, 0.28);
  --focus-outline: 2px solid var(--canvas-ink);
  --fill-bg: var(--canvas-ink);
  --fill-bg-hover: var(--gray-0);
  --fill-fg: var(--canvas-0);
  --primary-bg: var(--canvas-ink);
  /* One clear step darker: white is too close to the ink to see. */
  --primary-bg-hover: var(--gray-300);
  --primary-fg: var(--canvas-0);
  --primary-border: var(--canvas-ink);
  --primary-border-hover: var(--gray-300);
  --pressed-bg: rgba(255, 255, 255, 0.1);
  --pressed-fg: var(--canvas-ink);

  /* The reference's own red and amber, measured (step 6): a warm red and a soft amber. */
  --state-high: #f34c36;
  --state-high-text: #ff7462;
  --state-high-wash: rgba(243, 76, 54, 0.1);
  --state-medium: #f2b33d;
  --state-medium-text: #f5c35c;
  --state-medium-wash: rgba(242, 179, 61, 0.1);
  --state-low: var(--gray-200);
  --state-low-text: var(--gray-300);
  --state-low-wash: rgba(255, 255, 255, 0.07);
  /* The meaning palette on the dark ground: lighter steps of the same hues, so each still reads at a glance. */
  --state-ok: #4ade80;
  --state-ok-text: #4ade80;
  --state-ok-wash: rgba(74, 222, 128, 0.1);
  --state-ok-glow: rgba(74, 222, 128, 0.22);
  --state-ok-hover: #86efac;
  --state-info: #60a5fa;
  --state-info-text: #93c5fd;
  --state-info-wash: rgba(96, 165, 250, 0.1);
  --state-test: #a78bfa;
  --state-test-text: #c4b5fd;
  --state-test-wash: rgba(167, 139, 250, 0.1);
  --panel-float-bg: var(--canvas-panel);
  --glass-bg: linear-gradient(180deg, rgba(22, 22, 22, 0.8), rgba(6, 6, 6, 0.9));
  --glass-edge: rgba(255, 255, 255, 0.08);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 16px 48px rgba(0, 0, 0, 0.5);
  --panel-lit: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 45%);
  --divider: rgba(255, 255, 255, 0.06);
  --bar-track: #242424;

  /* The older signal tokens read the meaning palette here too: critical and high are both red (the word tells them apart),
     warning is amber, success green and info blue. */
  --p-critical: var(--state-high-text);
  --p-high: var(--state-high-text);
  --p-medium: var(--state-medium-text);
  --p-low: var(--canvas-ink-muted);
  --p-critical-bg: var(--state-high-wash);
  --p-high-bg: var(--state-high-wash);
  --p-medium-bg: var(--state-medium-wash);
  --p-low-bg: var(--state-low-wash);
  --danger: var(--state-high-text);
  --danger-text: var(--state-high-text);
  --warning: var(--state-medium);
  --warning-text: var(--state-medium-text);
  --success: var(--state-ok);
  --success-text: var(--state-ok-text);
  --info: var(--state-info);
  --info-text: var(--state-info-text);

  --shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-elevated: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 12px 32px -16px rgba(0, 0, 0, 0.7);
  --shadow-overlay: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 28px 56px -20px rgba(0, 0, 0, 0.85);

  background: var(--bg);
  color: var(--fg);
}

/* Light is the default :root above; dark is the canvas block below (`:root[data-theme="dark"], .px-canvas`), driven by data-theme
   on <html>, which the init script seeds from the OS preference on first visit. No prefers-color-scheme media queries. */

/* ─────────────────────────────── Base ─────────────────────────────── */

* {
  box-sizing: border-box;
}
html,
body,
#root {
  margin: 0;
  padding: 0;
  height: 100%;
}

/* Themed scrollbars — subtle + theme-aware (not the bright default that looks white on a dark page).
   color-scheme (above) handles native/Firefox; these refine the WebKit bar with an inset pill. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}
::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 3px solid transparent; /* inset padding via padding-box clip → a slim, breathing pill */
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  background-clip: padding-box;
}
::-webkit-scrollbar-corner {
  background: transparent;
}
/* Form controls take the page's font, size and line height instead of the browser's 13.33px system font. Each
   control primitive below states its own size and line height. */
button,
input,
select,
textarea {
  font: inherit;
}
/* Native checkboxes, radios and sliders wear the brand, not the browser's blue. */
input[type="checkbox"],
input[type="radio"],
input[type="range"] {
  accent-color: var(--brand);
}
/* WebKit's own clear button in a search field is a blue circle in the browser's style: draw it as the system's ✕,
   in muted ink, the same size as the sheet close glyph's stroke. */
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-left: var(--space-2);
  background: var(--fg-muted);
  -webkit-mask: var(--clear-glyph) center / 14px no-repeat;
  mask: var(--clear-glyph) center / 14px no-repeat;
  cursor: pointer;
}
input[type="search"]::-webkit-search-cancel-button:hover {
  background: var(--fg);
}

/* Text links take the text colour with an underline. The brand green marks a state (on, connected, done), never "you can
   open this", so a link reads as part of the sentence it sits in. A link-styled button uses .px-text-link. */
a:not(.px-btn, .skip-link),
.px-text-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--fg-muted);
  text-underline-offset: 3px;
}
a:not(.px-btn, .skip-link):hover,
.px-text-link:hover {
  text-decoration-color: currentColor;
}
.px-text-link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

/* Visible keyboard focus everywhere — one shared brand ring for every interactive element. Uses
   :focus-visible so it only shows for keyboard/AT focus, never on mouse click. */
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
[role="tab"]:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-offset);
}

/* Text for assistive technology only. */
.px-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Proportional figures in running text (step 6): Inter's tabular set widens the hyphen from 6.4 to 9 px and spaces every
     digit in a sentence. Figures that line up in a column or change in place take tabular-nums, below and in each numeral part. */
  font-feature-settings: "cv11", "ss01";
}
td,
th,
time,
.px-count,
.px-kv dd {
  font-variant-numeric: tabular-nums;
}

code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  color: var(--fg-soft);
  letter-spacing: 0;
}

.tnum {
  font-variant-numeric: tabular-nums;
}

/* ─────────────────────────────── Brand mark — identical everywhere ─────────────────────────────── */
/* Mercury/Resend feel: deep ink mark with a single emerald accent dot. No gradient. */

.px-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: var(--text-lg);
  letter-spacing: -0.012em;
  color: var(--fg);
}
.px-logo {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--gray-900);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-on-fill);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.px-logo::after {
  content: "";
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brand-500);
  box-shadow: 0 0 0 1.5px var(--gray-900);
}
[data-theme="dark"] .px-logo,
.px-canvas .px-logo {
  background: var(--gray-50);
  color: var(--gray-900);
}
[data-theme="dark"] .px-logo::after,
.px-canvas .px-logo::after {
  box-shadow: 0 0 0 1.5px var(--gray-50);
  background: var(--brand-500);
}
/* The product beside the logo ("Admin console", "Simulator", "Manager"): words, so sans like the rest of the chrome. */
.px-tag {
  font-size: var(--text-sm);
  color: var(--fg-faint);
  border-left: 1px solid var(--line);
  padding-left: 10px;
  margin-left: 2px;
}

/* ─────────────────────────────── The theme control (ThemeControl.tsx) ───────────────────────────────
   At the top right of every app, beside the connection status: a quiet icon button that shows the choice (half a circle for
   Match my device, a sun, a moon), and a menu of the three choices in words. The theme is the device's, not the account's. */
.px-theme-control {
  position: relative;
  display: inline-flex;
}
.px-theme-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-h-button);
  height: var(--control-h-button);
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: none;
  color: var(--fg-muted);
  cursor: pointer;
  transition:
    background var(--motion) var(--ease),
    color var(--motion) var(--ease);
}
/* Its target is the touch size, around the small button. */
.px-theme-btn::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--touch-target);
  height: var(--touch-target);
  transform: translate(-50%, -50%);
}
.px-theme-btn:hover,
.px-theme-btn[aria-expanded="true"] {
  background: var(--surface-2);
  color: var(--fg);
}
.px-theme-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: calc(var(--z-overlay) + 1);
}
/* The simulator's pages draw the same control in plain DOM (simulator-theme.js), which keeps the menu and hides it. */
.px-theme-menu[hidden] {
  display: none;
}
.px-theme-menu button {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}
.px-theme-item-icon {
  display: inline-flex;
  color: var(--fg-muted);
}
/* The current choice: a tick after its words, and full ink. */
.px-theme-menu button[aria-checked="true"] {
  color: var(--fg);
  font-weight: 500;
}
.px-theme-menu button[aria-checked="true"]::after {
  content: "✓";
  margin-left: auto;
  padding-left: var(--space-4);
}
@media (forced-colors: active) {
  .px-theme-btn[aria-expanded="true"] {
    border-color: CanvasText;
  }
}

/* ─────────────────────────────── Status pill — borderless mark + label ───────────────────────────────
   Lower-chrome: no box, border or fill. The word says the state, and the mark before it says it again in its meaning's colour
   and shape (the meaning palette): live a green dot that breathes, connecting a blue ring that blinks, polling an amber
   triangle, offline a red square. */

.px-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 2px 0;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--fg-muted);
}
.px-status .px-dot {
  width: var(--status-dot-sm);
  height: var(--status-dot-sm);
  border-radius: 50%;
  background: var(--fg-deco);
}
.px-status.live {
  color: var(--fg);
}
.px-status.linking {
  color: var(--fg-soft);
}
.px-status.offline {
  color: var(--danger-text);
}
/* "polling" = the hub is offline and the poll backstop is the data path: amber, and steady (no blink), since polling is a
   settled state, not a transition. */
.px-status.polling {
  color: var(--warning-text);
}

/* ─────────────────────────────── Marks: one shape and one colour per meaning ───────────────────────────────
   .px-mark is the mark on its own (a list row's, a tab's, a count's); the status chip, the status pill and the live dot
   draw the same shapes. A shape never changes meaning, so red and green (and amber) read apart without their colour. */
.px-mark {
  display: inline-block;
  flex: none;
  width: var(--status-dot);
  height: var(--status-dot);
  border-radius: 50%;
  background: var(--state-low);
}
.px-mark.tone-ok,
.px-status.live .px-dot {
  border-radius: 50%;
  background: var(--state-ok);
}
.px-mark.tone-warn,
.px-status.polling .px-dot,
.status-badge.tone-warn::before {
  border-radius: 0;
  background: var(--state-medium);
  clip-path: var(--mark-triangle);
}
.px-mark.tone-warn {
  width: calc(var(--status-dot) + 2px);
  height: calc(var(--status-dot) + 1px);
}
.px-mark.tone-danger,
.px-status.offline .px-dot,
.status-badge.tone-danger::before {
  border-radius: 1px;
  background: var(--state-high);
}
.px-mark.tone-info,
.px-status.linking .px-dot {
  border-radius: 50%;
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--state-info);
}
.px-mark.tone-test {
  width: calc(var(--status-dot) + 2px);
  height: calc(var(--status-dot) + 2px);
  border-radius: 50%;
  background: transparent;
  border: 1.5px dashed var(--state-test);
}
/* Live: the green dot breathes, and only while it is live. A ring of its own colour widens and fades, slowly. */
.px-mark.is-live,
.px-status.live .px-dot {
  box-shadow: 0 0 0 2px var(--state-ok-glow);
  animation: pxLivePulse var(--motion-pulse) var(--ease-pulse) infinite;
}
@keyframes pxLivePulse {
  0%,
  100% {
    box-shadow: 0 0 0 2px var(--state-ok-glow);
  }
  50% {
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--state-ok-glow) 40%, transparent);
  }
}
.px-status.linking .px-dot {
  animation: pxBlink 1.1s ease-in-out infinite;
}
@keyframes pxBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}
/* The shared marks' animations are defined HERE, so they get their reduce guard here too: no pulse and no blink. */
@media (prefers-reduced-motion: reduce) {
  .px-status.linking .px-dot,
  .px-status.live .px-dot,
  .px-mark.is-live {
    animation: none;
  }
}
/* Forced colours: every mark in the system's text colour, its shape intact (a ring and a dashed ring stay open). */
@media (forced-colors: active) {
  .px-mark,
  .px-mark:is(.tone-ok, .tone-warn, .tone-danger, .tone-muted, .is-live),
  .px-status .px-dot,
  .px-status:is(.live, .polling, .offline) .px-dot {
    forced-color-adjust: none;
    background: CanvasText;
    box-shadow: none;
    animation: none;
  }
  .px-mark.tone-info,
  .px-status.linking .px-dot {
    background: Canvas;
    box-shadow: inset 0 0 0 1.5px CanvasText;
  }
  .px-mark.tone-test {
    background: Canvas;
    border-color: CanvasText;
  }
}

/* ─────────────────────────────── Buttons (styleguide D-04, D-17) ───────────────────────────────
   Which weight a button takes:
     .px-btn-primary  the one page-level create or commit on a screen or sheet ("Add store", "Save")
     .px-btn-outline  row and checklist actions, and every other in-content action
     .px-btn          bare chrome: header utilities such as Refresh, and a confirm's Cancel
     .px-btn-ghost    pure text, for chrome that must stay quiet
     .px-btn-danger   a destructive action, outlined red; with .px-btn-danger-filled, its final confirm
     .px-btn-filled   the one filled button: sign-in
   Every variant carries a 1px edge (transparent when it has no box), so swapping a variant never moves its neighbours,
   and the committing sizes (sm, primary, outline) share --control-h-button. Every button keeps the shared focus ring. */

.px-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-muted);
  /* 1px less than the old borderless padding, so the edge adds no height. */
  padding: 6px 12px;
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background var(--motion) var(--ease),
    border-color var(--motion) var(--ease),
    color var(--motion) var(--ease);
}
.px-btn:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--fg);
}
/* The main action: the solid button (decision D1, 2026-11-05; ink since the UI refresh, 2026-11-27): white on near-black, near-black
   on near-white in dark. Its look is five tokens (--primary-*) that follow the --fill-* tokens, so a change of look is one
   :root rule. */
.px-btn-primary {
  height: var(--control-h-button);
  padding: 0 12px;
  background: var(--primary-bg);
  color: var(--primary-fg);
  border-color: var(--primary-border);
  font-weight: 500;
}
.px-btn-primary:hover:not(:disabled) {
  background: var(--primary-bg-hover);
  border-color: var(--primary-border-hover);
  color: var(--primary-fg);
}
.px-btn-ghost {
  background: transparent;
  color: var(--fg-soft);
}
.px-btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--fg);
}

/* DISABLED, for the whole px-btn family, so a disabled button never looks pressable. Kept above the variant
   rules' hover guards so nothing re-lights it. Quiet chrome buttons fade; a BOXED button (primary, filled, danger, outline)
   keeps its box at full opacity on the quiet fill with a plain edge and muted ink (styleguide D-17), so it reads as "not
   yet", never as missing. Never dashed: a dashed box reads as a drop zone (UX review 2026-11-15). Its reason sits beside it (the save bar, a sheet footer). */
.px-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.px-btn-primary:disabled,
.px-btn-filled:disabled,
.px-btn-danger:disabled,
.px-btn-outline:disabled {
  opacity: 1;
  background: var(--surface-2);
  border: 1px solid var(--line-hi);
  color: var(--fg-muted);
}

.px-btn-sm {
  height: var(--control-h-button);
  padding: 0 10px;
  font-size: var(--text-md);
}
/* Destructive: danger-red text in a danger-red box on the page's surface ("Remove camera"), so it never reads as an ordinary
   white button. A committing button gets a full box or nothing, never an underline. The hover wash is the fixed light-red rgba
   in both themes. Text 4.5:1 or better: #b91c1c on white 6.5:1, #ff7462 on the dark panel 7.4:1. */
.px-btn-danger {
  background: var(--surface);
  color: var(--danger-text);
  border-color: var(--danger);
}
.px-btn-danger:hover:not(:disabled) {
  background: var(--danger-wash-hi);
  color: var(--danger-text);
}
/* The final yes to a destructive action ("Remove" in its confirmation): filled red with white text, 4.8:1 in both themes (the fill
   stays the light theme's red in dark, where --danger is a light coral white text can't sit on). With .px-btn-danger. */
.px-btn-danger-filled,
.px-btn-danger-filled:hover:not(:disabled) {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}
.px-btn-danger-filled:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #b91c1c;
}
/* Filled CTA: the one filled button (auth gates, primary sign-in). Ink since the refresh: near-black with white text in light,
   near-white with near-black text on the canvas (the --fill-* tokens). */
.px-btn-filled {
  background: var(--fill-bg);
  color: var(--fill-fg);
  border-color: var(--fill-bg);
  font-weight: 500;
}
.px-btn-filled:hover:not(:disabled) {
  background: var(--fill-bg-hover);
  border-color: var(--fill-bg-hover);
  color: var(--fill-fg);
}

/* ─────────────────────────────── Inline confirm — shared SheetShell helper ─────────────────────────────── */
/* The discard-guard prose and buttons row inside sheets. */
.confirm-inline {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
  font-size: var(--text-md);
  color: var(--fg-muted);
}
/* A short question prefacing an inline confirm ("Retire?"), so it reads as a labeled prompt. */
.confirm-inline-q {
  white-space: nowrap;
  color: var(--fg-muted);
}
/* The non-affirmative in a confirm (Cancel / Keep editing) is a clean text button with a color-only hover,
   so the affirmative keeps its weight. */
.confirm-inline .px-btn:not(.px-btn-primary):not(.px-btn-danger):not(.px-btn-filled) {
  color: var(--fg-muted);
}
.confirm-inline .px-btn:not(.px-btn-primary):not(.px-btn-danger):not(.px-btn-filled):hover {
  background: transparent;
  color: var(--fg);
}

/* ─────────────────────────────── Icon button — square, hairline, icon carries the meaning ───────────────────────────────
   The general square icon-button (the theme toggle below is the borderless variant of this). A hairline
   frame + centered glyph — used where an icon reads faster than a word: the sheet-header close (✕), a
   compact "add" (＋). aria-label supplies the accessible name; keep the shared focus ring. */
.px-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--fg-soft);
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}
.px-icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--line-hi);
  color: var(--fg);
}
.px-icon-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.px-icon-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}
/* Borderless variant — a bare glyph for chrome that shouldn't carry a frame (a header ✕ over a title row). */
.px-icon-btn-plain {
  border-color: transparent;
}
.px-icon-btn-plain:hover {
  border-color: transparent;
}

/* ─────────────────────────────── In-content actions (styleguide D-04/D-08) ───────────────────────────────
   The border ladder: --line is structural (cards, tables, panels); --line-hi is interactive (fields, these
   buttons). Card-shaped clickable elements stay on --line. In-content actions must read as pressable at rest;
   the quiet px-btn family is for chrome (toolbars, nav, overlay footers) only. */
.px-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--control-h-button);
  padding: 0 11px;
  font-size: var(--text-md);
  line-height: 1.2;
  font-weight: 500;
  color: var(--fg-soft);
  background: var(--surface);
  border: 1px solid var(--line-hi);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}
.px-btn-outline:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--fg-deco);
  color: var(--fg);
}
.px-btn-outline:disabled {
  cursor: not-allowed;
}
/* PRESSED, the one selected state for every toggle and segmented control in every app: the selected fill, ink and
   ink, never a coloured edge or a heavier weight. Keyed off aria-pressed so it cannot drift from the state screen readers are given. */
:is(.px-btn, .px-btn-outline)[aria-pressed="true"],
:is(.px-btn, .px-btn-outline)[aria-pressed="true"]:hover:not(:disabled) {
  background: var(--pressed-bg);
  color: var(--pressed-fg);
  font-weight: 500;
}
/* Forced colors drop every fill, and the weight no longer marks the selection, so the pressed control takes the system's own
   selected pair. A fill, not an outline: the outline is the focus ring's. */
@media (forced-colors: active) {
  :is(.px-btn, .px-btn-outline)[aria-pressed="true"],
  :is(.px-btn, .px-btn-outline)[aria-pressed="true"]:hover:not(:disabled) {
    forced-color-adjust: none;
    background: SelectedItem;
    color: SelectedItemText;
  }
  :is(.px-btn, .px-btn-outline)[aria-pressed="true"] * {
    color: inherit;
  }
  /* With the adjustment off, the ring would keep the page theme's ink, which can match the system's background. */
  :is(.px-btn, .px-btn-outline)[aria-pressed="true"]:focus-visible {
    outline-color: CanvasText;
  }
}
.px-btn[aria-pressed="true"] {
  border-color: transparent;
}
/* The overflow trigger: a SQUARE with a vertical ⋮, height-matched to its neighbors (D-08). */
.px-kebab {
  width: var(--control-h-button);
  padding: 0;
  font-size: 16px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: 0;
}

/* Forced colours drop shadows and fills, which is all a focused field and most dots had to show. A menu item's highlight and a status
   label's mark are further down, after the rules they have to win over. */
@media (forced-colors: active) {
  /* Highlight is made to go behind words. As a ring it was measured on the page and on a field in Chromium's light and dark palettes
     (at least 8.73:1); other people's own palettes can differ, and nothing here checks them. */
  :is(input, select, textarea, .px-select, .px-input-compact):focus-visible:focus-visible:focus-visible {
    outline: 2px solid Highlight;
    outline-offset: 1px;
  }
  /* A state's dot, in a system colour and a shape of its own: full for high, half for medium, an outline for the rest. Only one with a
     state: one without draws itself (the simulator's clock), and would be left in the theme's colours. */
  :is(.px-state-dot, .px-glow-dot)[data-state] {
    forced-color-adjust: none;
    box-sizing: border-box;
    border: 1.5px solid CanvasText;
    background: Canvas;
    box-shadow: none;
  }
  :is(.px-state-dot, .px-glow-dot)[data-state="medium"] {
    background: linear-gradient(90deg, CanvasText 50%, Canvas 50%);
  }
  :is(.px-state-dot, .px-glow-dot)[data-state="high"] {
    background: CanvasText;
  }
  /* That setting is inherited, and would leave a live dot's ring in the theme's colour. */
  .px-pulse::after {
    forced-color-adjust: auto;
  }
  /* A status's dot: full when it's live, an outline otherwise; its words say which. The class is repeated to outweigh each state's own
     fill, here and in an app's later styles. An animation beats any rule, so the live one's glow and the linking one's fade go. */
  .px-status.px-status.px-status .px-dot {
    forced-color-adjust: none;
    box-sizing: border-box;
    border: 1.5px solid CanvasText;
    background: Canvas;
    box-shadow: none;
    animation: none;
  }
  .px-status.px-status.px-status.live .px-dot {
    background: CanvasText;
  }
}

/* The overflow menu — a row's 3rd+ actions fold behind the ⋮; destructive items sit at the bottom
   in danger ink. RowMenu (src/RowMenu.tsx) anchors it to its trigger as a popover; the rules below are every app's, so the
   manager's ⋮ is a popover too (combined review P2-4: without them its menu fell into the card's flex line and pushed the
   text, and an outside tap did not close it). */
.row-menu {
  position: relative;
  display: inline-flex;
}
/* The outside tap: a transparent layer under the menu that closes it. */
.row-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
}
/* Fixed and anchored in JS (RowMenu.tsx): a table's scroll box clips overflow, so absolute would cut it off. */
.row-menu .px-menu {
  position: fixed;
  width: 190px;
  z-index: calc(var(--z-overlay) + 1);
}
.px-menu {
  min-width: 190px; /* matches the styleguide's menu width */
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-overlay);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.px-menu button {
  text-align: left;
  border: none;
  background: none;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--text-md);
  line-height: 1.4; /* pinned so hosts can estimate item height for edge-flip math */
  color: var(--fg-soft);
  cursor: pointer;
  white-space: nowrap;
}
.px-menu button:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--fg);
}
/* Inside the item, so the ring never covers the menu's own edge. */
.px-menu button:focus-visible {
  outline-offset: -2px;
}
.px-menu button:disabled {
  opacity: 0.5;
  cursor: default;
}
.px-menu button.danger {
  color: var(--danger);
}
/* A line sets what can't be taken back apart from the rest (a border, so forced colours keep it). */
.px-menu button:not(.danger) + button.danger {
  position: relative;
  margin-top: 9px;
}
.px-menu button:not(.danger) + button.danger::before {
  content: "";
  position: absolute;
  inset: -5px 0 auto;
  border-top: 1px solid var(--line);
}
/* A choice among the menu's first items (RowMenu's checked items): room for a tick before each, the chosen one ticked and in full ink,
   and a line under the last choice, before the actions. */
/* Every item of a menu with choices starts after the tick's room, so the actions line up with the choices above them. */
.px-menu:has(> button[role="menuitemradio"]) > button {
  padding-left: 28px;
}
.px-menu button[role="menuitemradio"] {
  position: relative;
}
.px-menu button[aria-checked="true"] {
  color: var(--fg);
}
.px-menu button[aria-checked="true"]::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 50%;
  width: 4px;
  height: 8px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: translate(0, -65%) rotate(45deg);
}
.px-menu button[role="menuitemradio"] + button[role="menuitem"] {
  position: relative;
  margin-top: 9px;
}
.px-menu button[role="menuitemradio"] + button[role="menuitem"]::before {
  content: "";
  position: absolute;
  inset: -5px 0 auto;
  border-top: 1px solid var(--line);
}
.px-menu button.danger:hover:not(:disabled) {
  background: var(--danger-wash);
  color: var(--danger);
}
/* Forced colours drop the fill that marks a pointed-at or focused item, so it takes the system's highlight. With the adjustment off,
   whatever wins is painted as it is, so this comes after every rule above and weighs as much as the red item's. */
@media (forced-colors: active) {
  .px-menu button:is(:hover, :focus-visible):not(:disabled),
  .px-menu button.danger:is(:hover, :focus-visible):not(:disabled) {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
    /* The ring is inside the item, with the highlight on both sides of it: at the item's edge it would be beside the menu, which can be
       the same colour. */
    outline-color: HighlightText;
    outline-offset: -4px;
  }
  .px-menu button:disabled {
    opacity: 1;
    color: GrayText;
  }
  /* On a highlighted item, the line would be left in the theme's faint colour: that setting is inherited. */
  .px-menu button:not(.danger) + button.danger::before,
  .px-menu button[role="menuitemradio"] + button[role="menuitem"]::before {
    border-top-color: CanvasText;
  }
}

/* Compact dropdown trigger (styleguide D-02 addendum): a POPOVER trigger that must read exactly like
   the compact boxed select — one dropdown look everywhere. Pair with the --chevron token via a
   trailing inline SVG or the select background treatment. */
.px-dropbtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--control-h-field-compact);
  padding: 0 28px 0 10px;
  font-size: var(--text-md);
  font-weight: 500;
  color: var(--fg);
  background: var(--surface);
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
  border: 1px solid var(--line-field);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 120ms ease;
}
.px-dropbtn:hover {
  border-color: var(--line-field-hover);
}

/* ─────────────────────────────── Row readout (styleguide D-09) ───────────────────────────────
   Label/value pairs must differ visibly in size, weight, AND ink: labels are quiet captions
   (--fg-muted, regular), values are the data (full ink, medium; mono only for machine values).
   4+ pairs on a detail surface use THIS two-column row list instead of stacked pairs. */
.px-kv {
  display: grid;
  grid-template-columns: 150px 1fr;
  margin: 0;
}
.px-kv dt {
  padding: 8px 12px 8px 0;
  font-size: var(--text-md);
  font-weight: 400;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--line);
}
.px-kv dd {
  margin: 0;
  padding: 8px 0;
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--fg);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  word-break: break-word;
}
.px-kv dt:last-of-type,
.px-kv dd:last-of-type {
  border-bottom: none;
}
.px-kv dd.mono {
  font-family: var(--font-mono);
  font-size: var(--text-md);
}

/* ─────────────────────────────── Priority chip ─────────────────────────────── */

/* One priority-chip primitive for both apps. Hosts set --p-color/--p-bg via their priority-* modifiers;
   unset falls back to the low tier. */
.px-priority-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.5;
  color: var(--p-color, var(--p-low));
  background: var(--p-bg, var(--p-low-bg));
  /* The outline pill (step 6): an edge of its state's colour at 45 % (--p-edge, the mark's colour, not the text's), a faint wash, 6px corners. */
  border: 1px solid color-mix(in srgb, var(--p-edge, var(--state-low)) 45%, transparent);
  padding: 1px 8px;
  border-radius: var(--radius-md);
  white-space: nowrap;
}
/* A chip can name its own tier (SuggestionCardHead does), so it does not depend on the card around it. */
/* The chip's text needs the deeper red: #dc2626 on its own tint is 4.4:1 (the dot keeps the same ink). */
.px-priority-chip[data-priority="critical"] {
  --p-color: var(--danger-text);
  --p-bg: var(--p-critical-bg);
  --p-edge: var(--state-high);
}
.px-priority-chip[data-priority="high"] {
  --p-color: var(--p-high);
  --p-bg: var(--p-high-bg);
  --p-edge: var(--state-high);
}
.px-priority-chip[data-priority="medium"] {
  --p-color: var(--p-medium);
  --p-bg: var(--p-medium-bg);
  --p-edge: var(--state-medium);
}
.px-priority-chip[data-priority="low"] {
  --p-color: var(--p-low);
  --p-bg: var(--p-low-bg);
}
/* Once closed, the chip names the outcome in neutral ink: the urgency is over. */
.px-priority-chip.is-closed {
  /* A fill that shows on the card in both themes, so the chip's edge (not its text) lines up with the content below;
     on --surface-2 it all but vanished in light. The pair is a token per theme: a grey-100 fill with grey-700 ink in light, the
     dark card's grey-800 with grey-400 ink in dark (a lighter fill there read as a heavy button). */
  color: var(--chip-neutral-fg);
  background: var(--chip-neutral-bg);
  border-color: var(--line);
}
.px-priority-chip .pdot {
  width: var(--status-dot-sm);
  height: var(--status-dot-sm);
  border-radius: 50%;
  background: var(--p-color, var(--p-low));
}

/* ─────────────────────────────── Tag chip ─────────────────────────────── */

/* Plain mono text — no box. Used for in-table tier/compliance/vertical/source cells. */
.px-tagchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;
  color: var(--fg-muted);
  font-family: var(--font-mono);
}

/* ─────────────────────────────── Section eyebrow ─────────────────────────────── */
/* A short sentence-case word above or beside a heading that says which area it belongs to, never a number or
   uppercase. Use as: <div class="ph-title"><span class="ph-eyebrow">Live</span><h2>Suggestions</h2></div> */

.ph-title {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.ph-eyebrow {
  font-size: var(--text-sm);
  color: var(--brand-text); /* AA in both themes */
  font-weight: 500;
}

/* ─────────────────────────────── Compact select (styleguide D-02) ───────────────────────────────
   A native <select> outside a form field: the boxed field edge and the one chevron. Full size by default, and
   .px-select-compact for a toolbar, where it matches .px-dropbtn. Disabled follows D-17: the box stays, on the quiet fill. */
.px-select {
  height: var(--control-h-field);
  padding: 0 32px 0 12px;
  font-size: var(--text-base);
  line-height: 1.2;
  color: var(--fg);
  background: var(--surface) var(--chevron) no-repeat right 10px center / 14px;
  border: 1px solid var(--line-field);
  border-radius: var(--radius-lg);
  appearance: none;
  cursor: pointer;
  transition:
    border-color var(--motion) var(--ease),
    box-shadow var(--motion) var(--ease);
}
.px-select:hover:not(:disabled) {
  border-color: var(--line-field-hover);
}
.px-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.px-select:focus-visible {
  outline: none;
}
.px-select-compact {
  height: var(--control-h-field-compact);
  padding: 0 28px 0 10px;
  font-size: var(--text-md);
  font-weight: 500;
  border-radius: var(--radius-md);
  background-position: right 8px center;
}
.px-select:disabled {
  border-color: var(--line-hi);
  background-color: var(--surface-2);
  color: var(--fg-muted);
  cursor: not-allowed;
}

/* The one date picker (DateField): month, day and year side by side, the order every date is written in. */
.px-date {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: var(--space-2);
}

/* ─────────────────────────────── Compact text input (styleguide "One language, two densities") ───────────────────────────────
   A text input in a toolbar, outside a form field: the boxed field edge at the compact 31px height, beside a
   .px-select-compact or .px-dropbtn. Inside a form, a field is a .field input. */
.px-input-compact {
  height: var(--control-h-field-compact);
  padding: 0 10px;
  font-family: inherit;
  font-size: var(--text-md);
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line-field);
  border-radius: var(--radius-md);
  transition:
    border-color var(--motion) var(--ease),
    box-shadow var(--motion) var(--ease);
}
.px-input-compact:hover:not(:disabled) {
  border-color: var(--line-field-hover);
}
.px-input-compact:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.px-input-compact::placeholder {
  color: var(--fg-faint);
}

/* ─────────────────────────────── Count ───────────────────────────────
   A small count beside a tab, heading or disclosure label. Quiet: it supports the label, it never competes. */
.px-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--fg-soft);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ─────────────────────────────── Disclosure ───────────────────────────────
   A row that shows or hides the section under it. It always says so: the ▸/▾ arrow, a full-ink label at 500, a hover
   wash, and a real button. No box. 36px tall, 44px under a coarse pointer. The arrow starts on the line of what it is
   in, and the wash reaches past both sides without moving either. */
.px-disclosure {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: 0;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: var(--fg);
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}
/* The wash is drawn behind the label, and stays in front of whatever the group is on. */
.px-disclosure-group {
  isolation: isolate;
}
.px-disclosure::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 calc(-1 * var(--space-2));
  border-radius: var(--radius-md);
  transition: background var(--motion) var(--ease);
}
.px-disclosure:hover::before {
  background: var(--surface-2);
}
/* The arrow at full ink. Drawn, not set in type: a character has room at its sides, which would put it past the line. */
.px-disclosure-glyph {
  flex: none;
  width: var(--space-4);
  color: var(--fg);
  font-size: 0;
}
.px-disclosure-glyph::before {
  content: "";
  display: block;
  width: 6px;
  height: 8px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.px-disclosure[aria-expanded="true"] .px-disclosure-glyph::before {
  width: 8px;
  height: 6px;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
@media (forced-colors: active) {
  .px-disclosure-glyph::before {
    forced-color-adjust: none;
    background: CanvasText;
  }
}
@media (pointer: coarse) {
  .px-disclosure {
    min-height: var(--touch-target);
  }
}
.px-disclosure-body {
  padding-top: var(--space-2);
}

/* ─────────────────────────────── Switch ───────────────────────────────
   Switch.tsx. A setting that is on or off: the knob's side says it, green when on, and the state word after it says it again.
   The label and its one-line description are part of the button, so the whole row is the target: 44 px tall at least. Bare (the
   label is already on the screen beside it), it keeps its own size and an invisible 44 px target, so a card's head doesn't grow.
   Unknown is a dashed, empty track with the knob in the middle: never on and never off. Saving says "Saving…" and the knob
   breathes; under reduced motion it only dims. Forced colours draw it in system colours, its state still by side and fill.
   Pages without React (the simulator's, the 3D view's Show) draw the same track and knob inside their own role="switch"
   button and say its state with aria-checked alone; a checked switch's track is on wherever it stands. */
.px-switch {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: var(--switch-gap);
  min-height: var(--touch-target);
  padding: var(--space-1) 0;
  background: none;
  border: 0;
  border-radius: var(--radius-md);
  color: var(--fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.px-switch--bare {
  display: inline-flex;
  width: auto;
  min-width: 0;
  min-height: 0;
  padding: 0;
}
.px-switch--bare::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100%, var(--touch-target));
  height: max(100%, var(--touch-target));
  transform: translate(-50%, -50%);
}
.px-switch-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.px-switch-label {
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1.3;
}
.px-switch-desc {
  font-size: var(--text-sm);
  color: var(--fg-muted);
  line-height: 1.4;
}
.px-switch-control {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: var(--space-2);
}
/* The state word, after the track and in a fixed width: the track never moves when the word changes, and the tracks of a list of
   switches line up whatever each one says. */
.px-switch-word {
  min-width: 4.5em;
  text-align: left;
  font-size: var(--text-control);
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}
.px-switch-track {
  position: relative;
  flex: none;
  width: var(--switch-width);
  height: var(--switch-height);
  border-radius: 999px;
  /* Off: the field edge's grey; on: the meaning palette's green, since on is running. Both hold 3:1 against the knob and the
     surface in either theme, and the knob's side says it without the colour. */
  background: var(--line-field);
  transition: background var(--motion) var(--ease);
}
.px-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: transform var(--motion) var(--ease);
}
:is(.px-switch[data-state="on"], [role="switch"][aria-checked="true"]) .px-switch-track {
  background: var(--state-ok);
}
:is(.px-switch[data-state="on"], [role="switch"][aria-checked="true"]) .px-switch-knob {
  transform: translateX(16px);
}
.px-switch[data-state="unknown"] .px-switch-track {
  background: none;
  box-shadow: inset 0 0 0 1px var(--line-field);
  background-image: repeating-linear-gradient(135deg, transparent 0 3px, var(--line) 3px 4px);
}
.px-switch[data-state="unknown"] .px-switch-knob {
  transform: translateX(8px);
  background: var(--fg-muted);
  box-shadow: none;
}
.px-switch[data-busy] .px-switch-knob {
  animation: px-switch-saving 1s ease-in-out infinite alternate;
}
@keyframes px-switch-saving {
  to {
    opacity: 0.45;
  }
}
.px-switch:is([aria-disabled="true"], :disabled) {
  cursor: default;
}
/* Disabled dims it; Unknown keeps full ink, so it reads as a state of its own and not as a faded on or off. */
.px-switch:is([aria-disabled="true"], :disabled):not([data-busy], [data-state="unknown"]) .px-switch-control {
  opacity: 0.5;
}
/* A hover darkens the track a step, on a switch that can be pressed. Not in forced colours, where the system's own colours draw it
   and a hover colour would win over them. */
@media (forced-colors: none) {
  .px-switch:not([aria-disabled="true"], :disabled):hover .px-switch-track {
    background: var(--line-field-hover);
  }
  .px-switch:not([aria-disabled="true"], :disabled):is([data-state="on"], [aria-checked="true"]):hover
    .px-switch-track {
    background: var(--state-ok-hover);
  }
}
@media (prefers-reduced-motion: reduce) {
  .px-switch-track,
  .px-switch-knob {
    transition: none;
  }
  .px-switch[data-busy] .px-switch-knob {
    animation: none;
    opacity: 0.45;
  }
}
@media (forced-colors: active) {
  .px-switch-track {
    forced-color-adjust: none;
    border: 1px solid ButtonText;
    background: ButtonFace;
    color: ButtonText;
  }
  .px-switch-knob {
    forced-color-adjust: none;
    top: 1px;
    left: 1px;
    background: ButtonText;
    box-shadow: none;
  }
  :is(.px-switch[data-state="on"], [role="switch"][aria-checked="true"]) .px-switch-track {
    background: SelectedItem;
    color: SelectedItemText;
  }
  :is(.px-switch[data-state="on"], [role="switch"][aria-checked="true"]) .px-switch-knob {
    background: SelectedItemText;
  }
  .px-switch[data-state="unknown"] .px-switch-track {
    border-style: dashed;
    background: Canvas;
    color: CanvasText;
  }
  .px-switch[data-state="unknown"] .px-switch-knob {
    background: GrayText;
  }
  .px-switch:is([aria-disabled="true"], :disabled):not([data-busy], [data-state="unknown"]) .px-switch-track {
    border-color: GrayText;
  }
  .px-switch:focus-visible {
    outline: 2px solid CanvasText;
    outline-offset: 2px;
  }
}

/* ─────────────────────────────── Tabs ───────────────────────────────
   One underline tab strip, with an optional count chip. The selected tab is full ink at 500 over a 2px ink line; the
   strip's own hairline runs under all of them. A strip too wide for its pane scrolls sideways, never wraps. */
.px-tabs {
  --tabs-line: var(--line);
  display: flex;
  gap: calc(var(--space-4) + 4px);
  /* The strip scrolls, so it cuts off what is outside it. It reaches 4 px past its tabs on every side, which is the room a focused
     tab's ring takes; the tabs' words and the line under them stay on the page's own edges. */
  margin: -4px;
  padding: 4px;
  background: linear-gradient(var(--tabs-line), var(--tabs-line)) 4px calc(100% - 3px) / calc(100% - 8px) 1px no-repeat;
  overflow-x: auto;
  scrollbar-width: none;
}
/* More tabs past an edge: that edge fades out (Tabs sets the data attributes from the scroll position). */
.px-tabs[data-more-end] {
  mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
}
.px-tabs[data-more-start] {
  mask-image: linear-gradient(to left, #000 calc(100% - 48px), transparent);
}
/* A strip that scrolls shows a thin scrollbar, so a mouse can reach the tabs past the fade. */
.px-tabs:is([data-more-start], [data-more-end]) {
  scrollbar-width: thin;
}
.px-tabs[data-more-start][data-more-end] {
  mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent);
}
.px-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-height: 36px;
  margin-bottom: -1px;
  padding: 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--fg-muted);
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition:
    color var(--motion) var(--ease),
    border-color var(--motion) var(--ease);
}
.px-tab:hover {
  color: var(--fg);
}
.px-tab[aria-selected="true"] {
  color: var(--fg);
  font-weight: 500;
  border-bottom-color: var(--fg);
}
/* Forced colors paint a clear border, so every tab would show the open tab's line: only the open one keeps it. */
@media (forced-colors: active) {
  /* The strip's line is a gradient, which forced colours drop. So the strip keeps its own colours, and draws its line and its page in
     the person's. The class is repeated to outweigh each app's own colours for them. */
  .px-tabs.px-tabs.px-tabs {
    --tabs-line: CanvasText;
    forced-color-adjust: none;
    background-color: Canvas;
    scrollbar-color: auto;
  }
  /* That setting is inherited, and would leave the tabs' words in the theme's colours. */
  .px-tabs > .px-tab {
    forced-color-adjust: auto;
  }
  /* Any border would be painted, even a clear one, and would cover the line. The same room in its place, so nothing moves. */
  .px-tab:not([aria-selected="true"]) {
    border-bottom: 0;
    padding-bottom: 3px;
  }
  /* Not SelectedItem, which is made to go behind words, and follows the page's theme rather than the person's own colours: it can be
     too close to the page. Three times as thick as the line under every tab, and only under the open one. */
  .px-tab[aria-selected="true"] {
    border-bottom: 3px solid CanvasText;
  }
}
@media (pointer: coarse) {
  .px-tab {
    min-height: var(--touch-target);
  }
}

/* ─────────────────────────────── Steps ───────────────────────────────
   The one stepper (Stepper.tsx): a numbered circle and a label for each step, a hairline to the next; the current step in full
   ink, a done step ticked. One line: labels never wrap, and a long flow scrolls sideways rather than stacking. */
.px-steps {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-5);
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}
.px-step {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-2);
  color: var(--fg-muted);
  font-size: var(--text-sm);
  white-space: nowrap;
}
.px-step:not(:last-child) {
  flex: 1 0 auto;
}
.px-step:not(:last-child)::after {
  content: "";
  flex: 1;
  min-width: var(--space-4);
  height: 1px;
  margin-left: var(--space-2);
  background: var(--line);
}
.px-step-n {
  display: grid;
  flex: none;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--fg-muted);
  font-size: var(--text-xs);
  font-weight: 500;
}
.px-step.is-current {
  color: var(--fg);
  font-weight: 500;
}
.px-step.is-current .px-step-n {
  background: var(--fill-bg);
  color: var(--fill-fg);
}
.px-step.is-done .px-step-n {
  background: var(--brand-soft);
  color: var(--brand-text);
}
@media (forced-colors: active) {
  .px-step.is-current .px-step-n {
    forced-color-adjust: none;
    background: SelectedItem;
    color: SelectedItemText;
  }
}

/* ─────────────────────────────── Back link ───────────────────────────────
   The one way back (BackLink.tsx): a chevron and the parent page's name, quiet until hovered. */
a.px-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 var(--space-2) -4px;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  font-size: var(--text-base);
  text-decoration: none;
}
a.px-back:hover {
  color: var(--fg);
}
a.px-back:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 0;
}
.px-back-mark {
  width: 7px;
  height: 7px;
  margin: 0 2px 0 3px;
  border-bottom: 1.6px solid currentColor;
  border-left: 1.6px solid currentColor;
  transform: rotate(45deg);
}
@media (pointer: coarse) {
  a.px-back {
    min-height: var(--touch-target);
  }
}

/* ─────────────────────────────── Add a store ───────────────────────────────
   The one Add a store (AddStore.tsx), the console's sheet and the field app's page alike. Its form is the shared form (.px-form,
   any short form uses it): fields a form-field gap apart, each label over its control with its hint under it; the kinds of store as tiles that fill the row; the review's lines in one frame. */
.px-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  min-width: 0;
}
.px-form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.px-form-label {
  padding: 0;
  font-weight: 500;
  color: var(--fg);
}
.px-form-hint {
  margin: 0;
  color: var(--fg-muted);
  font-size: var(--text-sm);
  line-height: 1.45;
}
.px-kind-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
}
.px-kind-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  min-height: 96px;
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.px-kind-tile:hover {
  border-color: var(--line-hi);
  background: var(--surface-2);
}
.px-kind-tile.is-selected {
  border-color: var(--fg);
  box-shadow: inset 0 0 0 1px var(--fg);
}
.px-kind-tile:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-offset);
}
.px-kind-tile-icon {
  display: inline-flex;
  margin-bottom: var(--space-1);
  color: var(--fg-soft);
}
.px-kind-tile.is-selected .px-kind-tile-icon {
  color: var(--fg);
}
.px-kind-tile-title {
  font-weight: 500;
}
.px-kind-tile-sub {
  color: var(--fg-muted);
  font-size: var(--text-sm);
  line-height: 1.4;
}
.px-add-store-lead {
  margin: 0 0 var(--space-4);
  color: var(--fg-soft);
}
.px-review-lines {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.px-review-line {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
}
.px-review-line.has-action {
  grid-template-columns: 160px minmax(0, 1fr) auto;
}
.px-review-line + .px-review-line {
  border-top: 1px solid var(--line);
}
.px-review-line dt {
  color: var(--fg-muted);
}
.px-review-line dd {
  min-width: 0;
  margin: 0;
}
.px-review-from {
  display: block;
  margin-top: var(--space-1);
  color: var(--fg-muted);
  font-size: var(--text-sm);
}
@media (max-width: 640px) {
  .px-review-line,
  .px-review-line.has-action {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-1) var(--space-3);
  }
  .px-review-line dt {
    grid-column: 1 / -1;
  }
}
@media (forced-colors: active) {
  .px-kind-tile.is-selected {
    forced-color-adjust: none;
    background: SelectedItem;
    color: SelectedItemText;
  }
  /* Important: a part's own colour for this state would be the page theme's, on the system's. */
  .px-kind-tile.is-selected * {
    color: inherit !important;
  }
}

/* ─────────────────────────────── Touch targets (R-12-60, decided 2026-11-10) ───────────────────────────────
   Under a coarse pointer every control a finger presses in every app has a 44 px hit area. Two ways, so a page keeps its
   density:
   - Controls with a box of their own (buttons, tabs, selects, text fields, disclosures, options) get a 44 px floor in
     height and width. The floor is wrapped in :where(), so it has no specificity: a control whose own min-height is
     larger keeps it (a 96 px description box stays 96 px), and a control that sets a smaller one is raised by its own
     coarse rule beside it. touchTargets.test.ts holds both.
   - Text-styled controls inside tables, sentences and bars (a table's sort header, a row's Open, an in-cell link, the
     theme toggle) keep their size; an invisible ::after centred on them is the 44 px target, so rows and bars do not
     grow on touch.
   A fine pointer keeps the D-17 tiers (28 / 31 / 36). A checkbox or radio is reached through its label; an inline link
   in a sentence is text. */
@media (pointer: coarse) {
  :where(
    button:not(
      .sort-button,
      .row-open,
      .cell-link,
      .card-link,
      .ov-link,
      .ov-card-open,
      .copy-chip-value,
      .setting-reset,
      .llm-task-chip
    ),
    select,
    textarea,
    summary,
    [role="tab"],
    [role="button"],
    [role="option"],
    [role="menuitem"],
    input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="range"], [type="file"], [type="color"]),
    .px-btn,
    .px-btn-outline,
    .px-dropbtn,
    .form-check
  ) {
    min-height: var(--touch-target);
  }
  :where(
    button:not(
      .sort-button,
      .row-open,
      .cell-link,
      .card-link,
      .ov-link,
      .ov-card-open,
      .copy-chip-value,
      .setting-reset,
      .llm-task-chip
    ),
    [role="tab"],
    [role="button"],
    .px-btn,
    .px-btn-outline
  ) {
    min-width: var(--touch-target);
  }
  /* The text-styled controls: the target grows, the layout does not. (.ov-card-open already covers its whole card.) */
  :where(.sort-button, .row-open, .cell-link, .card-link, .ov-link, .copy-chip-value, .setting-reset, .llm-task-chip) {
    position: relative;
  }
  :where(
    .sort-button,
    .row-open,
    .cell-link,
    .card-link,
    .ov-link,
    .copy-chip-value,
    .setting-reset,
    .llm-task-chip
  )::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: max(100%, var(--touch-target));
    height: max(100%, var(--touch-target));
    transform: translate(-50%, -50%);
  }
}

/* ─────────────────────────────── Field (styleguide D-01) ───────────────────────────────
   The anatomy every form field shares: label above, control, hint below. The boxed control look stays with each app's
   form styles. */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-size: var(--text-label);
  font-weight: 500;
  color: var(--fg-muted);
}
.field-hint {
  font-size: var(--text-sm);
  color: var(--fg-faint);
  line-height: 1.4;
  margin-top: -2px; /* 4px control→hint per the rhythm contract */
}

/* ─────────────────────────────── Empty state (styleguide D-18) ───────────────────────────────
   Boxed: the console's plain bordered box, sentence on the left, the one action on the right.
   Plain: the manager app's borderless, centred state with a glyph and a title over the sentence. */
.px-empty {
  display: flex;
  gap: var(--space-3) var(--space-4);
}
.px-empty p {
  margin: 0;
}
.px-empty--boxed {
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.px-empty--boxed .px-empty-text {
  flex: 1 1 260px;
}
.px-empty--boxed .px-empty-title {
  margin-bottom: var(--space-1);
  font-weight: 500;
  color: var(--fg);
}
.px-empty--boxed .px-empty-sub {
  font-size: var(--text-read);
  color: var(--fg-muted);
  line-height: 1.5;
}
.px-empty--plain {
  flex-direction: column;
  align-items: center;
  padding: 60px var(--space-6) var(--space-10);
  text-align: center;
}
.px-empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: var(--space-2);
  border-radius: 18px;
  background: var(--surface-2);
  color: var(--fg-muted);
}
.px-empty--plain .px-empty-title {
  margin-bottom: var(--space-2);
  font-size: var(--text-display);
  font-weight: 500;
  color: var(--fg);
}
.px-empty--plain .px-empty-sub {
  max-width: 36ch;
  margin-inline: auto;
  font-size: var(--text-base);
  color: var(--fg-muted);
  line-height: 1.5;
}

/* ─────────────────────────────── Suggestion card head ───────────────────────────────
   SuggestionCardHead: the priority (or outcome) chip and its notes on the left, the impact and time left on the
   right. Wraps as two groups, never as a stack of loose chips. */
.px-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
}
.px-card-head-start,
.px-card-head-end {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-width: 0;
}
.px-card-head-note,
.px-card-expiry {
  font-size: var(--text-sm);
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}
.px-card-expiry {
  white-space: nowrap;
}
/* The safety fallback wrote this, not the agent: a quiet neutral chip, with the reason in its title. */
.px-fallback-chip {
  padding: 1px var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  line-height: 1.5;
  background: var(--chip-neutral-bg); /* the closed chip's outline and ink, for the same reason */
  color: var(--chip-neutral-fg);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
}

/* ─────────────────────────────── Selection ─────────────────────────────── */

::selection {
  background: var(--gray-200);
  color: var(--gray-900);
}
[data-theme="dark"] ::selection,
.px-canvas ::selection {
  background: rgba(255, 255, 255, 0.24);
  color: var(--gray-0);
}

/* ── The status chip (StatusBadge): one shape, its colour from the vocabulary's tone ─────────────────────────────
   ok is healthy (a green dot), warn the one "needs a look" state (an amber triangle), info on its way (a blue ring), muted a
   switch a person set or something settled (a grey dot), danger failing (a red square). The two that want a look also take
   their colour in the word and a wash; healthy and on its way keep ink words, so a page of healthy rows stays calm. */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  /* An outline, as every chip is: the hairline, or its state's colour. Its padding must never be left without an edge to see. */
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.status-badge::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-badge.tone-warn::before {
  width: 8px;
  height: 7px;
}
.status-badge.tone-ok {
  color: var(--fg);
}
.status-badge.tone-ok::before {
  background: var(--state-ok);
}
.status-badge.tone-warn {
  border-color: color-mix(in srgb, var(--state-medium) 45%, transparent);
  color: var(--state-medium-text);
  background: var(--state-medium-wash);
}
.status-badge.tone-info {
  color: var(--fg-soft);
}
/* On its way reads apart from healthy by its mark, a blue ring (as the simulator's "changing" and provenance's "derived" are). */
.status-badge.tone-info::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--state-info);
}
.status-badge.tone-muted {
  color: var(--fg-muted);
}
.status-badge.tone-danger {
  border-color: color-mix(in srgb, var(--state-high) 45%, transparent);
  color: var(--state-high-text);
  background: var(--state-high-wash);
}
/* "Test data": its own mark, a dashed violet outline around the words, on a heading, a row or a figure from a test store or a
   test source. It is never a state, so it has no dot. */
.test-data-tag {
  display: inline-block;
  padding: 1px 8px;
  border: 1px dashed var(--state-test);
  border-radius: var(--radius-md);
  background: var(--state-test-wash);
  color: var(--state-test-text);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: normal;
  white-space: nowrap;
}
/* Forced colours: the mark is a system colour, and still a ring for what's on its way. The label's own words say which state it is.
   After the rules above, which weigh as much. */
@media (forced-colors: active) {
  .status-badge::before,
  .status-badge:is(.tone-ok, .tone-warn, .tone-danger, .tone-muted)::before {
    forced-color-adjust: none;
    box-sizing: border-box;
    border: 1.5px solid CanvasText;
    background: CanvasText;
  }
  .status-badge.tone-info::before {
    background: Canvas;
    box-shadow: none;
  }
  .test-data-tag {
    border-color: CanvasText;
  }
}

/* ═══════════════════════════════ UI refresh (2026-11-27) ═══════════════════════════════
   The parts below are the refreshed language: the scene is the page, numbers are the type, colour only means state,
   and every figure says where it came from. They read the role tokens, so they work in the light theme, the dark
   theme and on .px-canvas alike. */

/* ─────────────────────────────── Panel ───────────────────────────────
   The one container: the surface fill, a 1px hairline, the 10px container radius, and padding on every side so text
   never touches the edge. No coloured edge and no tinted fill; state is a dot or a pill inside it. Sections are
   divided by the same hairline. .px-panel-float is a panel over a scene: its fill lets the scene just show. */
.px-panel {
  padding: var(--panel-pad);
  background: var(--panel-lit), var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-glass);
  color: var(--fg);
}
/* Glass: a panel over a scene (the measured pass). The fill deepens toward its foot, the scene shows faintly through it,
   and its top edge catches the light. .px-glass is the same look without a panel's padding, for a chip or a tool column. */
.px-panel-float,
.px-glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-glass);
  -webkit-backdrop-filter: blur(var(--panel-blur)) saturate(1.2);
  backdrop-filter: blur(var(--panel-blur)) saturate(1.2);
  box-shadow: var(--glass-shadow);
}
.px-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}
.px-panel-title {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.px-panel-sub {
  margin: 2px 0 0;
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--fg-muted);
}
.px-panel-section + .px-panel-section {
  margin-top: var(--panel-pad);
  padding-top: var(--panel-pad);
  border-top: 1px solid var(--divider);
}
.px-panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* ─────────────────────────────── Numerals ───────────────────────────────
   A reading is its value, its unit and its change on one baseline: the value large and light, the unit small and
   muted beside it, the change after that in plain ink. Three sizes: the one headline figure of a page or panel
   (.px-numeral-lg), the value on a card or a callout (the default), a reading in a row (.px-numeral-sm). */
.px-reading {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1);
}
.px-numeral {
  font-size: var(--numeral-md);
  font-weight: var(--numeral-weight);
  line-height: var(--numeral-leading);
  letter-spacing: var(--numeral-tracking-md);
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}
.px-numeral-lg {
  font-size: var(--numeral-lg);
  letter-spacing: var(--numeral-tracking-lg);
}
.px-numeral-sm {
  font-size: var(--numeral-sm);
  letter-spacing: var(--numeral-tracking-sm);
}
.px-unit {
  font-size: var(--text-sm);
  color: var(--fg-muted);
}
/* The change stands a little further off than the unit, which belongs to the figure. */
.px-delta {
  margin-left: var(--space-1);
  font-size: var(--text-md);
  font-variant-numeric: tabular-nums;
  color: var(--fg-soft);
}

/* ─────────────────────────────── Micro-label ───────────────────────────────
   A few words that place things: the site line over a title, a group label over readings, a name on the scene. Sentence case
   like every label (D-16 stands, decided again 2026-11-27): small, medium weight, muted; never a heading or a sentence. */
.px-microlabel {
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: 1.3;
  color: var(--fg-faint);
}

/* A tag on an inspector ("Express", "Self checkout"): a few words in an outline, never a fill. */
.px-chip-outline {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--fg-muted);
  white-space: nowrap;
}

/* ─────────────────────────────── State ───────────────────────────────
   The three levels, set with data-state="high | medium | low" (low when unset). A dot beside a word, or a pill with
   the word in it; the same three colour a sparkline's last point. Never a rail, a border or a panel fill. */
.px-state-dot,
.px-state-pill,
.px-spark,
.px-glow-dot,
.px-state-tile,
.px-bar,
.px-state-value {
  --state: var(--state-low);
  --state-text: var(--state-low-text);
  --state-wash: var(--state-low-wash);
}
:is(
  .px-state-dot,
  .px-state-pill,
  .px-spark,
  .px-glow-dot,
  .px-state-tile,
  .px-bar,
  .px-state-value
)[data-state="high"] {
  --state: var(--state-high);
  --state-text: var(--state-high-text);
  --state-wash: var(--state-high-wash);
}
:is(
  .px-state-dot,
  .px-state-pill,
  .px-spark,
  .px-glow-dot,
  .px-state-tile,
  .px-bar,
  .px-state-value
)[data-state="medium"] {
  --state: var(--state-medium);
  --state-text: var(--state-medium-text);
  --state-wash: var(--state-medium-wash);
}
.px-state-dot {
  display: inline-block;
  flex: none;
  width: var(--status-dot);
  height: var(--status-dot);
  border-radius: 50%;
  background: var(--state);
}
.px-state-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 8px;
  border: 1px solid color-mix(in srgb, var(--state) 45%, transparent);
  border-radius: var(--radius-md);
  background: var(--state-wash);
  color: var(--state-text);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
/* A value written in its state's colour ("96 %"), the low state in plain ink. */
.px-state-value {
  color: var(--state-text);
  font-variant-numeric: tabular-nums;
}
.px-state-value:not([data-state]),
.px-state-value[data-state="low"] {
  color: var(--fg);
}
/* A plotted point: the dot, a dark ring that parts it from its neighbours, and a halo of its state. */
.px-glow-dot {
  display: inline-block;
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--state);
  box-shadow:
    0 0 0 1.5px var(--bg),
    0 0 0 6px var(--state-wash),
    0 0 18px 2px color-mix(in srgb, var(--state) 40%, transparent);
}
/* A state tile: the small rounded square that leads a callout chip or a row, its edge in the state, a glyph in ink. */
.px-state-tile {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid color-mix(in srgb, var(--state) 55%, transparent);
  border-radius: 5px;
  background: var(--state-wash);
  color: var(--fg);
}
.px-state-tile svg {
  width: 11px;
  height: 11px;
}
/* A ranked bar: 3px of the state on a quiet track. Set the share with --value (0 to 1). */
.px-bar {
  position: relative;
  display: block;
  height: 3px;
  border-radius: 2px;
  background: var(--bar-track);
  overflow: hidden;
}
.px-bar::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--value, 0) * 100%);
  border-radius: inherit;
  background: var(--state);
}

/* ─────────────────────────────── Provenance ───────────────────────────────
   Where a figure came from, beside every reading: a dot and a word, then the instrument and the age
   ("Simulated · line count · 20 s ago"). The dot's shape says how far the figure is from a sensor, in ink only, since
   colour is for state: solid for measured, a ring for derived, a dotted ring for simulated. No data-source, no dot:
   a reading never claims a source it was not given. */
/* Inline text with the dot drawn before it, so the words space as words do ("Measured · line count · 2 min ago"). */
.px-prov {
  display: inline-block;
  font-size: var(--text-sm);
  line-height: 1.3;
  color: var(--fg-muted);
  white-space: nowrap;
}
.px-prov[data-source]::before {
  content: "";
  display: inline-block;
  width: var(--prov-dot);
  height: var(--prov-dot);
  margin-right: 6px;
  border-radius: 50%;
  border: 1.5px solid var(--fg-soft);
  vertical-align: -1px;
}
.px-prov[data-source="measured"]::before {
  background: var(--fg-soft);
}
.px-prov[data-source="simulated"]::before {
  border-style: dotted;
}
.px-prov-detail {
  color: var(--fg-faint);
}

/* ─────────────────────────────── Sparkline ───────────────────────────────
   The last minutes of a reading, to the right of its value: an inline SVG with one path and a circle for now
   (.px-spark-now), which takes the reading's state. */
.px-spark {
  display: block;
  flex: none;
  overflow: visible;
  fill: none;
  stroke: var(--fg-muted);
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* The row size, unless the chart states its own (a larger chart in a card or a selected row). */
.px-spark:not([width]) {
  width: 72px;
  height: 24px;
}
.px-spark-now {
  fill: var(--state);
  stroke: none;
}
/* A larger chart (a selected row, a card) adds these: a soft area under the line in the state's colour (an SVG gradient
   from --state at 16 % to nothing, drawn by the chart itself), the range as a band, and a limit as a dashed line. */
.px-spark-area {
  stroke: none;
}
.px-spark-band {
  fill: var(--fg);
  fill-opacity: 0.08;
  stroke: none;
}
.px-spark-limit {
  stroke: var(--state-medium);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.px-spark-axis {
  font-size: var(--text-xs);
  fill: var(--fg-faint);
  stroke: none;
}

/* ─────────────────────────────── Motion ───────────────────────────────
   The three moves that are CSS. The 3D view's fly-to (web/twin flight.ts) eases on --ease-fly's curve (ease-in-out cubic) over a
   time set by the distance flown, about --motion-fly for a move across the store. */
/* A panel or callout card arriving. */
.px-panel-in {
  animation: pxPanelIn var(--motion-panel) var(--ease); /* no fill: if the animation never runs (a stalled GPU), the panel still shows */
}
@keyframes pxPanelIn {
  from {
    opacity: 0;
    transform: translateY(var(--slide-distance));
  }
}
/* A live point: one ring breathing out from the dot. Put it on the points that are live now, not on every dot. */
.px-pulse {
  position: relative;
}
.px-pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--state, currentColor);
  animation: pxPulseRing var(--motion-pulse) var(--ease-pulse) infinite;
}
@keyframes pxPulseRing {
  from {
    opacity: 0.8;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(3.4);
  }
}
/* A route or an outline drawing itself once: an SVG path with pathLength="1". */
.px-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: pxDraw var(--motion-draw) var(--ease-fly) forwards;
}
@keyframes pxDraw {
  to {
    stroke-dashoffset: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .px-panel-in,
  .px-pulse::after,
  .px-draw {
    animation: none;
  }
  .px-draw {
    stroke-dashoffset: 0;
  }
}
