/* ============================================================================
   THE NIGHT SHIFT — design tokens, base styles, motion.
   Phase 3 build. Values ported from fableui/vision/*.html (the north-star comps).
   Two postures via [data-theme]: "daybreak" (warm paper — the app default) and
   "night" (deep blue-black — the marketing site + optional dark app theme).
   Every color authored in OKLCH per the design plan §2. Consumed by:
     - assets/console.css (the Triage engine + shared app shell/component library)
     - index.html / demo-map.html (marketing, hand CSS)
     - every other screen (Tailwind CDN utilities for page bodies; these tokens
       supply the semantic classes below — .chip/.btn/.card/.kpi/.tbl etc.)
   ========================================================================= */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ---------------------------------------------------------------- DAYBREAK */
:root, [data-theme="daybreak"] {
  --font-body: 'Geist', system-ui, sans-serif;
  --font-display: 'Archivo', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;

  --canvas: oklch(0.985 0.005 85);
  --sidebar: oklch(0.965 0.006 85);
  --topbar-bg: oklch(1 0 0);
  --spine-bg: oklch(0.985 0.005 85);
  --queue-bg: oklch(0.985 0.005 85);
  --actionbar-bg: oklch(1 0 0 / .85);
  --panel: oklch(1 0 0);
  --panel-2: oklch(0.965 0.006 85);
  --sunken: oklch(0.965 0.006 85);
  --hover: oklch(0.955 0.007 85);

  --line: oklch(0.92 0.008 85);
  --line-strong: oklch(0.87 0.01 85);
  --line-2: oklch(0.87 0.01 85);

  --ink: oklch(0.22 0.01 60);
  --ink-2: oklch(0.45 0.012 60);
  --ink-3: oklch(0.60 0.012 60);
  --ink-4: oklch(0.72 0.012 60);

  /* Signal Orange — the one accent, reserved for primary action + active state */
  --signal: oklch(0.62 0.19 45);       /* text-safe on paper (AA checked) */
  --signal-bg: oklch(0.70 0.19 45);    /* filled surfaces */
  --signal-hover: oklch(0.66 0.19 45);
  --accent: var(--signal-bg);
  --accent-ink: var(--signal);
  --accent-weak: oklch(0.97 0.03 45);
  --accent-border: oklch(0.85 0.08 45);
  --accent-halo: oklch(0.70 0.19 45 / .18);

  /* Moonlight — AI authorship, distinct from Signal Orange (never conflated) */
  --moon: oklch(0.50 0.11 265);
  --moon-wash: oklch(0.965 0.02 265);
  --moon-line: oklch(0.88 0.05 265);

  --ok: oklch(0.55 0.14 155); --ok-weak: oklch(0.96 0.03 155); --ok-ink: oklch(0.42 0.13 155);
  --warn: oklch(0.60 0.13 75); --warn-weak: oklch(0.97 0.035 85); --warn-ink: oklch(0.48 0.12 75);
  --bad: oklch(0.55 0.19 25); --bad-weak: oklch(0.965 0.025 25); --bad-ink: oklch(0.50 0.19 25); --bad-border: oklch(0.80 0.10 25);

  --pt: oklch(0.48 0.09 190);
  --pt-bg: oklch(0.48 0.09 190); --pt-fg: oklch(0.99 0 0);

  /* Dashboard "What sells" category palette (v3 §D) — 6 fixed hue slots, one
     per SEED.products category, assigned by identity (never by rank/position)
     so a category keeps its color regardless of sort order. Validated with
     the dataviz skill's six-check validator against this theme's --panel
     surface: lightness band + chroma floor PASS; worst adjacent CVD ΔE 24.6
     (protan) — clear of the 12 target; one slot (Polymeric Sand, the
     gold/yellow) sits at 2.87:1 contrast, under the WARN band — mitigated by
     always-visible text labels (the category name sits directly beside its
     own bar, never color-only identity). */
  --cat-1: oklch(0.55 0.14 235); /* Concrete Sealers — blue */
  --cat-2: oklch(0.60 0.11 185); /* Floor Epoxy — teal */
  --cat-3: oklch(0.68 0.15 95);  /* Polymeric Sand — gold */
  --cat-4: oklch(0.58 0.13 140); /* Resin / Hardener Kits — green */
  --cat-5: oklch(0.52 0.14 305); /* Concrete Stain — violet */
  --cat-6: oklch(0.58 0.17 10);  /* Cleaning Chemicals — rose */

  --brand-mark-bg: oklch(0.22 0.01 60); --brand-mark-fg: oklch(0.985 0.005 85); --brand-mark-shadow: none;
  --avatar-bg: oklch(0.965 0.02 265); --avatar-fg: oklch(0.50 0.11 265);
  --count-bg: oklch(0.92 0.008 85); --count-fg: oklch(0.45 0.012 60);
  --input-bg: oklch(1 0 0); --kbd-bg: oklch(1 0 0); --kbd-shadow: inset 0 -1px 0 oklch(0.92 0.008 85);
  --key-bg: oklch(0.965 0.006 85); --key-fg: oklch(0.60 0.012 60); --key-border: oklch(0.87 0.01 85); --key-on-accent-bg: oklch(1 0 0 / .22);
  --draft-bg: transparent; --draft-active-bg: oklch(1 0 0); --draft-active-shadow: 0 1px 3px oklch(0 0 0 / .06);
  --ai-bg: var(--moon-wash); --ai-border: var(--moon-line);
  --reply-bg: oklch(0.965 0.006 85); --reply-border: oklch(0.92 0.008 85);
  --btn-bg: oklch(1 0 0);
  --btn-primary-bg: var(--signal-bg); --btn-primary-fg: oklch(1 0 0); --btn-primary-border: var(--signal-bg);
  --btn-primary-hover: var(--signal-hover); --btn-primary-shadow: 0 1px 3px oklch(0.70 0.19 45 / .4);

  --radius-sm: 8px; --radius: 8px; --radius-lg: 12px; --r-s: 8px; --r-l: 12px;
  --shadow-card: 0 1px 2px oklch(0 0 0 / .04), 0 1px 1px oklch(0 0 0 / .03);
  --shadow-pop: 0 10px 28px oklch(0 0 0 / .10), 0 2px 6px oklch(0 0 0 / .05);
  --toast-bg: oklch(0.22 0.01 60); --toast-fg: oklch(0.985 0.005 85);
}

