/* --- css/ds/tokens.css --- */
/* analyst/static/css/ds/tokens.css — GENERATED from analyst/tools/design/tokens.json by
   analyst/tools/design/build_tokens.py. Do not edit: change tokens.json and rebuild. */

:root, :root[data-theme="light"] {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --border: #e4e4e7;
  --border-control: #8b8b94;
  --text: #3f3f46;
  --text-strong: #18181b;
  --text-muted: #63636b;
  --accent: #cc0047;
  --accent-fill: #e60050;
  --accent-fill-hover: #c40044;
  --on-accent: #ffffff;
  --info: #1d4ed8;
  --info-soft: #e8effd;
  --ok: #137333;
  --ok-soft: #e7f6ec;
  --warn: #a15c00;
  --warn-soft: #fdf3dc;
  --danger: #b91c1c;
  --danger-soft: #fdeaea;
  --danger-fill: #b91c1c;
  --scrim: rgba(9, 9, 11, 0.45);
  --chart-1: #3f3f46;
  --chart-2: #2563eb;
  --chart-3: #0f766e;
  --chart-4: #b45309;
  --chart-5: #a1a1aa;
  --dmg-surface: #d97706;
  --dmg-rust: #a8550f;
  --dmg-deform: #7c3aed;
  --dmg-break: #dc2626;
  --dmg-glass: #2563eb;
  --dmg-missing: #db2777;
  --dmg-tyre: #0d9488;
  --dmg-other: #52525b;
  --dmg-halo: #ffffff;
  --dmg-on: #ffffff;
  --shadow-pop: 0 8px 24px rgba(24, 24, 27, 0.12);
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Noto Sans Devanagari", "Nirmala UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 999px;
  --control-h: 36px;
  --control-h-sm: 28px;
  --touch-h: 44px;
  --touch-h-lg: 48px;
  --row-h: 44px;
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 64px;
  --appbar-h: 56px;
  --tabbar-h: 64px;
  --page-max: 1920px;
  --page-reading-max: 1040px;
  --z-sticky: 10;
  --z-nav: 96;
  --z-popover: 400;
  --z-dialog: 500;
  --z-toast: 10500;
  --bp-phone: 768px;
  --bp-tablet: 1024px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111113;
  --surface: #18181b;
  --surface-2: #222226;
  --border: #2c2c31;
  --border-control: #6e6e78;
  --text: #d4d4d8;
  --text-strong: #fafafa;
  --text-muted: #a1a1aa;
  --accent: #ff4d8d;
  --info: #93b4ff;
  --info-soft: #172340;
  --ok: #4ade80;
  --ok-soft: #10291a;
  --warn: #fbbf24;
  --warn-soft: #33260a;
  --danger: #f87171;
  --danger-soft: #3a1515;
  --danger-fill: #dc2626;
  --scrim: rgba(0, 0, 0, 0.6);
  --chart-1: #d4d4d8;
  --chart-2: #60a5fa;
  --chart-3: #2dd4bf;
  --chart-4: #fbbf24;
  --chart-5: #71717a;
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.45);
}
/* --- css/ds/components.css --- */
/* Fluxe design system - components (fx-*). One source for every visual decision; pages add layout only.
   Values come from tokens.css (generated from tokens.json). Breakpoints: 768px (phone), 1024px (tablet). */

/* ── Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-sans); font-size: 14px; line-height: 20px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Headings and regions get focus from code only (a new step or panel, so screen readers announce it);
   nobody tabs to them, so they show no ring (CA-238). Buttons and tabs with tabindex="-1" keep theirs. */
:is(h1, h2, h3, h4, h5, h6, section, article, main, [role="region"])[tabindex="-1"]:focus-visible { outline: none; }
.fx-num { font-variant-numeric: tabular-nums; }
.fx-muted { color: var(--text-muted); }
.fx-code { font-family: var(--font-mono); font-size: 13px; line-height: 18px; color: var(--text-strong); }
.fx-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.fx-link:hover { text-decoration: underline; }
.fx-icon { width: 16px; height: 16px; flex: none; }
.fx-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; }

/* design-exception: the global .hidden utility must beat every component's own display value */
.hidden { display: none !important; }

/* ── View changes ─────────────────────────────────────────────────────
   Content that appears on a tab, section or view switch fades in instead of flashing: .fx-view on a module's
   view containers, and every tab panel. Opacity only (a transform would move fixed dialogs inside a view).
   Page to page, the browser cross-fades while the shell (sidebar, top bar, tab bar) stays in place. */
@keyframes fx-view-in { from { opacity: 0; } to { opacity: 1; } }
.fx-view, [role="tabpanel"] { animation: fx-view-in .18s ease-out; }
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }
.fx-sidebar { view-transition-name: fx-sidebar; }
.fx-topbar { view-transition-name: fx-topbar; }
.fx-tabbar { view-transition-name: fx-tabbar; }
/* Page reveal (page_reveal.js, CA-500): page to page, the cross-fade is held on the previous page until the new one
   is complete. Without a view transition (first load, reload), the content - not the shell - stays transparent until
   it is complete, then fades in once. Nothing renders piece by piece in front of the user. */
html.fx-pending .fx-main > :not(.fx-topbar), html.fx-pending .fx-public-card { opacity: 0; }
html.fx-revealed .fx-main > :not(.fx-topbar), html.fx-revealed .fx-public-card { animation: fx-view-in .16s ease-out; }
/* Leaving a page: the click answers at once - the content gives way to a loading state, which the browser keeps on
   screen until the next page is complete. */
@keyframes fx-view-out { from { opacity: 1; } to { opacity: 0; } }
html.fx-leaving .fx-main > :not(.fx-topbar):not(.fx-page-loading) { animation: fx-view-out .12s ease-out forwards; }
.fx-page-loading { display: flex; justify-content: center; height: 0; overflow: visible; }
.fx-page-loading .fx-spinner { margin-top: 30vh; animation: fx-view-in .12s ease-out, fx-spin .8s linear infinite; }
/* CA-505: the held picture of the previous page is still, so the leaving spinner has its own view-transition name:
   the browser draws it apart and turns it on from the angle it had (the group keeps that angle), on the compositor -
   not held by page_reveal.js and not slowed by the new page's scripts. */
.fx-page-loading .fx-spinner { view-transition-name: fx-page-spinner; }
::view-transition-image-pair(fx-page-spinner) { animation: fx-spin .8s linear 4; }
/* The browser's fade of the spinner picture inherits the turn's timing (with repeats it would stay over the new page,
   without a fill it would come back at full opacity once faded): it gets its own - one short fade, played with the page
   cross-fade at the reveal, that keeps the picture hidden at its end. */
::view-transition-old(fx-page-spinner) { animation-duration: .16s; animation-iteration-count: 1; animation-timing-function: ease-out; animation-fill-mode: both; }

/* ── Button ───────────────────────────────────────────────────────── */
.fx-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: var(--control-h); padding: 0 var(--space-4); border: 1px solid var(--border-control); border-radius: var(--radius); background: var(--surface); color: var(--text-strong); font: 500 14px/20px var(--font-sans); white-space: nowrap; cursor: pointer; text-decoration: none; transition: background-color .15s ease-out, border-color .15s ease-out; }
.fx-btn:hover { background: var(--surface-2); }
.fx-btn:disabled, .fx-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.fx-btn--primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.fx-btn--primary:hover { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); }
.fx-btn--ghost { background: transparent; border-color: transparent; color: var(--text); }
.fx-btn--ghost:hover { background: var(--surface-2); color: var(--text-strong); }
.fx-btn--danger { color: var(--danger); border-color: var(--danger); background: var(--surface); }
.fx-btn--danger:hover { background: var(--danger-soft); }
.fx-btn--danger-solid { background: var(--danger-fill); border-color: var(--danger-fill); color: var(--on-accent); }
.fx-btn--sm { height: var(--control-h-sm); padding: 0 var(--space-3); font-size: 13px; line-height: 18px; }
.fx-btn--block { width: 100%; }

/* ── Icon button ──────────────────────────────────────────────────── */
.fx-icon-btn { display: inline-grid; place-items: center; flex: none; width: var(--control-h); height: var(--control-h); padding: 0; border: 0; border-radius: var(--radius); background: transparent; color: var(--text-muted); cursor: pointer; transition: background-color .15s ease-out, color .15s ease-out; }
.fx-icon-btn:hover { background: var(--surface-2); color: var(--text-strong); }
.fx-icon-btn--sm { width: var(--control-h-sm); height: var(--control-h-sm); }
.fx-icon-btn--outline { border: 1px solid var(--border-control); background: var(--surface); color: var(--text-strong); }
.fx-icon-btn--danger:hover { background: var(--danger-soft); color: var(--danger); }
.fx-icon-btn[aria-pressed="true"] { background: var(--surface-2); color: var(--text-strong); }

/* ── Field: label, control, hint, error ───────────────────────────── */
.fx-field { display: grid; gap: var(--space-1); min-width: 0; }
.fx-label { font: 500 13px/18px var(--font-sans); color: var(--text-strong); }
.fx-label .fx-opt { font-weight: 400; color: var(--text-muted); }
.fx-hint { font-size: 12px; line-height: 16px; color: var(--text-muted); }
.fx-error { display: flex; gap: var(--space-1); align-items: center; font-size: 12px; line-height: 16px; color: var(--danger); }
.fx-input, .fx-select, .fx-textarea { width: 100%; height: var(--control-h); padding: 0 var(--space-3); border: 1px solid var(--border-control); border-radius: var(--radius); background: var(--surface); color: var(--text-strong); font: 400 14px/20px var(--font-sans); transition: border-color .15s ease-out; }
.fx-input::placeholder, .fx-textarea::placeholder { color: var(--text-muted); }
.fx-input:hover, .fx-select:hover, .fx-textarea:hover { border-color: var(--text-muted); }
.fx-input:focus, .fx-select:focus, .fx-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.fx-input[aria-invalid="true"], .fx-select[aria-invalid="true"], .fx-textarea[aria-invalid="true"] { border-color: var(--danger); }
.fx-input:disabled, .fx-select:disabled, .fx-textarea:disabled { background: var(--surface-2); color: var(--text-muted); cursor: not-allowed; }
.fx-input[readonly], .fx-textarea[readonly] { background: var(--surface-2); color: var(--text-muted); }
.fx-input[readonly]:hover, .fx-textarea[readonly]:hover { border-color: var(--border-control); }
/* Masked value that is not a secret (model names in demos): text field, never type=password (CA-174). */
.fx-input--masked { -webkit-text-security: disc; }
.fx-textarea { height: auto; min-height: 88px; padding: var(--space-2) var(--space-3); resize: vertical; }
.fx-select { appearance: none; padding-right: var(--space-8); cursor: pointer; }
.fx-select-wrap { position: relative; display: block; }
.fx-select-wrap::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.fx-input-group { display: flex; align-items: center; gap: var(--space-2); }
.fx-form { display: grid; gap: var(--space-4); }
.fx-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); }

/* ── Choice: checkbox, radio, switch ──────────────────────────────── */
.fx-check { display: inline-flex; align-items: flex-start; gap: var(--space-2); color: var(--text-strong); cursor: pointer; }
.fx-check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent-fill); cursor: pointer; flex: none; }
.fx-check .fx-hint { display: block; }
.fx-switch { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--text-strong); cursor: pointer; }
.fx-switch input { appearance: none; position: relative; width: 32px; height: 20px; margin: 0; flex: none; border-radius: var(--radius-full); background: var(--border-control); cursor: pointer; transition: background-color .15s ease-out; }
.fx-switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: var(--radius-full); background: var(--surface); transition: transform .15s ease-out; }
.fx-switch input:checked { background: var(--accent-fill); }
.fx-switch input:checked::after { transform: translateX(12px); }
.fx-choices { display: grid; gap: var(--space-3); }

/* ── Segmented control ────────────────────────────────────────────── */
.fx-seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius); background: var(--surface-2); }
.fx-seg-opt { display: inline-flex; align-items: center; gap: var(--space-1); height: 28px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); font: 500 13px/18px var(--font-sans); cursor: pointer; }
.fx-seg-opt:hover { color: var(--text-strong); }
.fx-seg-opt[aria-pressed="true"], .fx-seg-opt[aria-checked="true"], .fx-seg-opt.active { background: var(--surface); color: var(--text-strong); box-shadow: 0 0 0 1px var(--border); }

/* ── Tabs ─────────────────────────────────────────────────────────── */
.fx-tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.fx-tab { display: inline-flex; align-items: center; gap: var(--space-2); height: 40px; margin-bottom: -1px; padding: 0 var(--space-3); border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-muted); font: 500 14px/20px var(--font-sans); white-space: nowrap; cursor: pointer; }
.fx-tab:hover { color: var(--text-strong); }
.fx-tab[aria-selected="true"] { color: var(--text-strong); border-bottom-color: var(--accent); }
/* Edge buttons added by core/fx_tabs.js when the strip overflows (CA-208): pinned inside the scroller. */
.fx-tabs-nav { position: sticky; z-index: 1; align-self: center; }
/* CA-502: the edge buttons fill the strip's height instead of setting it (a 44 px phone icon button grew the 40 px strip one frame after a switch). */
.fx-tabs > .fx-tabs-nav { height: auto; align-self: stretch; }
.fx-tabs-nav--prev { left: 0; order: -1; }
.fx-tabs-nav--next { right: 0; order: 1; margin-left: auto; }
.fx-tabs-nav[hidden] { display: none; }
.fx-tabs-nav[data-off] { visibility: hidden; }
.fx-tab .fx-count { min-width: 20px; height: 20px; padding: 0 var(--space-1); border-radius: var(--radius); background: var(--surface-2); color: var(--text-muted); font: 500 12px/20px var(--font-sans); text-align: center; }

/* ── Badge ────────────────────────────────────────────────────────── */
.fx-badge { display: inline-flex; align-items: center; gap: var(--space-1); height: 20px; padding: 0 var(--space-2); border-radius: var(--radius); background: var(--surface-2); color: var(--text); font: 500 12px/16px var(--font-sans); white-space: nowrap; }
.fx-badge--info { background: var(--info-soft); color: var(--info); }
/* Partner brand logo inline with text (CA-168, GT Estimate): sized to the surrounding line. */
.fx-brand-logo { display: inline-block; height: 1.15em; width: auto; vertical-align: -0.22em; }
.fx-badge .fx-brand-logo { height: 12px; vertical-align: middle; }
.fx-brand-logo--lg { height: 24px; vertical-align: middle; }
.fx-badge--ok { background: var(--ok-soft); color: var(--ok); }
.fx-badge--warn { background: var(--warn-soft); color: var(--warn); }
.fx-badge--danger { background: var(--danger-soft); color: var(--danger); }
.fx-badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: var(--radius-full); background: currentColor; }

/* ── Card ─────────────────────────────────────────────────────────── */
.fx-card { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.fx-card-hd { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5) 0; }
.fx-card-title { margin: 0; font: 600 16px/24px var(--font-sans); color: var(--text-strong); }
.fx-card-sub { margin: 0; font-size: 13px; line-height: 18px; color: var(--text-muted); }
.fx-card-bd { padding: var(--space-4) var(--space-5); }
.fx-card-ft { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border); }
.fx-kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: var(--space-2) var(--space-6); margin: 0; }
.fx-kv dt { color: var(--text-muted); }
.fx-kv dd { margin: 0; color: var(--text-strong); min-width: 0; overflow-wrap: anywhere; }

/* ── KPI tile ─────────────────────────────────────────────────────── */
.fx-kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-3); }
.fx-kpi { display: grid; gap: var(--space-1); align-content: start; padding: var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.fx-kpi-label { font: 500 13px/18px var(--font-sans); color: var(--text-muted); }
.fx-kpi-value { font: 600 24px/32px var(--font-sans); color: var(--text-strong); font-variant-numeric: tabular-nums; }
.fx-kpi-meta { display: flex; flex-wrap: wrap; min-width: 0; gap: var(--space-1); font-size: 12px; line-height: 16px; color: var(--text-muted); }
/* A source badge in a KPI footer may be longer than the card (long translations): wrap, never clip. */
.fx-kpi-meta .fx-badge { display: inline-block; white-space: normal; height: auto; max-width: 100%; padding-block: 2px; overflow-wrap: break-word; }
.fx-kpi-meta .is-up { color: var(--ok); font-weight: 500; }
.fx-kpi-meta .is-down { color: var(--danger); font-weight: 500; }

/* ── Data table (cards at phone width) ────────────────────────────── */
.fx-table-wrap { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow-x: auto; }
.fx-table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 18px; }
.fx-table th { position: sticky; top: 0; z-index: var(--z-sticky); height: 40px; padding: 0 var(--space-3); background: var(--surface); border-bottom: 1px solid var(--border); text-align: left; font: 500 12px/16px var(--font-sans); color: var(--text-muted); white-space: nowrap; }
.fx-table th[aria-sort] { cursor: pointer; }
.fx-table th[aria-sort]:hover { color: var(--text-strong); }
.fx-table td { height: var(--row-h); padding: 0 var(--space-3); border-bottom: 1px solid var(--border); color: var(--text); }
.fx-table tbody tr:last-child td { border-bottom: 0; }
.fx-table tbody tr:hover { background: var(--surface-2); }
.fx-table tbody tr[aria-selected="true"] { background: var(--surface-2); }
.fx-table .is-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fx-table .is-num .fx-hint { white-space: normal; }   /* the figure stays on one line, its detail line may wrap */
.fx-table .is-primary { color: var(--text-strong); font-weight: 500; }
.fx-table .is-sel { width: 40px; }
.fx-row-actions { display: flex; justify-content: flex-end; gap: var(--space-1); opacity: 0; transition: opacity .15s ease-out; }
.fx-table tbody tr:hover .fx-row-actions, .fx-row-actions:focus-within { opacity: 1; }
@media (hover: none) { .fx-row-actions { opacity: 1; } }

/* ── List ─────────────────────────────────────────────────────────── */
.fx-list { margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.fx-list-item { display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 52px; padding: var(--space-2) var(--space-4); border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text-strong); font: inherit; text-align: left; text-decoration: none; }
.fx-list > li:last-child > .fx-list-item, .fx-list > .fx-list-item:last-child { border-bottom: 0; }
a.fx-list-item, button.fx-list-item { cursor: pointer; }
a.fx-list-item:hover, button.fx-list-item:hover { background: var(--surface-2); }
.fx-list-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: var(--radius); background: var(--surface-2); color: var(--text-muted); }
.fx-list-text { display: grid; flex: 1; min-width: 0; }
.fx-list-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-list-sub { font-size: 13px; line-height: 18px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-list-end { display: flex; align-items: center; gap: var(--space-2); color: var(--text-muted); }
.fx-list-group { margin: var(--space-6) 0 var(--space-2); padding: 0 var(--space-1); font: 500 13px/18px var(--font-sans); color: var(--text-muted); }

/* ── Menu, popover, tooltip ───────────────────────────────────────── */
.fx-menu { min-width: 200px; padding: var(--space-1); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); z-index: var(--z-popover); }
.fx-menu-item { display: flex; align-items: center; gap: var(--space-2); width: 100%; height: 32px; padding: 0 var(--space-2); border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); font: 400 14px/20px var(--font-sans); text-align: left; text-decoration: none; cursor: pointer; }
.fx-menu-item:hover, .fx-menu-item:focus-visible { background: var(--surface-2); color: var(--text-strong); outline: none; }
.fx-menu-item .fx-icon { color: var(--text-muted); }
.fx-menu-item[aria-checked="true"] { color: var(--text-strong); font-weight: 500; }
.fx-menu-item--danger, .fx-menu-item--danger .fx-icon { color: var(--danger); }
.fx-menu-label { padding: var(--space-2) var(--space-2) var(--space-1); font-size: 12px; line-height: 16px; color: var(--text-muted); }
.fx-menu-sep { height: 1px; margin: var(--space-1) 0; background: var(--border); }
.fx-menu-item-end { display: inline-flex; align-items: center; margin-left: auto; color: var(--text-muted); }
.fx-menu-sub .fx-menu-item { padding-left: var(--space-8); }
.fx-popover { width: 320px; max-width: calc(100vw - 32px); padding: var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); z-index: var(--z-popover); }
.fx-tooltip { display: inline-block; max-width: 240px; padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm); background: var(--text-strong); color: var(--bg); font-size: 12px; line-height: 16px; z-index: var(--z-popover); }

/* ── Filter bar: search, Filters popover, chips ───────────────────── */
.fx-filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.fx-search { position: relative; flex: 0 1 280px; min-width: 160px; }
.fx-search .fx-input { padding-left: 36px; }
.fx-search .fx-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.fx-filter-count { min-width: 20px; height: 20px; padding: 0 var(--space-1); border-radius: var(--radius); background: var(--text-strong); color: var(--bg); font: 500 12px/20px var(--font-sans); text-align: center; }
.fx-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.fx-chip { display: inline-flex; align-items: center; gap: var(--space-1); height: 28px; padding: 0 var(--space-1) 0 var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: 13px; line-height: 18px; white-space: nowrap; }
.fx-chip b { font-weight: 500; color: var(--text-strong); }
.fx-chip .fx-icon-btn { width: 20px; height: 20px; }
.fx-filter-bar .fx-push { margin-left: auto; }

/* ── Page header and page ─────────────────────────────────────────── */
.fx-page { display: grid; gap: var(--space-6); width: 100%; max-width: var(--page-max); margin: 0 auto; padding: var(--space-6) var(--space-8) var(--space-12); }
/* Data-heavy pages (Admin): use the whole width on large screens so wide tables fit without scrolling sideways. */
.fx-page--reading { max-width: var(--page-reading-max); }   /* text pages; work pages use the full --page-max */
/* Split-layout drag handle (core/fx_resizer.js): sits on the right edge of the panel it resizes. Desktop only. */
.fx-resizer { position: absolute; top: 0; right: 0; bottom: 0; z-index: var(--z-sticky); width: var(--space-3); cursor: col-resize; touch-action: none; }
.fx-resizer::after { content: ""; position: absolute; top: var(--space-4); bottom: var(--space-4); left: 50%; width: 2px; border-radius: var(--radius-full); background: transparent; transform: translateX(-50%); transition: background-color .15s ease-out; }
.fx-resizer:hover::after, .fx-resizer:focus-visible::after, .is-resizing .fx-resizer::after { background: var(--accent); }
.fx-resizer:focus-visible { outline: none; }
.is-resizing { cursor: col-resize; user-select: none; }
.fx-page-hd { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4); }
.fx-page-hd-text { display: grid; gap: var(--space-1); min-width: 0; }
.fx-page-title { margin: 0; font: 600 20px/28px var(--font-sans); color: var(--text-strong); }
.fx-page-sub { margin: 0; color: var(--text-muted); }
.fx-page-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.fx-section { display: grid; gap: var(--space-3); }
.fx-section-title { margin: 0; font: 600 16px/24px var(--font-sans); color: var(--text-strong); }

/* ── Pager ────────────────────────────────────────────────────────── */
.fx-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); font-size: 13px; line-height: 18px; color: var(--text-muted); }
.fx-pager-nav { display: flex; align-items: center; gap: var(--space-1); }

/* ── Dialog (bottom sheet at phone width) ─────────────────────────── */
.fx-scrim { position: fixed; inset: 0; z-index: calc(var(--z-dialog) + var(--fx-layer, 0)); display: grid; place-items: center; padding: var(--space-4); background: var(--scrim); }
.fx-scrim--inline { position: static; inset: auto; z-index: auto; display: block; padding: 0; background: none; }   /* a dialog shown as page content (History page) */
.fx-scrim--inline > .fx-dialog { width: 100%; max-width: none; height: auto; max-height: none; box-shadow: none; animation: none; }
.fx-dialog { display: flex; flex-direction: column; width: min(520px, 100%); min-width: 0; max-height: calc(100vh - 64px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); }
.fx-dialog--sm { width: min(400px, 100%); }
.fx-dialog--lg { width: min(760px, 100%); }
.fx-dialog-hd { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-3) var(--space-3) var(--space-5); }
.fx-dialog-title { flex: 1; min-width: 0; margin: 0; font: 600 16px/24px var(--font-sans); color: var(--text-strong); }
.fx-dialog-bd { display: grid; gap: var(--space-4); padding: 0 var(--space-5) var(--space-5); overflow-y: auto; color: var(--text); }
.fx-dialog-bd p { margin: 0; }
.fx-dialog-ft { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border); }  /* CA-372: actions that do not fit on one line wrap inside the dialog */

/* ── Release notes (What's new) ───────────────────────────────────── */
.fx-release { border-bottom: 1px solid var(--border); }
.fx-release:last-child { border-bottom: 0; }
.fx-release > summary { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) 0; list-style: none; cursor: pointer; }
.fx-release > summary::-webkit-details-marker { display: none; }
.fx-release > summary > .fx-icon { color: var(--text-muted); transition: transform .15s ease-out; }
.fx-release[open] > summary > .fx-icon { transform: rotate(180deg); }
.fx-release-version { font-weight: 600; color: var(--text-strong); }
.fx-release-date { margin-left: auto; font-size: 13px; line-height: 18px; color: var(--text-muted); }
.fx-release-body { display: grid; gap: var(--space-4); padding: 0 0 var(--space-4); }
.fx-release-group { margin: 0 0 var(--space-1); font: 500 13px/18px var(--font-sans); color: var(--text-muted); }
.fx-release-list { display: grid; gap: var(--space-2); margin: 0; padding-left: var(--space-5); color: var(--text); }
.fx-release-body-wrap { gap: 0; }
.fx-release-module { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) 0; list-style: none; cursor: pointer; font: 600 14px/20px var(--font-sans); color: var(--text-strong); }
.fx-release-module::-webkit-details-marker { display: none; }
.fx-release-module .fx-icon { color: var(--text-muted); }
.fx-release-module > .fx-icon:last-child { margin-left: auto; transition: transform .15s ease-out; }
.fx-release-mod:not([open]) > .fx-release-module > .fx-icon:last-child { transform: rotate(-90deg); }
.fx-release-count { font-size: 13px; font-weight: 400; color: var(--text-muted); }
.fx-release-mod-bd { display: grid; gap: var(--space-3); padding: var(--space-1) 0 0 calc(16px + var(--space-2)); }
.fx-release-type { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.fx-release-type--add { color: var(--ok); }
.fx-release-type--improve { color: var(--info); }
.fx-release-type--fix { color: var(--warn); }
.fx-release-type--remove { color: var(--danger); }

/* ── Toast ────────────────────────────────────────────────────────── */
.fx-toasts { position: fixed; right: var(--space-6); bottom: var(--space-6); z-index: var(--z-toast); display: grid; gap: var(--space-2); }
.fx-toast { display: flex; align-items: center; gap: var(--space-3); width: min(420px, calc(100vw - 32px)); padding: var(--space-3) var(--space-2) var(--space-3) var(--space-4); border-radius: var(--radius-lg); background: var(--text-strong); color: var(--bg); box-shadow: var(--shadow-pop); }
.fx-toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.fx-toast-action { padding: 0 var(--space-2); border: 0; background: none; color: inherit; font: 600 14px/20px var(--font-sans); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.fx-toast .fx-icon-btn { color: inherit; opacity: .7; }
.fx-toast .fx-icon-btn:hover { background: none; color: inherit; opacity: 1; }

/* ── Banner (inline message) ──────────────────────────────────────── */
.fx-banner { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); background: var(--info-soft); color: var(--text-strong); }
.fx-banner > .fx-icon { margin-top: 2px; color: var(--info); }
.fx-banner-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.fx-banner-text b { font-weight: 600; }
.fx-banner--ok { background: var(--ok-soft); } .fx-banner--ok > .fx-icon { color: var(--ok); }
.fx-banner--warn { background: var(--warn-soft); } .fx-banner--warn > .fx-icon { color: var(--warn); }
.fx-banner--danger { background: var(--danger-soft); } .fx-banner--danger > .fx-icon { color: var(--danger); }
/* Floating status banner in the toast stack (CA-69 connection status). */
.fx-banner--float { width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow-pop); }

/* ── State: empty, loading, error ─────────────────────────────────── */
.fx-state { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-12) var(--space-6); text-align: center; color: var(--text-muted); }
.fx-state-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-full); background: var(--surface-2); color: var(--text-muted); }
.fx-state--error .fx-state-icon { background: var(--danger-soft); color: var(--danger); }
.fx-state-title { margin: 0; font: 600 16px/24px var(--font-sans); color: var(--text-strong); }
.fx-state-text { margin: 0; max-width: 44ch; }
.fx-state .fx-btn { margin-top: var(--space-2); }
.fx-spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--text-strong); border-radius: var(--radius-full); animation: fx-spin .8s linear infinite; }
.fx-skeleton { height: 12px; border-radius: var(--radius-sm); background: var(--surface-2); animation: fx-pulse 1.4s ease-in-out infinite; }
@keyframes fx-spin { to { transform: rotate(360deg); } }
@keyframes fx-pulse { 50% { opacity: .5; } }