/* -------------------------------------------------------------------- NIGHT */
[data-theme="night"] {
  --font-body: 'Geist', system-ui, sans-serif;
  --font-display: 'Archivo', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;

  --canvas: oklch(0.16 0.015 260);
  --sidebar: oklch(0.14 0.014 260);
  --topbar-bg: oklch(0.20 0.015 260);
  --spine-bg: oklch(0.16 0.015 260);
  --queue-bg: oklch(0.16 0.015 260);
  --actionbar-bg: oklch(0.20 0.015 260 / .85);
  --panel: oklch(0.20 0.015 260);
  --panel-2: oklch(0.23 0.018 260);
  --sunken: oklch(0.14 0.014 260);
  --hover: oklch(1 0 0 / .04);

  --line: oklch(1 0 0 / .09);
  --line-strong: oklch(1 0 0 / .16);
  --line-2: oklch(1 0 0 / .16);

  --ink: oklch(0.93 0.005 260);
  --ink-2: oklch(0.72 0.01 260);
  --ink-3: oklch(0.52 0.012 260);
  --ink-4: oklch(0.40 0.012 260);

  --signal: oklch(0.70 0.19 45);
  --signal-bg: oklch(0.70 0.19 45);
  --signal-hover: oklch(0.74 0.19 45);
  --accent: var(--signal-bg);
  --accent-ink: oklch(0.78 0.17 45);
  --accent-weak: oklch(0.70 0.19 45 / .14);
  --accent-border: oklch(0.70 0.19 45 / .4);
  --accent-halo: oklch(0.70 0.19 45 / .35);

  --moon: oklch(0.72 0.10 265);
  --moon-wash: oklch(0.72 0.10 265 / .12);
  --moon-line: oklch(0.72 0.10 265 / .3);

  --ok: oklch(0.75 0.14 155); --ok-weak: oklch(0.75 0.14 155 / .14); --ok-ink: oklch(0.80 0.14 155);
  --warn: oklch(0.75 0.13 80); --warn-weak: oklch(0.75 0.13 80 / .14); --warn-ink: oklch(0.82 0.13 80);
  --bad: oklch(0.68 0.19 25); --bad-weak: oklch(0.68 0.19 25 / .14); --bad-ink: oklch(0.78 0.17 25); --bad-border: oklch(0.68 0.19 25 / .4);

  --pt: oklch(0.72 0.09 190);
  --pt-bg: oklch(0.72 0.09 190); --pt-fg: oklch(0.16 0.015 260);

  /* Dashboard category palette — same 6 hues, restepped for the dark band
     (L 0.48–0.67) and re-validated against this theme's --panel surface:
     lightness/chroma/contrast all PASS; worst adjacent CVD ΔE 27.1 (protan). */
  --cat-1: oklch(0.65 0.12 235);
  --cat-2: oklch(0.65 0.10 185);
  --cat-3: oklch(0.67 0.14 95);
  --cat-4: oklch(0.65 0.12 140);
  --cat-5: oklch(0.62 0.12 305);
  --cat-6: oklch(0.62 0.15 10);

  --brand-mark-bg: var(--signal-bg); --brand-mark-fg: oklch(0.16 0.015 260);
  --brand-mark-shadow: 0 0 0 1px oklch(0.70 0.19 45 / .5), 0 4px 16px oklch(0.70 0.19 45 / .35);
  --avatar-bg: oklch(0.72 0.10 265 / .15); --avatar-fg: oklch(0.80 0.10 265);
  --count-bg: oklch(1 0 0 / .08); --count-fg: oklch(0.72 0.01 260);
  --input-bg: oklch(0.16 0.015 260); --kbd-bg: oklch(0.20 0.015 260); --kbd-shadow: inset 0 1px 0 oklch(1 0 0 / .05);
  --key-bg: oklch(1 0 0 / .06); --key-fg: oklch(0.72 0.01 260); --key-border: oklch(1 0 0 / .09); --key-on-accent-bg: oklch(0 0 0 / .25);
  --draft-bg: transparent; --draft-active-bg: oklch(0.23 0.018 260); --draft-active-shadow: inset 0 1px 0 oklch(1 0 0 / .05), 0 8px 24px oklch(0 0 0 / .5);
  --ai-bg: var(--moon-wash); --ai-border: var(--moon-line);
  --reply-bg: oklch(0.23 0.018 260); --reply-border: oklch(1 0 0 / .09);
  --btn-bg: oklch(0.23 0.018 260);
  --btn-primary-bg: var(--signal-bg); --btn-primary-fg: oklch(0.16 0.015 260); --btn-primary-border: var(--signal-bg);
  --btn-primary-hover: var(--signal-hover); --btn-primary-shadow: 0 0 0 1px oklch(0.70 0.19 45 / .4), 0 4px 20px oklch(0.70 0.19 45 / .3);

  --radius-sm: 8px; --radius: 8px; --radius-lg: 12px; --r-s: 8px; --r-l: 12px;
  --shadow-card: inset 0 1px 0 oklch(1 0 0 / .04), 0 1px 2px oklch(0 0 0 / .4);
  --shadow-pop: 0 16px 48px oklch(0 0 0 / .6), 0 0 0 1px oklch(1 0 0 / .06);
  --toast-bg: oklch(0.23 0.018 260); --toast-fg: oklch(0.93 0.005 260);
}

/* ------------------------------------------------------------------- BASE */
* { box-sizing: border-box; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  /* blueprint grid — the canvas texture (very low opacity; never behind dense data) */
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 24px 24px;
}
body.no-grid { background-image: none; }
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.display { font-family: var(--font-display); }
.micro { font-family: var(--font-display); font-variation-settings: 'wdth' 110; font-weight: 650; font-size: 10.5px;
  letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
kbd { font-family: var(--font-mono); font-size: 10px; line-height: 1; padding: 2px 5px; border: 1px solid var(--key-border);
  border-bottom-width: 2px; border-radius: 5px; color: var(--ink-3); background: var(--kbd-bg); box-shadow: var(--kbd-shadow); }
a { color: inherit; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 9999px; border: 2px solid transparent; background-clip: padding-box; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--signal-bg); outline-offset: 2px; border-radius: 6px;
}

/* ---------------------------------------------------------- shared shell
   Reused by every non-Triage screen so the whole app shares one sidebar/
   topbar with Triage (console.css owns the structural rules for these same
   class names — .sidebar/.nav-item/.topbar/etc. — this file only adds the
   generic scroll region + page-content wrapper). */
.content { flex: 1; overflow-y: auto; min-height: 0; }
.page { max-width: 1400px; margin: 0 auto; padding: 20px 24px 48px; }
.page-sm { max-width: 1000px; }
.page-md { max-width: 1100px; }
.page-lg { max-width: 1200px; }