/* ── Progress and steps ───────────────────────────────────────────── */
.fx-progress { height: 4px; border-radius: var(--radius-full); background: var(--surface-2); overflow: hidden; }
.fx-progress > span { display: block; width: var(--value, 0%); height: 100%; background: var(--text-strong); transition: width .2s ease-out; }
.fx-steps { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; padding: 0; list-style: none; counter-reset: fx-step; }
.fx-step { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--text-muted); font: 500 13px/18px var(--font-sans); counter-increment: fx-step; }
.fx-step::before { content: counter(fx-step); display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--border-control); border-radius: var(--radius-full); font-size: 12px; line-height: 16px; }
.fx-step:not(:last-child)::after { content: ""; width: 24px; height: 1px; background: var(--border-control); }
.fx-step[aria-current="step"] { color: var(--text-strong); }
.fx-step[aria-current="step"]::before { background: var(--text-strong); border-color: var(--text-strong); color: var(--bg); }
.fx-step.is-done { color: var(--text); }
.fx-step.is-done::before { content: "\2713"; background: var(--ok-soft); border-color: var(--ok-soft); color: var(--ok); }

/* ── Avatar ───────────────────────────────────────────────────────── */
.fx-avatar { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: var(--radius-full); background: var(--surface-2); color: var(--text-strong); font: 600 12px/16px var(--font-sans); }

/* ── App shell: sidebar + top bar ─────────────────────────────────── */
.fx-app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; background: var(--bg); }
.fx-sidebar { position: sticky; top: 0; z-index: var(--z-nav); display: flex; flex-direction: column; height: 100vh; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; }
.fx-sidebar-brand { display: flex; flex-shrink: 0; align-items: center; height: var(--appbar-h); padding: 0 var(--space-5); border-bottom: 1px solid var(--border); }
.fx-sidebar-brand img { display: block; height: 22px; width: auto; }
.fx-sidebar-brand .fx-logo-dark { display: none; }
[data-theme="dark"] .fx-sidebar-brand .fx-logo-light { display: none; }
[data-theme="dark"] .fx-sidebar-brand .fx-logo-dark { display: block; }
/* The menu scrolls on its own between the logo and the account card, so a long menu (every Admin
   group open) never pushes the card off screen (CA-237). align-content keeps rows from stretching. */
.fx-nav { display: grid; flex: 1 1 auto; align-content: start; gap: 2px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--space-3) var(--space-2); }
.fx-nav-group { padding: var(--space-4) var(--space-3) var(--space-1); font: 500 12px/16px var(--font-sans); color: var(--text-muted); }
.fx-nav-item { position: relative; display: flex; align-items: center; gap: var(--space-3); height: 36px; padding: 0 var(--space-2) 0 var(--space-3); border-radius: var(--radius); color: var(--text); font: 500 14px/20px var(--font-sans); text-decoration: none; white-space: nowrap; }
.fx-nav-item .fx-icon { color: var(--text-muted); }
.fx-nav-item:hover { background: var(--surface-2); color: var(--text-strong); }
.fx-nav-item[aria-current="page"], .fx-nav-item.is-active { background: var(--surface-2); color: var(--accent); }
.fx-nav-item[aria-current="page"] .fx-icon, .fx-nav-item.is-active .fx-icon { color: var(--accent); }
.fx-nav-item[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: var(--radius-full); background: var(--accent); }
.fx-nav-item.is-open { color: var(--text-strong); }
.fx-nav-item.is-open .fx-icon { color: var(--text-strong); }
.fx-nav-sub { display: grid; gap: 2px; padding: 2px 0 var(--space-1) 40px; }
.fx-nav-sub .fx-nav-item { height: 32px; padding-left: var(--space-3); font-weight: 400; }
.fx-nav-sub .fx-nav-item[aria-current="page"]::before { content: none; }   /* a section is marked by its fill and colour; the bar is for the areas */
.fx-nav-item .fx-badge { margin-left: auto; }
button.fx-nav-item { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; }
.fx-nav-sub--admin { padding-left: var(--space-2); min-width: 0; grid-template-columns: minmax(0, 1fr); }
.fx-nav-search { flex: none; width: 100%; min-width: 0; margin-bottom: var(--space-2); }
.fx-nav-search .fx-input { width: 100%; min-width: 0; }   /* the input's intrinsic width must not push past the sidebar */
.fx-nav-scope { margin-top: var(--space-3); padding: var(--space-3) var(--space-3) var(--space-1); border-top: 1px solid var(--border); font: 500 12px/16px var(--font-sans); color: var(--text-muted); }
.fx-nav-search + .fx-nav-scope { margin-top: 0; border-top: 0; }
.fx-nav-block { display: grid; gap: 2px; }
.fx-nav-disclosure { display: flex; align-items: center; gap: var(--space-3); width: 100%; height: 36px; padding: 0 var(--space-2) 0 var(--space-3); border: 0; border-radius: var(--radius); background: none; color: var(--text-strong); font: 500 14px/20px var(--font-sans); text-align: left; cursor: pointer; }
.fx-nav-disclosure:hover { background: var(--surface-2); }
.fx-nav-disclosure:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.fx-nav-disclosure > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-nav-disclosure .fx-icon { color: var(--text-muted); }
.fx-nav-disclosure > .fx-icon:last-child { transition: transform .15s ease-out; }
.fx-nav-disclosure[aria-expanded="true"] > .fx-icon:last-child { transform: rotate(180deg); }
.fx-nav-block-bd { display: grid; gap: 2px; padding-left: var(--space-6); }
.fx-nav-block-bd .fx-nav-item { height: 32px; padding-left: var(--space-3); font-weight: 400; }
.fx-nav-block-bd .fx-nav-item[aria-current="page"]::before { content: none; }
.fx-nav-empty { margin: 0; padding: var(--space-3); color: var(--text-muted); font: 400 14px/20px var(--font-sans); }
.fx-sidebar-foot { flex-shrink: 0; margin-top: auto; padding: var(--space-2); border-top: 1px solid var(--border); }
.fx-account { display: flex; align-items: center; gap: var(--space-3); width: 100%; padding: var(--space-2); border: 0; border-radius: var(--radius); background: none; color: var(--text-strong); font: inherit; text-align: left; cursor: pointer; }
.fx-account:hover { background: var(--surface-2); }
.fx-account-text { display: grid; flex: 1; min-width: 0; }
.fx-account-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-account-org { font-size: 12px; line-height: 16px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-main { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }
.fx-sidebar-foot { position: relative; }
.fx-account-menu { position: absolute; left: var(--space-2); bottom: calc(100% + var(--space-1)); width: 240px; }
.fx-topbar-actions { position: relative; display: flex; align-items: center; gap: var(--space-1); }
.fx-topbar-actions > .fx-icon-btn { position: relative; }
.fx-topbar-pop { position: absolute; right: 0; top: calc(100% + var(--space-1)); width: 360px; max-width: calc(100vw - 32px); max-height: 70vh; overflow-y: auto; padding: 0; }
.fx-count-dot { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 var(--space-1); border-radius: var(--radius-full); background: var(--text-strong); color: var(--bg); font: 600 12px/16px var(--font-sans); text-align: center; }
/* CA-502: flex: none - inside the fixed-height .fx-main scroller a tall page squeezed the bar (56 -> 37 px) and the breadcrumbs jumped on every in-page switch. */
.fx-topbar { position: sticky; top: 0; z-index: var(--z-nav); flex: none; display: flex; align-items: center; gap: var(--space-2); height: var(--appbar-h); padding: 0 var(--space-6); background: var(--bg); border-bottom: 1px solid var(--border); }
.fx-crumbs { display: flex; align-items: center; gap: var(--space-2); flex: 1; min-width: 0; margin: 0; padding: 0; list-style: none; color: var(--text-muted); white-space: nowrap; overflow: hidden; }
.fx-crumbs a { color: var(--text-muted); text-decoration: none; }
.fx-crumbs a:hover { color: var(--text-strong); }
.fx-crumbs li + li::before { content: "/"; margin-right: var(--space-2); color: var(--border-control); }
.fx-crumbs [aria-current="page"] { color: var(--text-strong); font-weight: 500; }
.fx-dot { position: relative; }
.fx-dot::after { content: ""; position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border: 2px solid var(--bg); border-radius: var(--radius-full); background: var(--accent); }

.fx-avatar img { width: 100%; height: 100%; border-radius: var(--radius-full); object-fit: cover; }
.fx-avatar .fx-icon { color: var(--text-muted); }
html:not(.is-admin) .fx-only-admin { display: none; }
.fx-notif-hd { display: flex; align-items: center; gap: var(--space-1); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4); border-bottom: 1px solid var(--border); }
.fx-notif-hd .fx-section-title { flex: 1; min-width: 0; }
.fx-notif-body .fx-state { padding: var(--space-8) var(--space-4); }
.fx-notif-item { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-2) var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.fx-notif-item:last-child { border-bottom: 0; }
.fx-notif-item:hover { background: var(--surface-2); }
.fx-notif-item.is-info .fx-list-icon { background: var(--info-soft); color: var(--info); }
.fx-notif-item.is-warn .fx-list-icon { background: var(--warn-soft); color: var(--warn); }
.fx-notif-item.is-danger .fx-list-icon { background: var(--danger-soft); color: var(--danger); }
.fx-notif-main { display: grid; gap: 2px; flex: 1; min-width: 0; cursor: pointer; }
.fx-notif-title { font-weight: 600; color: var(--text-strong); }
.fx-notif-item.is-read .fx-notif-title { font-weight: 500; }
.fx-notif-text { font-size: 13px; line-height: 18px; color: var(--text); overflow-wrap: anywhere; }
.fx-notif-meta { font-size: 12px; line-height: 16px; color: var(--text-muted); }
.fx-notif-main .fx-progress { margin-top: var(--space-1); }
.fx-progress.is-error > span { background: var(--danger); }

/* ── Phone shell: app bar, tiles, bottom tabs ─────────────────────── */
.fx-appbar { position: sticky; top: 0; z-index: var(--z-nav); display: none; align-items: center; gap: var(--space-1); height: var(--appbar-h); padding: 0 var(--space-1); background: var(--surface); border-bottom: 1px solid var(--border); }
.fx-appbar-title { flex: 1; min-width: 0; margin: 0; padding-left: var(--space-3); font: 600 17px/24px var(--font-sans); color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-appbar .fx-icon-btn + .fx-appbar-title { padding-left: 0; }
.fx-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-nav); display: none; grid-template-columns: repeat(5, 1fr); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--surface); border-top: 1px solid var(--border); }
.fx-tabbar-item { display: grid; justify-items: center; align-content: center; gap: 2px; min-width: 0; color: var(--text-muted); font: 500 12px/16px var(--font-sans); text-decoration: none; }
.fx-tabbar-item .fx-icon { width: 20px; height: 20px; }
.fx-tabbar-item > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }   /* one line per slot */
.fx-tabbar-item[aria-current="page"] { color: var(--accent); }
/* A module's primary action in the middle of the bar (Fleet scan, Glass new case, guided capture). */
.fx-tabbar-item--primary { padding: 0; border: 0; background: none; color: var(--text-strong); cursor: pointer; }
.fx-tabbar-fab { display: grid; place-items: center; width: 48px; height: 48px; margin-top: calc(-1 * var(--space-5)); border-radius: var(--radius-full); background: var(--accent-fill); color: var(--on-accent); box-shadow: var(--shadow-pop); }
.fx-tabbar-item--primary:active .fx-tabbar-fab { background: var(--accent-fill-hover); }
.fx-tabbar-item--primary:focus-visible { outline: none; }
.fx-tabbar-item--primary:focus-visible .fx-tabbar-fab { outline: 2px solid var(--accent); outline-offset: 2px; }
.fx-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.fx-tile { display: grid; align-content: space-between; gap: var(--space-3); min-height: 104px; padding: var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text-strong); text-decoration: none; }
.fx-tile:active { background: var(--surface-2); }
.fx-tile .fx-icon { width: 20px; height: 20px; color: var(--text-muted); }
.fx-tile-title { font: 600 15px/22px var(--font-sans); }
.fx-tile-meta { font-size: 13px; line-height: 18px; color: var(--text-muted); }
.fx-kpi-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.fx-kpi-strip > div { display: grid; gap: 2px; padding: var(--space-3); }
.fx-kpi-strip > div + div { border-left: 1px solid var(--border); }
.fx-kpi-strip b { font: 600 20px/28px var(--font-sans); color: var(--text-strong); font-variant-numeric: tabular-nums; }
.fx-kpi-strip span { font-size: 12px; line-height: 16px; color: var(--text-muted); }
.fx-kpi-strip--auto { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.fx-sticky-action { position: sticky; bottom: 0; padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--border); }

/* ── Public layout: login, register, capture links, trial ─────────── */
.fx-public { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; min-height: 100vh; min-height: 100dvh; padding: var(--space-6) var(--space-4); background: var(--bg); }
.fx-public-card { display: grid; gap: var(--space-5); width: min(400px, 100%); padding: var(--space-8); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.fx-public-card img { height: 28px; width: auto; }
.fx-public-title { margin: 0; font: 600 20px/28px var(--font-sans); color: var(--text-strong); }
.fx-public-foot { font-size: 12px; line-height: 16px; color: var(--text-muted); text-align: center; }

/* ── Tablet: icon sidebar ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .fx-app { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }
  .fx-sidebar-brand { justify-content: center; padding: 0; }
  .fx-nav-item { justify-content: center; padding: 0; }
  .fx-nav-item > span, .fx-nav-item .fx-badge, .fx-nav-group, .fx-nav-sub, .fx-account-text, .fx-account > .fx-icon { display: none; }
  .fx-account { justify-content: center; }
  .fx-sidebar-brand img { height: 16px; }
  .fx-page { padding: var(--space-6); }
}

/* ── Phone ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  body { font-size: 15px; line-height: 22px; }
  .fx-app { display: block; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
  .fx-sidebar { display: none; }
  .fx-appbar { display: flex; }
  .fx-topbar { padding: 0 var(--space-1) 0 var(--space-4); background: var(--surface); }
  .fx-crumbs li:not(:last-child) { display: none; }
  .fx-crumbs li + li::before { content: none; }
  .fx-crumbs [aria-current="page"] { font: 600 17px/24px var(--font-sans); overflow: hidden; text-overflow: ellipsis; }
  .fx-topbar-pop { position: fixed; left: var(--space-2); right: var(--space-2); top: calc(var(--appbar-h) + var(--space-1)); width: auto; }
  .fx-tabbar { display: grid; }
  .fx-resizer { display: none; }
  .fx-tabs[data-module-tabs] { display: none; }   /* phones: these sections live in the bottom tab bar */
  .fx-page { gap: var(--space-4); padding: var(--space-4) var(--space-4) var(--space-6); }
  .fx-page-hd { display: none; }
  .fx-btn { height: var(--touch-h); }
  .fx-btn--sm { height: 36px; }
  .fx-icon-btn { width: var(--touch-h); height: var(--touch-h); }
  .fx-input, .fx-select { height: var(--touch-h); font-size: 16px; }
  .fx-textarea { font-size: 16px; }
  .fx-list-item { min-height: 56px; }
  .fx-search { flex: 1 1 auto; }
  .fx-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fx-kpi-strip--auto { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fx-kpi-strip--auto > div + div { border-left: 0; }
  .fx-kv { grid-template-columns: fit-content(40%) minmax(0, 1fr); column-gap: var(--space-4); }
  .fx-kv dt, .fx-kv dd { min-width: 0; overflow-wrap: anywhere; }
  .fx-kv dd .fx-btn, .fx-kv dd .fx-badge { max-width: 100%; height: auto; white-space: normal; text-align: start; }
  .fx-kv dd .fx-btn { min-height: 36px; padding-block: var(--space-1); }
  .fx-kv dd .fx-btn > .fx-badge { flex: none; white-space: nowrap; }
  .fx-table-wrap.fx-table--cards { background: none; border: 0; }
  .fx-table--cards .fx-table thead { display: none; }
  .fx-table--cards .fx-table tbody { display: grid; gap: var(--space-2); }
  .fx-table--cards .fx-table tr { display: grid; gap: var(--space-1); padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
  .fx-table--cards .fx-table td { display: flex; justify-content: space-between; gap: var(--space-3); height: auto; padding: 0; border: 0; font-size: 14px; line-height: 20px; }
  .fx-table--cards .fx-table td::before { content: attr(data-label); color: var(--text-muted); font-size: 12px; }
  .fx-table--cards .fx-table td.is-primary { font-size: 15px; font-weight: 600; }
  .fx-table--cards .fx-table td.is-primary::before, .fx-table--cards .fx-table td.is-sel { display: none; }
  .fx-table--cards .fx-row-actions { opacity: 1; }
  .fx-scrim { place-items: end stretch; padding: 0; }
  .fx-dialog, .fx-dialog--sm, .fx-dialog--lg { width: 100%; min-width: 0; max-height: 92vh; border-bottom: 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
  .fx-dialog::before { content: ""; align-self: center; width: 36px; height: 4px; margin-top: var(--space-2); border-radius: var(--radius-full); background: var(--border-control); }
  .fx-dialog-ft { flex-direction: column-reverse; flex-wrap: nowrap; padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px)); }
  .fx-dialog-ft .fx-btn { width: 100%; height: var(--touch-h-lg); }
  .fx-toasts { left: var(--space-4); right: var(--space-4); bottom: calc(var(--tabbar-h) + var(--space-3) + env(safe-area-inset-bottom, 0px)); }
  .fx-public-card { padding: var(--space-6) var(--space-4); border: 0; background: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fx-view, [role="tabpanel"] { animation: none; }
  /* not none: the reveal holds the page change on its first frame, so the swap must still be an animation */
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .001s; }
  html.fx-revealed .fx-main > :not(.fx-topbar), html.fx-revealed .fx-public-card { animation: none; }
  html.fx-leaving .fx-main > :not(.fx-topbar):not(.fx-page-loading) { animation: none; opacity: 0; }
  .fx-spinner, .fx-skeleton { animation: none; }
  ::view-transition-image-pair(fx-page-spinner) { animation: none; }
  .fx-btn, .fx-icon-btn, .fx-input, .fx-switch input, .fx-switch input::after, .fx-progress > span, .fx-row-actions { transition: none; }
}
/* --- css/ds/components-shell.css --- */
/* Fluxe design system - generic components added while converting the shell, Home, Dashboard and the
   public pages (CA-160). Same rules as components.css (fx-* names, tokens only); to be folded into it.
   Breakpoints: 768px (phone), 1024px (tablet). */

/* ── Layout helpers ───────────────────────────────────────────────── */
.fx-inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.fx-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }   /* CA-535: the track may shrink below its content, so a wide report table scrolls in its wrap instead of overflowing the dialog */
.fx-break { overflow-wrap: anywhere; }
.fx-self-start { justify-self: start; }
.fx-self-stretch { justify-self: stretch; width: 100%; }
.fx-note { display: flex; align-items: flex-start; gap: var(--space-2); margin: 0; }
.fx-note > .fx-icon { margin-top: 1px; flex: none; }
.fx-fieldset { display: grid; gap: var(--space-2); min-width: 0; margin: 0; padding: 0; border: 0; }
.fx-fieldset > legend { padding: 0; }
.fx-section-hd { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }

/* ── Media object: avatar or icon next to text ────────────────────── */
.fx-media { display: flex; align-items: center; gap: var(--space-4); min-width: 0; }
.fx-media-body { display: grid; gap: var(--space-1); min-width: 0; }

/* ── Avatar, large ────────────────────────────────────────────────── */
.fx-avatar--lg { width: 64px; height: 64px; font-size: 20px; line-height: 28px; }

/* ── Choice row: a list item that is a radio or checkbox ──────────── */
.fx-choice { cursor: pointer; }
.fx-choice:hover { background: var(--surface-2); }
.fx-choice > input { width: 16px; height: 16px; margin: 0; flex: none; accent-color: var(--accent-fill); cursor: pointer; }
.fx-choice:has(> input:checked) { background: var(--surface-2); }
.fx-choice:has(> input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ── Rating: a row of icon buttons ────────────────────────────────── */
.fx-rating { display: flex; gap: var(--space-1); }
.fx-rating .fx-icon-btn[aria-checked="true"], .fx-rating .fx-icon-btn:has(.ui-icon-star) { color: var(--text-strong); }

/* ── Dialog footer note (left of the buttons; above them on phones) ── */
.fx-dialog-ft { align-items: center; }
.fx-dialog-ft-note { margin-right: auto; }

/* ── Prose: rendered long-form text (legal documents, release notes) ─ */
.fx-prose { color: var(--text); font-size: 14px; line-height: 22px; overflow-wrap: anywhere; }
.fx-prose > :first-child { margin-top: 0; }
/* Rendered Markdown (legal documents): block spacing comes from the margins below, never from source newlines (CA-475) */
.fx-prose.fx-prose--doc { white-space: normal; }
.fx-prose h1, .fx-prose h2, .fx-prose h3, .fx-prose h4, .fx-prose h5, .fx-prose h6 { margin: var(--space-6) 0 var(--space-2); color: var(--text-strong); font-weight: 600; }
.fx-prose h1 { font-size: 20px; line-height: 28px; }
.fx-prose h2 { font-size: 17px; line-height: 24px; }
.fx-prose h3 { font-size: 16px; line-height: 24px; }
.fx-prose h4, .fx-prose h5, .fx-prose h6 { font-size: 14px; line-height: 20px; }
.fx-prose p { margin: 0 0 var(--space-3); }
.fx-prose ul, .fx-prose ol { margin: 0 0 var(--space-3); padding-left: var(--space-6); }
.fx-prose li { margin-bottom: var(--space-1); }
.fx-prose li > ul, .fx-prose li > ol { margin: var(--space-1) 0 0; }
/* Tables (CA-231): the shared fx-table; cells wrap, and a wide table scrolls inside its own wrap */
.fx-prose .fx-table-wrap { margin: 0 0 var(--space-3); }
.fx-prose .fx-table th, .fx-prose .fx-table td { min-width: 160px; height: auto; padding: var(--space-2) var(--space-3); vertical-align: top; white-space: normal; overflow-wrap: break-word; }
.fx-prose .fx-table .is-center { text-align: center; }
.fx-prose .fx-table .is-right { text-align: right; }
/* Fenced code (CA-231): kept as written, scrolls sideways instead of wrapping */
.fx-prose pre { margin: 0 0 var(--space-3); padding: var(--space-3); overflow-x: auto; border-radius: var(--radius); background: var(--surface-2); }
.fx-prose pre code { padding: 0; background: none; white-space: pre; overflow-wrap: normal; }
.fx-prose hr { margin: var(--space-6) 0; border: 0; border-top: 1px solid var(--border); }
.fx-prose a { color: var(--accent); }
.fx-prose code { padding: 0 var(--space-1); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-strong); font-family: var(--font-mono); font-size: 13px; }
.fx-prose strong { color: var(--text-strong); font-weight: 600; }

/* ── Dialog, extra large (report viewers); flush body; fullscreen ──── */
.fx-dialog--xl > .fx-dialog-bd { flex: 1; min-height: 0; align-content: start; }
.fx-dialog--xl > .fx-state { flex: 1; align-content: center; }
.fx-dialog-bd--flush { padding: 0; gap: 0; }
.fx-dialog:fullscreen { width: 100vw; height: 100vh; max-width: none; max-height: none; border: 0; border-radius: 0; }

/* ── Thumbnail (list rows, cards) ─────────────────────────────────── */
.fx-thumb-count { position: absolute; right: 2px; bottom: 2px; padding: 0 var(--space-1); border-radius: var(--radius-sm); background: var(--text-strong); color: var(--bg); font: 500 12px/16px var(--font-sans); }
.fx-list-end .fx-num { color: var(--text-strong); font-weight: 500; }
.fx-list-end--stack { flex: none; }

/* ── Logo (light / dark variants swapped by the theme) ────────────── */
.fx-logo { display: inline-flex; align-items: center; }
.fx-public-card:has(> .fx-state) > .fx-logo { justify-self: center; }
.fx-logo img { display: block; height: 28px; width: auto; }
.fx-logo .fx-logo-dark { display: none; }
[data-theme="dark"] .fx-logo .fx-logo-light { display: none; }
[data-theme="dark"] .fx-logo .fx-logo-dark { display: block; }

/* ── Public pages: card stack, wide variant, header text, alt link ─── */
.fx-public { align-content: center; gap: var(--space-6); }
.fx-public-card--wide { width: min(560px, 100%); }
.fx-public-hd { display: grid; gap: var(--space-1); }
.fx-public-sub { margin: 0; color: var(--text-muted); }
.fx-public-alt { margin: 0; color: var(--text-muted); text-align: center; }
.fx-public-foot.fx-inline { justify-content: center; max-width: 100%; }
.fx-public-foot .fx-select-wrap, .fx-public-foot .fx-select { min-width: 0; max-width: 100%; }
.fx-select--sm { width: auto; height: var(--control-h-sm); padding-left: var(--space-2); font-size: 13px; line-height: 18px; }
.fx-select-wrap:has(.fx-select--sm)::after { right: 10px; width: 6px; height: 6px; }

/* ── Input with a trailing icon button (password reveal, clear) ────── */
.fx-affix { position: relative; display: block; }
.fx-affix > .fx-input { padding-right: 44px; }
.fx-affix > .fx-icon-btn { position: absolute; top: 50%; right: 2px; transform: translateY(-50%); width: var(--control-h-sm); height: var(--control-h-sm); }

/* ── Button busy state (spinner instead of the label) ──────────────── */
.fx-btn[aria-busy="true"] { position: relative; color: transparent; pointer-events: none; }
.fx-btn[aria-busy="true"]::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border: 2px solid currentColor; border-color: var(--on-accent) var(--on-accent) transparent; border-radius: var(--radius-full); animation: fx-spin .8s linear infinite; }
.fx-btn:not(.fx-btn--primary)[aria-busy="true"]::after { border-color: var(--text-strong) var(--text-strong) transparent; }

/* ── Tiles: auto-filling grid on desktop, buttons as tiles, hover ─── */
.fx-tiles--auto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.fx-tiles--auto > .fx-tile { align-content: start; }
button.fx-tabbar-item { padding: 0; border: 0; background: none; cursor: pointer; }
button.fx-tile { width: 100%; font: inherit; text-align: left; cursor: pointer; }
.fx-tile { transition: background-color .15s ease-out, border-color .15s ease-out; }
.fx-tile:hover { background: var(--surface-2); }
.fx-stack--lg { gap: var(--space-6); }

/* ── KPI as a link; skeleton lines sized like KPI text ─────────────── */
.fx-kpi--link { color: inherit; text-decoration: none; transition: background-color .15s ease-out; }
.fx-kpi--link:hover { background: var(--surface-2); }
.fx-skeleton--label { width: 60%; height: 12px; margin: 2px 0 4px; }
.fx-skeleton--value { width: 40%; height: 24px; margin: 4px 0; }

/* ── Card grid (dashboards) and chart frame ───────────────────────── */
.fx-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); gap: var(--space-4); }
.fx-card--wide { grid-column: 1 / -1; }
.fx-chart { position: relative; height: 260px; min-width: 0; }
.fx-chart--tall { height: 380px; }
.fx-state--compact { padding: var(--space-8) var(--space-4); }
.is-flash { outline: 2px solid var(--accent); outline-offset: 2px; transition: outline-color .6s ease-out; }

/* ── Controls that size to their content (toolbars) ────────────────── */
.fx-select--auto, .fx-input--auto { width: auto; }
.fx-truncate { display: block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-table tbody tr[data-id] { cursor: pointer; }

/* ── Page banner (full width under the top bar), inline usage meters ─ */
.fx-banner--page { align-items: center; margin: var(--space-4) var(--space-8) 0; }
.fx-usage--inline { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-2) var(--space-4); margin-top: var(--space-2); }
.fx-only-phone { display: none; }

/* ── Content site: header, hero, media frames, gallery, lightbox (public showcase) ── */
.fx-site-hd { display: flex; align-items: center; height: var(--appbar-h); padding: 0 var(--space-8); border-bottom: 1px solid var(--border); background: var(--surface); }
.fx-site-ft { padding: var(--space-8) var(--space-4); }
.fx-page--narrow { max-width: var(--page-reading-max); gap: var(--space-8); }
.fx-hero { display: grid; gap: var(--space-6); }
.fx-hero-text { display: grid; gap: var(--space-2); max-width: 720px; }
.fx-display { margin: 0; font: 600 24px/32px var(--font-sans); color: var(--text-strong); }
.fx-lead { margin: 0; font-size: 16px; line-height: 24px; color: var(--text-muted); }
.fx-measure { max-width: 720px; }
.fx-media-frame { position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); }
.fx-media-frame > img, .fx-media-frame > video { display: block; width: 100%; height: auto; max-height: 72vh; object-fit: cover; }
/* CA-443: a video taken full screen shows whole (bars where the shapes differ), never cropped: the browser's own
   full-screen contain has no !important, so the cover above would still win. Separate rules: a selector a browser does
   not know drops its whole rule. */
.fx-media-frame > video:fullscreen { max-height: none; object-fit: contain; }
.fx-media-frame > video:-webkit-full-screen { max-height: none; object-fit: contain; }
.fx-media-controls { position: absolute; right: var(--space-3); bottom: var(--space-3); display: flex; gap: var(--space-2); }
[data-playing="1"] > .fx-i-play, [data-playing="0"] > .fx-i-pause, [data-muted="1"] > .fx-i-sound, [data-muted="0"] > .fx-i-muted { display: none; }
.fx-icon-btn > .fx-i-busy { display: none; width: 16px; height: 16px; }
.fx-icon-btn.is-loading > .fx-icon { display: none; }
.fx-icon-btn.is-loading > .fx-i-busy { display: block; }
.fx-figure { display: grid; gap: var(--space-2); margin: 0; min-width: 0; }
.fx-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: var(--space-6); }
.fx-gallery { columns: var(--cols, 3) 220px; column-gap: var(--space-4); }
.fx-gallery > .fx-figure { break-inside: avoid; margin-bottom: var(--space-4); }
.fx-gallery-btn { display: block; width: 100%; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.fx-gallery-btn img { display: block; width: 100%; height: auto; }
.fx-lightbox { position: fixed; inset: 0; z-index: calc(var(--z-dialog) + var(--fx-layer, 0)); display: grid; place-items: center; padding: var(--space-12) var(--space-4); background: var(--scrim); }
.fx-lightbox[hidden] { display: none; }
.fx-lightbox-bar { position: absolute; top: var(--space-4); right: var(--space-4); display: flex; align-items: center; gap: var(--space-2); }
.fx-lightbox-count, .fx-lightbox-cap { padding: var(--space-1) var(--space-2); border-radius: var(--radius); background: var(--surface); color: var(--text-strong); font-size: 13px; line-height: 18px; }
.fx-lightbox-fig { display: grid; justify-items: center; gap: var(--space-3); margin: 0; max-width: 100%; }
.fx-lightbox-fig img { display: block; max-width: min(1200px, 92vw); max-height: 80vh; border-radius: var(--radius-lg); object-fit: contain; }
.fx-lightbox-cap:empty, .fx-lightbox-cap[hidden] { display: none; }
.fx-lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.fx-lightbox-prev { left: var(--space-4); }
.fx-lightbox-next { right: var(--space-4); }
.fx-lightbox.is-single .fx-lightbox-nav { display: none; }

/* ── Scrolling: the legacy base CSS pins html/body to the viewport with overflow hidden (pages used to
   scroll inside their own panes). Converted app pages scroll in .fx-main on desktop (at 1024px and below
   html is already the scroll root); public pages scroll as a normal document. ── */
@media (min-width: 1025px) {
  .fx-app.fx-converted > .fx-main { height: 100vh; overflow-y: auto; }
}
html:has(> body > .fx-public, > body > .fx-site-hd) { height: auto; overflow-x: hidden; overflow-y: auto; }
html:has(> body > .fx-public, > body > .fx-site-hd) > body { height: auto; min-height: 100vh; min-height: 100dvh; overflow: visible; }

/* ── Account menu: long list (help and legal) scrolls; on the icon-only tablet sidebar it opens beside the
   rail instead of being clipped by it. ── */
.fx-account-menu { max-height: calc(100vh - var(--appbar-h)); overflow-y: auto; }
@media (min-width: 769px) and (max-width: 1024px) {
  .fx-account-menu { position: fixed; left: calc(var(--sidebar-w-collapsed) + var(--space-2)); bottom: var(--space-2); max-height: calc(100vh - var(--space-4)); }
}
/* Desktop: fixed above the account button (the sidebar is a scroll box, so an absolute menu wider than it
   was cut on the right); --fx-foot-h is the sidebar footer height, kept current by core/app_shell.js. */
@media (min-width: 1025px) {
  .fx-account-menu { position: fixed; left: var(--space-2); bottom: calc(var(--fx-foot-h, 69px) + var(--space-1)); width: max-content; min-width: 240px; max-width: min(320px, calc(100vw - var(--space-4))); max-height: calc(100vh - var(--fx-foot-h, 69px) - var(--space-4)); }
}
.fx-account-menu:not(.hidden) { transform-origin: bottom left; animation: fx-menu-in .16s ease-out; }
@keyframes fx-menu-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@media (prefers-reduced-motion: reduce) {
  .fx-account-menu:not(.hidden) { animation: none; }
}

/* ── Start page: hero card, action cards, photo cards, list grid, phone action bar ── */
.fx-hero-card { display: grid; gap: var(--space-6); padding: var(--space-8); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); }
.fx-hero-card-text { display: grid; align-content: center; gap: var(--space-2); }
.fx-hero-card-text > .fx-inline { margin-top: var(--space-3); }
.fx-btn--lg { height: var(--touch-h); padding: 0 var(--space-5); font-size: 15px; }
.fx-action-cards { display: grid; gap: var(--space-2); align-content: center; }
.fx-action-card { display: flex; align-items: center; gap: var(--space-3); min-height: 64px; padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); color: var(--text-strong); font: inherit; text-align: left; text-decoration: none; cursor: pointer; transition: background-color .15s ease-out, border-color .15s ease-out; }
.fx-action-card:hover { background: var(--surface-2); border-color: var(--border-control); }
.fx-action-card > .fx-icon { color: var(--text-muted); }
.fx-icon-well { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text-strong); }
.fx-action-card-text { display: grid; flex: 1; min-width: 0; }
.fx-action-card-title { font-weight: 600; }
.fx-action-card-sub { font-size: 13px; line-height: 18px; color: var(--text-muted); }
.fx-split { display: grid; gap: var(--space-6); align-items: start; }
.fx-list-icon--info { background: var(--info-soft); color: var(--info); }
.fx-list-icon--warn { background: var(--warn-soft); color: var(--warn); }
.fx-media-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: var(--space-3); }
.fx-media-card { display: flex; align-items: center; gap: var(--space-3); min-width: 0; padding: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text-strong); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s ease-out, background-color .15s ease-out; }
.fx-media-card:hover { border-color: var(--border-control); background: var(--surface-2); }
.fx-media-card-img { display: grid; place-items: center; width: 112px; height: 84px; flex: none; overflow: hidden; border-radius: var(--radius); background: var(--surface-2); color: var(--text-muted); }
.fx-media-card-img img { width: 100%; height: 100%; object-fit: cover; }
.fx-media-card-body { display: grid; gap: var(--space-1); min-width: 0; padding-right: var(--space-2); }
.fx-media-card-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-media-card-meta { font-size: 12px; line-height: 16px; color: var(--text-muted); }
.fx-list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: var(--space-4); align-items: start; }
.fx-list-grid .fx-list-group { margin: 0; }
.fx-list-item--compact { min-height: 44px; }
.fx-list-item--compact .fx-list-icon { width: 28px; height: 28px; }
.fx-phone-action { display: none; }
@media (min-width: 1025px) {
  .fx-hero-card { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); }
  .fx-split { grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); }
}

/* ── Phone ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .fx-dialog-ft-note { margin-right: 0; text-align: center; }
  .fx-dialog--xl { height: 92vh; }
  .fx-affix > .fx-icon-btn { width: 40px; height: 40px; }
  .fx-select--sm { height: 36px; font-size: 16px; }
  .fx-tiles--auto { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fx-tiles--auto > .fx-tile { min-height: 88px; gap: var(--space-2); }
  .fx-tiles--auto .fx-tile-meta { display: none; }
  .fx-list-end--stack { flex-direction: column; align-items: flex-end; gap: 2px; }
  .fx-hero-card { gap: var(--space-4); padding: var(--space-5) var(--space-4); }
  .fx-hide-phone-block { display: none; }
  .fx-action-card { min-height: 56px; padding: var(--space-2) var(--space-3); }
  .fx-action-card-sub { display: none; }
  .fx-phone-action { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); z-index: var(--z-sticky); display: block; padding: var(--space-3) var(--space-4); background: var(--surface); border-top: 1px solid var(--border); }
  .fx-page--home { padding-bottom: calc(var(--touch-h) + var(--space-12)); }
  .fx-media-cards { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 86%; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 calc(-1 * var(--space-4)); padding: 0 var(--space-4) var(--space-1); scrollbar-width: none; }
  .fx-media-card { scroll-snap-align: start; }
  .fx-chart { height: 240px; }
  .fx-chart--tall { height: 340px; }
  .fx-truncate { max-width: 180px; }
  .fx-only-phone { display: inline-flex; }
  .fx-site-hd { padding: 0 var(--space-4); }
  .fx-page--narrow { gap: var(--space-6); }
  .fx-gallery { columns: 2 140px; column-gap: var(--space-2); }
  .fx-gallery > .fx-figure { margin-bottom: var(--space-2); }
  .fx-lightbox-nav { top: auto; bottom: var(--space-4); transform: none; }
  .fx-banner .fx-hide-phone { display: none; }
  .fx-banner--page { margin: var(--space-3) var(--space-4) 0; flex-wrap: wrap; }
}

@media (max-width: 1024px) and (min-width: 769px) {
  .fx-banner--page { margin: var(--space-4) var(--space-6) 0; }
}

@media (prefers-reduced-motion: reduce) {
  .fx-btn[aria-busy="true"]::after { animation: none; }
}
/* --- css/ds/components-chat.css --- */
/* Fluxe design system - chat component (fx-chat-*), used by the AI advisor panel (CA-160).
   Same rules as components.css (fx-* names, tokens only); to be folded into it. Breakpoints: 768px, 1024px.
   Composition: launcher + panel (header, tabs, messages, input). Reuses fx-icon-btn, fx-tabs/fx-tab, fx-menu,
   fx-prose (markdown), fx-table, fx-badge, fx-banner, fx-state, fx-card, fx-list-item, fx-textarea. */

/* ── Launcher: quiet round button, bottom right ───────────────────── */
.fx-chat-launcher { position: fixed; right: var(--space-6); bottom: var(--space-6); z-index: var(--z-popover); display: grid; place-items: center; width: var(--touch-h-lg); height: var(--touch-h-lg); padding: 0; border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--surface); color: var(--text-strong); box-shadow: var(--shadow-pop); cursor: pointer; transition: background-color .15s ease-out; }
.fx-chat-launcher:hover { background: var(--surface-2); }
.fx-chat-launcher .fx-icon { width: 20px; height: 20px; }
.fx-chat-launcher-close { display: none; }
.fx-chat-launcher[aria-expanded="true"] .fx-chat-launcher-open { display: none; }
.fx-chat-launcher[aria-expanded="true"] .fx-chat-launcher-close { display: block; }
.fx-chat-launcher.is-unread::after { content: ""; position: absolute; top: 2px; right: 2px; width: 12px; height: 12px; border: 2px solid var(--surface); border-radius: var(--radius-full); background: var(--accent); }

/* ── Panel: floating, anchored above the launcher ─────────────────── */
.fx-chat-panel { position: fixed; right: var(--space-6); bottom: calc(var(--space-6) + var(--touch-h-lg) + var(--space-3)); z-index: var(--z-popover); display: flex; flex-direction: column; width: 400px; max-width: calc(100vw - 32px); height: min(640px, calc(100dvh - 120px)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); overflow: hidden; }
.fx-chat-panel.is-fullscreen { top: var(--space-6); right: var(--space-6); bottom: var(--space-6); left: var(--space-6); width: min(960px, calc(100vw - 48px)); max-width: none; height: auto; margin: 0 auto; }

/* ── Header ───────────────────────────────────────────────────────── */
.fx-chat-hd { position: relative; display: flex; align-items: center; gap: var(--space-1); flex: none; padding: var(--space-3) var(--space-2) var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.fx-chat-title { display: flex; align-items: center; flex: 1; gap: var(--space-3); min-width: 0; }
.fx-chat-title-text { display: grid; min-width: 0; }
.fx-chat-name { overflow: hidden; font: 600 14px/20px var(--font-sans); color: var(--text-strong); text-overflow: ellipsis; white-space: nowrap; }
.fx-chat-sub { overflow: hidden; font-size: 12px; line-height: 16px; color: var(--text-muted); text-overflow: ellipsis; white-space: nowrap; }
.fx-chat-actions { display: flex; align-items: center; gap: var(--space-1); }

/* ── Past conversations (fx-menu anchored under the header) ───────── */
.fx-chat-history { position: absolute; top: calc(100% + var(--space-1)); right: var(--space-2); width: min(320px, calc(100% - 16px)); max-height: 320px; overflow-y: auto; }
.fx-chat-history-item { height: auto; min-height: var(--row-h); padding-top: var(--space-1); padding-bottom: var(--space-1); }
.fx-chat-history-item .fx-list-text { flex: 1; }

/* ── Conversation tabs ────────────────────────────────────────────── */
.fx-chat-tabs { display: flex; align-items: center; flex: none; gap: var(--space-1); padding-right: var(--space-2); border-bottom: 1px solid var(--border); }
.fx-chat-tabs .fx-tabs { flex: 1; min-width: 0; border-bottom: 0; }
.fx-chat-tab { gap: var(--space-1); max-width: 200px; padding-right: var(--space-1); }
.fx-chat-tab-label { overflow: hidden; text-overflow: ellipsis; }
.fx-chat-tab .fx-icon-btn { width: 20px; height: 20px; }

/* ── Messages ─────────────────────────────────────────────────────── */
.fx-chat-messages { display: flex; flex: 1; flex-direction: column; gap: var(--space-4); min-height: 0; padding: var(--space-4); overflow-y: auto; overscroll-behavior: contain; }
.fx-chat-msg { display: flex; min-width: 0; }
.fx-chat-msg--user { justify-content: flex-end; }
.fx-chat-bubble { min-width: 0; max-width: 100%; color: var(--text); font-size: 14px; line-height: 22px; overflow-wrap: anywhere; }
.fx-chat-msg--assistant .fx-chat-bubble { width: 100%; }
.fx-chat-msg--user .fx-chat-bubble { max-width: 85%; padding: var(--space-2) var(--space-3); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text-strong); }
.fx-chat-msg--error .fx-chat-bubble { width: 100%; }
.fx-chat-bubble > :last-child { margin-bottom: 0; }
.fx-chat-usage { margin-top: var(--space-2); font-size: 12px; line-height: 16px; color: var(--text-muted); }

/* Markdown inside a message (headings, lists, links, inline code come from fx-prose) */
.fx-chat-bubble.fx-prose h3, .fx-chat-bubble.fx-prose h4, .fx-chat-bubble.fx-prose h5 { margin: var(--space-4) 0 var(--space-1); font-size: 14px; line-height: 20px; }
.fx-chat-bubble.fx-prose h3:first-child, .fx-chat-bubble.fx-prose h4:first-child, .fx-chat-bubble.fx-prose h5:first-child { margin-top: 0; }
.fx-chat-bubble.fx-prose ul, .fx-chat-bubble.fx-prose ol { padding-left: var(--space-5); }
.fx-chat-code { margin: 0 0 var(--space-3); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text-strong); font-family: var(--font-mono); font-size: 13px; line-height: 18px; overflow-x: auto; }
.fx-chat-bubble .fx-table-wrap { margin: 0 0 var(--space-3); max-width: 100%; overflow-x: auto; }
.fx-chat-bubble .fx-table { width: max-content; min-width: 100%; }
.fx-chat-bubble .fx-table th { height: 32px; }
.fx-chat-bubble .fx-table td { height: auto; padding: var(--space-2) var(--space-3); vertical-align: top; }
.fx-chat-bubble .fx-table .is-center { text-align: center; }
.fx-chat-bubble .fx-table .is-right { text-align: right; font-variant-numeric: tabular-nums; }
.fx-chat-bubble .fx-table .is-left { text-align: left; }

/* Entity pills (fx-badge tones; buttons that deep-link) */
.fx-chat-pill { max-width: 100%; border: 0; vertical-align: middle; cursor: pointer; }
.fx-chat-pill:hover { text-decoration: underline; }
.fx-chat-pill .fx-icon { width: 12px; height: 12px; }

/* Tool events: muted status rows above the answer */
.fx-chat-tools { display: grid; gap: var(--space-1); margin-bottom: var(--space-2); }
.fx-chat-tool { display: flex; align-items: center; gap: var(--space-2); font-size: 12px; line-height: 16px; color: var(--text-muted); }
.fx-chat-tool .fx-icon { width: 12px; height: 12px; }
.fx-chat-tool .fx-spinner { width: 12px; height: 12px; flex: none; border-width: 1.5px; }

/* Typing indicator and streaming caret */
.fx-chat-typing { display: inline-flex; align-items: center; gap: var(--space-1); height: 22px; }
.fx-chat-typing > span { width: 6px; height: 6px; border-radius: var(--radius-full); background: var(--text-muted); animation: fx-chat-dot 1.2s ease-in-out infinite; }
.fx-chat-typing > span:nth-child(2) { animation-delay: .15s; }
.fx-chat-typing > span:nth-child(3) { animation-delay: .3s; }
.fx-chat-caret { display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: text-bottom; background: var(--text-strong); animation: fx-chat-blink 1s steps(2, start) infinite; }
@keyframes fx-chat-dot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
@keyframes fx-chat-blink { to { visibility: hidden; } }

/* ── Empty state: digest, intro, suggestions ──────────────────────── */
.fx-chat-empty { display: grid; gap: var(--space-4); align-content: start; }
.fx-chat-empty .fx-state { padding: var(--space-4) var(--space-2) 0; }
.fx-chat-suggestions { display: grid; gap: var(--space-2); }
.fx-chat-suggestion { min-height: var(--row-h); padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-strong); font: inherit; line-height: 20px; text-align: left; cursor: pointer; }
.fx-chat-suggestion:hover { background: var(--surface-2); }
.fx-chat-digest .fx-chat-suggestion { min-height: 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
.fx-chat-digest .fx-chat-suggestion:last-child { border-bottom: 0; }
.fx-chat-digest-hd { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4); border-bottom: 1px solid var(--border); }
.fx-chat-digest-title { margin: 0; font: 600 14px/20px var(--font-sans); color: var(--text-strong); }
.fx-chat-digest .fx-chat-suggestion { display: flex; align-items: flex-start; gap: var(--space-3); width: 100%; }
.fx-chat-sev { flex: none; width: 8px; height: 8px; margin-top: var(--space-2); border-radius: var(--radius-full); background: var(--info); }
.fx-chat-sev.is-warning { background: var(--warn); }
.fx-chat-sev.is-critical { background: var(--danger); }
.fx-chat-loading { display: grid; place-items: center; padding: var(--space-8) 0; }

/* ── Input bar ────────────────────────────────────────────────────── */
.fx-chat-input { display: flex; align-items: flex-end; flex: none; gap: var(--space-2); padding: var(--space-3); border-top: 1px solid var(--border); }
.fx-chat-textarea { flex: 1; height: var(--chat-input-h, auto); min-height: var(--control-h); max-height: 120px; resize: none; }

/* ── Tablet and up: nothing extra. Phone: full-height bottom sheet above the tab bar ── */
@media (max-width: 768px) {
  .fx-chat-launcher { right: var(--space-4); bottom: calc(var(--tabbar-h) + var(--space-4) + env(safe-area-inset-bottom, 0px)); }
  /* A page with a sticky bottom action (Fleet check-in, capture links): sit above it instead of covering its button. */
  body:has(.fx-sticky-action:not(.hidden)) .fx-chat-launcher { bottom: calc(var(--tabbar-h) + var(--touch-h-lg) + var(--space-3) * 2 + var(--space-3) + env(safe-area-inset-bottom, 0px)); }
  .fx-chat-launcher[aria-expanded="true"] { display: none; }
  .fx-chat-panel, .fx-chat-panel.is-fullscreen { top: auto; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); left: 0; width: 100%; max-width: none; height: calc(100dvh - var(--appbar-h) - var(--tabbar-h) - env(safe-area-inset-bottom, 0px)); margin: 0; border-right: 0; border-bottom: 0; border-left: 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
  .fx-chat-fullscreen { display: none; }
  .fx-chat-tabs .fx-tab { height: var(--touch-h); }
  .fx-chat-tab .fx-icon-btn { width: 32px; height: 32px; }
  .fx-chat-tabs > .fx-icon-btn { width: var(--touch-h); height: var(--touch-h); }
  .fx-chat-history-item { min-height: var(--touch-h); }
  .fx-chat-suggestion { min-height: var(--touch-h); }
  .fx-chat-textarea { min-height: var(--touch-h); }
  .fx-chat-bubble { font-size: 15px; line-height: 22px; }
}

/* ── Support chat (CA-170): conversation list / new form views, attachments, meta line ── */
.fx-chat-body { display: flex; flex: 1; flex-direction: column; gap: var(--space-3); min-height: 0; padding: var(--space-4); overflow-y: auto; }
.fx-chat-meta { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-1); font-size: 12px; line-height: 16px; color: var(--text-muted); }
.fx-chat-msg--user .fx-chat-meta { justify-content: flex-end; }
.fx-chat-msg--note .fx-chat-bubble { width: 100%; padding: var(--space-2) var(--space-3); border: 1px dashed var(--warn); border-radius: var(--radius-lg); background: var(--warn-soft); }
.fx-chat-attachments { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.fx-chat-attach-img { display: block; max-width: 200px; max-height: 160px; border: 1px solid var(--border); border-radius: var(--radius); object-fit: cover; }
.fx-chat-attach-video { display: block; width: 100%; max-width: 320px; max-height: 240px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.fx-chat-attach-audio { display: block; width: 260px; max-width: 100%; }
.fx-chat-pending { display: flex; flex-wrap: wrap; gap: var(--space-1); padding: 0 var(--space-3) var(--space-2); }
.fx-chat-panel.is-dropping { outline: 2px dashed var(--accent); outline-offset: -6px; }

@media (prefers-reduced-motion: reduce) {
  .fx-chat-launcher, .fx-chat-typing > span, .fx-chat-caret { transition: none; animation: none; }
}

/* CA-181: an assistant reply that handed the problem to the support chat */
.fx-chat-handoff { margin-top: var(--space-2); }

/* Support rating (CA-176): five star buttons in one row, the comment and the send button under them */
.fx-chat-stars { display: flex; gap: var(--space-1); margin: var(--space-2) 0; }
.fx-chat-stars .fx-btn { flex: 1 1 0; justify-content: center; }
.fx-chat-stars .fx-btn[aria-pressed="true"] { background: var(--surface-2); border-color: var(--text-strong); }
/* CA-175: context cards (records attached to a support message) and the record picker */
.fx-chat-cards { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); }
.fx-chat-card { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.fx-chat-card-kind { font-size: 12px; line-height: 16px; color: var(--text-muted); }
.fx-chat-card-title { font-weight: 500; color: var(--text-strong); overflow-wrap: anywhere; }
.fx-chat-card-sub { font-size: 13px; line-height: 18px; color: var(--text-muted); }
.fx-chat-card-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-1); }
.fx-chat-picker { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); border-top: 1px solid var(--border); background: var(--surface); }
.fx-chat-picker-rows { display: flex; flex-wrap: wrap; gap: var(--space-1); max-height: 132px; overflow-y: auto; }
/* --- css/ds/components-wizard.css --- */
/* Fluxe design system - multi-step public form components (OTP code input, password strength meter,
   question carousel, choice chips, perks list, usage rows...) used by the trial sign-up (CA-160). fx-* names,
   tokens only; to be folded into components.css. Breakpoints: 768px, 1024px. */

/* ── Field helpers ────────────────────────────────────────────────── */
.fx-field > .fx-error:empty { display: none; }
.fx-form > .fx-error:empty { display: none; }
.fx-req { color: var(--danger); }
.fx-link-btn { justify-self: start; padding: 0; border: 0; background: none; font: inherit; font-weight: 500; text-align: left; cursor: pointer; }
.fx-check + .fx-link-btn { margin-left: var(--space-6); }
.fx-link-btn:disabled { color: var(--text-muted); cursor: not-allowed; text-decoration: none; }
.fx-captcha { display: flex; justify-content: center; min-height: 0; }
.fx-center { text-align: center; justify-items: center; }

/* ── Six-digit code input ─────────────────────────────────────────── */
.fx-otp { display: grid; grid-template-columns: repeat(6, minmax(0, 52px)); justify-content: center; gap: var(--space-2); }
.fx-otp > input { width: 100%; height: var(--touch-h-lg); padding: 0; border: 1px solid var(--border-control); border-radius: var(--radius); background: var(--surface); color: var(--text-strong); font: 600 20px/28px var(--font-sans); font-variant-numeric: tabular-nums; text-align: center; transition: border-color .15s ease-out; }
.fx-otp > input:hover { border-color: var(--text-muted); }
.fx-otp > input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.fx-otp > input[aria-invalid="true"] { border-color: var(--danger); }

/* ── Password strength meter (data-level 0..4) ────────────────────── */
.fx-strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-1); }
.fx-strength > span { height: 4px; border-radius: var(--radius-full); background: var(--surface-2); }
.fx-strength[data-level="1"] > span:nth-child(-n+1) { background: var(--danger); }
.fx-strength[data-level="2"] > span:nth-child(-n+2) { background: var(--warn); }
.fx-strength[data-level="3"] > span:nth-child(-n+3) { background: var(--info); }
.fx-strength[data-level="4"] > span { background: var(--ok); }

/* ── Question carousel frame (one slide at a time) ────────────────── */
.fx-carousel { display: grid; gap: var(--space-4); }
.fx-carousel-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); color: var(--text-muted); font: 500 13px/18px var(--font-sans); }
.fx-carousel-meta b { color: var(--text-strong); font-weight: 600; font-variant-numeric: tabular-nums; }
.fx-carousel-slide { display: grid; gap: var(--space-3); }
.fx-carousel-nav { display: flex; justify-content: space-between; gap: var(--space-2); }

/* ── Choice chips (single or multiple answer) ─────────────────────── */
.fx-choice-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.fx-choice-chip { position: relative; display: inline-flex; align-items: center; min-height: var(--control-h); padding: 0 var(--space-3); border: 1px solid var(--border-control); border-radius: var(--radius); background: var(--surface); color: var(--text-strong); font: 500 14px/20px var(--font-sans); cursor: pointer; transition: background-color .15s ease-out, border-color .15s ease-out; }
.fx-choice-chip:hover { background: var(--surface-2); }
.fx-choice-chip > input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.fx-choice-chip:has(> input:checked) { background: var(--surface-2); border-color: var(--text-strong); box-shadow: 0 0 0 1px var(--text-strong); }
.fx-choice-chip:has(> input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.fx-choice-chips[aria-invalid="true"] .fx-choice-chip { border-color: var(--danger); }

/* ── Perks list (short facts with an icon) ────────────────────────── */
.fx-wizard { display: grid; gap: var(--space-6); }
.fx-wizard-intro { display: grid; gap: var(--space-4); }
.fx-wizard > .fx-steps { padding-top: var(--space-5); border-top: 1px solid var(--border); }
.fx-wizard > .fx-form { gap: var(--space-5); }
.fx-perks { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin: 0; padding: 0; list-style: none; color: var(--text); font-size: 13px; line-height: 18px; }
.fx-perks > li { display: inline-flex; align-items: center; gap: var(--space-2); }
.fx-perks .fx-icon { color: var(--text-muted); }

/* ── Verified marker and ok state icon ────────────────────────────── */
.fx-state--ok .fx-state-icon { background: var(--ok-soft); color: var(--ok); }

/* ── Usage rows (label, used / max, progress) ─────────────────────── */
.fx-usage { display: grid; gap: var(--space-4); width: 100%; text-align: left; }
.fx-usage-row { display: grid; gap: var(--space-1); }
.fx-usage-top { display: flex; justify-content: space-between; gap: var(--space-3); color: var(--text); font-size: 14px; line-height: 20px; }
.fx-usage-top b { color: var(--text-strong); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Reviewer questions (CA-233): view picker + photo ─────────────────── */
.fx-view-picker { display: grid; justify-items: center; gap: var(--space-2); }
.fx-view-3d { position: relative; width: 100%; max-width: 360px; aspect-ratio: 16 / 10; }
.fx-view-3d-canvas { display: block; width: 100%; height: 100%; }
.fx-view-svg { width: 100%; max-width: 280px; height: auto; }
.fx-view-car { fill: var(--surface-2); stroke: var(--border-control); stroke-width: 2; }
.fx-view-glass { fill: var(--border); }
.fx-view-roof { fill: var(--surface); stroke: var(--border); }
.fx-view-front { fill: var(--border-control); }
.fx-view-pos { cursor: pointer; outline: none; }
.fx-view-hit { fill: var(--surface); stroke: var(--border-control); stroke-width: 2; transition: fill .15s ease-out; }
.fx-view-dot { fill: var(--border-control); }
.fx-view-pos:hover .fx-view-hit { fill: var(--surface-2); }
.fx-view-pos.is-selected .fx-view-hit { fill: var(--text-strong); stroke: var(--text-strong); }
.fx-view-pos.is-selected .fx-view-dot { fill: var(--surface); }
.fx-view-pos:focus-visible .fx-view-hit { stroke: var(--accent); stroke-width: 4; }
.fx-view-caption { margin: 0; min-height: 20px; font: 600 14px/20px var(--font-sans); color: var(--text-strong); }
.fx-review-photo { display: block; width: 100%; max-height: 220px; object-fit: contain; border-radius: var(--radius); background: var(--surface-2); }
.fx-review-frame { position: relative; width: fit-content; max-width: 100%; margin-inline: auto; }
.fx-review-frame .fx-review-photo { width: auto; max-width: 100%; height: auto; }
.fx-review-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); align-items: start; }
.fx-review-pair .fx-review-frame { width: 100%; }
.fx-review-pair .fx-review-photo { width: 100%; max-height: 180px; object-fit: contain; }
/* CA-428: a photo with a region opens zoomed on it (the whole photo keeps sizing the frame underneath), an icon
   button switches to the whole photo and back, and a ring marks a region that stays small in what is shown. */