/* breadcrumb — shared by every record/detail page (customer/call/lead) */
.crumb { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 14px; }
.crumb a { color: inherit; text-decoration: none; } .crumb a:hover { color: var(--ink); }
.crumb .ic { width: 13px; height: 13px; }

/* ---------------------------------------------------- generic components
   (chips/buttons/cards/table/kpi — used by both console.js and the
   Tailwind-utility interior pages, so the whole app draws from one sheet). */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.card-sm { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }

.chip { display: inline-flex; align-items: center; gap: 5px; font: 500 11.5px var(--font-mono); border: 1px solid var(--line-strong);
  border-radius: 6px; padding: 2px 8px; color: var(--ink-2); background: var(--panel); white-space: nowrap; line-height: 1.7; }
.chip .ic { width: 12px; height: 12px; }
.chip-ok { color: var(--ok-ink); border-color: color-mix(in oklch, var(--ok) 35%, transparent); background: var(--ok-weak); }
.chip-warn { color: var(--warn-ink); border-color: color-mix(in oklch, var(--warn) 40%, transparent); background: var(--warn-weak); }
.chip-bad { color: var(--bad-ink); border-color: color-mix(in oklch, var(--bad) 40%, transparent); background: var(--bad-weak); }
.chip-moon { color: var(--moon); border-color: var(--moon-line); background: var(--moon-wash); }
.chip-pt { color: var(--pt-fg); background: var(--pt-bg); border-color: transparent; font-weight: 600; }
.chip-neutral { color: var(--ink-2); background: var(--sunken); border-color: var(--line); }
.chip-click { cursor: pointer; } .chip-click:hover { border-color: var(--moon); }

.btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px; border-radius: var(--radius);
  font: 600 13px var(--font-body); color: var(--ink); background: var(--btn-bg); border: 1px solid var(--line-strong);
  cursor: pointer; transition: background .12s, box-shadow .12s; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn .ic { width: 15px; height: 15px; }
.btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-fg); border-color: var(--btn-primary-border); box-shadow: var(--btn-primary-shadow); }
.btn-primary:hover { background: var(--btn-primary-hover); }
.btn-danger { color: var(--bad-ink); border-color: var(--bad-border); }
.btn-danger:hover { background: var(--bad-weak); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--hover); }
.btn-quiet:hover { background: var(--btn-bg); border-color: var(--signal); color: var(--signal); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 16px 14px;
  cursor: pointer; transition: border-color .12s, transform .12s; text-decoration: none; display: block; color: inherit; }
.kpi:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.kpi .lbl { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 7px; margin-bottom: 9px; }
.kpi .num { font: 650 28px/1 var(--font-mono); letter-spacing: -.02em; }
.kpi .why { font-size: 12px; color: var(--ink-2); margin-top: 8px; line-height: 1.5; }
.kpi .why b { color: var(--ink); }
.kpi .go { float: right; font: 500 10.5px var(--font-mono); color: var(--ink-3); }
.kpi:hover .go { color: var(--signal); }
.kpi.moon { background: linear-gradient(180deg, var(--moon-wash), var(--panel) 70%); border-color: var(--moon-line); }
.kpi.moon .num { color: var(--moon); }
.kpi.risk .num { color: var(--bad-ink); }
.kpi.risk { border-color: var(--bad-border); }

.tbl { font-variant-numeric: tabular-nums; width: 100%; font-size: 13px; }
.tbl th { font-weight: 600; color: var(--ink-3); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--sunken); }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background-color .1s ease; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover { background: var(--hover); }

.toast-el { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--toast-bg); color: var(--toast-fg); border-radius: var(--radius); padding: 11px 16px; font-size: 13px;
  font-weight: 500; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-pop);
  transition: opacity .25s, transform .3s cubic-bezier(.2,.9,.3,1.1); z-index: 80; }
.toast-el.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-el .undo { color: var(--signal); font-weight: 700; cursor: pointer; }
.toast-el .cd { font: 500 11px var(--font-mono); opacity: .6; }

/* ============================================================================
   v4 §12 additions — Orders/Products/Dashboard's new shared components.
   Every value below is an existing token (OKLCH custom property already
   defined in :root/[data-theme] above) — no raw hex anywhere in this block.
   One-orange rule: NONE of these five components uses --signal/--signal-bg/
   --accent — active/selected states read in neutral ink, AI-authorship reads
   in moonlight (--moon family, same as triage), warnings read in --warn
   (amber, a distinct pre-existing hue from signal orange), never orange. ===*/

/* ---------- .subnav — the shared subscreen tab strip (§2). A generalized,
   SEPARATE component from CRM's own .lensbar/.lens-btn (crm.html's markup/
   CSS/behavior is untouched) — underline tabs rather than filled pills, so
   the two families read as related but visually distinct. Rendered by
   SZ.subnav(), wired by SZ.wireSubnav() (see app.js). */
.subnav { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.subnav-tab { display: inline-flex; align-items: center; gap: 6px; border: none; background: none; padding: 9px 3px; margin-right: 20px;
  font: 500 13px var(--font-body); color: var(--ink-3); cursor: pointer; position: relative; white-space: nowrap; }
.subnav-tab:hover { color: var(--ink); }
.subnav-tab:last-child { margin-right: 0; }
.subnav-tab::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: transparent; transition: background .12s; }
.subnav-tab.on { color: var(--ink); font-weight: 600; }
.subnav-tab.on::after { background: var(--ink); }
.subnav-count { font: 600 11px var(--font-mono); color: var(--ink-3); background: var(--sunken); border-radius: 9999px; padding: 1px 7px; }
.subnav-tab.on .subnav-count { color: var(--ink); background: var(--line); }
@media (max-width: 640px) { .subnav-tab { margin-right: 12px; font-size: 12.5px; } }

/* ---------- .chip-prov — order provenance chip (§6 Orders Fulfillment
   cards): "AI phone · 2:14 AM" vs "Rich · counter". Use WITH the base .chip
   class, same convention as chip-ok/chip-warn/chip-moon/chip-neutral:
     <span class="chip chip-prov-ai"><i data-lucide="phone" class="ic"></i>AI phone · 2:14 AM</span>
     <span class="chip chip-prov-staff"><i data-lucide="user" class="ic"></i>Rich · counter</span>
   Deliberately the identical recipe as chip-moon/chip-neutral above (reusing
   triage's own moonlight variables exactly, per spec) — given its own
   provenance-specific name so orders.html's markup self-documents what the
   chip means without a reader having to trace back to chip-moon's triage
   origin. Not a visual fork, just a clearer name at the call site. */
.chip-prov-ai { color: var(--moon); border-color: var(--moon-line); background: var(--moon-wash); }
.chip-prov-staff { color: var(--ink-2); border-color: var(--line); background: var(--sunken); }

/* ---------- .chip-prov-clickable — v8 "Wired In" Builder B: clickable-
   provenance affordance. Add alongside chip-prov-ai/chip-moon (never
   chip-prov-staff/other neutral chips — there's no machine inbound behind a
   human counter sale to reveal). Pair with role="button" tabindex="0" +
   Enter/Space wiring at the call site; this class only supplies the visual
   affordance — cursor + a hover underline. Deliberately NOT reusing the
   existing generic .chip-click (cursor + hover border→moon, above/elsewhere
   in this file): that reads fine on a neutral/tone chip whose rest border
   ISN'T already moon, but chip-prov-ai's border is ALREADY --moon-line at
   rest, so the same hover trick barely moves — too subtle to "read as
   clickable" on this specific chip. An underline reads unambiguously as a
   link regardless of the chip's base color. Focus ring is free from the
   shared [tabindex]:focus-visible rule near the top of this file — nothing
   new needed for keyboard focus. */
.chip-prov-clickable { cursor: pointer; }
.chip-prov-clickable:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- .agenda-strip — Dashboard's owner-agenda row (§9), under the
   morning greeting. Quiet chips only (never orange, never alarming) — type
   icon + text + an optional trailing "→" for items with an href. Wraps at
   narrow widths, no horizontal scroll. Works as either <a> (has an href) or
   <span> (the AR one-liner has none) — no tag-specific styling. */
.agenda-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 18px; }
.agenda-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 9999px;
  border: 1px solid var(--line); background: var(--panel); font-size: 12.5px; color: var(--ink-2); text-decoration: none; }