.fx-review-frame.has-region { overflow: hidden; border-radius: var(--radius); }
.fx-review-pair .fx-review-frame.has-region { width: fit-content; justify-self: center; }
.fx-review-pair .fx-review-frame.has-region .fx-review-photo { width: auto; max-width: 100%; height: auto; }
.fx-review-zoom { position: absolute; inset: 0; display: none; overflow: hidden; background: var(--surface-2); }
.fx-review-frame.is-zoomed .fx-review-zoom { display: block; }
.fx-review-frame.is-zoomed > .fx-review-photo, .fx-review-frame.is-zoomed > .fx-dmg-canvas { visibility: hidden; }
.fx-review-zoom-photo { position: absolute; display: block; max-width: none; width: calc(var(--zoom, 1) * 100%); height: auto; left: calc(var(--vx, 0) * var(--zoom, 1) * -100%); top: calc(var(--vy, 0) * var(--zoom, 1) * -100%); }
.fx-review-ring { position: absolute; left: calc(var(--rx, .5) * 100%); top: calc(var(--ry, .5) * 100%); width: max(48px, calc(var(--rs, 0) * 100% + 24px)); aspect-ratio: 1; translate: -50% -50%; border: 2px solid var(--accent); border-radius: 50%; box-shadow: 0 0 0 2px var(--dmg-halo); pointer-events: none; }
.fx-review-zoom-toggle { position: absolute; top: var(--space-1); inset-inline-end: var(--space-1); background: var(--surface); color: var(--text-strong); box-shadow: var(--shadow-pop); }
.fx-review-zoom-toggle:hover { background: var(--surface-2); }
.fx-review-ai { margin-inline-start: auto; }
.fx-view-picker.has-3d .fx-view-car, .fx-view-picker.has-3d .fx-view-glass, .fx-view-picker.has-3d .fx-view-roof, .fx-view-picker.has-3d .fx-view-front { display: none; }
/* 3D car in the middle of the ring of camera positions: both share one grid cell, the targets stay on top. */
.fx-view-picker.has-3d .fx-view-svg { grid-area: 1 / 1; position: relative; z-index: 1; max-width: 340px; }
.fx-view-picker.has-3d .fx-view-3d { grid-area: 1 / 1; align-self: center; width: min(48%, 163px); max-width: none; }
.fx-view-3d-status { margin: 0; }
.fx-review-body { display: grid; gap: var(--space-3); }
.fx-review-unknown { justify-self: center; }

/* ── What to estimate (CA-233 C): pick the photo, circle the damage ──── */
.fx-scope-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--space-2); }
.fx-scope-grid > .fx-thumb { width: 100%; height: auto; aspect-ratio: 4 / 3; }
.fx-scope-mark { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fx-scope-mark polygon { fill: var(--accent); fill-opacity: .18; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.fx-scope-frame .fx-review-photo { max-height: min(60vh, 520px); user-select: none; -webkit-user-select: none; }
.fx-scope-draw { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.fx-scope-draw polygon { fill: var(--accent); fill-opacity: .18; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.fx-scope-draw polyline { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.fx-scope-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.fx-scope-kept { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--space-2); }
.fx-scope-kept > img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); background: var(--surface-2); }

/* ── Phone ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .fx-steps--wizard { justify-content: space-between; flex-wrap: nowrap; }
  .fx-steps--wizard .fx-step:not([aria-current="step"]) .fx-step-label { display: none; }
  .fx-steps--wizard .fx-step:not(:last-child)::after { width: 12px; }
  .fx-otp { gap: var(--space-1); }
  .fx-otp > input { font-size: 20px; }
  .fx-choice-chip { min-height: var(--touch-h); }
  .fx-view-svg { max-width: 220px; }
  .fx-view-picker.has-3d .fx-view-svg { max-width: 300px; }
  .fx-view-picker.has-3d .fx-view-3d { width: min(48%, 144px); }
  .fx-review-photo { max-height: 160px; }
  .fx-review-pair .fx-review-photo { max-height: 120px; }
  .fx-review-unknown { min-height: var(--touch-h); }
  .fx-scope-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fx-scope-frame .fx-review-photo { max-height: 55vh; }
  .fx-scope-tools .fx-btn { min-height: var(--touch-h); flex: 1; }
  .fx-carousel-nav .fx-btn { flex: 1; }
  .fx-link-btn { min-height: var(--touch-h); }
}
/* --- css/ds/components-report.css --- */
/* analyst/static/css/ds/components-report.css - CA-160 generic design-system components added while
   converting the Analyst area (analysis report, wizard, uploader). Tokens only, fx-* names, no area
   names. To be folded into components.css. */

/* ── Disclosure: a collapsible row (<details class="fx-disclosure">) ── */
.fx-disclosure { border-bottom: 1px solid var(--border); }
.fx-disclosure:last-child { border-bottom: 0; }
.fx-disclosure > summary { display: flex; align-items: center; gap: var(--space-3); min-height: var(--row-h); padding: var(--space-2) var(--space-4); list-style: none; cursor: pointer; color: var(--text-strong); }
.fx-disclosure > summary::-webkit-details-marker { display: none; }
.fx-disclosure > summary:hover { background: var(--surface-2); }
.fx-disclosure > summary > .fx-icon:last-child { margin-left: auto; color: var(--text-muted); transition: transform .15s ease-out; }
.fx-disclosure[open] > summary > .fx-icon:last-child { transform: rotate(180deg); }
.fx-disclosure-title { flex: 1; min-width: 0; font-weight: 500; }
.fx-disclosure-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); color: var(--text-muted); font-size: 13px; line-height: 18px; }
.fx-disclosure-bd { display: grid; gap: var(--space-3); padding: 0 var(--space-4) var(--space-4); color: var(--text); }
.fx-card > .fx-disclosure:first-child > summary { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.fx-disclosure--card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.fx-disclosure--card:last-child { border-bottom: 1px solid var(--border); }
.fx-disclosure--card > summary { border-radius: var(--radius-lg); }
.fx-disclosure--warn { border-color: transparent; background: var(--warn-soft); }
.fx-disclosure--warn > summary:hover { background: none; }
.fx-disclosure--flat { border-width: 1px 0 0; border-style: solid; border-color: var(--border); border-radius: 0; background: none; }
.fx-disclosure-end { display: inline-flex; align-items: center; gap: var(--space-2); margin-left: auto; color: var(--text-muted); font-weight: 400; }
.fx-disclosure-chev { transition: transform .15s ease-out; }
.fx-disclosure[open] > summary .fx-disclosure-chev { transform: rotate(180deg); }

/* Static section header (same look as fx-panel-toggle, not clickable) */
.fx-panel-head { cursor: default; }
.fx-panel-head:hover { background: none; }
.fx-panel-head .fx-panel-toggle-title { margin: 0; font: inherit; color: inherit; }
/* Disclosure inside a padded container: no divider, no side padding */
.fx-disclosure--plain { border-bottom: 0; }
.fx-disclosure--plain > summary, .fx-disclosure--plain > .fx-disclosure-bd { padding-left: 0; padding-right: 0; }
.fx-disclosure--plain > summary:hover { background: none; }

/* ── Expandable table row (fx-table): toggle + detail row ── */
.fx-table .is-toggle { width: 44px; }
.fx-table tr.is-clickable:not(.is-expanded) + tr.fx-row-detail { display: none; }
.fx-table tbody tr.fx-row-detail:hover { background: transparent; }
.fx-table tr.fx-row-detail > td { height: auto; padding: var(--space-3) var(--space-3) var(--space-4); background: var(--surface-2); }
.fx-table tr.is-expanded .is-toggle .fx-icon { transform: rotate(90deg); }
.fx-table .is-toggle .fx-icon { transition: transform .15s ease-out; }
.fx-table tr.is-clickable { cursor: pointer; }
.fx-table tr.is-dim td { color: var(--text-muted); }
.fx-table tr.is-flash > td { background: var(--warn-soft); transition: background-color .15s ease-out; }
.fx-table tfoot td { height: var(--row-h); padding: 0 var(--space-3); border-top: 1px solid var(--border); font-weight: 600; color: var(--text-strong); }
.fx-cell-stack { display: grid; gap: 2px; }
.fx-cell-wrap { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.fx-table td { padding-top: var(--space-2); padding-bottom: var(--space-2); }

/* Link-styled inline button (cross-references inside tables and cards) */
.fx-link-btn { display: inline; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 500; text-align: left; cursor: pointer; }
.fx-link-btn:hover { text-decoration: underline; }

/* ── Media viewer: photo stage + prev/next + thumbnails ── */
.fx-media-tile { display: grid; gap: var(--space-2); min-width: 0; }
.fx-media-stage { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius-lg); background: var(--surface-2); border: 1px solid var(--border); }
.fx-media-stage > img { display: block; width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.fx-media-stage > canvas { position: absolute; }
.fx-media-stage > .fx-icon-btn { position: absolute; background: var(--surface); color: var(--text-strong); box-shadow: var(--shadow-pop); }
.fx-media-stage > .fx-icon-btn:hover { background: var(--surface-2); }
.fx-media-stage > .fx-media-fs { top: var(--space-2); right: var(--space-2); }
.fx-media-stage > .fx-media-prev { left: var(--space-2); top: 50%; transform: translateY(-50%); }
.fx-media-stage > .fx-media-next { right: var(--space-2); top: 50%; transform: translateY(-50%); }
.fx-media-stage > .fx-icon-btn:disabled { opacity: .4; cursor: default; }
.fx-media-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); font-size: 13px; line-height: 18px; color: var(--text-muted); }
.fx-thumbs { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.fx-thumbs--scroll { flex-wrap: nowrap; overflow-x: auto; padding: var(--space-2) 0; scrollbar-width: thin; }
.fx-thumb-item { position: relative; }
.fx-thumb { position: relative; display: grid; grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); place-items: center; flex: none; width: var(--thumb-w, var(--thumb-size, 64px)); height: var(--thumb-h, var(--thumb-size, 48px)); padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text-muted); cursor: pointer; }
.fx-thumb:hover { border-color: var(--text-muted); }
img.fx-thumb, video.fx-thumb { object-fit: cover; }
button.fx-thumb, a.fx-thumb { cursor: pointer; }
.fx-thumb > img, .fx-thumb-open > img, .fx-thumb-media { display: block; width: 100%; height: 100%; border-radius: var(--radius-sm); object-fit: cover; }
.fx-thumb-media { display: grid; place-items: center; align-content: center; color: var(--text-muted); font: 500 12px/16px var(--font-sans); font-variant-numeric: tabular-nums; }
.fx-thumb-open { display: block; width: 100%; height: 100%; padding: 0; border: 0; border-radius: inherit; background: none; color: inherit; cursor: pointer; }
.fx-thumb[aria-pressed="true"], .fx-thumb[aria-current="true"], .fx-thumb.is-active { border-color: var(--text-strong); box-shadow: 0 0 0 1px var(--text-strong); }
.fx-thumb.is-dim img { opacity: .5; }
.fx-thumb--add, .fx-thumb-add { border-style: dashed; border-color: var(--border-control); background: var(--surface); }
.fx-thumb--add:hover, .fx-thumb-add:hover { color: var(--text-strong); background: var(--surface-2); }
.fx-thumb-x, .fx-thumb-rm, .fx-thumb-del { position: absolute; top: -6px; right: -6px; z-index: 1; display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--surface); color: var(--text-muted); cursor: pointer; }
.fx-thumb-x:hover, .fx-thumb-rm:hover, .fx-thumb-del:hover { color: var(--danger); }
.fx-thumb-x .fx-icon, .fx-thumb-rm .fx-icon, .fx-thumb-del .fx-icon { width: 12px; height: 12px; }
.fx-thumb-flag { position: absolute; right: -6px; bottom: -6px; display: grid; place-items: center; width: 20px; height: 20px; border: 2px solid var(--surface); border-radius: var(--radius-full); cursor: default; }
.fx-thumb-flag--warn { background: var(--warn-soft); color: var(--warn); }
.fx-thumb-flag--danger { background: var(--danger-soft); color: var(--danger); }
.fx-thumb-badge { position: absolute; left: 2px; bottom: 2px; }

/* ── Hover card: small floating preview (image + caption) ── */
.fx-hover-card { position: fixed; z-index: var(--z-popover); width: 240px; padding: var(--space-2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); pointer-events: none; }
.fx-hover-card-stage { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius); background: var(--surface-2); }
.fx-hover-card-stage > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.fx-hover-card-stage > canvas { position: absolute; }
.fx-hover-card-cap { padding: var(--space-2) var(--space-1) 0; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--text-strong); }
.fx-tooltip--float { position: fixed; pointer-events: none; white-space: pre-line; }
.fx-tooltip--anchor { position: absolute; transform: translate(-50%, calc(-100% - 8px)); pointer-events: none; white-space: nowrap; }

/* ── Stacked share bar + legend ── */
.fx-bar-stack { display: flex; height: 8px; overflow: hidden; border-radius: var(--radius-full); background: var(--surface-2); }
.fx-bar-seg { flex: var(--value, 1) 1 0; min-width: 0; }
.fx-bar-seg + .fx-bar-seg { border-left: 2px solid var(--surface); }
.fx-bar-seg--1 { background: var(--chart-1); }
.fx-bar-seg--2 { background: var(--chart-2); }
.fx-bar-seg--3 { background: var(--chart-3); }
.fx-bar-seg--4 { background: var(--chart-4); }
.fx-legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); font-size: 13px; line-height: 18px; color: var(--text); }
.fx-legend-item { display: inline-flex; align-items: center; gap: var(--space-2); }
.fx-legend-item::before { content: ""; width: 8px; height: 8px; border-radius: var(--radius-sm); background: var(--chart-5); }
.fx-legend-item--1::before { background: var(--chart-1); }
.fx-legend-item--2::before { background: var(--chart-2); }
.fx-legend-item--3::before { background: var(--chart-3); }
.fx-legend-item--4::before { background: var(--chart-4); }

/* Inline meter (a value against the largest in its list) */
.fx-meter { display: flex; align-items: center; gap: var(--space-2); min-width: 96px; }
.fx-meter > .fx-progress { flex: 1; min-width: 48px; }

/* ── Rating scale (A..G): one step marked current ── */
.fx-scale { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius); background: var(--surface-2); }
.fx-scale-step { display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 var(--space-1); border-radius: var(--radius-sm); color: var(--text-muted); font: 500 12px/16px var(--font-sans); }
.fx-scale-step[aria-current="true"] { background: var(--surface); color: var(--text-strong); font-weight: 600; box-shadow: 0 0 0 1px var(--border-control); }
.fx-scale-step[aria-current="true"].is-ok { background: var(--ok-soft); color: var(--ok); box-shadow: none; }
.fx-scale-step[aria-current="true"].is-warn { background: var(--warn-soft); color: var(--warn); box-shadow: none; }
.fx-scale-step[aria-current="true"].is-danger { background: var(--danger-soft); color: var(--danger); box-shadow: none; }

/* Grade mark: a single letter grade shown large */
.fx-grade { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text-strong); font: 600 24px/32px var(--font-sans); }
.fx-grade.is-ok { background: var(--ok-soft); color: var(--ok); }
.fx-grade.is-warn { background: var(--warn-soft); color: var(--warn); }
.fx-grade.is-danger { background: var(--danger-soft); color: var(--danger); }
.fx-grade--sm { width: 32px; height: 32px; font-size: 16px; line-height: 24px; border-radius: var(--radius); }

/* KPI tile extras: tone on the value, an inline info button */
.fx-kpi-value.is-ok { color: var(--ok); }
.fx-kpi-value.is-warn { color: var(--warn); }
.fx-kpi-value.is-danger { color: var(--danger); }
.fx-kpi-value.is-muted { color: var(--text-muted); }
.fx-kpi-value--md { font-size: 20px; line-height: 28px; }
.fx-kpi-hd { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.fx-kpi .fx-icon-btn--sm { margin: -4px -4px -4px 0; }
.fx-kpi-grid--sm { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.fx-kpi-grid--sm .fx-kpi { padding: var(--space-3); }
.fx-kpi-grid--sm .fx-kpi-value { font-size: 16px; line-height: 24px; }

/* ── Plain text blocks inside cards ── */
.fx-prose { margin: 0; color: var(--text); white-space: pre-line; overflow-wrap: anywhere; }
.fx-bullets { display: grid; gap: var(--space-1); margin: 0; padding-left: var(--space-5); color: var(--text); }
.fx-subhead { margin: 0; font: 500 13px/18px var(--font-sans); color: var(--text-muted); }
/* Definition grid: label on the left, value on the right (stacked on phones) */
.fx-dl { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr); gap: var(--space-3) var(--space-6); margin: 0; }
.fx-dl > dt { color: var(--text-muted); font-size: 13px; line-height: 20px; }
.fx-dl > dd { min-width: 0; margin: 0; color: var(--text); font-size: 14px; line-height: 20px; }
.fx-dl .fx-bullets { gap: 2px; }
/* Disclosures nested inside a card disclosure (a phase and its steps) */
.fx-disclosure-group { border-top: 1px solid var(--border); }
.fx-disclosure-group > .fx-disclosure:last-child { border-bottom: 0; }
.fx-badges { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.fx-badge--lg { height: 28px; padding: 0 var(--space-3); font-size: 14px; line-height: 20px; }
button.fx-badge { border: 0; font-family: var(--font-sans); cursor: pointer; }
button.fx-badge:hover { box-shadow: 0 0 0 1px var(--border-control); }

/* ── Drop zone and choice tile (uploader) ── */
.fx-dropzone { display: grid; justify-items: center; gap: var(--space-1); width: 100%; padding: var(--space-6) var(--space-4); border: 1px dashed var(--border-control); border-radius: var(--radius-lg); background: var(--surface); color: var(--text-muted); font: inherit; text-align: center; cursor: pointer; transition: background-color .15s ease-out, border-color .15s ease-out; }
.fx-dropzone:hover, .fx-dropzone.is-dragover { background: var(--surface-2); border-color: var(--text-strong); }
.fx-dropzone .fx-icon { width: 20px; height: 20px; color: var(--text-muted); }
.fx-dropzone-title { color: var(--text-strong); font-weight: 500; }
.fx-dropzone-sub { font-size: 13px; line-height: 18px; }
.fx-dropzone.is-highlight { border-color: var(--accent); }
.fx-choice { display: flex; align-items: center; gap: var(--space-3); width: 100%; padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text-strong); font: inherit; text-align: left; cursor: pointer; transition: background-color .15s ease-out; }
.fx-choice:hover { background: var(--surface-2); }
.fx-choice-text { display: grid; flex: 1; min-width: 0; }
.fx-choice-title { font-weight: 500; }
.fx-choice-sub { font-size: 13px; line-height: 18px; color: var(--text-muted); }
.fx-choice > .fx-list-icon { width: 36px; height: 36px; }
.fx-divider-text { display: flex; align-items: center; gap: var(--space-3); color: var(--text-muted); font-size: 12px; line-height: 16px; }
.fx-divider-text::before, .fx-divider-text::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ── Step tabs: fx-steps whose steps are buttons ── */
.fx-steps--nav .fx-step { padding: 0; border: 0; background: none; cursor: pointer; }
.fx-steps--nav .fx-step:disabled { cursor: default; opacity: .6; }
.fx-steps--nav .fx-step:not(:disabled):hover { color: var(--text-strong); }
.fx-step-label { white-space: nowrap; }

/* ── Live activity feed (streamed progress lines) ── */
.fx-feed { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.fx-feed-item { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--border); color: var(--text); font-size: 14px; line-height: 20px; }
.fx-feed-item:last-child { border-bottom: 0; }
.fx-feed-icon { display: inline-grid; flex: none; margin-top: 2px; color: var(--text-muted); }
.fx-feed-item.is-ok .fx-feed-icon { color: var(--ok); }
.fx-feed-item.is-warn .fx-feed-icon { color: var(--warn); }
.fx-feed-item.is-danger .fx-feed-icon { color: var(--danger); }
.fx-feed-text .fx-badge { margin: 0 2px; vertical-align: 1px; }
.fx-feed-text { display: grid; gap: 2px; flex: 1; min-width: 0; max-width: 96ch; }   /* readable line length on wide screens */
.fx-feed-text > .fx-badge { justify-self: start; }   /* a tag stays tag-sized, never a full-width bar */
.fx-feed-title { color: var(--text-strong); font-weight: 500; }
.fx-feed-sub { font-size: 13px; line-height: 18px; color: var(--text-muted); }
.fx-state-icon.is-ok { background: var(--ok-soft); color: var(--ok); }

/* ── Large dialog (a whole page in a dialog: History) and the full-screen media viewer ── */
.fx-dialog--xl { width: min(1200px, 100%); height: min(calc(100vh - 64px), 960px); max-height: none; }
.fx-dialog--xl > .fx-dialog-bd { flex: 1; min-height: 0; padding-top: var(--space-2); }
.fx-dialog--xl:fullscreen { width: 100%; height: 100%; border: 0; border-radius: 0; }
.fx-scrim--media { grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); padding: 0; background: var(--scrim); }
.fx-media-full { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: 100%; height: 100%; background: var(--bg); }
.fx-media-full-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); height: var(--appbar-h); padding: 0 var(--space-2) 0 var(--space-4); background: var(--surface); border-bottom: 1px solid var(--border); color: var(--text-strong); }
.fx-media-full-stage { position: relative; display: grid; grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); place-items: center; min-height: 0; padding: var(--space-4) var(--space-12); overflow: hidden; }
.fx-media-full-stage > img { max-width: 100%; max-height: 100%; object-fit: contain; }
.fx-media-full-stage > canvas { position: absolute; }
.fx-media-full-stage > .fx-icon-btn { position: absolute; top: 50%; transform: translateY(-50%); background: var(--surface); color: var(--text-strong); box-shadow: var(--shadow-pop); }
.fx-media-full-stage > .fx-media-prev { left: var(--space-2); }
.fx-media-full-stage > .fx-media-next { right: var(--space-2); }
.fx-media-full-stage > .fx-icon-btn:disabled { opacity: .4; }
/* Damage type key under the full-screen photo (CA-340): same fx-dmg-key as the inline viewer. */
.fx-media-full-key { padding: var(--space-2) var(--space-4); background: var(--surface); border-top: 1px solid var(--border); }
canvas.is-pointer { cursor: pointer; }

@media (max-width: 768px) {
  /* Phone: the title takes the first line (with the number and the chevron); the meta wraps to a line of its own */
  .fx-disclosure > summary { flex-wrap: wrap; row-gap: 2px; }
  .fx-disclosure > summary > .fx-disclosure-title { flex: 1 1 0; }
  .fx-disclosure > summary > .fx-disclosure-meta { order: 3; flex-basis: 100%; }
  .fx-card--flat-phone { border: 0; background: none; }
  .fx-table--cards .fx-table tr.is-clickable:not(.is-expanded) + tr.fx-row-detail { display: none; }
  .fx-table--cards .fx-table tr.fx-row-detail > td { display: block; padding: 0; background: none; }
  .fx-table--cards .fx-table tr.fx-row-detail > td::before { content: none; }
  .fx-table--cards .fx-table td.is-toggle { display: none; }
  .fx-table--cards .fx-table tr.is-clickable { cursor: pointer; }
  .fx-table--cards .fx-table td .fx-cell-wrap, .fx-table--cards .fx-table td .fx-meter { justify-content: flex-end; }
  .fx-table--cards .fx-table tfoot { display: block; }
  .fx-table--cards .fx-table tfoot tr { display: flex; justify-content: space-between; }
  .fx-table--cards .fx-table tfoot td { height: auto; border: 0; }
  .fx-hover-card { display: none; }
  .fx-thumb { width: var(--thumb-w-phone, var(--thumb-size, 72px)); height: var(--thumb-h-phone, var(--thumb-size, 54px)); }
  .fx-thumb-x, .fx-thumb-rm, .fx-thumb-del { width: 28px; height: 28px; }
  .fx-media-stage > .fx-icon-btn { width: 40px; height: 40px; }
  .fx-dialog--xl { height: 100vh; max-height: none; border-radius: 0; }
  .fx-dialog--xl::before { display: none; }
  .fx-media-full-stage { padding: var(--space-2); }
}

@media (prefers-reduced-motion: reduce) {
  .fx-disclosure > summary > .fx-icon:last-child, .fx-table .is-toggle .fx-icon, .fx-dropzone, .fx-choice, .fx-table tr.is-flash > td, .fx-disclosure-chev { transition: none; }
}

@media (max-width: 768px) {
  .fx-dl { grid-template-columns: minmax(0, 1fr); gap: var(--space-1); }
  .fx-dl > dd + dt { margin-top: var(--space-2); }
}

/* ── Marker: a small round numbered badge (photo pins, list numbers). Tones: danger / warn / muted ── */
.fx-marker { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 var(--space-1); border: 2px solid var(--surface); border-radius: 999px; background: var(--text-muted); color: var(--surface); font: 600 12px/16px var(--font-sans); font-variant-numeric: tabular-nums; box-shadow: var(--shadow-pop); }
.fx-marker--danger { background: var(--danger); }
.fx-marker--warn { background: var(--warn); }
/* CA-334: a damage number in its family colour, the same as its pin on a photo and on the 3D model */
.fx-marker--dmg { flex: none; background: var(--dmg-other); color: var(--dmg-on); }
.fx-marker--dmg[data-dmg="surface"] { background: var(--dmg-surface); }
.fx-marker--dmg[data-dmg="rust"] { background: var(--dmg-rust); }
.fx-marker--dmg[data-dmg="deform"] { background: var(--dmg-deform); }
.fx-marker--dmg[data-dmg="break"] { background: var(--dmg-break); }
.fx-marker--dmg[data-dmg="glass"] { background: var(--dmg-glass); }
.fx-marker--dmg[data-dmg="missing"] { background: var(--dmg-missing); }
.fx-marker--dmg[data-dmg="tyre"] { background: var(--dmg-tyre); }
button.fx-marker { cursor: pointer; }
button.fx-marker:hover, button.fx-marker:focus-visible, .fx-marker.is-active { outline: 2px solid var(--text-strong); outline-offset: 1px; }

/* ── Region: a dashed outline drawn over a photo area ── */
.fx-region { border: 2px dashed var(--text-muted); border-radius: var(--radius-sm); }
.fx-region--danger { border-color: var(--danger); }
.fx-region--warn { border-color: var(--warn); }

/* ── Corner dot: a small status dot on a thumbnail ── */
.fx-corner-dot { width: 10px; height: 10px; border: 2px solid var(--surface); border-radius: 50%; background: var(--warn); }

/* ── Accent: a coloured leading edge on a card or row ── */
.fx-accent { border-inline-start: 3px solid var(--text-muted); }
.fx-accent--danger { border-inline-start-color: var(--danger); }
.fx-accent--warn { border-inline-start-color: var(--warn); }

/* ── Badge button: an fx-badge used as a button ── */
.fx-badge-btn { border: 0; cursor: pointer; font-family: inherit; }
/* --- css/ds/components-capture.css --- */
/* analyst/static/css/ds/components-capture.css - CA-160 generic design-system components added while converting the Analyst area (capture); tokens only, fx-* names. To be folded into components.css. */

/* ── Full-screen camera tool ───────────────────────────────────────── */
/* design-exception: the camera palette is drawn over live video, so it stays the same in light and dark themes */
.fx-cam {
  --cam-bg: #000;
  --cam-fg: #fff;
  --cam-fg-dim: rgba(255, 255, 255, 0.75);
  --cam-scrim: rgba(0, 0, 0, 0.6);
  --cam-line: rgba(255, 255, 255, 0.3);
  --cam-ok: #4ade80;
  --cam-warn: #fbbf24;
  --cam-danger: #f87171;
  --cam-hi: #67e8f9;
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-dialog) + var(--fx-layer, 0));
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
}
.fx-cam-shell { position: relative; display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; background: var(--surface); }
.fx-cam-shell.is-immersive { background: var(--cam-bg); }
/* The pre-camera tips screen is ordinary page content even while the shell is immersive (phones start there) */
.fx-cam-shell.is-immersive.is-tips { background: var(--surface); }
.fx-cam-stage { position: relative; overflow: hidden; background: var(--cam-bg); color: var(--cam-fg); }
.fx-cam-video { display: block; background: var(--cam-bg); }