a.agenda-chip:hover { border-color: var(--line-strong); background: var(--hover); }
.agenda-chip .ic { width: 13px; height: 13px; color: var(--ink-4); flex-shrink: 0; }
.agenda-chip .go { color: var(--ink-4); font-size: 11px; margin-left: 1px; }

/* ---------- .pop — "explain-this" popover (§9 Dashboard KPIs/sections,
   reusable anywhere). Hairline border + the EXISTING --shadow-pop token
   (same soft shadow as .why-pop/.cmdk-panel/.sheet in console.css — reused,
   not reinvented), max-width 280px, 120ms fade + 2px rise, honors
   prefers-reduced-motion. Presentation-only: SZ.wirePop(trigger, popEl) in
   app.js is the optional Esc/outside-click/blur dismiss wiring; a page can
   hand-wire its own instead (same split as subnav render vs. wireSubnav). */
.pop { position: absolute; z-index: 45; max-width: 280px; background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 12px 14px; font-size: 12.5px; line-height: 1.55; color: var(--ink-2);
  opacity: 0; transform: translateY(2px); pointer-events: none; transition: opacity .12s ease, transform .12s ease; }
.pop.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.pop b, .pop strong { color: var(--ink); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .pop { transition: opacity .01s !important; transform: none !important; } }

/* ---------- .spark — inline 8-week sales sparkline (§7 Products & Pricing
   Catalog tab), a ~72×20 container for an inline SVG polyline the page draws
   from product.weekly[] (no fetch, no chart library). Mono ink stroke by
   default; .spark.warn switches to --warn (amber — a distinct pre-existing
   hue from signal orange, the same "watch this" amber used everywhere else)
   when the SKU is projecting out soon. */