/* Translucent surface over live video: status banner, step pill, record pill, labels */
.fx-cam-hud { background: var(--cam-scrim); color: var(--cam-fg); border: 1px solid var(--cam-line); border-radius: var(--radius-lg); font: 500 13px/18px var(--font-sans); }
.fx-cam-hud--ok { color: var(--cam-ok); border-color: var(--cam-ok); }
.fx-cam-hud--warn { color: var(--cam-warn); border-color: var(--cam-warn); }
.fx-cam-hud--danger { color: var(--cam-danger); border-color: var(--cam-danger); }
.fx-cam-pill { border-radius: var(--radius-full); }
button.fx-cam-hud { cursor: pointer; text-align: left; }
.fx-cam-bare { display: inline-flex; align-items: center; gap: var(--space-2); padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.fx-cam-bare:disabled { opacity: .5; cursor: not-allowed; }
.fx-cam-strong { font-weight: 600; }
.fx-cam-dim { color: var(--cam-fg-dim); font-weight: 400; }

/* Round icon button over video (switch camera, fullscreen, thumbnail, guide toggle) */
.fx-cam-btn { position: relative; display: inline-grid; place-items: center; flex: none; width: var(--touch-h); height: var(--touch-h); padding: 0; border: 1px solid var(--cam-line); border-radius: var(--radius-full); background: var(--cam-scrim); color: var(--cam-fg); cursor: pointer; transition: background-color .15s ease-out; }
.fx-cam-btn:hover { background: var(--cam-line); }
.fx-cam-btn[aria-pressed="true"], .fx-cam-btn.is-active { background: var(--cam-fg); border-color: var(--cam-fg); color: var(--cam-bg); }
.fx-cam-btn:disabled { opacity: .4; cursor: not-allowed; }
.fx-cam-btn--ghost { border-color: transparent; background: transparent; }
.fx-cam-btn--thumb { border-radius: var(--radius-lg); background-color: var(--cam-scrim); background-image: var(--thumb, none); background-position: center; background-size: cover; }
.fx-cam-count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 var(--space-1); border-radius: var(--radius-full); background: var(--cam-fg); color: var(--cam-bg); font: 600 12px/18px var(--font-sans); font-variant-numeric: tabular-nums; text-align: center; }

/* Shutter: tap = photo, hold = video. --shutter sets the outer size. */
.fx-cam-shutter { display: grid; place-items: center; flex: none; width: var(--shutter, 72px); height: var(--shutter, 72px); padding: 0; border: 3px solid var(--cam-fg); border-radius: var(--radius-full); background: transparent; cursor: pointer; touch-action: none; transition: border-color .15s ease-out; }
.fx-cam-shutter::before { content: ""; width: calc(var(--shutter, 72px) - 16px); height: calc(var(--shutter, 72px) - 16px); border-radius: var(--radius-full); background: var(--cam-fg); transition: width .15s ease-out, height .15s ease-out, border-radius .15s ease-out, background-color .15s ease-out; }
.fx-cam-shutter:active::before { width: calc(var(--shutter, 72px) - 24px); height: calc(var(--shutter, 72px) - 24px); }
.fx-cam-shutter:disabled { opacity: .35; cursor: not-allowed; }
.fx-cam-shutter.is-recording { border-color: var(--cam-danger); }
.fx-cam-shutter.is-recording::before { width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--cam-danger); animation: fx-cam-blink 1.2s ease-in-out infinite; }

/* Recording dot and camera flash */
.fx-cam-dot { width: 8px; height: 8px; flex: none; border-radius: var(--radius-full); background: var(--cam-danger); animation: fx-cam-blink 1s ease-in-out infinite; }
.fx-cam-dot--paused { background: var(--cam-warn); animation: none; }
.fx-cam-flash { background: var(--cam-fg); opacity: 0; pointer-events: none; transition: opacity .1s ease-out; }
.fx-cam-flash.is-on { opacity: .85; transition-duration: .05s; }
@keyframes fx-cam-blink { 50% { opacity: .3; } }
@keyframes fx-cam-spin { to { transform: rotate(360deg); } }
@keyframes fx-cam-turn { 0%, 30% { transform: rotate(0); } 65%, 100% { transform: rotate(90deg); } }
@keyframes fx-cam-turn-back { 0%, 30% { transform: rotate(90deg); } 65%, 100% { transform: rotate(0); } }

/* Spinning status icon and orientation gate */
.fx-cam-spin { animation: fx-cam-spin 1.1s linear infinite; }
.fx-cam-gate { background: var(--cam-scrim); color: var(--cam-fg); font: 400 14px/20px var(--font-sans); text-align: center; }
.fx-cam-gate strong { font: 600 17px/24px var(--font-sans); }
.fx-cam-gate-icon { display: inline-flex; animation: fx-cam-turn 1.6s ease-in-out infinite; }
.fx-cam-gate[data-required="portrait"] .fx-cam-gate-icon { animation-name: fx-cam-turn-back; }

/* Floating tag over video (end tags of the reference outline) */
.fx-cam-tag { border: 1px solid var(--cam-line); border-radius: var(--radius-full); background: var(--cam-scrim); color: var(--cam-fg); font: 600 13px/18px var(--font-sans); }

/* Bottom sheet inside a full-screen tool (evidence gallery) */
.fx-cam-sheet { background: var(--surface); border-top: 1px solid var(--border); color: var(--text); }

/* ── Reference outline drawn over video (guide) + where-to-stand map ─── */
.fx-guide { transition: opacity .3s ease-out; }
.fx-guide.is-fading { opacity: 0; }
.fx-guide * { vector-effect: non-scaling-stroke; }
.fx-guide-body { fill: color-mix(in srgb, var(--cam-fg) 8%, transparent); stroke: var(--cam-fg); stroke-width: 2.2; stroke-linejoin: round; }
.fx-guide-glass { fill: color-mix(in srgb, var(--cam-fg) 20%, transparent); stroke: color-mix(in srgb, var(--cam-fg) 60%, transparent); stroke-width: 1.3; stroke-linejoin: round; }
.fx-guide-glass-hero { fill: color-mix(in srgb, var(--cam-hi) 20%, transparent); stroke: var(--cam-hi); stroke-width: 2.4; stroke-linejoin: round; }
.fx-guide-head { fill: color-mix(in srgb, var(--cam-warn) 30%, var(--cam-fg)); stroke: var(--cam-fg); stroke-width: 1; }
.fx-guide-tail { fill: color-mix(in srgb, var(--cam-danger) 60%, transparent); stroke: var(--cam-danger); stroke-width: 1; }
.fx-guide-plate { fill: color-mix(in srgb, var(--cam-fg) 55%, transparent); stroke: var(--cam-fg); stroke-width: .8; }
.fx-guide-mirror { fill: color-mix(in srgb, var(--cam-fg) 14%, transparent); stroke: var(--cam-fg); stroke-width: 1.2; }
.fx-guide-wheel-far { fill: color-mix(in srgb, var(--cam-fg) 5%, transparent); stroke: color-mix(in srgb, var(--cam-fg) 45%, transparent); stroke-width: 1.2; stroke-dasharray: 3 3; }
.fx-guide-wheel-near ellipse { fill: color-mix(in srgb, var(--cam-hi) 26%, transparent); stroke: var(--cam-hi); stroke-width: 2.4; }
.fx-guide-rim { fill: none; stroke: var(--cam-fg); stroke-width: 1.1; }
.fx-guide-hub { fill: var(--cam-fg); stroke: none; }
.fx-guide-body-line { fill: none; stroke: var(--cam-fg); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.fx-guide-wiper { fill: none; stroke: var(--cam-fg-dim); stroke-width: 1.2; stroke-linecap: round; }
.fx-guide-map { border: 1px solid var(--cam-line); border-radius: var(--radius-lg); background: var(--cam-scrim); transition: opacity .3s ease-out; }
.fx-guide-map.is-fading { opacity: 0; }
.fx-guide-map-ring { fill: none; stroke: var(--cam-line); stroke-width: .8; stroke-dasharray: 2 2; }
.fx-guide-map-spot { fill: var(--cam-fg-dim); }
.fx-guide-map-body { fill: color-mix(in srgb, var(--cam-fg) 16%, transparent); stroke: var(--cam-fg); stroke-width: .9; stroke-linejoin: round; }
.fx-guide-map-glass { fill: color-mix(in srgb, var(--cam-fg) 38%, transparent); stroke: none; }
.fx-guide-map-head { fill: color-mix(in srgb, var(--cam-warn) 30%, var(--cam-fg)); }
.fx-guide-map-tail { fill: var(--cam-danger); }
.fx-guide-map-you circle { fill: var(--cam-hi); stroke: var(--cam-fg); stroke-width: 1.2; }
.fx-guide-map-cone { fill: var(--cam-hi); fill-opacity: .42; }



/* ── Small additions to existing components ────────────────────────── */
.fx-list-text--wrap > * { overflow: visible; text-overflow: clip; white-space: normal; }
.fx-seg-mark { display: none; color: var(--ok); }
.fx-seg-opt.is-done .fx-seg-mark { display: inline-flex; }
.fx-pre { max-height: 220px; margin: 0; padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text); font: 400 12px/16px var(--font-mono); overflow: auto; overflow-wrap: anywhere; white-space: pre-wrap; }

/* Audio level meter (5 bars driven by --level 0..1 on each bar) */
.fx-level { display: inline-flex; align-items: flex-end; justify-content: center; gap: 2px; height: 16px; color: var(--cam-fg-dim, var(--text-muted)); }
.fx-level-bar { display: block; width: 3px; height: calc(3px + var(--level, 0) * 11px); border-radius: var(--radius-full); background: currentColor; transition: height .05s ease-out; }
.fx-level-bar.is-active { color: var(--cam-danger, var(--danger)); }

@media (prefers-reduced-motion: reduce) {
  .fx-cam-dot, .fx-cam-spin, .fx-cam-gate-icon, .fx-cam-shutter.is-recording::before { animation: none; }
  .fx-cam-gate-icon { transform: rotate(90deg); }
  .fx-cam-gate[data-required="portrait"] .fx-cam-gate-icon { transform: none; }
  .fx-guide, .fx-guide-map, .fx-level-bar, .fx-cam-flash, .fx-cam-shutter::before { transition: none; }
}
/* --- css/ds/components-capture-link.css --- */
/* Fluxe design system - capture-link components (plate input, camera overlay, signature pad, result
   summary...) used by the public inspection link /c/<token> (CA-160). fx-* names, tokens only; to be folded
   into components.css. Breakpoints: 768px, 1024px. */

/* ── Compact app bar of the public capture page ───────────────────── */
.fx-capbar { display: flex; align-items: center; gap: var(--space-3); min-height: var(--appbar-h); padding: var(--space-2) var(--space-4); padding-top: calc(var(--space-2) + env(safe-area-inset-top, 0px)); background: var(--surface); border-bottom: 1px solid var(--border); }
.fx-capbar-org { display: grid; min-width: 0; margin-left: auto; text-align: right; }
.fx-capbar-name { font: 600 13px/18px var(--font-sans); color: var(--text-strong); overflow-wrap: anywhere; }
.fx-capbar-sub { font-size: 12px; line-height: 16px; color: var(--text-muted); overflow-wrap: anywhere; }

/* ── Public card that ends in a sticky primary action ─────────────── */
.fx-public-card--action { display: flex; flex-direction: column; gap: var(--space-5); padding-bottom: 0; }
.fx-public-card--action > .fx-sticky-action { margin: auto calc(-1 * var(--space-8)) 0; padding: var(--space-4) var(--space-8) var(--space-5); z-index: var(--z-sticky); background: transparent; border-top: 0; }
.fx-public-card--xl { width: min(720px, 100%); }

/* ── Number plate input (the value is a literal code: mono allowed) ── */
.fx-plate { display: flex; align-items: stretch; height: 64px; overflow: hidden; background: var(--on-accent); border: 2px solid var(--border-control); border-radius: var(--radius-lg); }
.fx-plate:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.fx-plate-eu { flex: none; width: var(--space-8); background: var(--info); }
.fx-plate-input { display: flex; align-items: center; justify-content: center; flex: 1; min-width: 0; width: 100%; box-sizing: border-box; padding: 0 var(--space-3); border: 0; outline: none; background: transparent; color: var(--text-strong); font: 600 24px/32px var(--font-mono); text-align: center; }
.fx-plate-input::placeholder { color: var(--text-muted); }
.fx-plate-edit { display: flex; align-items: center; justify-content: center; flex: none; width: var(--space-8); margin-right: var(--space-2); padding: 0; border: 0; background: transparent; color: var(--text-muted); cursor: text; }   /* CA-474: the plate can be typed */
.fx-plate:focus-within .fx-plate-edit { color: var(--accent); }
[data-theme="dark"] .fx-plate-input { color: var(--bg); }

/* ── Full-screen camera overlay: video, aim frame, tip, buttons ───── */
.fx-camera { position: fixed; inset: 0; z-index: calc(var(--z-dialog) + var(--fx-layer, 0)); display: grid; place-items: center; background: var(--bg); }
.fx-camera > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fx-camera-frame { position: relative; width: min(86vw, 520px); aspect-ratio: 9 / 2; border: 3px solid var(--on-accent); border-radius: var(--radius-xl); box-shadow: 0 0 0 100vmax var(--scrim); }
.fx-camera-tip { position: absolute; left: var(--space-4); right: var(--space-4); top: calc(var(--space-4) + env(safe-area-inset-top, 0px)); margin: 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius-lg); background: var(--scrim); color: var(--on-accent); font: 500 16px/24px var(--font-sans); text-align: center; }
.fx-camera-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: var(--space-8); padding: var(--space-4) var(--space-4) calc(var(--space-6) + env(safe-area-inset-bottom, 0px)); }
.fx-camera-btn { display: inline-grid; place-items: center; flex: none; width: 56px; height: 56px; padding: 0; border: 2px solid var(--on-accent); border-radius: var(--radius-full); background: var(--scrim); color: var(--on-accent); cursor: pointer; }
.fx-camera-btn--shoot { width: 72px; height: 72px; border-width: 4px; background: var(--accent-fill); }
.fx-camera-btn--shoot:hover { background: var(--accent-fill-hover); }
.fx-camera-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Signature canvas frame ───────────────────────────────────────── */
.fx-signature { display: block; width: 100%; height: 160px; background: var(--on-accent); border: 1px solid var(--border-control); border-radius: var(--radius); touch-action: none; }

/* ── Result summary: status icon, title, subtitle ─────────────────── */
.fx-result { display: grid; justify-items: center; gap: var(--space-2); text-align: center; }
.fx-result-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--radius-full); background: var(--surface-2); color: var(--text-muted); }
.fx-result-icon--ok { background: var(--ok-soft); color: var(--ok); }
.fx-result-icon--warn { background: var(--warn-soft); color: var(--warn); }
.fx-result-icon--danger { background: var(--danger-soft); color: var(--danger); }
.fx-result-title { margin: 0; font: 600 24px/32px var(--font-sans); color: var(--text-strong); outline: none; }
.fx-result-sub { margin: 0; color: var(--text-muted); }

/* ── Collapsible section (details) ────────────────────────────────── */
.fx-fold { display: grid; gap: var(--space-2); }
.fx-fold > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: var(--touch-h); color: var(--text-strong); font: 600 16px/24px var(--font-sans); cursor: pointer; list-style: none; }
.fx-fold > summary::-webkit-details-marker { display: none; }
.fx-fold > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fx-fold-chev { display: inline-flex; color: var(--text-muted); transition: transform .15s ease-out; }
.fx-fold[open] .fx-fold-chev { transform: rotate(180deg); }
.fx-fold-bd { display: grid; gap: var(--space-3); }

/* ── Total row and tips list ──────────────────────────────────────── */
.fx-total { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 0 var(--space-1); color: var(--text-strong); font-weight: 600; }
.fx-tips { display: grid; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.fx-tips > li { display: flex; align-items: center; gap: var(--space-3); color: var(--text-strong); }

@media (max-width: 768px) {
  .fx-public-card--action > .fx-sticky-action { margin-left: calc(-1 * var(--space-4)); margin-right: calc(-1 * var(--space-4)); padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--border); }
  .fx-camera-frame { width: 90vw; }
}

@media (prefers-reduced-motion: reduce) {
  .fx-fold-chev { transition: none; }
}
/* --- css/ds/components-windshield.css --- */
/* analyst/static/css/ds/components-windshield.css - CA-160 generic design-system components added while converting the Analyst area (windshield); tokens only, fx-* names. To be folded into components.css. */


/* ── Media frame: one image, optionally a zoom button ─────────────── */
.fx-media-frame { position: relative; display: block; width: 100%; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); overflow: hidden; }
button.fx-media-frame { cursor: zoom-in; }
.fx-media-frame img { display: block; width: 100%; max-height: 280px; object-fit: contain; }

/* ── Image annotation: boxes over an image, select / hover / draw ──
   The stage takes its proportions from --ratio-num (width / height of the image); every box is
   placed with --x --y --w --h percentages set from script. */
.fx-annotate { position: relative; display: block; width: min(100%, calc(var(--annotate-max-h, 60vh) * var(--ratio-num, 1.78))); margin: 0 auto; aspect-ratio: var(--ratio-num, 1.78); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); overflow: hidden; user-select: none; touch-action: none; }
.fx-annotate > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.fx-annotate.is-drawing { cursor: crosshair; }
.fx-annotate-layer { position: absolute; inset: 0; }
.fx-annotate-box { position: absolute; left: var(--x); top: var(--y); width: var(--w); height: var(--h); border: 2px solid var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); cursor: move; touch-action: none; transition: background-color .15s ease-out; }
.fx-annotate-box:hover { background: color-mix(in srgb, var(--danger) 22%, transparent); }
.fx-annotate-box.is-selected { border-color: var(--info); background: color-mix(in srgb, var(--info) 16%, transparent); }
.fx-annotate-label { position: absolute; top: 0; left: 0; padding: 0 var(--space-1); background: var(--danger-fill); color: var(--on-accent); font: 500 12px/16px var(--font-sans); pointer-events: none; }
.fx-annotate-box.is-selected .fx-annotate-label { background: var(--info); }
.fx-annotate-handle { position: absolute; right: -8px; bottom: -8px; display: none; width: 16px; height: 16px; border: 2px solid var(--surface); border-radius: var(--radius-full); background: var(--info); cursor: nwse-resize; touch-action: none; }
.fx-annotate-handle::after { content: ""; position: absolute; inset: -12px; }
.fx-annotate-box.is-selected .fx-annotate-handle { display: block; }
.fx-annotate-draft { position: absolute; left: var(--x); top: var(--y); width: var(--w); height: var(--h); border: 2px dashed var(--info); background: color-mix(in srgb, var(--info) 15%, transparent); pointer-events: none; }

/* Styled variant (CA-433): the damages are drawn by DamageStyle on a canvas under the layer (real outline, family
   colour, texture, numbered pin); the boxes stay as invisible hit / focus areas, the selected one shows its frame,
   its resize handle and its outline points. */
.fx-annotate--dmg .fx-annotate-box { border-color: transparent; background: none; pointer-events: none; }
.fx-annotate--dmg .fx-annotate-box:hover { background: none; }
.fx-annotate--dmg .fx-annotate-box:focus-visible { outline: 2px solid var(--text-strong); outline-offset: 2px; }
.fx-annotate--dmg .fx-annotate-box.is-selected { border: 1px dashed var(--text-strong); background: none; }
.fx-annotate--dmg .fx-annotate-label { display: none; }
.fx-annotate--dmg .fx-annotate-handle { pointer-events: auto; }
.fx-annotate-vertex { position: absolute; left: var(--x); top: var(--y); width: 12px; height: 12px; padding: 0; transform: translate(-50%, -50%); border: 2px solid var(--surface); border-radius: var(--radius-full); background: var(--text-strong); cursor: grab; touch-action: none; }
.fx-annotate-vertex::after { content: ""; position: absolute; inset: -10px; }
.fx-annotate-vertex.is-dragging { background: var(--surface); border-color: var(--text-strong); cursor: grabbing; }
.fx-annotate--dmg > .fx-dmg-canvas { z-index: 0; }
.fx-annotate--dmg .fx-annotate-layer { z-index: 1; }

/* ── Photo gallery: stage with overlay regions, nav, strip, counter ─ */
.fx-gallery { display: grid; gap: var(--space-3); min-width: 0; }
.fx-gallery-stage { position: relative; display: grid; place-items: center; min-height: 160px; padding: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); overflow: hidden; }
.fx-gallery-frame { position: relative; display: block; max-width: 100%; }
.fx-gallery-img { display: block; max-width: 100%; max-height: 60vh; width: auto; height: auto; border-radius: var(--radius-sm); cursor: zoom-in; }
.fx-gallery-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fx-gallery-nav, .fx-gallery-full { position: absolute; z-index: var(--z-sticky); }
.fx-gallery-nav { top: 50%; transform: translateY(-50%); }
.fx-gallery-prev { left: var(--space-2); }
.fx-gallery-next { right: var(--space-2); }
.fx-gallery-full { top: var(--space-2); right: var(--space-2); }
.fx-gallery-count { text-align: center; font-size: 12px; line-height: 16px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.fx-gallery-tip { padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.fx-region { fill: color-mix(in srgb, var(--danger) 16%, transparent); stroke: var(--danger); stroke-width: 2; cursor: pointer; pointer-events: all; }
.fx-region:hover { fill: color-mix(in srgb, var(--danger) 28%, transparent); }
.fx-region--ok { fill: color-mix(in srgb, var(--ok) 16%, transparent); stroke: var(--ok); }
.fx-region--ok:hover { fill: color-mix(in srgb, var(--ok) 28%, transparent); }
.fx-region.is-selected { stroke: var(--info); stroke-width: 3; }

/* ── Stage list: pending / working / done steps with detail ───────── */
.fx-stages { display: grid; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.fx-stage { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: var(--space-3); align-items: start; color: var(--text-muted); }
.fx-stage-mark { display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid var(--border-control); border-radius: var(--radius-full); }
.fx-stage-mark .fx-icon { width: 12px; height: 12px; }
.fx-stage-text { display: grid; gap: var(--space-1); min-width: 0; }
.fx-stage-title { font-weight: 500; line-height: 20px; }
.fx-stage-detail { font-size: 13px; line-height: 18px; color: var(--text-muted); }
.fx-stage.is-active { color: var(--text-strong); }
.fx-stage.is-active .fx-stage-mark { border-color: var(--text-strong); }
.fx-stage.is-active .fx-stage-mark::after { content: ""; width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--text-strong); }
.fx-stage.is-done { color: var(--text); }
.fx-stage.is-done .fx-stage-mark { border-color: var(--ok-soft); background: var(--ok-soft); color: var(--ok); }

/* ── Grade scale (A to G): the current grade filled, the rest tinted ─ */
.fx-grade-scale { display: flex; gap: 2px; }
.fx-grade-cell { display: grid; place-items: center; width: 24px; height: 24px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-muted); font: 500 12px/16px var(--font-sans); }
.fx-grade-cell[data-tone="ok"] { background: var(--ok-soft); color: var(--ok); }
.fx-grade-cell[data-tone="warn"] { background: var(--warn-soft); color: var(--warn); }
.fx-grade-cell[data-tone="danger"] { background: var(--danger-soft); color: var(--danger); }
.fx-grade-cell.is-on[data-tone="ok"] { background: var(--ok); color: var(--surface); }
.fx-grade-cell.is-on[data-tone="warn"] { background: var(--warn); color: var(--surface); }
.fx-grade-cell.is-on[data-tone="danger"] { background: var(--danger-fill); color: var(--on-accent); }
.fx-grade-letter { font: 600 24px/32px var(--font-sans); }
.fx-grade-letter[data-tone="ok"] { color: var(--ok); }
.fx-grade-letter[data-tone="warn"] { color: var(--warn); }
.fx-grade-letter[data-tone="danger"] { color: var(--danger); }

/* ── Small extensions of existing components (new states only) ────── */
.fx-btn[aria-pressed="true"] { background: var(--surface-2); border-color: var(--text-strong); }
.fx-list-item.is-selected { background: var(--surface-2); }
.fx-list-pick { display: flex; flex: 1; align-items: center; gap: var(--space-3); min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.fx-row-toggle .fx-icon { transition: transform .15s ease-out; }
.fx-row-toggle[aria-expanded="true"] .fx-icon { transform: rotate(90deg); }
.fx-table .fx-row-detail td { height: auto; padding: var(--space-3) var(--space-4); background: var(--surface-2); }
.fx-dialog-media { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; border-radius: var(--radius); object-fit: contain; }
.fx-dialog-ft--split { justify-content: space-between; }
.fx-tab-panel[hidden] { display: none; }

@media (max-width: 768px) {
  .fx-gallery-img { max-height: 48vh; }
  .fx-dialog-ft--split { flex-direction: row; }
  .fx-dialog-ft--split .fx-icon-btn { width: var(--touch-h-lg); height: var(--touch-h-lg); }
}

@media (prefers-reduced-motion: reduce) {
  .fx-annotate-box, .fx-row-toggle .fx-icon { transition: none; }
}
/* --- css/ds/components-3d.css --- */
/* analyst/static/css/ds/components-3d.css - CA-160 generic design-system components added while converting the Analyst area (3d); tokens only, fx-* names. To be folded into components.css.

   Families: colour scales (--sev-*, --mark-*), fx-probe (token -> canvas colour), fx-sev (severity badge), fx-key (colour key),
   fx-viewer (canvas viewer with tool bar, photo panel, side panel / bottom drawer, hints, footer), fx-item (selectable detail card),
   fx-pick (choice chip row), fx-drawer-handle, fx-imgbox (full-screen photo), fx-stage-frame (labelled frame on a canvas),
   fx-range, fx-combo (input with option menu). */

/* ── Colour scales: derived from the design tokens, so they follow the theme ──────────── */
:root {
  --sev-default: var(--chart-5);
  --sev-none: var(--info);
  --sev-minor: var(--warn);
  --sev-moderate: color-mix(in srgb, var(--warn) 55%, var(--danger));
  --sev-severe: var(--danger);
  --sev-critical: color-mix(in srgb, var(--danger-fill) 70%, var(--text-strong));

  --mark-1: var(--chart-2);
  --mark-2: var(--ok);
  --mark-3: color-mix(in srgb, var(--danger) 50%, var(--info));
  --mark-4: var(--chart-4);
  --mark-5: var(--chart-3);
  --mark-6: color-mix(in srgb, var(--warn) 50%, var(--danger));
  --mark-7: color-mix(in srgb, var(--info) 70%, var(--danger));
  --mark-8: var(--danger);
  --mark-9: var(--chart-5);
  --mark-10: color-mix(in srgb, var(--chart-5) 70%, var(--info));
  --mark-11: color-mix(in srgb, var(--chart-4) 60%, var(--ok));
}

/* Zero-size element whose computed colour resolves a token for canvas / WebGL code (set --probe on it). */
.fx-probe { position: absolute; width: 0; height: 0; overflow: hidden; visibility: hidden; pointer-events: none; color: var(--probe, var(--text)); }

/* ── Severity badge ───────────────────────────────────────────────────────────────────── */
.fx-sev { --tone: var(--sev-default); display: inline-flex; align-items: center; gap: var(--space-1); flex: none; height: 20px; padding: 0 var(--space-2); border-radius: var(--radius); background: color-mix(in srgb, var(--tone) 14%, var(--surface)); color: var(--tone); font: 500 12px/16px var(--font-sans); white-space: nowrap; }
.fx-sev[data-sev="none"] { --tone: var(--sev-none); }
.fx-sev[data-sev="minor"] { --tone: var(--sev-minor); }
.fx-sev[data-sev="moderate"] { --tone: var(--sev-moderate); }
.fx-sev[data-sev="severe"] { --tone: var(--sev-severe); }
.fx-sev[data-sev="critical"] { --tone: var(--sev-critical); }

/* ── Colour key (legend rows: dot + label + count) ────────────────────────────────────── */
.fx-key { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.fx-key-row { display: flex; align-items: center; gap: var(--space-2); min-width: 0; font-size: 13px; line-height: 18px; color: var(--text); }
.fx-key-dot { flex: none; width: 10px; height: 10px; border-radius: var(--radius-sm); background: var(--dot, var(--chart-5)); }
.fx-key-label { flex: 1; min-width: 0; }
/* CA-333 damage key: inline chips (texture swatch + type name), wraps on phone; overlay canvas over a photo */
.fx-dmg-key { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); }
/* CA-435: a row wider than the key (long type, part and severity) shrinks to the key width and its label wraps,
   instead of being cut and giving the report a horizontal scrollbar. */
.fx-dmg-key .fx-key-row { flex: 0 1 auto; max-width: 100%; }
.fx-dmg-key .fx-key-label { overflow-wrap: anywhere; }
/* CA-340: key rows that show/hide a damage type on the photo. Off = muted label, faded swatch, struck through. */
.fx-key-toggle { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; max-width: 100%; min-height: 32px; padding: 0 var(--space-1); margin: 0; border: 0; border-radius: var(--radius-sm); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.fx-key-toggle:hover { background: var(--surface-2); }
.fx-key-row.is-off .fx-key-label { color: var(--text-muted); text-decoration: line-through; }
.fx-key-row.is-off .fx-dmg-swatch, .fx-key-row.is-off .fx-key-count { opacity: 0.4; }
.fx-dmg-swatch { flex: none; width: 28px; height: 16px; border-radius: var(--radius-sm); }
.fx-dmg-canvas { position: absolute; pointer-events: none; }
.fx-key-count { flex: none; min-width: 20px; height: 20px; padding: 0 var(--space-1); border-radius: var(--radius); background: var(--surface-2); color: var(--text-muted); font: 500 12px/20px var(--font-sans); text-align: center; font-variant-numeric: tabular-nums; }

/* ── Viewer: bar + body (photo panel | canvas stage | side panel) + footer ───────────── */
.fx-viewer { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text); }
.fx-viewer-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3); padding: var(--space-2) var(--space-3); background: var(--surface); border-bottom: 1px solid var(--border); }
.fx-viewer-heading { display: flex; flex-direction: column; min-width: 0; }
.fx-viewer-title { margin: 0; font: 600 14px/20px var(--font-sans); color: var(--text-strong); }
.fx-viewer-sub { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; line-height: 18px; color: var(--text-muted); }
.fx-viewer-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.fx-viewer-nav { display: inline-flex; align-items: center; gap: var(--space-1); padding: 2px; border-radius: var(--radius); background: var(--surface-2); }
.fx-viewer-nav-label { min-width: 112px; padding: 0 var(--space-2); text-align: center; white-space: nowrap; font: 500 13px/18px var(--font-sans); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.fx-viewer-body { background: var(--bg); }
.fx-viewer-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); }
.fx-viewer-stage > canvas { display: block; }
.fx-viewer-float { position: absolute; z-index: 10; box-shadow: var(--shadow-pop); }
.fx-viewer-float.fx-btn[aria-pressed="true"] { border-color: var(--text-strong); }
/* Freehand sketch over a viewer stage (CA-441: a damage drawn on the 2D map) */
.fx-viewer-sketch { position: absolute; inset: 0; z-index: 8; width: 100%; height: 100%; pointer-events: none; }
.fx-viewer-sketch polyline { fill: color-mix(in srgb, var(--accent) 12%, transparent); stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.fx-viewer-toolbar { position: absolute; z-index: 7; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); max-width: calc(100% - 2 * var(--space-3)); }
.fx-viewer-toolbar .fx-btn { box-shadow: var(--shadow-pop); }
.fx-viewer-toolbar .fx-btn[aria-pressed="true"] { border-color: var(--text-strong); }
.fx-viewer-veil { background: var(--bg); }