.spark { display: inline-block; width: 72px; height: 20px; vertical-align: middle; }
.spark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.spark polyline { fill: none; stroke: var(--ink-3); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.spark.warn polyline { stroke: var(--warn); }

/* ------------------------------------------------------------------ MOTION
   Named per the design plan §2. All gated behind prefers-reduced-motion. */
@keyframes sz-print { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sz-print { animation: sz-print .32s ease-out both; }

@keyframes sz-advance-out { to { opacity: 0; transform: translateX(-16px); } }
@keyframes sz-advance-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.sz-advance-out { animation: sz-advance-out .18s ease-in both; }
.sz-advance-in { animation: sz-advance-in .22s cubic-bezier(.2,.9,.3,1.1) both; }

@keyframes sz-slip-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.sz-slip { animation: sz-slip-pulse 1.8s ease-in-out 2; }

/* v6 §F — the `.rise` class rule that used to live here (animation: sz-rise
   .3s ...) was dead code: console.css defines its own `.rise` (sz-rise .28s)
   at identical specificity, and console.css loads AFTER this file on every
   page, so its copy always won the cascade — this one never took effect
   anywhere (v6-findings #68). Deleted; the sz-rise keyframes stay defined
   here since console.css's surviving rule (and the reduced-motion override
   below, which still lists .rise on purpose) both depend on it. */
@keyframes sz-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@keyframes sz-steam {
  0% { transform: translateY(0) scaleX(1); opacity: .55; }
  50% { transform: translateY(-9px) scaleX(1.15); opacity: .28; }
  100% { transform: translateY(-18px) scaleX(0.9); opacity: 0; }
}
.sz-steam { animation: sz-steam 2.6s ease-in-out infinite; }
.sz-steam:nth-child(2) { animation-delay: .5s; }
.sz-steam:nth-child(3) { animation-delay: 1s; }

@keyframes sz-pulse-dot { 50% { opacity: .35; } }
.sz-pulse { animation: sz-pulse-dot 2s infinite; }

/* Sunrise (moonlight → paper on approve) is a plain transition, not a keyframe —
   see .blk.ai-auth / .f in console.css: transition: background .5s ease, border-color .5s ease */

@media (prefers-reduced-motion: reduce) {
  .sz-print, .sz-advance-out, .sz-advance-in, .sz-slip, .rise, .sz-steam, .sz-pulse { animation: none !important; opacity: 1 !important; transform: none !important; }
  .toast-el { transition: opacity .01s !important; }
  * { scroll-behavior: auto !important; }
}

/* ============================================================================
   v8 "Wired In" — Foundation CSS (fableui/17-connections-v8.md). Two blocks:
   (1) hub-and-spoke + node-card, scaffolded for Builder A's connections.html;
   (2) the couple of SZ.showInbound body shapes with no existing home (email
   card / plain field list / honest-fallback note — app.js). Both are
   token-driven only (existing OKLCH vars, no new hardcoded colors) — quiet
   node cards, moonlight for AI/system flow accents, never --signal. ========*/

/* ---------- (1) hub-and-spoke — the Connections screen's centerpiece ------
   3-column CSS grid: [IN column] [center app node] [OUT column]. Each node
   is a plain quiet card (same --panel/--line/--shadow-card recipe as every
   other card in the app); a short hairline "stub" on each node's center-
   facing edge + a vertical spine in the middle column read as "hub and
   spoke" without any JS-computed SVG coordinates. Builder A: wire each
   .hub-node as a <button> (opens a slide-over — reuse SZ.showInbound for the
   phone/email/whatsapp nodes; author your own small payload for vendor-api/
   quickbooks, which aren't "records" with provenance elsewhere) and join
   SEED.connections (id/icon/label/side) with SZ.connectionCounts() for the
   live status line. Page-scoped sizing (e.g. the exact center-node
   dimensions) belongs in connections.html's own <style>, same convention
   orders.html's board/kpis already follow. */
/* v8 QA fix — align-items: stretch (was center). With `center`, a CSS grid
   shrink-to-fits each column to its OWN content height first, then centers
   that shorter box within the row — so hub-col-out (3 nodes) and hub-center
   (one small card) floated mid-row while hub-col-in (5 nodes, the tallest)
   set the row height, leaving OUT's top node ~84px below IN's top node and
   a slab of dead space at the row's bottom. `stretch` makes every column's
   box fill the full row height instead; hub-col's flex-start default then
   top-aligns IN/OUT's nodes to the same edge (a coherent grid, not a
   floating shorter list), and hub-center's own internal
   align-items:center/min-height:100% (unchanged) now centers the SZ card
   within that FULL height — a true hub-in-the-middle, not a hub in the
   middle of empty space. Zero effect at the ≤1080px stacked breakpoint
   below (each column is alone in its own auto-height row there either way). */
.hub { display: grid; grid-template-columns: 1fr auto 1fr; column-gap: 40px; row-gap: 24px; align-items: stretch; padding: 8px 0 24px; }
.hub-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.hub-center { position: relative; display: flex; align-items: center; justify-content: center; min-height: 100%; }
.hub-center-node { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
  padding: 22px 28px; text-align: center; }
.hub-center-mark { width: 40px; height: 40px; border-radius: 10px; background: var(--brand-mark-bg); color: var(--brand-mark-fg);
  display: flex; align-items: center; justify-content: center; font: 700 15px var(--font-display); box-shadow: var(--brand-mark-shadow); }
.hub-center-name { font: 650 14px var(--font-display); color: var(--ink); }
.hub-center-sub { font-size: 11.5px; color: var(--ink-3); max-width: 170px; }

/* the vertical spine behind the center node, visually collecting every
   column's stub connector (below) into one hub */
.hub-spine { position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: var(--line-strong); transform: translateX(-50%); z-index: 1; }

.hub-node { position: relative; display: flex; align-items: center; gap: 11px; width: 100%; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  text-decoration: none; color: inherit; cursor: pointer; font-family: var(--font-body); text-align: left;
  transition: border-color .12s, transform .12s; }
.hub-node:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.hub-node-icon { flex-shrink: 0; width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: var(--moon-wash); color: var(--moon); }
.hub-node-icon .ic { width: 16px; height: 16px; }
.hub-node-body { min-width: 0; flex: 1; }
.hub-node-label { font-size: 13px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.hub-node-status { margin-top: 2px; font: 500 11.5px var(--font-mono); color: var(--ink-3); }
.hub-node-go { flex-shrink: 0; font: 500 10.5px var(--font-mono); color: var(--ink-4); }
.hub-node:hover .hub-node-go { color: var(--moon); }

/* live dot — shape/color only; reuses the EXISTING .sz-pulse keyframe above
   (already reduced-motion gated in the block at the top of this section) —
   zero new animation needed. */
.hub-live-dot { flex-shrink: 0; width: 6px; height: 6px; border-radius: 9999px; background: var(--ok); }

/* stub connectors — a short hairline from each node toward the center
   column; .hub-spine above visually "collects" them into one hub. */
.hub-col-in .hub-node::after { content: ''; position: absolute; top: 50%; right: -21px; width: 20px; height: 1px; background: var(--line-strong); }
.hub-col-out .hub-node::before { content: ''; position: absolute; top: 50%; left: -21px; width: 20px; height: 1px; background: var(--line-strong); }

/* flow shimmer — a small moonlight dot traveling along each stub, toward the
   center for IN nodes and away from it for OUT nodes. Opt-IN query (only
   exists when motion is explicitly fine) rather than an opt-out override —
   by default (query unmatched) there is zero animation, no separate
   kill-rule needed in the reduced-motion block above. */
@media (prefers-reduced-motion: no-preference) {
  .hub-flow-dot { position: absolute; top: 50%; width: 4px; height: 4px; margin-top: -2px; border-radius: 9999px; background: var(--moon); opacity: 0; }
  .hub-col-in .hub-flow-dot { right: -21px; animation: hub-flow-in 2.6s ease-in-out infinite; }
  .hub-col-out .hub-flow-dot { left: -21px; animation: hub-flow-out 2.6s ease-in-out infinite; }
  @keyframes hub-flow-in { 0% { right: -21px; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { right: 1px; opacity: 0; } }
  @keyframes hub-flow-out { 0% { left: -21px; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { left: 1px; opacity: 0; } }
}

/* narrow widths — collapse the 3-column hub into one stacked column; stub
   connectors/spine don't make sense stacked, so they're hidden. Same
   breakpoint the rest of the app already treats as "narrow" (products/orders
   board wrap at ≤1080). */
@media (max-width: 1080px) {
  .hub { grid-template-columns: 1fr; }
  .hub-spine { display: none; }
  .hub-col-in .hub-node::after, .hub-col-out .hub-node::before { display: none; }
  .hub-center { order: -1; padding-bottom: 8px; }
}

/* ---------- (2) SZ.showInbound body shapes with no existing home ----------
   The chrome (.overlay-scrim/.sheet/.sheet-head) and the two richest body
   shapes (.turn/.ts/.who/.pt/.en for a transcript; .photo-artifact/.photo-
   paper/.photo-hw/.photo-cap for a WhatsApp photo order) are ALL existing
   console.css classes, reused as-is — these few rules cover only the shapes
   that had no home: the who/when meta line, an email card, and a plain
   field list (web-form submissions / the honest lightweight-summary
   fallback). console.css is loaded on every page in this app already, so
   no new script/stylesheet include is needed anywhere for this to work. */
/* .sheet.inbound-sheet (compound, not .inbound-sheet alone) — console.css's
   own `.sheet { width: 380px }` loads AFTER this file on every page, so a
   single-class override here would lose a same-specificity, later-source-
   order tiebreak; the compound selector's higher specificity wins the width
   regardless of link order (same fix class as .order-modal/.po-modal, which
   dodge this by living in page-scoped <style> — later than both stylesheets
   — instead). */
.sheet.inbound-sheet { width: 420px; }
.inbound-meta { padding: 10px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inbound-body { padding: 4px 16px 14px; max-height: 50vh; overflow-y: auto; }
.inbound-email { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.inbound-email .subj { font-weight: 600; color: var(--ink); font-size: 13px; margin-bottom: 6px; }
.inbound-email .body { font-size: 13px; color: var(--ink-2); white-space: pre-line; line-height: 1.55; }
.inbound-fields { display: flex; flex-direction: column; gap: 8px; }
.inbound-fields .row { display: flex; gap: 8px; font-size: 13px; }
.inbound-fields .row .k { color: var(--ink-3); min-width: 92px; flex-shrink: 0; }
.inbound-fields .row .v { color: var(--ink); }
.inbound-note { font-size: 12.5px; color: var(--ink-3); line-height: 1.55; padding: 10px 2px 4px; }
.inbound-link { display: block; padding: 10px 16px; border-top: 1px solid var(--line); font: 600 12.5px var(--font-body); color: var(--accent-ink); text-decoration: none; }
.inbound-link:hover { text-decoration: underline; }
@media (max-width: 480px) { .sheet.inbound-sheet { width: calc(100vw - 32px); } }