/* Photo panel (left of the canvas on desktop, a view of its own on phones) */
.fx-viewer-media { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--surface); border-right: 1px solid var(--border); }
.fx-viewer-media-hd { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); }
.fx-viewer-media-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 13px/18px var(--font-sans); color: var(--text-strong); }
.fx-viewer-media-count { flex: none; font-size: 13px; line-height: 18px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.fx-viewer-media-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); flex: 1 1 100%; }
.fx-viewer-media-stage { position: relative; display: flex; align-items: center; justify-content: center; flex: 1 1 0; min-width: 0; min-height: 0; overflow: hidden; background: var(--surface-2); }
.fx-viewer-media-stage > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.fx-viewer-media-stage > .fx-icon-btn { position: absolute; z-index: 10; background: var(--surface); color: var(--text-strong); box-shadow: var(--shadow-pop); }
.fx-viewer-media-stage > .fx-icon-btn:hover { background: var(--surface-2); }
.fx-viewer-media-stage > .fx-icon-btn:disabled { opacity: .4; cursor: default; }
.fx-viewer-media-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-top: 1px solid var(--border); background: var(--surface-2); font-size: 13px; line-height: 18px; color: var(--text); }
.fx-viewer-media-bar > .fx-viewer-media-note { flex: 1 1 auto; min-width: 0; }
.fx-viewer-media-strip { padding: var(--space-2) var(--space-3); border-top: 1px solid var(--border); background: var(--surface); }
.fx-viewer-media-hint { padding: var(--space-1) var(--space-3); font-size: 12px; line-height: 16px; color: var(--text-muted); }

/* Side panel: legend, lists, detail, hints. A bottom drawer in the immersive phone layout */
.fx-viewer-side { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--surface); border-left: 1px solid var(--border); }
.fx-viewer-side-sec { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.fx-viewer-side-hd { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); width: 100%; margin: 0 0 var(--space-2); padding: 0; border: 0; background: none; color: var(--text-strong); font: 600 13px/18px var(--font-sans); text-align: left; }
.fx-viewer-side-hd .fx-icon { color: var(--text-muted); }
.fx-viewer-hint { display: grid; gap: var(--space-1); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); background: var(--surface-2); font-size: 12px; line-height: 16px; color: var(--text-muted); }
.fx-viewer-hint p { margin: 0; }
.fx-viewer-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--surface); border-top: 1px solid var(--border); }
.fx-viewer-foot-note { font-size: 13px; line-height: 18px; color: var(--text-muted); }

/* Selectable detail card (damage on a part, list row with several lines) */
.fx-item { display: grid; gap: var(--space-2); min-width: 0; padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.fx-item[role="button"] { cursor: pointer; }
.fx-item[role="button"]:hover { background: var(--surface-2); }
.fx-item[aria-current="true"] { border-color: var(--text-strong); box-shadow: 0 0 0 1px var(--text-strong); }
.fx-item-hd { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); min-width: 0; }
.fx-item-title { min-width: 0; font: 500 14px/20px var(--font-sans); color: var(--text-strong); }
.fx-item-end { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-1); flex: none; }
.fx-item-text { margin: 0; font-size: 13px; line-height: 18px; color: var(--text-muted); }
.fx-item-meta { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); font-size: 12px; line-height: 16px; color: var(--text-muted); }
.fx-item-tags { display: flex; flex-wrap: wrap; gap: var(--space-1); }

/* Footer line of an .fx-item: a quiet divider with secondary details below the card body */
.fx-item-foot { display: grid; gap: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--border); }

/* A list row that acts as a button (div with role="button") */
.fx-list-item[role="button"] { cursor: pointer; }
.fx-list-item[role="button"]:hover { background: var(--surface-2); }

/* Choice chip row (jump to one of several items) */
.fx-pick-row { display: flex; gap: var(--space-2); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; scroll-snap-type: x proximity; }
.fx-pick-row::-webkit-scrollbar { display: none; }
.fx-pick { display: inline-flex; align-items: center; gap: var(--space-2); flex: none; max-width: 70vw; height: var(--touch-h); padding: 0 var(--space-3); border: 1px solid var(--border-control); border-radius: var(--radius); background: var(--surface); color: var(--text-strong); font: 500 13px/18px var(--font-sans); white-space: nowrap; cursor: pointer; scroll-snap-align: center; }
.fx-pick:hover { background: var(--surface-2); }
.fx-pick[aria-selected="true"], .fx-pick[aria-pressed="true"] { border-color: var(--text-strong); box-shadow: 0 0 0 1px var(--text-strong); }
.fx-pick-text { overflow: hidden; text-overflow: ellipsis; }

/* Sticky head of a bottom drawer (handle + chips) */
.fx-drawer-head { background: var(--surface); }

/* Drag handle of a bottom drawer */
.fx-drawer-handle { display: flex; align-items: center; justify-content: center; width: 100%; height: 24px; padding: 0; border: 0; background: none; cursor: grab; touch-action: none; }
.fx-drawer-handle > span { width: 40px; height: 4px; border-radius: var(--radius-full); background: var(--border-control); }

/* Borderless viewer that fills its host (the wizard workspace) */
.fx-viewer--flush { border: 0; border-radius: 0; }

/* Immersive (full-screen) state of the viewer */
.fx-viewer--immersive { border: 0; border-radius: 0; background: var(--bg); }
.fx-viewer--immersive .fx-viewer-bar { border-bottom: 1px solid var(--border); }

/* Full-screen photo */
.fx-imgbox { position: fixed; inset: 0; z-index: var(--z-lightbox, 10200); display: flex; align-items: center; justify-content: center; background: var(--bg); }
.fx-imgbox-stage { position: relative; display: flex; align-items: center; justify-content: center; }
.fx-imgbox-img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.fx-imgbox > .fx-icon-btn { position: absolute; z-index: 2; }
.fx-imgbox-count { position: absolute; z-index: 2; padding: var(--space-1) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-strong); font: 500 13px/18px var(--font-sans); font-variant-numeric: tabular-nums; }

/* Labelled frame drawn over a canvas (one per sub-view of a grid) */
.fx-stage-frame { position: absolute; box-sizing: border-box; border: 1px dashed var(--border-control); border-radius: var(--radius-sm); pointer-events: none; }
.fx-stage-frame::after { content: attr(data-label); position: absolute; top: var(--space-1); left: var(--space-2); padding: 0 var(--space-1); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-muted); font: 500 12px/16px var(--font-sans); }

/* Inline panel on desktop, bottom sheet on phones (an edit form inside a side panel) */
.fx-sheet { display: grid; gap: var(--space-3); }
@media (max-width: 768px) {
  .fx-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-dialog); max-height: 82dvh; overflow-y: auto; padding: var(--space-4) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--border); border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: var(--shadow-pop); }
}


/* ── Phone: panels stack, the side panel loses its left edge ──────────────────────────── */
@media (max-width: 768px) {
  .fx-viewer-media { border-right: 0; border-bottom: 1px solid var(--border); }
  .fx-viewer-side { border-left: 0; border-top: 1px solid var(--border); }
  .fx-viewer { border-radius: 0; border-left: 0; border-right: 0; }
  .fx-viewer--immersive .fx-viewer-side { border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: var(--shadow-pop); }
  .fx-viewer-nav-label { min-width: 0; }
  .fx-pick { height: var(--touch-h); }
}
@media (prefers-reduced-motion: reduce) {
  .fx-pick-row { scroll-behavior: auto; }
}
/* --- css/ds/components-tools.css --- */
/* analyst/static/css/ds/components-tools.css - CA-160 generic design-system components added while converting the Analyst area (tools); tokens only, fx-* names. To be folded into components.css. */

/* ── Panel section: a collapsible block of a side panel (<details> or button + body) ── */
.fx-panel-section { border-bottom: 1px solid var(--border); }
.fx-panel-toggle { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); width: 100%; min-height: var(--row-h); padding: var(--space-2) var(--space-4); border: 0; background: none; color: var(--text-strong); font: 500 14px/20px var(--font-sans); text-align: left; list-style: none; cursor: pointer; }
.fx-panel-toggle::-webkit-details-marker { display: none; }
.fx-panel-toggle:hover { background: var(--surface-2); }
.fx-panel-toggle .fx-icon { color: var(--text-muted); }
.fx-panel-toggle-title { display: inline-flex; align-items: center; gap: var(--space-2); }
.fx-panel-section > .fx-panel-toggle > .fx-icon { transition: transform .15s ease-out; }
.fx-panel-section[open] > .fx-panel-toggle > .fx-icon { transform: rotate(180deg); }
.fx-panel-body { display: grid; gap: var(--space-3); padding: var(--space-2) var(--space-4) var(--space-4); }

/* ── Range input ── */
.fx-range { width: 100%; height: 20px; margin: 0; accent-color: var(--accent-fill); cursor: pointer; }

/* ── Compact controls (desktop only: phones keep the touch height) ── */
@media (min-width: 769px) {
  .fx-input--sm, .fx-select--sm { height: var(--control-h-sm); padding-left: var(--space-2); font-size: 13px; line-height: 18px; }
  .fx-select--sm { padding-right: var(--space-6); }
}

/* ── Thumbnail grid (a page of images; thumbs are fx-thumb buttons) ── */
.fx-thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: var(--space-1); }
.fx-thumb-grid > .fx-thumb { width: 100%; height: auto; aspect-ratio: 1; }

/* ── Combo: text input with a suggestions menu under it ── */
.fx-combo { position: relative; display: flex; align-items: center; gap: var(--space-1); min-width: 0; }
.fx-combo > .fx-input { flex: 1; min-width: 0; }
.fx-combo-opts { z-index: var(--z-popover); margin: 0; list-style: none; }
.fx-combo-opts > li { height: auto; min-height: 32px; white-space: normal; }
.fx-combo-menu, .fx-combo-opts { position: absolute; left: 0; right: 0; top: calc(100% + var(--space-1)); max-height: 240px; overflow-y: auto; }

/* ── Neutral info strip and value change ── */
.fx-strip { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-4); padding: var(--space-2) var(--space-3); border-radius: var(--radius); background: var(--surface-2); color: var(--text-muted); font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; }
.fx-delta { font-weight: 500; }
.fx-delta.is-up { color: var(--danger); }
.fx-delta.is-down { color: var(--ok); }

/* ── Key-value lines that add up (label left, amount right, optional sum rows) ── */
.fx-kv--lines { grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2) var(--space-4); }
.fx-kv--lines dd { text-align: right; }
.fx-kv--lines .is-sum { padding-top: var(--space-2); border-top: 1px solid var(--border); font-weight: 600; color: var(--text-strong); }

/* ── Rules and small text ── */
.fx-divider { height: 0; margin: 0; border: 0; border-top: 1px solid var(--border); }
.fx-note { margin: 0; font-size: 13px; line-height: 18px; color: var(--text-muted); }
.fx-list:empty { display: none; }
.fx-card-bd + .fx-disclosure { border-top: 1px solid var(--border); }
.fx-list-sub.is-ok, .fx-list-sub.loaded { color: var(--ok); font-weight: 500; }

/* ── Floating card (a bar or panel over a canvas or photo) ── */
.fx-card--float { box-shadow: var(--shadow-pop); z-index: var(--z-popover); }

/* ── Dialog extras: extra wide, flush body, embedded frame ── */
.fx-dialog-bd--flush { padding: 0; }
.fx-frame { display: block; align-self: stretch; width: 100%; height: 100%; border: 0; background: var(--surface); }

/* ── Full-screen tool: a scrim that holds a toolbar and a work area ── */
.fx-scrim--tool { display: flex; flex-direction: column; align-items: stretch; padding: 0; background: var(--bg); }
.fx-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-3); padding: var(--space-2) var(--space-4); background: var(--surface); border-bottom: 1px solid var(--border); }
.fx-toolbar-group { display: flex; align-items: center; gap: var(--space-1); }
.fx-toolbar-text { min-width: 48px; text-align: center; color: var(--text-strong); font: 500 13px/18px var(--font-sans); }
.fx-toolbar-end { margin-left: auto; }

/* ── Progress meter: label + percent line, bar, stage line ── */
.fx-progress-block { display: grid; gap: var(--space-1); text-align: left; }
.fx-progress-hd { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-1) var(--space-3); font: 500 13px/18px var(--font-sans); color: var(--text-strong); }
.fx-progress-hd > :last-child { margin-left: auto; color: var(--text-muted); white-space: nowrap; }
.fx-progress-note { font-size: 13px; line-height: 18px; color: var(--text-muted); overflow-wrap: anywhere; }
.fx-progress-note:empty { display: none; }
.fx-progress-block.is-error .fx-progress-note { color: var(--danger); }

/* ── Media overlay: a scrim over a photo or thumbnail that holds a progress block or a percentage ── */
.fx-media-overlay, .infer-overlay, .thumb-spin { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); border-radius: inherit; background: var(--scrim); color: var(--on-accent); font: 500 12px/16px var(--font-sans); font-variant-numeric: tabular-nums; pointer-events: none; }
.fx-media-overlay > .pm-host, .infer-overlay > .pm-host { padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); }

/* ── Spotlight ring and floating popover (guided tour) ── */
.fx-spotlight { position: fixed; top: var(--top, 0); left: var(--left, 0); width: var(--w, 0); height: var(--h, 0); z-index: var(--z-dialog); border-radius: var(--radius); outline: 2px solid var(--accent); outline-offset: 0; opacity: 0; pointer-events: none; transition: opacity .15s ease-out; }
.fx-spotlight.active { opacity: 1; }
.fx-popover--float { position: fixed; top: var(--top, 0); left: var(--left, 0); z-index: calc(var(--z-dialog) + 1); display: grid; gap: var(--space-3); opacity: 0; pointer-events: none; transition: opacity .15s ease-out; }
.fx-popover--float.active { opacity: 1; pointer-events: auto; }

/* ── Transitional aliases (remove when the owning markup uses the fx-* class) ── */
/* app.js still toggles .active on the AI tool buttons instead of aria-pressed */
.fx-seg-opt.active { background: var(--surface); color: var(--text-strong); box-shadow: 0 0 0 1px var(--border); }
/* Fleet photo-manager lightbox (vehicles.html) still carries its own shell classes */
.fs-sam-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); }
.pm-fs-modal { background: var(--bg); }
.pm-fs-toolbar { background: var(--surface); border-bottom: 1px solid var(--border); }

@media (max-width: 768px) {
  .fx-toolbar { gap: var(--space-1) var(--space-2); padding: var(--space-2); }
  .fx-toolbar .fx-seg-opt { height: var(--touch-h); }
  .fx-range { height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .fx-spotlight, .fx-popover--float, .fx-panel-section > .fx-panel-toggle > .fx-icon { transition: none; }
}
/* --- css/ds/components-admin.css --- */
/* Fluxe design system - generic components first needed by the Admin area (CA-160). Same rules as components.css:
   fx-* names, tokens only, no page knowledge. To be folded into components.css. Breakpoints: 768px / 1024px. */

/* design-exception: the HTML hidden attribute must beat every component's own display value (same as .hidden) */
[hidden] { display: none !important; }

/* ── Drawer: a dialog docked to the right edge (bottom sheet on phones) ── */
.fx-scrim:has(> .fx-dialog--drawer) { place-items: stretch end; padding: 0; }
.fx-dialog--drawer { width: min(640px, 100%); height: 100vh; max-height: none; border-width: 0 0 0 1px; border-radius: 0; }
.fx-dialog--wide { width: min(1080px, 100%); }

/* ── Grid containers never grow past their parent (implicit auto columns size to content) ── */
.fx-section, .fx-form, .fx-state, .fx-dialog-bd, .fx-collapse-bd { grid-template-columns: minmax(0, 1fr); }

/* ── Tile as a button ─────────────────────────────────────────────────── */
button.fx-tile { width: 100%; font: inherit; text-align: left; cursor: pointer; }

/* ── Collapsible section (details/summary) ────────────────────────────── */
.fx-collapse { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.fx-collapse > summary { display: flex; align-items: center; gap: var(--space-3); min-height: 48px; padding: var(--space-3) var(--space-4); list-style: none; cursor: pointer; font: 600 14px/20px var(--font-sans); color: var(--text-strong); }
.fx-collapse > summary::-webkit-details-marker { display: none; }
.fx-collapse > summary .fx-collapse-sub { font-weight: 400; color: var(--text-muted); }
.fx-collapse > summary > .fx-icon:last-child { margin-left: auto; color: var(--text-muted); transition: transform .15s ease-out; }
.fx-collapse[open] > summary > .fx-icon:last-child { transform: rotate(180deg); }
.fx-collapse-bd { display: grid; gap: var(--space-4); padding: 0 var(--space-4) var(--space-4); }
.fx-collapse--plain { background: none; border: 0; border-radius: 0; }
.fx-collapse--plain > summary { padding: var(--space-2) 0; min-height: 0; font-weight: 500; }
.fx-collapse--plain .fx-collapse-bd { padding: 0; }

/* ── Dropzone (file pick + drop target) ───────────────────────────────── */
.fx-dropzone { display: grid; justify-items: center; gap: var(--space-1); padding: var(--space-6) var(--space-4); border: 1px dashed var(--border-control); border-radius: var(--radius-lg); background: var(--surface); color: var(--text-muted); text-align: center; cursor: pointer; }
.fx-dropzone:hover, .fx-dropzone.is-over { background: var(--surface-2); color: var(--text-strong); }
.fx-dropzone .fx-icon { width: 20px; height: 20px; }

/* ── Code / data pane ─────────────────────────────────────────────────── */
.fx-pre { margin: 0; max-height: 220px; padding: var(--space-3); overflow: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); font: 400 12px/16px var(--font-mono); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ── Thumbnail ────────────────────────────────────────────────────────── */
.fx-thumb--xs { --thumb-size: 40px; }

/* ── Chart box and sparkline ──────────────────────────────────────────── */
.fx-chart { position: relative; height: 260px; min-width: 0; }
.fx-chart--sm { height: 160px; }
.fx-chart > canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.fx-spark { display: block; width: 100%; height: 32px; }
button.fx-kpi, a.fx-kpi { width: 100%; text-align: left; font: inherit; color: inherit; text-decoration: none; cursor: pointer; }
button.fx-kpi:hover, a.fx-kpi:hover, .fx-kpi[aria-pressed="true"] { border-color: var(--border-control); }
.fx-kpi-value.is-danger { color: var(--danger); }
.fx-kpi-strip b.is-danger { color: var(--danger); }
.fx-kpi-value.is-ok { color: var(--ok); }

/* ── Larger progress bar (funnels, meters) ────────────────────────────── */
.fx-progress--lg { height: 8px; }
.fx-progress--ok > span { background: var(--ok); }
.fx-progress--warn > span { background: var(--warn); }
.fx-progress--danger > span { background: var(--danger); }

/* ── Board (kanban) ───────────────────────────────────────────────────── */
.fx-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: var(--space-3); overflow-x: auto; padding-bottom: var(--space-2); }
.fx-board-col { display: grid; align-content: start; gap: var(--space-2); min-height: 160px; padding: var(--space-2); background: var(--surface-2); border-radius: var(--radius-lg); }
.fx-board-col.is-over { box-shadow: inset 0 0 0 1px var(--border-control); }
.fx-board-hd { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-1) var(--space-2); font: 500 13px/18px var(--font-sans); color: var(--text-strong); }
.fx-board-card { display: grid; gap: var(--space-1); padding: var(--space-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text); cursor: grab; }
.fx-board-card:hover { border-color: var(--border-control); }

/* ── Table: clickable rows, group rows, nested detail ─────────────────── */
.fx-table tbody tr.is-link { cursor: pointer; }
.fx-table tbody tr.is-group td { background: var(--surface-2); color: var(--text-strong); font-weight: 500; }
.fx-table .is-wrap { white-space: normal; overflow-wrap: anywhere; }
.fx-table td.is-detail { height: auto; padding: var(--space-3); background: var(--surface-2); }

/* ── Toolbar popover anchoring for the filter bar ─────────────────────── */
.fx-popover-anchor { position: relative; display: inline-flex; }
.fx-popover-anchor > .fx-popover { position: absolute; top: calc(100% + var(--space-1)); left: 0; }
.fx-popover-anchor > .fx-popover.is-end { left: auto; right: 0; }
.fx-popover-hd { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin: calc(var(--space-2) * -1) 0 var(--space-3); }
.fx-popover-ft { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--border); }

/* ── Inline key list with a copy action (tokens, URLs) ────────────────── */
.fx-copy { display: flex; align-items: center; gap: var(--space-2); min-width: 0; padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.fx-copy > code, .fx-copy > .fx-code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 768px) {
  .fx-dialog--drawer { height: auto; max-height: 92vh; border-width: 1px 0 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
  .fx-scrim:has(> .fx-dialog--drawer) { place-items: end stretch; }
  .fx-board { grid-auto-columns: minmax(260px, 85vw); }
  .fx-collapse > summary { min-height: var(--touch-h); }
}

/* ══ From the Admin "perms" panes ══════════════════════════════════════════ */
/* ── Tree: expandable groups with a control per row ───────────────────── */
.fx-tree { display: grid; gap: var(--space-3); min-width: 0; color: var(--text); }
.fx-tree-body { display: grid; gap: var(--space-2); min-width: 0; }
.fx-tree .fx-state { padding: var(--space-6) var(--space-4); }
.fx-tree-mod { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.fx-tree-mod-hd { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); background: var(--surface-2); }
.fx-tree-title { flex: 1 1 160px; min-width: 0; display: grid; gap: 2px; cursor: pointer; }
.fx-tree-name { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-weight: 500; color: var(--text-strong); overflow-wrap: anywhere; }
.fx-tree-mod.is-off .fx-tree-name { color: var(--text-muted); }
.fx-tree-mod-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-2) var(--space-3); }

/* ── Tree row: toggle, info, control (control wraps under the text on phones) ── */
.fx-tree-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: start; column-gap: var(--space-2); padding: var(--space-2) var(--space-3); padding-left: calc(var(--space-3) + var(--depth, 0) * var(--space-4)); border-top: 1px solid var(--border); }
.fx-tree-info { min-width: 0; display: grid; gap: 2px; }
.fx-tree-label { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); color: var(--text-strong); overflow-wrap: anywhere; }
.fx-tree-row.is-off .fx-tree-label { color: var(--text-muted); }
.fx-tree-row.is-blocked, .fx-tree-row.is-unmet { opacity: .6; }
.fx-tree-desc, .fx-tree-note { font-size: 12px; line-height: 16px; color: var(--text-muted); overflow-wrap: anywhere; }
.fx-tree-note { display: flex; align-items: center; gap: var(--space-1); }
.fx-tree-note--warn { color: var(--warn); }
.fx-tree-note .is-ok { color: var(--ok); }
.fx-tree-note .is-miss { color: var(--warn); }
.fx-tree-ctl { display: flex; align-items: center; justify-content: flex-end; min-width: 0; max-width: 100%; }
.fx-tree-ctl .fx-seg { max-width: 100%; }
.fx-tree-ctl .fx-seg-opt { padding: 0 var(--space-2); }
.fx-tree-ctl .fx-seg-opt:disabled { opacity: .5; cursor: not-allowed; }
.fx-tree-ctl .fx-switch input:disabled { opacity: .5; cursor: not-allowed; }
.fx-tree.is-readonly .fx-tree-ctl { opacity: .7; }
.fx-tree-toggle, .fx-tree-spacer { display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; }
.fx-tree-toggle { padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); cursor: pointer; }
.fx-tree-toggle:hover { background: var(--surface-2); color: var(--text-strong); }
.fx-tree-toggle .fx-icon { transition: transform .15s ease-out; }
.fx-tree-toggle[aria-expanded="true"] .fx-icon { transform: rotate(90deg); }

/* ── Allow / deny colouring for a segmented control ───────────────────── */
.fx-seg-opt--ok[aria-pressed="true"] { background: var(--ok-soft); color: var(--ok); box-shadow: none; }
.fx-seg-opt--danger[aria-pressed="true"] { background: var(--danger-soft); color: var(--danger); box-shadow: none; }

/* ── Pips: one dot per item, filled when on ───────────────────────────── */
.fx-pips { display: inline-flex; flex-wrap: wrap; gap: 2px; }
.fx-pip { display: inline-block; width: 6px; height: 6px; border-radius: var(--radius-full); background: var(--border-control); }
.fx-pip.is-on { background: var(--text-strong); }

/* ── Badge used as a button ───────────────────────────────────────────── */
button.fx-badge { border: 0; font-family: var(--font-sans); cursor: pointer; }
button.fx-badge:hover { background: var(--border); }

/* ── Tile as a toggle (template pickers) ──────────────────────────────── */
button.fx-tile[aria-pressed="true"] { border-color: var(--text-strong); box-shadow: 0 0 0 1px var(--text-strong); }

@media (max-width: 768px) {
  .fx-tree-row { grid-template-columns: 24px minmax(0, 1fr); padding-left: calc(var(--space-3) + var(--depth, 0) * var(--space-3)); }
  .fx-tree-ctl { grid-column: 2; justify-content: flex-start; padding-top: var(--space-1); }
  .fx-tree-ctl .fx-seg { flex-wrap: wrap; }
}

/* ══ From the Admin "growth" panes ══════════════════════════════════════════ */
/* ── Drag state shared by boards, sortable lists and media tiles ──────── */
.fx-board-card.is-drag, .fx-drag-item.is-drag, .fx-asset.is-drag { opacity: .4; }

/* ── Sortable list: rows with a grip, a title button and actions; may expand a body ── */
.fx-drag-list { display: grid; gap: var(--space-2); min-height: var(--space-6); border-radius: var(--radius-lg); }
.fx-drag-list.is-over { box-shadow: inset 0 0 0 1px var(--border-control); }
.fx-drag-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.fx-drag-item.is-open, .fx-drag-item.is-over { border-color: var(--border-control); }
.fx-drag-item-hd { display: flex; align-items: center; gap: var(--space-1); padding-right: var(--space-1); }
.fx-drag-grip { display: grid; place-items: center; flex: none; padding: 0 var(--space-1) 0 var(--space-3); color: var(--text-muted); cursor: grab; }
.fx-drag-item-main { display: flex; flex: 1; align-items: center; gap: var(--space-2); min-width: 0; min-height: var(--control-h); padding: var(--space-2); border: 0; background: none; color: var(--text-strong); font: 500 14px/20px var(--font-sans); text-align: left; cursor: pointer; }
.fx-drag-item-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-drag-item-sub { margin-left: auto; flex: none; font-weight: 400; font-size: 13px; line-height: 18px; color: var(--text-muted); }
.fx-drag-item-bd { display: grid; gap: var(--space-4); padding: var(--space-4); border-top: 1px solid var(--border); }

/* ── Timeline: dated events with an icon dot ──────────────────────────── */
.fx-timeline { margin: 0; padding: 0; list-style: none; }
.fx-timeline-item { position: relative; display: flex; gap: var(--space-3); padding-bottom: var(--space-4); }
.fx-timeline-item::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 1px; background: var(--border); }
.fx-timeline-item:last-child::before { display: none; }
.fx-timeline-dot { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: var(--radius-full); background: var(--surface-2); color: var(--text-muted); }
.fx-timeline-main { display: grid; flex: 1; gap: var(--space-1); min-width: 0; align-content: start; }
.fx-timeline-main b { font-weight: 500; color: var(--text-strong); }

/* ── Media tile: preview, caption field and actions ───────────────────── */
.fx-asset { display: grid; gap: var(--space-2); padding: var(--space-2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.fx-asset.is-hero, .fx-asset.is-target { border-color: var(--border-control); }
.fx-media-view { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius); background: var(--surface-2); cursor: grab; }
.fx-media-view img, .fx-media-view video { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.fx-media-view.is-busy { opacity: .5; }
.fx-media-tag { position: absolute; top: var(--space-2); left: var(--space-2); }
.fx-media-dur { position: absolute; right: var(--space-2); bottom: var(--space-2); padding: 2px var(--space-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-strong); font-size: 12px; line-height: 16px; font-variant-numeric: tabular-nums; }
.fx-media-dur:empty { display: none; }

/* ── Device frame for live previews ───────────────────────────────────── */
.fx-device { margin-inline: auto; max-width: 100%; overflow: hidden; border: 1px solid var(--border-control); border-radius: var(--radius-lg); background: var(--surface-2); }
.fx-device iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--surface); }
.fx-device--phone { width: 280px; height: 540px; border-width: 6px; border-radius: var(--radius-xl); }
.fx-device--desktop { width: 100%; height: 480px; }

/* ── Colour picker paired with its hex code ───────────────────────────── */
.fx-color { display: flex; align-items: center; gap: var(--space-2); }
.fx-color input[type="color"] { flex: none; width: 44px; height: var(--control-h); padding: 2px; border: 1px solid var(--border-control); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.fx-color .fx-input { flex: 1; min-width: 0; }

/* ══ From the Admin "capture" panes ══════════════════════════════════════════ */
/* ── QR image panel (a scannable code always sits on the surface colour) ── */
.fx-qr { display: grid; justify-items: center; padding: var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.fx-qr > img { display: block; width: 100%; max-width: 260px; height: auto; }

/* ══ From the Admin "config" panes ══════════════════════════════════════════ */
/* ── Range slider with a live value readout ───────────────────────────── */
.fx-range-row { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.fx-range { flex: 1; min-width: 0; height: 20px; margin: 0; background: transparent; accent-color: var(--accent-fill); cursor: pointer; }
.fx-range:disabled { opacity: .5; cursor: not-allowed; }
.fx-range-val { min-width: 48px; color: var(--text-strong); font: 500 13px/18px var(--font-sans); font-variant-numeric: tabular-nums; text-align: right; }

/* ── Choice that is unavailable ───────────────────────────────────────── */
.fx-check:has(input:disabled), .fx-switch:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.fx-check input:disabled, .fx-switch input:disabled { cursor: not-allowed; }

/* ══ From the Admin "legal" panes ══════════════════════════════════════════ */
/* ── Selectable list row (fx-list-item as a div: version pickers, anything with controls inside the row) ── */
.fx-list-item.is-link { cursor: pointer; }
.fx-list-item.is-link:hover, .fx-list-item[aria-current="true"] { background: var(--surface-2); }
.fx-list-item.is-link:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.fx-list-item .fx-list-text { gap: var(--space-1); padding: var(--space-1) 0; }
.fx-list-item .fx-list-sub { white-space: normal; }

/* ── Inline-editable table cell: a compact textarea with status badges underneath ── */
.fx-table td.is-field { vertical-align: top; padding-top: var(--space-2); padding-bottom: var(--space-2); min-width: 180px; }
.fx-table td.is-primary { vertical-align: top; padding-top: var(--space-3); }
.fx-cell-field { display: grid; gap: var(--space-1); min-width: 0; }
.fx-cell-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); min-height: 24px; }
.fx-cell-meta-badges { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); }
.fx-textarea--cell { min-height: 36px; padding-top: var(--space-2); padding-bottom: var(--space-2); resize: none; field-sizing: content; }

@media (max-width: 768px) {
  .fx-table--cards .fx-table td.is-field { flex-direction: column; gap: var(--space-1); min-width: 0; }
  .fx-table--cards .fx-table td.is-primary { padding-top: 0; }
  .fx-table--cards .fx-table td.is-detail { display: block; padding: 0; background: none; }
}

/* ══ From the Admin "ai" panes ══════════════════════════════════════════ */
/* ── Series badge: a badge that carries a chart-series colour (legend for boxes drawn on a canvas) ── */
.fx-badge--series-1, .fx-badge--series-2, .fx-badge--series-3, .fx-badge--series-4, .fx-badge--series-5 { color: var(--text-strong); }
.fx-badge--series-1::before, .fx-badge--series-2::before, .fx-badge--series-3::before, .fx-badge--series-4::before, .fx-badge--series-5::before { content: ""; width: 8px; height: 8px; border-radius: var(--radius-full); }
.fx-badge--series-1::before { background: var(--chart-1); }
.fx-badge--series-2::before { background: var(--chart-2); }
.fx-badge--series-3::before { background: var(--chart-3); }
.fx-badge--series-4::before { background: var(--chart-4); }
.fx-badge--series-5::before { background: var(--chart-5); }

/* ── Check list: a bounded, scrollable list of fx-check rows (pick lists with many entries) ── */
.fx-check-list { display: grid; align-content: start; gap: var(--space-1); max-height: 240px; padding: var(--space-2); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.fx-check-list .fx-check { padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm); }
.fx-check-list .fx-check:hover { background: var(--surface-2); }
.fx-check-list .fx-state { padding: var(--space-4); }

/* ── Media: an image or canvas in a frame, optionally with a canvas laid over the image ── */
.fx-annot { position: relative; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.fx-annot > img, .fx-annot > canvas:only-child { display: block; width: 100%; height: auto; }
.fx-annot > img + canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fx-annot--click { cursor: crosshair; }

/* ── Thumbnail with an overlay canvas ── */
/* CA-504: middle, not baseline - on the baseline a still-loading image made its table row 1 px taller, so every row in view moved when the images arrived */
.fx-thumb-stack { position: relative; display: inline-block; vertical-align: middle; width: 40px; height: 40px; flex: none; }
.fx-thumb-stack > .fx-thumb { width: 100%; height: 100%; }
.fx-thumb-stack > canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* ── Tree: collapsible JSON viewer built from details/summary (use together with fx-pre) ── */
.fx-json details > summary { display: flex; flex-wrap: wrap; align-items: baseline; list-style: none; cursor: pointer; }
.fx-json details > summary::-webkit-details-marker { display: none; }
.fx-json details > summary:hover { background: var(--surface); }
.fx-json details > summary > .fx-icon { align-self: center; width: 14px; height: 14px; margin-right: var(--space-2); color: var(--text-muted); transition: transform .15s ease-out; }
.fx-json details:not([open]) > summary > .fx-icon { transform: rotate(-90deg); }
.fx-json-fold { display: none; color: var(--text-muted); }
.fx-json details:not([open]) > summary .fx-json-fold { display: inline; }
.fx-json-fold em { margin-left: var(--space-1); font-style: normal; font-size: 12px; }
.fx-json-kids { margin-left: var(--space-2); padding-left: var(--space-3); border-left: 1px solid var(--border); }
.fx-json-leaf { padding-left: var(--space-6); overflow-wrap: anywhere; }
.fx-json-key { color: var(--info); }
.fx-json-idx, .fx-json-null { color: var(--text-muted); }
.fx-json-null { font-style: italic; }
.fx-json-str { color: var(--ok); }
.fx-json-num { color: var(--warn); }
.fx-json-bool { color: var(--accent); }
.fx-json-p { color: var(--text-muted); }
.fx-json-tag { margin-left: var(--space-2); padding: 0 var(--space-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-muted); font: 500 12px/16px var(--font-sans); }
.fx-json-end { padding-left: var(--space-6); color: var(--text-muted); }

/* ══ From the Admin "ops" panes ══════════════════════════════════════════ */
Same rules as components.css: fx-* names, tokens only, no page knowledge. To be folded into components.css. */

/* ── Chart legend: colour swatch + name + value, so a series is never identified by colour alone ── */
.fx-legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin: 0; padding: 0; list-style: none; font-size: 13px; line-height: 18px; color: var(--text); }
.fx-legend-item { display: inline-flex; align-items: center; gap: var(--space-2); }
.fx-legend-swatch { width: 10px; height: 10px; flex: none; border-radius: var(--radius-sm); background: var(--swatch, var(--chart-1)); }
.fx-legend-item b { font-weight: 500; color: var(--text-strong); }

/* ── Highlighted match inside running text (search results) ── */
.fx-mark { padding: 0 2px; border-radius: var(--radius-sm); background: var(--warn-soft); color: inherit; }

/* ══ From the Admin "insights" panes ══════════════════════════════════════════ */
/* ── Stack and cluster: vertical rhythm and wrapping control rows (no page CSS needed) ── */
.fx-vstack { display: grid; gap: var(--space-4); min-width: 0; }
.fx-vstack--lg { gap: var(--space-6); }
.fx-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-width: 0; }
.fx-cluster--between { justify-content: space-between; }
.fx-cluster--end { justify-content: flex-end; }
.fx-cluster-grow { flex: 1 1 200px; min-width: 0; }

/* ── Chart grid: cards of charts that wrap by available width ─────────── */
.fx-chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--space-4); min-width: 0; }
.fx-chart-grid > .fx-card { min-width: 0; }

/* ── Headline KPI: one large figure with supporting lines ─────────────── */
.fx-kpi--hero { gap: var(--space-2); padding: var(--space-5); }
.fx-kpi-lines { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-5); color: var(--text); }
.fx-kpi-lines b { font-weight: 600; color: var(--text-strong); }

/* ── Before / after comparison row inside a key/value list ────────────── */
.fx-delta { display: inline-flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.fx-delta .fx-icon { color: var(--text-muted); }

/* ── Form that sits inside a table cell or list row ───────────────────── */
.fx-inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-width: 0; }
.fx-inline-form > .fx-input, .fx-inline-form > .fx-select-wrap { flex: 1 1 140px; min-width: 120px; }
.fx-inline-form > .fx-btn { flex: none; }

/* ── Session replay player (CA-236): the vendored rrweb-player (static/vendor/rrweb) on design-system tokens ──
   Its stylesheet hard-codes a light controller (white bar, blue accents) and leaves the button text inheriting
   the page colour, so in the dark theme 2x/4x/8x and "skip inactive" were light-on-white. It is linked before
   this file, so these rules win on equal specificity (the vendor selectors are .x.svelte-hash.svelte-hash);
   the extra ancestor classes below only match that specificity, they add no layout. */
.fx-replay .rr-player { background: var(--surface); border-radius: var(--radius-lg); box-shadow: none; overflow: hidden; } /* no border: the player sizes itself to the container, 2px more overflows it */
.fx-replay .rr-player .rr-controller { background: var(--surface); color: var(--text); border-top: 1px solid var(--border); border-radius: 0; }
.fx-replay .rr-timeline .rr-timeline__time { color: var(--text-muted); font: 400 13px/16px var(--font-sans); }
.fx-replay .rr-timeline .rr-progress { background: var(--surface-2); border-top-color: var(--surface); border-bottom-color: var(--surface); }
.fx-replay .rr-progress .rr-progress__step { background: var(--border-control); }
.fx-replay .rr-progress .rr-progress__handler { background: var(--accent-fill); }
.fx-replay .rr-controller .rr-controller__btns { gap: var(--space-1); color: var(--text); font: 500 13px/16px var(--font-sans); }
.fx-replay .rr-controller .rr-controller__btns button { border-radius: var(--radius-full); color: var(--text); }
.fx-replay .rr-controller .rr-controller__btns button:hover { background: var(--surface-2); }
.fx-replay .rr-controller .rr-controller__btns button:active { background: var(--surface-2); }
.fx-replay .rr-controller .rr-controller__btns button.active { background: var(--accent-fill); color: var(--on-accent); }
.fx-replay .rr-controller .rr-controller__btns button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fx-replay .rr-controller .rr-controller__btns svg { fill: currentColor; }
.fx-replay .rr-player .rr-controller .switch label::before { background: var(--border-control); }
.fx-replay .rr-player .rr-controller .switch label::after { background: var(--surface); box-shadow: var(--shadow-pop); }
.fx-replay .rr-player .rr-controller .switch input[type='checkbox']:checked + label::before { background: var(--accent-fill); }
.fx-replay .rr-player .rr-controller .switch input[type='checkbox']:focus-visible + label::before { outline: 2px solid var(--accent); outline-offset: 2px; }
.fx-replay .rr-controller .switch .label { color: var(--text); }
/* --- css/ds/components-fleet.css --- */
/* analyst/static/css/ds/components-fleet.css — design-system components first needed by the Fleet area
   (CA-160). Generic fx-* names, tokens only, so any area can reuse them; to be folded into components.css.
   Thumbnails, drop zone, signature field, accordion card, activity feed, selectable list rows,
   autocomplete menu, floating panel, media viewer, segmented counts. */

/* ── Thumbnail sizes (the thumbnail itself: components-report.css) ── */
.fx-thumb--sm { --thumb-w: 40px; --thumb-h: 32px; }
.fx-thumb--lg { --thumb-w: 160px; --thumb-h: 112px; }
.fx-thumb--empty { display: grid; place-items: center; cursor: default; }
.fx-thumb[aria-pressed="true"], .fx-thumb[aria-selected="true"] { border-color: var(--text-strong); box-shadow: 0 0 0 1px var(--text-strong); }
.fx-thumb-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 var(--space-1); border-radius: var(--radius); background: var(--surface); color: var(--text-strong); font: 500 12px/16px var(--font-sans); font-variant-numeric: tabular-nums; }

/* ── Drop zone (upload) ───────────────────────────────────────────── */
.fx-dropzone { display: grid; justify-items: center; gap: var(--space-1); padding: var(--space-6) var(--space-4); border: 1px dashed var(--border-control); border-radius: var(--radius-lg); background: var(--surface); color: var(--text-muted); text-align: center; cursor: pointer; transition: background-color .15s ease-out, border-color .15s ease-out; }
.fx-dropzone:hover, .fx-dropzone.is-over { background: var(--surface-2); border-color: var(--text-muted); }
.fx-dropzone .fx-icon { width: 20px; height: 20px; }
.fx-dropzone-title { font: 500 14px/20px var(--font-sans); color: var(--text-strong); }
.fx-dropzone-hint { font-size: 12px; line-height: 16px; }
.fx-dropzone--primary { padding: var(--space-8) var(--space-4); }

/* ── Signature field ──────────────────────────────────────────────── */
/* The pad draws dark ink for printed reports, so the writing surface is paper-white in both themes. */
.fx-signature { display: block; width: 100%; height: 160px; border: 1px solid var(--border-control); border-radius: var(--radius); background: var(--on-accent); cursor: crosshair; touch-action: none; }
.fx-signature-img { display: block; max-width: 240px; height: auto; padding: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius); background: var(--on-accent); }

/* ── Accordion card (expandable row in a card list) ──────────────── */
.fx-acc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.fx-acc + .fx-acc { margin-top: var(--space-2); }
.fx-acc-hd { display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 56px; padding: var(--space-3) var(--space-2) var(--space-3) var(--space-4); border: 0; border-radius: var(--radius-lg); background: none; color: var(--text-strong); font: inherit; text-align: left; cursor: pointer; }
.fx-acc-hd:hover { background: var(--surface-2); }
.fx-acc-main { display: grid; gap: 2px; flex: 1; min-width: 0; }
.fx-acc-title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-weight: 500; }
.fx-acc-sub { font-size: 13px; line-height: 18px; color: var(--text-muted); }
.fx-acc-end { display: flex; align-items: center; gap: var(--space-1); color: var(--text-muted); }
.fx-acc-chev { transition: transform .15s ease-out; }
.fx-acc-hd[aria-expanded="true"] .fx-acc-chev { transform: rotate(180deg); }
.fx-acc-bd { display: grid; gap: var(--space-4); padding: var(--space-4); border-top: 1px solid var(--border); }
.fx-acc.is-flash { border-color: var(--text-strong); }

/* ── Sub-panel inside a card (check-out / check-in columns) ──────── */
.fx-panel { display: grid; align-content: start; gap: var(--space-3); min-width: 0; padding: var(--space-4); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.fx-panel-hd { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.fx-panel-title { margin: 0; font: 600 14px/20px var(--font-sans); color: var(--text-strong); }
.fx-panel-actions { display: flex; flex-wrap: wrap; gap: var(--space-1); }

/* ── Activity feed (vertical timeline) ────────────────────────────── */
.fx-events { margin: 0; padding: 0; list-style: none; }
.fx-events-item { position: relative; display: flex; gap: var(--space-3); padding: 0 0 var(--space-4); }
.fx-events-item::before { content: ""; position: absolute; left: 15px; top: 32px; bottom: 0; width: 1px; background: var(--border); }
.fx-events-item:last-child::before { content: none; }
.fx-event-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: var(--radius-full); background: var(--surface-2); color: var(--text-muted); }
.fx-event-icon.is-info { background: var(--info-soft); color: var(--info); }
.fx-event-icon.is-ok { background: var(--ok-soft); color: var(--ok); }
.fx-event-icon.is-warn { background: var(--warn-soft); color: var(--warn); }
.fx-event-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.fx-event-body { display: grid; gap: 2px; flex: 1; min-width: 0; padding-top: var(--space-1); }
.fx-event-title { font-weight: 500; color: var(--text-strong); }
.fx-event-text { font-size: 13px; line-height: 18px; color: var(--text); overflow-wrap: anywhere; }
.fx-event-meta { font-size: 12px; line-height: 16px; color: var(--text-muted); }
button.fx-event-body { border: 0; background: none; font: inherit; text-align: left; cursor: pointer; border-radius: var(--radius); }
button.fx-event-body:hover .fx-event-title { text-decoration: underline; }

/* ── History chart (desktop timeline + open-cost curve, CA-202) ───── */
.fl-tl-chart { overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); cursor: grab; touch-action: none; user-select: none; }
.fl-tl-chart.is-dragging { cursor: grabbing; }
.fl-tl-svg { display: block; width: 100%; height: 220px; }
.fl-tl-axis { stroke: var(--border); stroke-width: 1; }
.fl-tl-grid { stroke: var(--border); stroke-dasharray: 2 4; }
.fl-tl-tick { fill: var(--text-muted); font: 400 12px var(--font-sans); }
.fl-tl-cost-area { fill: var(--danger-soft); }
.fl-tl-cost-line { fill: none; stroke: var(--danger); stroke-width: 2; }
.fl-tl-cost-label { fill: var(--danger); font: 600 12px var(--font-sans); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.fl-tl-node { cursor: pointer; outline: none; }
.fl-tl-node circle { fill: var(--surface-2); stroke: var(--text-muted); stroke-width: 2; }
.fl-tl-node.is-info circle { fill: var(--info-soft); stroke: var(--info); }
.fl-tl-node.is-ok circle { fill: var(--ok-soft); stroke: var(--ok); }
.fl-tl-node.is-warn circle { fill: var(--warn-soft); stroke: var(--warn); }
.fl-tl-node.is-danger circle { fill: var(--danger-soft); stroke: var(--danger); }
.fl-tl-node:hover circle, .fl-tl-node:focus-visible circle { stroke-width: 3; }
.fl-tl-node:focus-visible circle { stroke: var(--accent); }
.fl-tl-count { fill: var(--text-strong); font: 600 12px var(--font-sans); }

/* ── Selectable list rows (pickers) ───────────────────────────────── */
.fx-list-item[aria-selected="true"], .fx-list-item[aria-pressed="true"] { background: var(--surface-2); }
.fx-list-item[aria-selected="true"] .fx-list-check, .fx-list-item[aria-pressed="true"] .fx-list-check { visibility: visible; }
.fx-list-check { visibility: hidden; color: var(--text-strong); }
.fx-list--scroll { max-height: 320px; overflow-y: auto; }
.fx-list label.fx-list-item { cursor: pointer; }
.fx-list label.fx-list-item:hover { background: var(--surface-2); }

/* ── Autocomplete (input + menu) ──────────────────────────────────── */
.fx-ac { position: relative; }
.fx-ac-menu { position: absolute; left: 0; right: 0; top: calc(100% + var(--space-1)); max-height: 240px; overflow-y: auto; }
.fx-ac-menu .fx-menu-item { height: auto; min-height: 36px; padding-top: var(--space-1); padding-bottom: var(--space-1); }
.fx-ac-menu .fx-menu-item-end { font-size: 12px; line-height: 16px; }
.fx-ac-empty { padding: var(--space-2); font-size: 13px; line-height: 18px; color: var(--text-muted); }

/* ── Floating panel (progress panels, docked cards) ───────────────── */
.fx-float { box-shadow: var(--shadow-pop); }
.fx-log { display: grid; gap: var(--space-1); max-height: 240px; overflow-y: auto; font-size: 13px; line-height: 18px; color: var(--text); }
.fx-log > * { margin: 0; }

/* ── Media viewer (lightbox, image tools, camera) ─────────────────── */
.fx-screen { position: fixed; inset: 0; z-index: calc(var(--z-dialog) + var(--fx-layer, 0)); display: flex; flex-direction: column; background: var(--bg); color: var(--text-strong); }
.fx-screen-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-height: var(--appbar-h); padding: var(--space-2) var(--space-4); background: var(--surface); border-bottom: 1px solid var(--border); }
.fx-screen-title { flex: 1; min-width: 0; margin: 0; font: 600 16px/24px var(--font-sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-screen-stage { position: relative; display: grid; grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); place-items: center; flex: 1; min-height: 0; overflow: hidden; }
.fx-screen-stage img, .fx-screen-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.fx-screen-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-2); padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--border); }
.fx-screen-sep { width: 1px; height: 20px; background: var(--border); }
.fx-screen-side { width: 320px; flex: none; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--border); }
.fx-screen--camera { background: var(--bg); }
.fx-screen--camera .fx-screen-stage video { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }

/* ── Backdrop (scrim layer inside a full-screen tool) ─────────────── */
.fx-backdrop { background: var(--scrim); }

/* ── Overlay chip on media (status over a camera or photo) ───────── */
.fx-overlay-chip { display: inline-flex; align-items: center; gap: var(--space-1); height: 32px; padding: 0 var(--space-3); border-radius: var(--radius-full); background: var(--surface); color: var(--text-strong); font: 500 13px/18px var(--font-sans); box-shadow: var(--shadow-pop); }

/* ── Camera framing: reticle corners and live status dot ──────────── */
.fx-reticle { position: relative; border-radius: var(--radius-xl); box-shadow: 0 0 0 100vmax var(--scrim); overflow: hidden; }
.fx-reticle > b { position: absolute; width: 24px; height: 24px; border: 3px solid var(--on-accent); }
.fx-reticle > b:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; border-top-left-radius: var(--radius-xl); }
.fx-reticle > b:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; border-top-right-radius: var(--radius-xl); }
.fx-reticle > b:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; border-bottom-left-radius: var(--radius-xl); }
.fx-reticle > b:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; border-bottom-right-radius: var(--radius-xl); }
.fx-reticle > span { position: absolute; left: 8%; right: 8%; top: 8%; height: 2px; border-radius: var(--radius-full); background: var(--on-accent); opacity: .7; animation: fx-sweep 2.2s ease-in-out infinite; }
@keyframes fx-sweep { 50% { top: 90%; } }
.fx-status-dot { display: inline-block; width: 8px; height: 8px; flex: none; border-radius: var(--radius-full); background: currentColor; }
.fx-status-dot.is-live { color: var(--info); animation: fx-pulse 1.4s ease-in-out infinite; }
.fx-status-dot.is-warn { color: var(--warn); }
.fx-status-dot.is-ok { color: var(--ok); }
.fx-panel[aria-current="true"] { border-color: var(--text-strong); }

/* ── Segmented control: counts ────────────────────────────────────── */
.fx-seg-opt.active { background: var(--surface); color: var(--text-strong); box-shadow: 0 0 0 1px var(--border); }
.fx-seg-count { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.fx-seg--block { display: flex; }
.fx-seg--block .fx-seg-opt { flex: 1; justify-content: center; }

/* ── Clickable table rows ─────────────────────────────────────────── */
.fx-table tbody tr.is-link { cursor: pointer; }
.fx-table td.is-media { width: 64px; }

/* ── Tile as a button ─────────────────────────────────────────────── */
button.fx-tile { width: 100%; font: inherit; text-align: left; cursor: pointer; }

/* ── Inline note (view: one-line trigger; edit: textarea + actions) ─ */
.fx-note-btn { display: inline-flex; align-items: flex-start; gap: var(--space-2); max-width: 100%; min-height: 28px; padding: var(--space-1) var(--space-2); border: 0; border-radius: var(--radius); background: none; color: var(--text); font: 400 13px/18px var(--font-sans); text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.fx-note-btn:hover { background: var(--surface-2); color: var(--text-strong); }
.fx-note-btn .fx-icon { margin-top: 1px; color: var(--text-muted); }
.fx-note-btn.is-empty { color: var(--text-muted); }

/* ── Guided tour: spotlight + tour card ─────────────────────────── */
.fx-tour-spot { position: fixed; z-index: var(--z-toast); border-radius: var(--radius-lg); box-shadow: 0 0 0 9999px var(--scrim); outline: 2px solid var(--accent); outline-offset: 2px; pointer-events: none; opacity: 0; transition: top .18s ease-out, left .18s ease-out, width .18s ease-out, height .18s ease-out, opacity .15s ease-out; }
.fx-tour-spot:not(.active) { visibility: hidden; }
.fx-tour-spot.active { opacity: 1; }
.fx-tour { position: fixed; z-index: var(--z-toast); width: 400px; max-width: calc(100vw - 32px); overflow: hidden; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .15s ease-out, visibility 0s linear .15s; }
.fx-tour.active { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .15s ease-out; }
.fx-tour .fx-progress { border-radius: 0; }

/* ── Pressed toggle button ────────────────────────────────────────── */
.fx-btn[aria-pressed="true"] { background: var(--surface-2); border-color: var(--text-strong); color: var(--text-strong); }

/* ── Range ────────────────────────────────────────────────────────── */
.fx-range { width: 100%; accent-color: var(--accent-fill); }

@media (max-width: 768px) {
  .fx-tour { width: calc(100vw - 24px); }
  .fx-acc-hd { min-height: 64px; }
  .fx-signature { height: 160px; }
  .fx-sticky-action .fx-btn { height: var(--touch-h-lg); }
  .fx-screen-side { width: 100%; max-height: 40vh; border-left: 0; border-top: 1px solid var(--border); }
  .fx-seg--block .fx-seg-opt { height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .fx-acc-chev, .fx-dropzone, .fx-tour-spot, .fx-tour { transition: none; }
  .fx-reticle > span, .fx-status-dot.is-live { animation: none; }
}

/* ── Horizontal card carousel ─────────────────────────────────────── */
.fx-scroller { display: flex; gap: var(--space-3); padding-bottom: var(--space-1); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; }
.fx-scroller > * { flex: none; scroll-snap-align: start; }

/* ── Damage card (crop, number, part, type) ───────────────────────── */
.fx-dmg { display: grid; align-content: start; gap: var(--space-2); width: 168px; padding: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.fx-dmg:hover { background: var(--surface-2); }
.fx-dmg.is-active { border-color: var(--text-strong); box-shadow: 0 0 0 1px var(--text-strong); }
.fx-dmg-media { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius); background: var(--surface-2); color: var(--text-muted); }
.fx-dmg-media canvas { display: block; width: 100%; height: 100%; }
.fx-dmg-num { position: absolute; left: var(--space-1); top: var(--space-1); display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 var(--space-1); border-radius: var(--radius-full); background: var(--text-strong); color: var(--surface); font: 600 12px/16px var(--font-sans); font-variant-numeric: tabular-nums; }
.fx-dmg-tag { position: absolute; right: var(--space-1); top: var(--space-1); }
.fx-dmg-name { overflow: hidden; font: 500 14px/20px var(--font-sans); color: var(--text-strong); text-overflow: ellipsis; white-space: nowrap; }
.fx-dmg-type { overflow: hidden; font-size: 13px; line-height: 18px; color: var(--text-muted); text-overflow: ellipsis; white-space: nowrap; }

/* ── Top-view overview with numbered pins (positions via --x / --y) ── */
.fx-topview { position: relative; width: 100%; max-width: 560px; aspect-ratio: 320 / 150; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); }
.fx-topview > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.fx-topview-note { position: absolute; left: 0; right: 0; bottom: var(--space-2); text-align: center; font-size: 13px; line-height: 18px; color: var(--text-muted); }
.fx-pin { position: absolute; left: var(--x, 50%); top: var(--y, 50%); display: grid; place-items: center; width: 24px; height: 24px; padding: 0; transform: translate(-50%, -50%); border: 2px solid var(--surface); border-radius: var(--radius-full); background: var(--warn); color: var(--on-accent); font: 600 12px/16px var(--font-sans); cursor: pointer; }
.fx-pin.is-danger { background: var(--danger); }
.fx-pin.is-info { background: var(--info); }
.fx-pin.is-active { outline: 2px solid var(--text-strong); z-index: 1; }

/* ── Zone picker on the top-view (impact sides; front is on the right of car_top.png) ── */
.fx-zone-picker { margin: var(--space-2) 0; }
.fx-topview-zone { position: absolute; display: block; box-sizing: border-box; min-width: 44px; min-height: 44px; padding: 0; border: 1px dashed var(--border-strong, var(--border)); border-radius: var(--radius); background: transparent; color: var(--text-strong); cursor: pointer; }
/* CA-469: hover/tap only marks the border; a background here stuck after a tap on touch screens and hid the car. */
.fx-topview-zone:hover { border-color: var(--accent); }
.fx-topview-zone:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fx-topview-zone.is-selected, .fx-topview-zone[aria-pressed="true"] { border-style: solid; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.fx-topview-zone--static { cursor: default; pointer-events: none; min-width: 0; min-height: 0; }
.fx-topview-zone--static:not(.is-selected):not(.is-preexisting) { display: none; }
/* CA-87: sides whose AI damages were left out of the estimate as pre-existing (dotted amber, not the declared accent) */
.fx-topview-zone.is-preexisting { display: block; border-style: dotted; border-color: var(--amber); background: color-mix(in srgb, var(--amber) 16%, transparent); }
.fx-topview-zone--rear  { left: 8%;  top: 15%; width: 22%; height: 70%; }
.fx-topview-zone--front { left: 70%; top: 15%; width: 22%; height: 70%; }
.fx-topview-zone--left  { left: 31%; top: 4%;  width: 38%; height: 32%; }
.fx-topview-zone--right { left: 31%; top: 64%; width: 38%; height: 32%; }
.fx-topview-zone--roof  { left: 31%; top: 36%; width: 38%; height: 28%; }

/* ── Sparkline (inline SVG trend) ─────────────────────────────────── */
.fx-sparkline { display: block; width: 100%; height: 64px; color: var(--chart-2); }
.fx-sparkline polyline { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.fx-sparkline polygon { fill: currentColor; opacity: .12; }
.fx-sparkline.is-danger { color: var(--danger); }
.fx-sparkline.is-warn { color: var(--warn); }

/* ── Labelled bar row (top damaged parts) ─────────────────────────── */
.fx-barrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-1) var(--space-3); align-items: center; font-size: 13px; line-height: 18px; color: var(--text); }
.fx-barrow > .fx-progress { grid-column: 1 / -1; }
.fx-barrow > span:last-of-type { color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* --- css/ds/components-glass.css --- */
/* Fluxe design system - components added by the Glass conversion (CA-160). Generic fx-* names, tokens only;
   to be folded into components.css. Breakpoints: 768px (phone), 1024px (tablet). */

/* ── Drop zone (file upload) ──────────────────────────────────────── */
.fx-dropzone { display: grid; justify-items: center; gap: var(--space-1); padding: var(--space-6) var(--space-4); border: 1px dashed var(--border-control); border-radius: var(--radius-lg); background: var(--surface); color: var(--text-muted); text-align: center; cursor: pointer; transition: background-color .15s ease-out, border-color .15s ease-out; }
.fx-dropzone:hover, .fx-dropzone.is-over { background: var(--surface-2); border-color: var(--text-muted); }
.fx-dropzone .fx-icon { width: 20px; height: 20px; }
.fx-dropzone-title { font: 500 14px/20px var(--font-sans); color: var(--text-strong); }
.fx-dropzone-sub { font-size: 13px; line-height: 18px; }

/* ── Thumbnails (image grid with caption and remove) ──────────────── */
.fx-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--space-2); }
.fx-photo { position: relative; display: grid; gap: var(--space-1); min-width: 0; margin: 0; }
.fx-photo-img { display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); overflow: hidden; cursor: zoom-in; }
.fx-photo-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.fx-photo-cap { display: flex; align-items: center; justify-content: space-between; gap: var(--space-1); min-width: 0; font-size: 12px; line-height: 16px; color: var(--text-muted); }
.fx-photo-cap > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-photo-remove { position: absolute; top: var(--space-1); right: var(--space-1); display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--surface); color: var(--text-strong); cursor: pointer; }
.fx-photo-remove:hover { background: var(--surface-2); }
.fx-photo-remove .fx-icon { width: 12px; height: 12px; }
.fx-photos--sm { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }

/* ── Photo slots (one labelled drop box per required photo) ───────── */
.fx-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: var(--space-3); }
.fx-slot { display: grid; gap: var(--space-1); min-width: 0; }
.fx-slot-label { font: 500 12px/16px var(--font-sans); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-slot-drop { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; padding: 0; border: 1px dashed var(--border-control); border-radius: var(--radius); background: var(--surface); color: var(--text-muted); overflow: hidden; cursor: pointer; transition: background-color .15s ease-out; }
.fx-slot-drop:hover, .fx-slot-drop.is-over { background: var(--surface-2); }
.fx-slot-drop.is-filled { border-style: solid; border-color: var(--border); }
.fx-slot-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fx-slot-drop.is-missing { border-color: var(--danger); }

/* ── Timeline (event history) ─────────────────────────────────────── */
.fx-track { display: grid; margin: 0; padding: 0; list-style: none; }
.fx-track-item { position: relative; display: grid; grid-template-columns: 32px 1fr; gap: var(--space-3); padding-bottom: var(--space-4); }
.fx-track-item:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 32px; bottom: 0; width: 1px; background: var(--border); }
.fx-track-dot { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-full); background: var(--surface-2); color: var(--text-muted); }
.fx-track-body { display: grid; gap: 2px; min-width: 0; padding-top: var(--space-1); }
.fx-track-title { color: var(--text-strong); font-weight: 500; }
.fx-track-text { font-size: 13px; line-height: 18px; color: var(--text); }
.fx-track-meta { font-size: 12px; line-height: 16px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ── Accordion (details / summary section) ────────────────────────── */
.fx-accordion { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.fx-accordion + .fx-accordion { margin-top: var(--space-2); }
.fx-accordion > summary { display: flex; align-items: center; gap: var(--space-3); min-height: 48px; padding: var(--space-2) var(--space-4); list-style: none; cursor: pointer; color: var(--text-strong); font: 500 14px/20px var(--font-sans); }
.fx-accordion > summary::-webkit-details-marker { display: none; }
.fx-accordion > summary > .fx-icon { color: var(--text-muted); }
.fx-accordion-title { flex: 1; min-width: 0; }
.fx-accordion > summary::after { content: ""; flex: none; width: 7px; height: 7px; margin-right: var(--space-1); border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted); transform: rotate(45deg); transition: transform .15s ease-out; }
.fx-accordion[open] > summary::after { transform: rotate(-135deg); }
.fx-accordion-body { display: grid; gap: var(--space-4); padding: 0 var(--space-4) var(--space-4); }

/* ── Segmented control with real radios; fieldset reset ──────────── */
.fx-seg-opt:has(input:checked) { background: var(--surface); color: var(--text-strong); box-shadow: 0 0 0 1px var(--border); }
.fx-seg-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.fx-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.fx-fieldset > legend { padding: 0; margin-bottom: var(--space-1); }
.fx-field > .fx-seg { justify-self: start; }
.fx-field > .fx-seg--block { justify-self: stretch; }

/* ── Tile as a button (opens a dialog instead of a page) ─────────── */
button.fx-tile { width: 100%; font: inherit; text-align: start; cursor: pointer; }

/* ── Tabs as links (URL sections) ──────────────────────────────────── */
a.fx-tab, a.fx-tab:hover { text-decoration: none; }

/* ── Steps: error state ───────────────────────────────────────────── */
.fx-step.is-error { color: var(--danger); }
.fx-step.is-error::before { content: "!"; background: var(--danger-soft); border-color: var(--danger-soft); color: var(--danger); }

/* ── Split bar (two-part ratio: ok vs danger) and share meter ─────── */
.fx-ratio { display: flex; height: 8px; border-radius: var(--radius-full); background: var(--danger); overflow: hidden; }
.fx-ratio > span { display: block; width: var(--value, 0%); height: 100%; background: var(--ok); }
.fx-ratio-legend { display: flex; justify-content: space-between; gap: var(--space-3); font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; }
.fx-ratio-legend .is-ok { color: var(--ok); font-weight: 500; }
.fx-ratio-legend .is-danger { color: var(--danger); font-weight: 500; }
.fx-bar { display: block; height: 4px; border-radius: var(--radius-full); background: var(--surface-2); overflow: hidden; }
.fx-bar > span { display: block; width: var(--value, 0%); height: 100%; background: var(--text-muted); }

/* ── Combobox (type-ahead multi-select with chips) ────────────────── */
.fx-combobox { position: relative; display: grid; gap: var(--space-2); }
.fx-combobox-box { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); min-height: var(--control-h); padding: var(--space-1) var(--space-2); border: 1px solid var(--border-control); border-radius: var(--radius); background: var(--surface); cursor: text; }
.fx-combobox-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.fx-combobox-input { flex: 1; min-width: 120px; height: 28px; padding: 0 var(--space-1); border: 0; background: none; color: var(--text-strong); font: 400 14px/20px var(--font-sans); }
.fx-combobox-input:focus { outline: none; }
.fx-combobox-menu { position: absolute; left: 0; right: 0; top: calc(var(--control-h) + var(--space-1)); max-height: 240px; overflow-y: auto; }
.fx-combobox-menu .fx-menu-item.is-active { background: var(--surface-2); color: var(--text-strong); }
.fx-combobox-foot { display: flex; align-items: center; gap: var(--space-3); font-size: 12px; line-height: 16px; color: var(--text-muted); }

/* ── Popover that becomes a bottom sheet on phones (filters) ──────── */
.fx-pop-anchor { position: relative; }
.fx-popover--sheet { position: absolute; top: calc(100% + var(--space-1)); left: 0; display: grid; gap: var(--space-4); }
.fx-popover-ft { display: flex; justify-content: flex-end; gap: var(--space-2); }
.fx-popover-scrim { display: none; }

/* ── Lightbox (fullscreen image viewer) ───────────────────────────── */
.fx-photobox { position: fixed; inset: 0; z-index: calc(var(--z-dialog) + var(--fx-layer, 0)); display: grid; grid-template-rows: auto 1fr auto; background: var(--bg); }
.fx-photobox-bar { display: flex; justify-content: flex-end; gap: var(--space-1); padding: var(--space-2); }
.fx-photobox-bar .fx-icon-btn, .fx-photobox-nav { background: var(--surface); color: var(--text-strong); }
.fx-photobox-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 var(--space-12); }
.fx-photobox-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius); }
.fx-photobox-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.fx-photobox-nav.is-prev { left: var(--space-2); }
.fx-photobox-nav.is-next { right: var(--space-2); }
.fx-photobox-cap { justify-self: center; margin: var(--space-3); padding: var(--space-1) var(--space-3); border-radius: var(--radius); background: var(--surface); color: var(--text-strong); font-size: 13px; line-height: 18px; }

/* ── Dialog body: rows keep their content height (tabs and wide tables are scroll containers) ── */
.fx-dialog-bd { grid-auto-rows: max-content; }

/* ── Dialog: extra large (review workspaces) ──────────────────────── */
.fx-dialog--xl > .fx-dialog-bd { flex: 1; min-height: 0; }

/* ── Map (Leaflet theming) ────────────────────────────────────────── */
.fx-map { position: relative; isolation: isolate; min-height: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); font-family: var(--font-sans); }
.fx-map .leaflet-container { background: var(--surface-2); font-family: var(--font-sans); }
.fx-map .leaflet-control-zoom { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); overflow: hidden; }
.fx-map .leaflet-control-zoom a { width: 32px; height: 32px; border-bottom: 1px solid var(--border); background: var(--surface); color: var(--text-strong); font: 500 16px/32px var(--font-sans); text-align: center; text-decoration: none; }
.fx-map .leaflet-control-zoom a:last-child { border-bottom: 0; }
.fx-map .leaflet-control-zoom a:hover { background: var(--surface-2); }
.fx-map .leaflet-control-attribution { background: var(--surface); color: var(--text-muted); font-size: 12px; line-height: 16px; }
.fx-map .leaflet-control-attribution a { color: var(--text-muted); }
.fx-map .leaflet-tooltip, .fx-map .leaflet-popup-content-wrapper { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-pop); color: var(--text-strong); font-size: 13px; line-height: 18px; }
.fx-map .leaflet-tooltip-top::before { border-top-color: var(--surface); }
.fx-map .leaflet-popup-tip { background: var(--surface); box-shadow: none; }
.fx-map .leaflet-popup-close-button { color: var(--text-muted); font: 400 20px/24px var(--font-sans); text-decoration: none; }
.fx-map .leaflet-interactive:focus, .fx-map .leaflet-interactive:focus-visible, .fx-map .leaflet-marker-icon:focus { outline: none; }
.fx-map-status { position: absolute; z-index: 500; top: var(--space-3); left: 50%; transform: translateX(-50%); padding: var(--space-1) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-muted); font-size: 12px; line-height: 16px; pointer-events: none; }
.fx-map-divicon { border: 0; background: none; }
.fx-map-pin { position: relative; display: block; width: 28px; height: 28px; border: 3px solid var(--surface); border-radius: 50% 50% 50% 0; rotate: -45deg; background: var(--text-strong); box-shadow: var(--shadow-pop); transition: scale .15s ease-out; }
.fx-map-pin::after { content: ""; position: absolute; inset: 6px; border-radius: var(--radius-full); background: var(--surface); }
.fx-map-pin.is-warn { background: var(--warn); }
.fx-map-pin.is-approx { background: var(--text-muted); opacity: 0.75; border-style: dashed; }
.fx-map-pin.is-selected, .fx-map-pin:hover { z-index: 2; scale: 1.15; background: var(--accent-fill); }
.fx-map-pin > i { position: absolute; z-index: 1; top: -8px; right: -8px; display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 var(--space-1); border: 2px solid var(--surface); border-radius: var(--radius-full); rotate: 45deg; background: var(--text-strong); color: var(--bg); font: 600 12px/16px var(--font-sans); font-style: normal; }
.fx-map-pin > i:empty { display: none; }
.fx-map-bar-slot { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; width: var(--w, 16px); height: var(--slot-h, 120px); pointer-events: none; }
.fx-map-bar { position: relative; display: flex; flex-direction: column; flex: none; width: var(--w, 16px); height: var(--h, 0px); border: 1px solid var(--surface); border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--surface); box-shadow: var(--shadow-pop); cursor: pointer; pointer-events: auto; transition: height .7s cubic-bezier(.2, .8, .2, 1), opacity .3s ease-out; }
.fx-map-bar.is-empty { opacity: 0; }
.fx-map-bar > i { display: block; flex: var(--n, 0) 1 0; min-height: 0; transition: flex-grow .7s cubic-bezier(.2, .8, .2, 1); }
.fx-map-bar > i.is-ok { background: var(--ok); }
.fx-map-bar > i.is-danger { background: var(--danger); }
.fx-map-bar > i.is-none { background: var(--border-control); }
.fx-map-bar > i.is-accent { background: var(--accent-fill); }
.fx-map-bar > b { position: absolute; bottom: calc(100% + var(--space-1)); left: 50%; transform: translateX(-50%); padding: 0 var(--space-1); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-strong); font: 600 12px/16px var(--font-sans); white-space: nowrap; }
.fx-legend { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: 13px; line-height: 18px; }
.fx-legend > span { display: inline-flex; align-items: center; gap: var(--space-1); }
.fx-swatch { display: inline-block; width: 12px; height: 8px; border-radius: 2px; background: var(--border-control); }
.fx-swatch.is-ok { background: var(--ok); }
.fx-swatch.is-ok-2 { background: var(--chart-3); }
.fx-swatch.is-warn { background: var(--warn); }
.fx-swatch.is-danger { background: var(--danger); }
.fx-swatch.is-none { background: var(--surface-2); border: 1px solid var(--border-control); }

/* ── Chat assistant: floating button, panel, messages, composer ────── */
.fx-fab { position: fixed; right: var(--space-6); bottom: var(--space-6); z-index: var(--z-popover); display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border: 0; border-radius: var(--radius-full); background: var(--text-strong); color: var(--bg); box-shadow: var(--shadow-pop); cursor: pointer; transition: background-color .15s ease-out; }
.fx-fab:hover { background: var(--text); }
.fx-fab .fx-icon { width: 20px; height: 20px; }
.fx-fab .fx-fab-close, .fx-fab[aria-expanded="true"] .fx-fab-open { display: none; }
.fx-fab[aria-expanded="true"] .fx-fab-close { display: block; }
.fx-chat-box { position: fixed; right: var(--space-6); bottom: calc(var(--space-6) + 48px + var(--space-3)); z-index: var(--z-popover); display: flex; flex-direction: column; width: min(420px, calc(100vw - 32px)); height: min(640px, calc(100vh - 120px)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); overflow: hidden; }
.fx-chat-box .fx-chat-hd { position: relative; display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-2) var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.fx-chat-box .fx-chat-hd-text { display: grid; flex: 1; min-width: 0; }
.fx-chat-box .fx-chat-title { margin: 0; font: 600 15px/22px var(--font-sans); color: var(--text-strong); }
.fx-chat-box .fx-chat-sub { margin: 0; font-size: 12px; line-height: 16px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-chat-box .fx-chat-history { position: absolute; top: calc(100% + var(--space-1)); right: var(--space-2); width: 300px; max-height: 360px; overflow-y: auto; }
.fx-chat-box .fx-chat-history .fx-menu-item { height: auto; min-height: 44px; padding: var(--space-2); }
.fx-chat-box .fx-chat-context { padding: var(--space-2) var(--space-4) 0; }
.fx-chat-box .fx-chat-log { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-4); overflow-y: auto; }
.fx-chat-box .fx-chat-msg { display: flex; flex-direction: column; gap: var(--space-2); max-width: 100%; }
.fx-chat-box .fx-chat-msg.is-user { align-items: flex-end; }
.fx-chat-box .fx-chat-bubble { display: grid; gap: var(--space-2); min-width: 0; max-width: 100%; color: var(--text-strong); font-size: 14px; line-height: 21px; overflow-wrap: anywhere; }
.fx-chat-box .fx-chat-msg.is-user .fx-chat-bubble { max-width: 85%; padding: var(--space-2) var(--space-3); border-radius: var(--radius-lg); background: var(--surface-2); }
.fx-chat-box .fx-chat-msg.is-error .fx-chat-bubble { padding: var(--space-2) var(--space-3); border-radius: var(--radius-lg); background: var(--danger-soft); color: var(--danger); }
.fx-chat-box .fx-chat-bubble p, .fx-chat-box .fx-chat-bubble ul, .fx-chat-box .fx-chat-bubble ol { margin: 0; }
.fx-chat-box .fx-chat-bubble ul, .fx-chat-box .fx-chat-bubble ol { padding-left: var(--space-5); display: grid; gap: var(--space-1); }
.fx-chat-box .fx-chat-bubble h3, .fx-chat-box .fx-chat-bubble h4, .fx-chat-box .fx-chat-bubble h5 { margin: var(--space-1) 0 0; font: 600 14px/20px var(--font-sans); color: var(--text-strong); }
.fx-chat-box .fx-chat-bubble a { color: var(--accent); }
.fx-chat-box .fx-chat-bubble .fx-table-wrap { max-width: 100%; }
.fx-chat-box .fx-chat-code { margin: 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius); background: var(--surface-2); font: 400 13px/18px var(--font-mono); white-space: pre-wrap; }
.fx-chat-box .fx-chat-tools { display: grid; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.fx-chat-box .fx-chat-tool { display: flex; align-items: center; gap: var(--space-2); font-size: 12px; line-height: 16px; color: var(--text-muted); }
.fx-chat-box .fx-chat-tool .fx-spinner { width: 12px; height: 12px; border-width: 1.5px; }
.fx-chat-box .fx-chat-tool .fx-icon { width: 12px; height: 12px; color: var(--ok); }
.fx-chat-box .fx-chat-typing { display: inline-flex; gap: var(--space-1); padding: var(--space-2) 0; }
.fx-chat-box .fx-chat-typing i { width: 6px; height: 6px; border-radius: var(--radius-full); background: var(--text-muted); animation: fx-pulse 1.2s ease-in-out infinite; }
.fx-chat-box .fx-chat-typing i:nth-child(2) { animation-delay: .2s; }
.fx-chat-box .fx-chat-typing i:nth-child(3) { animation-delay: .4s; }
.fx-chat-box .fx-chat-caret { display: inline-block; width: 2px; height: 14px; margin-left: 2px; background: var(--text-strong); vertical-align: text-bottom; animation: fx-pulse 1s steps(2) infinite; }
.fx-chat-box .fx-chat-meta { display: flex; align-items: center; gap: var(--space-2); font-size: 12px; line-height: 16px; color: var(--text-muted); }
.fx-chat-box .fx-chat-empty { display: grid; justify-items: center; align-content: center; gap: var(--space-2); flex: 1; padding: var(--space-6) var(--space-2); text-align: center; color: var(--text-muted); }
.fx-chat-box .fx-chat-empty .fx-state-title, .fx-chat-box .fx-chat-empty .fx-state-text { margin: 0; }
.fx-chat-box .fx-chat-suggestions { display: grid; gap: var(--space-2); width: 100%; margin-top: var(--space-3); }
.fx-chat-box .fx-chat-suggestions .fx-chip { justify-content: flex-start; height: auto; min-height: 36px; padding: var(--space-2) var(--space-3); white-space: normal; text-align: start; }
.fx-chat-box .fx-chat-attachments { padding: var(--space-2) var(--space-4) 0; }
.fx-chat-box .fx-chat-composer { display: flex; align-items: flex-end; gap: var(--space-2); padding: var(--space-3); border-top: 1px solid var(--border); }
.fx-chat-box .fx-chat-input { flex: 1; min-height: var(--control-h); max-height: 120px; resize: none; }
.fx-icon-btn--primary { background: var(--accent-fill); color: var(--on-accent); }
.fx-icon-btn--primary:hover { background: var(--accent-fill-hover); color: var(--on-accent); }
.fx-icon-btn--primary:disabled { opacity: .5; cursor: not-allowed; }
.fx-table .is-center { text-align: center; }

/* ── Badge: neutral tone for read-only states ─────────────────────── */
.fx-badge--muted { background: var(--surface-2); color: var(--text-muted); }

/* ── Chat (assistant) additions: removable context chip, sources ──── */
.fx-chip--button { cursor: pointer; padding-right: var(--space-3); }
.fx-chip--button:hover { background: var(--surface-2); }

@media (max-width: 768px) {
  .fx-fab { right: var(--space-4); }
  .fx-chat-box { left: 0; right: 0; bottom: 0; z-index: var(--z-dialog); width: 100%; height: 88vh; border-bottom: 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .fx-chat-box .fx-chat-input { font-size: 16px; }
  .fx-chat-box .fx-chat-history { left: var(--space-2); width: auto; }
  .fx-photos { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fx-slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fx-popover--sheet { position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: var(--z-dialog); width: 100%; max-width: none; max-height: 92vh; overflow-y: auto; padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px)); border-bottom: 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
  .fx-popover--sheet::before { content: ""; justify-self: center; width: 36px; height: 4px; border-radius: var(--radius-full); background: var(--border-control); }
  .fx-popover--sheet .fx-popover-ft { flex-direction: column-reverse; }
  .fx-popover--sheet .fx-popover-ft .fx-btn { width: 100%; height: var(--touch-h-lg); }
  .fx-popover-scrim:not(.hidden) { display: block; position: fixed; inset: 0; z-index: var(--z-dialog); background: var(--scrim); }
  .fx-photobox-stage { padding: 0 var(--space-2); }
  .fx-dialog--xl { height: 92vh; }
  .fx-accordion > summary { min-height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  .fx-chat-box .fx-chat-typing i, .fx-chat-box .fx-chat-caret, .fx-fab { animation: none; transition: none; }
  .fx-map-bar, .fx-map-bar > i, .fx-map-pin, .fx-accordion > summary::after, .fx-dropzone, .fx-slot-drop { transition: none; }
}
/* --- css/ds/components-flow.css --- */
/* analyst/static/css/ds/components-flow.css — "How it works" stakeholder flow diagrams (CA-373).
 * Rendered by js/components/stakeholder_flows.js inside an FxDialog (size wide). Tokens only. */

.fx-flow { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.fx-flow-intro { margin: 0; font-size: 14px; line-height: 20px; color: var(--text); }
.fx-flow-legend { padding: var(--space-2) 0; }
.fx-flow-legend .fx-legend-item::before { content: none; }
.fx-flow-key { flex: none; overflow: visible; }

/* ── Canvas ── */
.fx-flow-canvas { overflow: auto; max-height: 70vh; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.fx-flow-canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fx-flow-svg { display: block; font-family: var(--font-sans); }
.fx-flow-scroll-hint { display: none; margin: 0; }

/* ── Lanes ── */
.fx-flow-lane rect { fill: var(--surface); stroke: var(--border); stroke-width: 1; }
.fx-flow-lane--alt rect { fill: var(--surface-2); }
.fx-flow-lane-name { font-size: 14px; font-weight: 600; fill: var(--text-strong); }

/* ── Nodes ── */
.fx-flow-shape { fill: var(--surface); stroke: var(--border-control); stroke-width: 1.5; }
.fx-flow-node--start .fx-flow-shape { fill: var(--info-soft); stroke: var(--info); }
.fx-flow-node--decision .fx-flow-shape { fill: var(--warn-soft); stroke: var(--warn); }
.fx-flow-node--output .fx-flow-shape { fill: var(--ok-soft); stroke: var(--ok); }
.fx-flow-title { font-size: 13px; font-weight: 600; fill: var(--text-strong); }
.fx-flow-sub { font-size: 12px; font-weight: 400; fill: var(--text-muted); }

/* ── Arrows ── */
.fx-flow-edge { fill: none; stroke: var(--text-muted); stroke-width: 1.5; }
.fx-flow-edge--loop { stroke: var(--accent); stroke-dasharray: 6 4; }
.fx-flow-marker path, .fx-flow-head { fill: var(--text-muted); }
.fx-flow-marker--loop path, .fx-flow-head--loop { fill: var(--accent); }
.fx-flow-elabel rect { fill: var(--surface); stroke: var(--border); stroke-width: 1; }
.fx-flow-elabel text { font-size: 12px; font-weight: 500; fill: var(--text); }

/* ── Gives / gets table ── */
.fx-flow-list { margin: 0; padding-left: var(--space-4); font-size: 13px; line-height: 20px; color: var(--text); }

@media (max-width: 768px) {
  .fx-flow-canvas { max-height: 60vh; }
  .fx-flow-scroll-hint { display: block; }
}

/* ── Intensity scale (CA-398 knowledge map heat: 0 none, 1 low, 2 medium, 3 high), dimming and selection ── */
.fx-heat-0 { background-color: transparent; }
.fx-heat-1 { background-color: var(--info-soft); }
.fx-heat-2 { background-color: var(--warn-soft); }
.fx-heat-3 { background-color: var(--danger-soft); }
.fx-flow-node.fx-heat-1 .fx-flow-shape { fill: var(--info-soft); }
.fx-flow-node.fx-heat-2 .fx-flow-shape { fill: var(--warn-soft); }
.fx-flow-node.fx-heat-3 .fx-flow-shape { fill: var(--danger-soft); }
.fx-dim { opacity: .4; }
.fx-list-item.is-selected, .fx-table tr.is-selected > td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.fx-flow-node.is-selected .fx-flow-shape { stroke: var(--accent); stroke-width: 2.5; }
.fx-flow-node[data-map-node] { cursor: pointer; }
.fx-list-item.is-match, .fx-table tr.is-match { background-color: var(--surface-2); }
.fx-list-item.is-current, .fx-table tr.is-current { outline: 2px solid var(--accent); outline-offset: -2px; }
.fx-flow-node.is-match .fx-flow-shape { fill: var(--surface-2); }
.fx-flow-node.is-current .fx-flow-shape { stroke: var(--accent); stroke-width: 3; }

/* ── Node-link graph + full screen (knowledge map, CA-398) ─────────── */
.fx-graph { position: relative; min-width: 0; }
.fx-graph-canvas { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); touch-action: none; }
.fx-graph-tools { position: absolute; top: var(--space-2); right: var(--space-2); display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-1); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); }
.fx-graph-legend { position: absolute; left: var(--space-2); bottom: var(--space-2); max-width: calc(100% - var(--space-4)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); }
.fx-graph-legend > summary { list-style: none; cursor: pointer; }
.fx-graph-legend > summary::-webkit-details-marker { display: none; }
.fx-graph-legend-bd { max-height: 40vh; overflow-y: auto; padding: var(--space-2) var(--space-3) var(--space-3); }
.fx-graph-legend-bd .fx-check { display: flex; align-items: center; gap: var(--space-2); }
.fx-maximized { position: fixed; inset: 0; z-index: calc(var(--z-nav) + 1); padding: var(--space-3); background: var(--bg); overflow: auto; }
.fx-graph-tip { position: absolute; left: var(--tip-x, 0); top: var(--tip-y, 0); z-index: 3; display: grid; gap: var(--space-1); max-width: 260px; pointer-events: none; }
.fx-graph-tip[hidden] { display: none; }
.fx-graph-tip > span { font-weight: 400; }
/* --- css/pages/52_shell_compat.css --- */
/* analyst/static/css/pages/52_shell_compat.css — TEMPORARY bridge between the CA-160 app shell and
   the legacy page CSS. Legacy pages were built under a fixed full-width top nav and a fixed full-width
   footer, both with !important geometry. This file only moves those boxes so the shell stays usable;
   each rule goes away when its area is converted, and the file is deleted with the last one. Layout only.
   Converted pages set fx_converted (templates) and get no top-bar bridge. */

@media (max-width: 1024px) {
  /* design-exception: legacy tablet/phone page CSS assumes a fixed top bar of height --nav-h */
  .fx-app:not(.fx-converted) .fx-topbar { position: fixed; top: 0; left: var(--sidebar-w-collapsed); right: 0; }
}

@media (max-width: 768px) {
  .fx-app:not(.fx-converted) .fx-topbar { left: 0; }
}
/*# sourceMappingURL=b-1d0a2a3991.css.4d754ec74d53.css.map */
