:root {
  --bg-page:        #0A0E14;
  --bg-panel:       #131820;
  --bg-panel-2:     #1A2029;
  --bg-elevated:    #232B36;
  --border:         #2A3340;
  --border-strong:  #3A4554;
  --text-primary:   #E8ECF1;
  --text-secondary: #9AA5B4;
  --text-muted:     #5E6878;
  --accent:         #D97757;
  --accent-soft:    rgba(217,119,87,0.15);
  --green:          #4A8E5F;
  --green-soft:     rgba(74,142,95,0.20);
  --amber:          #D9A157;
  --amber-soft:     rgba(217,161,87,0.20);
  --red:            #C2554F;
  --red-soft:       rgba(194,85,79,0.20);
  --blue:           #5C7CB0;
  --blue-soft:      rgba(92,124,176,0.20);
  --font-mono:      'SF Mono', 'Consolas', 'Monaco', monospace;
  --font-sans:      -apple-system, 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─────────────────  TOP BAR  ───────────────── */
.topbar {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--bg-page);
}
.brand-text { display: flex; flex-direction: column; }
.brand-title { font-size: 14px; font-weight: 600; }
.brand-sub { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); letter-spacing: 0.5px; }

.topbar-status {
  display: flex; gap: 24px; align-items: center;
}
.status-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-secondary);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green-soft);
}
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--bg-elevated);
  border-radius: 16px;
  font-size: 12px;
}

/* ─────────────────  NAV TABS  ───────────────── */
.nav-tabs {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  gap: 4px;
}
.nav-tab {
  padding: 14px 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  user-select: none;
  display: flex; align-items: center; gap: 8px;
  transition: all 0.15s;
}
.nav-tab:hover { color: var(--text-primary); }
.nav-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.nav-tab-icon { font-size: 14px; opacity: 0.7; }

/* ─────────────────  MAIN LAYOUT  ───────────────── */
.main {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: none;
}
.content.active { display: block; }
.chat-panel {
  width: 360px;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* ─────────────────  PAGE HEADER  ───────────────── */
.page-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.page-title {
  font-size: 22px; font-weight: 600;
  letter-spacing: -0.3px;
}
.page-sub {
  font-size: 12px; color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.page-actions {
  display: flex; gap: 8px;
}
.btn {
  padding: 8px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--border); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1A1F2B;
  font-weight: 600;
}
/* #387 — actions not wired up in the pilot read as disabled: muted, non-interactive
   cursor, no hover lift; the title tooltip keeps the intent visible. */
.btn.disabled, .btn.disabled:hover {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-muted);
  font-weight: 600;
}

/* ─────────────────  KPI ROW  ───────────────── */
.kpi-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.kpi {
  flex: 1;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.kpi-label {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
.kpi-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.5px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.kpi-value-unit {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
}
.kpi-value.red { color: var(--red); }
.kpi-value.amber { color: var(--amber); }
.kpi-value.green { color: var(--green); }
.kpi-value.muted { color: var(--text-muted); }
/* #374 ADAPT: roadmap strip — greyed PENDING placeholder cards (frame the gap,
   don't overclaim). Muted + dashed so they read as "coming", not as live data. */
#health-roadmap { margin-bottom: 20px; }
.roadmap-lead { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.8px;
  color: var(--text-muted); margin-bottom: 8px; }
.kpi-pending { background: none; border-style: dashed; opacity: 0.82; }
.kpi-pending-head { display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 6px; }
.kpi-pending-head .kpi-label { margin-bottom: 0; }
.pending-chip { font-family: var(--font-mono); font-size: 8px; font-weight: 700;
  letter-spacing: 0.4px; color: var(--text-muted); border: 1px solid var(--border-strong);
  border-radius: 3px; padding: 1px 5px; white-space: nowrap; }
.kpi-delta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-family: var(--font-mono);
}

/* ─────────────────  PANEL  ───────────────── */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.panel-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.panel-actions { display: flex; gap: 6px; }

/* ─────────────────  GRID LAYOUTS  ───────────────── */
.grid-2 {
  display: flex; gap: 16px;
}
.grid-2 > * { flex: 1; min-width: 0; }
.grid-3 {
  display: flex; gap: 16px;
}
.grid-3 > * { flex: 1; min-width: 0; }
.grid-asym {
  display: flex; gap: 16px;
}
.grid-asym > *:first-child { flex: 2; min-width: 0; }
.grid-asym > *:last-child { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ─────────────────  SPEEDOMETER / GAUGE  ───────────────── */
.gauge-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 8px;
}
.gauge-svg { width: 200px; height: 130px; }
.gauge-value {
  font-size: 36px;
  font-weight: 700;
  margin-top: -36px;
  letter-spacing: -1px;
}
.gauge-value.red { color: var(--red); }
.gauge-value.amber { color: var(--amber); }
.gauge-value.green { color: var(--green); }
.gauge-label {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  text-align: center;
  margin-top: 8px;
}
/* #370 recurrence k/N KPI card under the selected-unit gauge */
.gauge-recur {
  margin-top: 12px; padding: 8px 12px;
  background: var(--bg-panel-2); border: 1px solid var(--border);
  border-radius: 8px; text-align: center; cursor: help; min-width: 180px;
}
.gauge-recur .gr-head { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.gauge-recur .gr-k { font-size: 22px; font-weight: 700; color: var(--text-primary); font-family: var(--font-mono); }
.gauge-recur .gr-lbl { font-size: 10px; color: var(--text-secondary); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.5px; }
.gauge-recur .gr-band { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.gauge-recur .gr-sub { margin-top: 4px; font-size: 9px; color: var(--text-muted); font-family: var(--font-mono); }

/* #374 ADAPT: verdict roster — units grouped by tier as clickable chips */
.vr-wrap { margin-bottom: 12px; padding: 10px 12px; background: var(--bg-panel-2); border: 1px solid var(--border); border-radius: 8px; }
.vr-row { display: flex; align-items: center; gap: 10px; margin: 4px 0; }
.vr-tier { min-width: 72px; text-align: center; }
.vr-units { display: flex; flex-wrap: wrap; gap: 6px; }
.vr-chip { font-family: var(--font-mono); font-size: 12px; cursor: pointer; padding: 3px 9px;
  background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border); border-radius: 5px; }
.vr-chip:hover { border-color: var(--accent); color: var(--accent); }
.vr-note { margin-top: 8px; font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }

/* ─────────────────  AXLE PRIORITY TABLE  ───────────────── */
.priority-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.priority-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.priority-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.priority-table tr:hover { background: var(--bg-elevated); cursor: pointer; }
.priority-table tr.row-red { background: rgba(194,85,79,0.05); }
.priority-table tr.row-amber { background: rgba(217,161,87,0.04); }

.conf-ci {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
  cursor: help;
}
/* #316 end-bogie tag · #317 inline recurrence CI in the priority table */
.bogie-end { font-size: 10px; color: var(--amber); cursor: help; }
.ci-inline { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); cursor: help; white-space: nowrap; }

.priority-rank {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  width: 30px;
}
.unit-chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}
.severity-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}
.severity-fill {
  height: 100%;
  border-radius: 3px;
}
.severity-fill.red { background: var(--red); }
.severity-fill.amber { background: var(--amber); }
.severity-fill.green { background: var(--green); }
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
/* ─────────────  ANALYTICS EXPLORER (#239)  ───────────── */
.filter-bar { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.filter-field {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 10px; font-family: var(--font-mono); letter-spacing: 0.5px;
  color: var(--text-muted); text-transform: uppercase;
}
.filter-field select, .filter-field input, .cmp-select {
  background: var(--bg-elevated); color: var(--text-primary);
  border: 1px solid var(--border-strong); border-radius: 6px;
  padding: 7px 10px; font-size: 12px; font-family: var(--font-sans);
  min-width: 160px; outline: none;
}
.cmp-select { min-width: 90px; }
.filter-field select:focus, .filter-field input:focus, .cmp-select:focus { border-color: var(--accent); }
.cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cmp-col { border: 1px solid var(--border); border-radius: 8px; padding: 14px; background: var(--bg-elevated); }
.cmp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.cmp-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.cmp-row:last-child { border-bottom: none; }
.cmp-k { color: var(--text-muted); }
.cmp-v { color: var(--text-primary); font-family: var(--font-mono); }
.cmp-v.better { color: var(--green); }
.cmp-v.worse { color: var(--red); }
@media (max-width: 720px) { .cmp-grid { grid-template-columns: 1fr; } }
/* signal drill-down modal (#241) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(8, 11, 16, 0.72);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--bg-panel); border: 1px solid var(--border-strong);
  border-radius: 12px; padding: 20px 22px; width: 680px; max-width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
/* #374 ADAPT: the SIGNAL drill-down is a bottom-sheet (scoped to #signal-modal
   so the anatomy/defect modals keep the centered style). Slides up; wider to
   hold the 2-column verdict/evidence layout. */
#signal-modal.modal-overlay { align-items: flex-end; padding: 0; }
#signal-modal .modal-box {
  width: 1000px; max-width: 100%; max-height: 90vh; overflow-y: auto;
  border-radius: 16px 16px 0 0; border-bottom: none;
  animation: sheet-up 0.22s ease-out;
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.cert-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 22px; margin-top: 6px; }
.cert-col-h { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.6px; color: var(--text-muted);
  text-transform: uppercase; border-bottom: 1px solid var(--border); padding-bottom: 5px; margin-bottom: 10px; }
.cert-verdict { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.cert-verdict .idx { font-size: 20px; }
.cert-left .gauge-recur { margin-top: 0; }
@media (max-width: 760px) { .cert-cols { grid-template-columns: 1fr; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.modal-close { cursor: pointer; color: var(--text-muted); font-size: 16px; padding: 2px 8px; border-radius: 6px; }
.modal-close:hover { color: var(--text-primary); background: var(--bg-elevated); }
.sig-sub { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; }
/* #369 — "not a confirmed wheel defect" honesty gate badge (qualifier tone:
   amber, never red/green — it qualifies the flag, it is not an alarm or a
   clean bill). Sits between the sig-sub line and the WHY-THIS-LABEL lead. */
.sig-gate {
  display: inline-flex; align-items: center; gap: 7px; cursor: help;
  margin: 0 0 12px; padding: 6px 11px; border-radius: 6px;
  border: 1px solid var(--amber); background: var(--amber-soft);
}
.sig-gate-dot { color: var(--amber); font-size: 13px; line-height: 1; }
.sig-gate-lbl { font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.4px; color: var(--amber); }
/* #343/#368: quantitative receipt for the gate badge — wheel-locked energy
   above the noise floor. Neutral/confident (not an alarm); sits under the gate. */
.sig-energy { display: inline-flex; align-items: baseline; gap: 8px; cursor: help;
  margin: -6px 0 12px; padding: 5px 11px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: var(--bg-elevated); }
.sig-energy-k { font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.4px; color: var(--text-secondary); }
.sig-energy-v { font-family: var(--font-mono); font-size: 14px; font-weight: 700;
  color: var(--text-primary); }
.sig-energy-sub { font-size: 10px; color: var(--text-muted); }
/* #368: energy budget as a 3-segment stacked bar (wheel / line / unexplained).
   The glanceable form of the wheel-locked receipt; reads ~99% grey on our data,
   visually proving the flagged energy is broadband, not a rotating wheel order. */
.sig-budget { margin: 0 0 14px; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--bg-elevated); cursor: help; }
.sig-budget-k { font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.4px; color: var(--text-secondary); margin-bottom: 7px; }
.sig-budget-bar { display: flex; height: 14px; border-radius: 4px; overflow: hidden;
  background: var(--bg-page); border: 1px solid var(--border); }
.sig-budget-bar .seg { display: block; height: 100%; min-width: 0; }
.sig-budget-bar .seg-wheel { background: var(--accent); }
.sig-budget-bar .seg-line  { background: var(--blue); }
.sig-budget-bar .seg-resid { background: var(--text-muted); }
.sig-budget-leg { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px;
  font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }
.sig-budget-li { display: inline-flex; align-items: center; gap: 5px; }
.sig-budget-li b { color: var(--text-secondary); font-weight: 700; }
.sig-budget-li .sw { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.sig-budget-li .sw-wheel { background: var(--accent); }
.sig-budget-li .sw-line  { background: var(--blue); }
.sig-budget-li .sw-resid { background: var(--text-muted); }
/* #372 STRUCTURAL OPERATORS block — one row per corroborating operator. Each row
   is a verdict + compact metric; tone shows whether that operator found a wheel
   defect (warn) or not (clear). Within-pass / fleet / unit scopes are tagged. */
.sig-ops { margin: 0 0 14px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--bg-elevated); }
.sig-ops-h { display: flex; align-items: center; gap: 9px; margin-bottom: 5px; }
.sig-ops-k { font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.4px; color: var(--text-secondary); }
.sig-ops-cap { font-size: 10px; color: var(--text-muted); line-height: 1.4; margin-bottom: 9px; }
.op-row { display: grid; grid-template-columns: auto 1fr auto; column-gap: 10px;
  align-items: baseline; padding: 5px 0; border-top: 1px solid var(--border); }
.op-row:first-of-type { border-top: none; }
.op-dot { width: 7px; height: 7px; border-radius: 50%; align-self: center;
  background: var(--text-muted); }
.op-clear .op-dot { background: var(--blue); }
.op-warn .op-dot { background: var(--amber); }
.op-pending .op-dot, .op-mute .op-dot { background: var(--border-strong);
  border: 1px solid var(--text-muted); }
.op-name { font-size: 12px; color: var(--text-primary); }
.op-ref { display: none; }   /* #414/F20 — internal tracker IDs hidden from the operator UI */
.op-scope { font-family: var(--font-mono); font-size: 8px; font-weight: 700;
  letter-spacing: 0.3px; padding: 1px 4px; border-radius: 3px; margin-left: 5px;
  vertical-align: middle; }
.op-scope-fleet { color: var(--accent); border: 1px solid var(--accent); }
.op-scope-unit { color: var(--blue); border: 1px solid var(--blue); }
.op-verdict { font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  text-align: right; white-space: nowrap; color: var(--text-secondary); }
.op-warn .op-verdict { color: var(--amber); }
.op-pending .op-verdict, .op-mute .op-verdict { color: var(--text-muted); font-style: italic; }
.op-metric { grid-column: 2 / -1; font-family: var(--font-mono); font-size: 9px;
  color: var(--text-muted); text-align: right; margin-top: 1px; }
.op-sep { font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.4px; color: var(--text-muted); margin: 9px 0 1px;
  padding-top: 8px; border-top: 1px dashed var(--border-strong); }
/* #344/#374 — per-unit trajectory chip on the fleet/queue rows. EVOLVING warns
   (amber, the only act-now state); one-off / stable read clear (blue/muted). */
.traj-chip { display: inline-block; font-family: var(--font-mono); font-size: 9px;
  font-weight: 700; letter-spacing: 0.3px; padding: 1px 6px; border-radius: 4px;
  vertical-align: middle; cursor: help; white-space: nowrap; }
.traj-clear { color: var(--blue); border: 1px solid var(--blue); }
.traj-warn { color: var(--amber); border: 1px solid var(--amber);
  background: var(--amber-soft); }
/* #345/#374 — per-axle Operator-A attribution row under the Analytics heatmap. */
.hm-attr-row { margin-top: 6px; }
.hm-attr-cell { flex: 1; height: 18px; display: flex; align-items: center;
  justify-content: center; font-family: var(--font-mono); font-size: 9px;
  font-weight: 700; cursor: help; border-radius: 3px;
  border: 1px solid var(--border); color: var(--text-muted);
  background: var(--bg-elevated); }
.hm-attr-clear { color: var(--blue); border-color: var(--blue); }
.hm-attr-warn { color: var(--amber); border-color: var(--amber);
  background: var(--amber-soft); }
.hm-attr-mute { color: var(--text-muted); border-color: var(--border);
  background: none; }
/* #374 ADAPT: WITHIN-PASS scope chip on the single-pass signal excerpt */
.sig-scope { display: flex; align-items: center; gap: 8px; margin: 10px 0 6px;
  font-size: 11px; color: var(--text-muted); }
.scope-chip { font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: 0.4px;
  color: var(--blue); border: 1px solid var(--blue); border-radius: 4px; padding: 2px 6px; white-space: nowrap; }
.sig-why {             /* #283 — "why this label" lead, above the evidence receipt */
  margin: 0 0 12px; padding: 8px 10px; border-left: 3px solid var(--accent);
  background: var(--bg-page); border-radius: 6px; font-size: 12px; line-height: 1.45;
}
.sig-why-k { display: block; font-family: var(--font-mono); font-size: 9px;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--accent); margin-bottom: 3px; }
.sig-svg { width: 100%; height: 200px; background: var(--bg-page); border: 1px solid var(--border); border-radius: 8px; display: block; }
.sig-axis { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); margin-top: 6px; }
.sig-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.sig-stat { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; font-size: 12px; display: flex; gap: 8px; align-items: baseline; }
.sig-k { color: var(--text-muted); font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.sig-v { color: var(--text-primary); font-family: var(--font-mono); font-weight: 600; }
.sig-note { margin-top: 14px; font-size: 11px; color: var(--text-muted); line-height: 1.5; border-top: 1px solid var(--border); padding-top: 10px; }

/* #314 RECEIPT — per-flag evidence ledger in the drill-down */
.rcpt { margin-top: 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elevated); padding: 10px 12px; }
.rcpt-head { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); margin-bottom: 8px; }
.rcpt-row { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: baseline; padding: 4px 0; border-top: 1px solid var(--border); }
.rcpt-row:first-of-type { border-top: none; }
.rcpt-name { font-size: 12px; color: var(--text-primary); }
.rcpt-val { font-family: var(--font-mono); font-size: 12px; font-weight: 600; text-align: right; white-space: nowrap; }
.rcpt-note { grid-column: 1 / -1; font-size: 10px; color: var(--text-muted); line-height: 1.4; margin-top: 1px; }
.rcpt-measured { color: var(--text-primary); }
.rcpt-deferred { color: var(--amber); font-style: italic; }
.rcpt-excluded { color: var(--text-muted); font-style: italic; }
.rcpt-na { color: var(--text-muted); }
.rcpt-legend { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 10px; color: var(--text-muted); line-height: 1.4; }
/* #319 label-source conflict guard */
.sig-conflict { margin-bottom: 10px; padding: 8px 10px; border-left: 3px solid var(--red); background: var(--red-soft); color: var(--red); font-size: 12px; font-weight: 600; }
/* #318 FALLBACK action line */
.sig-fallback { margin-top: 10px; padding: 8px 10px; border-left: 3px solid var(--accent); background: rgba(217,119,87,0.10); font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.sig-fallback strong { color: var(--text-primary); }

/* pre-registered prediction card (#240) */
.prediction-card { border: 1px solid var(--border-strong); border-left: 3px solid var(--accent); border-radius: 10px; padding: 16px 18px; background: var(--bg-panel); }
.prediction-card .pc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.prediction-card .pc-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.prediction-card .pc-body { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.prediction-card .pc-reasons { margin-top: 10px; font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.prediction-card .pc-unit { font-family: var(--font-mono); font-weight: 700; color: var(--accent); }
/* #441 — scored prediction (loop closed): tint the left border by outcome and
   surface the verdict chip; an honest miss reads amber, not hidden. */
.prediction-card.pc-hit { border-left-color: var(--green); }
.prediction-card.pc-partial { border-left-color: var(--amber); }
.prediction-card.pc-miss { border-left-color: var(--red); }
.prediction-card .pc-verdict { font-family: var(--font-mono); font-weight: 700; font-size: 12px; letter-spacing: .3px; }
.prediction-card.pc-hit .pc-verdict { color: var(--green); }
.prediction-card.pc-partial .pc-verdict { color: var(--amber); }
.prediction-card.pc-miss .pc-verdict { color: var(--red); }

#filter-results tr[data-unit] { cursor: pointer; }
#filter-results tr.analytics-row-sel { outline: 1px solid var(--accent); outline-offset: -1px; }

.badge-confirmed {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  /* #437 — relayed, not-yet-operator-confirmed reprofiling note: amber (caution),
     not green (confirmed). It is corroborating context, not established fact. */
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid var(--amber);
  cursor: help;
  vertical-align: middle;
}

/* ─────────────────  AXLE GRID  ───────────────── */
.axle-grid {
  display: flex;
  gap: 4px;
  padding: 12px;
  background: var(--bg-elevated);
  border-radius: 6px;
}
.axle-cell {
  flex: 1;
  height: 40px;
  background: var(--green);
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
}
.axle-cell.red { background: var(--red); }
.axle-cell.amber { background: var(--amber); }
.axle-cell.green { background: var(--green); }
.axle-cell.empty { background: transparent; }
.axle-cell:hover { outline: 2px solid var(--accent); }

/* ─────────────────  SCHEMATIC TRAIN MAP (#245)  ───────────────── */
.trainmap-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border-radius: 6px;
}
.trainmap-id {
  width: 80px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.trainmap-id .unit-chip { display: inline-block; }
/* #336: defect-library load-failure hint (cold-box retry, not a blank grid). */
.defect-empty { color: var(--muted, #8a94a6); font-size: 13px; padding: 16px 4px; }
/* #336: direction-mix chip — muted, secondary to the verdict badge. */
.dir-chip {
  display: inline-block;
  font-size: 8px;
  color: var(--muted, #8a94a6);
  border: 1px solid var(--border, #2a3344);
  border-radius: 6px;
  padding: 1px 4px;
  white-space: nowrap;
  cursor: help;
}
.trainmap-svg-wrap { flex: 1; min-width: 0; overflow-x: auto; }
/* #384 — fill the panel width instead of sitting in the left ~45%: the SVG now
   stretches to its container (width:100%) and its height follows the aspect,
   capped so the stacked Fleet-Health list stays compact (the 2026-06-17 "all
   units visible" ask). The wider inter-bogie gap in the generator keeps the
   aspect tall-and-thin so the capped height still fills most of the width. */
.trainmap-svg { width: 100%; height: auto; min-height: 52px; max-height: 84px; display: block; }
/* wheelset tier fills */
.ws-inspect { fill: var(--red); }
.ws-watch   { fill: var(--amber); }
.ws-ok      { fill: var(--green); }
.ws-none    { fill: var(--bg-elevated); stroke: var(--border-strong); stroke-width: 1.5; }
.ws-hit { cursor: pointer; transition: filter .12s; }
.ws-hit:hover { filter: brightness(1.25); }
.ws-worst-ring {
  fill: none;
  stroke: var(--text-primary);
  stroke-width: 2.5;
  pointer-events: none;
}
.tm-coach { fill: var(--bg-panel-2); stroke: var(--border-strong); stroke-width: 1; }
.tm-window { fill: var(--bg-page); stroke: var(--border); stroke-width: 0.75; opacity: 0.85; }
.tm-bogie-trailer { stroke-dasharray: 3 2; }
.tm-frame { fill: none; stroke: var(--border-strong); stroke-width: 1.5; }
.tm-bogie-frame { fill: var(--bg-panel); stroke: var(--border); stroke-width: 1; }
.tm-axle-bar { stroke: var(--border-strong); stroke-width: 2; }
.tm-blabel { fill: var(--text-muted); font-family: var(--font-mono); font-size: 8px; }
/* #367 polish: worst-bogie star marker prepended to the bogie label. Colour by
   tier so it reads at a glance; one per unit, flagged units only (set in app.js). */
.tm-worst-star { font-size: 9px; font-weight: 700; }
.tm-worst-star.star-inspect { fill: var(--red); }
.tm-worst-star.star-watch { fill: var(--amber); }
/* #328 provisional travel-direction arrow */
.tm-travel-line, .tm-travel-head { stroke: var(--text-muted); fill: var(--text-muted); }
.tm-travel-head { stroke: none; }
.tm-travel-lbl { fill: var(--text-muted); font-family: var(--font-mono); font-size: 7px; }
.tm-travel { cursor: help; }
/* #323 bogie-level hit-zone: transparent, highlights the whole bogie on hover */
.bogie-hit { fill: transparent; cursor: pointer; }
.bogie-hit:hover { fill: rgba(217,119,87,0.10); stroke: var(--accent); stroke-width: 1; }
.tm-worst-label {
  fill: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
}
/* #322: from-below view toggle + plan rails/wheels */
.trainmap-toolbar { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.view-toggle {
  font-family: var(--font-mono); font-size: 11px; cursor: pointer;
  background: var(--bg-elevated); color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px;
}
.view-toggle:hover { color: var(--text-primary); border-color: var(--border-strong); }
.view-toggle[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.pl-rail { fill: var(--text-muted); font-family: var(--font-mono); font-size: 7px; }
.pl-wheel { stroke: var(--border-strong); stroke-width: 1; }

/* #313: per-pass bogie strips stacked under an elevated unit's aggregate row */
.pp-stack {
  margin: 4px 0 2px 0;
  padding: 6px 8px 4px;
  border-left: 2px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}
.pp-head {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.pp-row { display: flex; align-items: center; gap: 8px; margin: 1px 0; }
/* #374 ADAPT: clickable per-pass row (scopes assistant context to the pass) */
.pp-row-click { cursor: pointer; border-radius: 4px; }
.pp-row-click:hover { background: var(--accent-soft); }
.pp-row-click.sel { background: var(--accent-soft); outline: 1px solid var(--accent); }
.pp-agg {              /* #315 — aggregate-across-passes summary row */
  padding-bottom: 3px;
  margin-bottom: 3px;
  border-bottom: 1px solid var(--border-strong);
}
.pp-agg .pp-label, .pp-agg .pp-score { font-weight: 700; text-transform: uppercase; }
.pp-label {
  flex: 0 0 150px;   /* #326 — widened to fit per-pass speed + crawl tag */
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.pp-flag { color: var(--red); margin-left: 3px; }
.screen-tag {          /* #291 — single-signal (uncorroborated) WATCH marker */
  color: var(--text-muted);
  font-size: 8px;
  text-transform: uppercase;
  border: 1px dotted var(--text-muted);
  border-radius: 3px;
  padding: 0 3px;
  margin-left: 4px;
  vertical-align: middle;
}
.kpi-range {           /* #291 — headline upper bound, e.g. "6–7" */
  font-size: 0.55em;
  color: var(--text-muted);
  vertical-align: super;
}
.border-tag {          /* #366 — knife-edge tier marker */
  color: var(--amber);
  font-size: 8px;
  text-transform: uppercase;
  border: 1px dashed var(--amber);
  border-radius: 3px;
  padding: 0 3px;
  margin-left: 4px;
  vertical-align: middle;
}
.axle-sec {            /* #405 — within-bogie axle shown as secondary/illustrative */
  color: var(--text-muted);
  font-size: 11px;
}
.src-tag {             /* #409 — source of priority (workshop override vs blind signal) */
  font-size: 9px;
  text-transform: uppercase;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
  cursor: help;
}
.src-workshop { color: var(--blue, #4a9ed9); border-color: var(--blue, #4a9ed9); }
.src-recurrence { color: var(--text-secondary); }
.src-single, .src-impact { color: var(--amber); border-color: var(--amber); border-style: dashed; }
.xday-flag {           /* #405/#402-F16 — worst bogie moved across days (combined view) */
  color: #1a1205;
  background: var(--amber);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  border: 1px solid var(--amber);
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 6px;
  white-space: nowrap;
  vertical-align: middle;
  cursor: help;
}
.wheel-neg {           /* #404 — wear-band ≠ confirmed wheel defect (structural-negative) */
  color: var(--text-muted);
  font-size: 8px;
  text-transform: uppercase;
  border: 1px dashed var(--border-strong);
  border-radius: 3px;
  padding: 0 3px;
  margin-left: 4px;
  vertical-align: middle;
  cursor: help;
}
.idx-repeat {          /* #424 (#421-F3) — inline repeatability caption: 2-dp index ranks, it does not measure */
  color: var(--text-muted);
  font-size: 9px;
  font-style: italic;
  line-height: 1.3;
  cursor: help;
}
.gauge-value + .idx-repeat { margin: 2px 0 4px; }
/* #431 — fleet-wide bogie ranking (worst-N operating point) */
.rk-head { font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; line-height: 1.5; }
.rk-metric { font-size: 10px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.45; }
.rk-list { display: flex; flex-direction: column; gap: 2px; }
.rk-row { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 10px; }
.rk-row.rk-cutrow { border-top: 2px dashed var(--amber); padding-top: 3px; margin-top: 1px; }
.rk-lbl { width: 92px; flex-shrink: 0; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-bar-wrap { flex: 1; height: 11px; background: var(--bg-elevated); border-radius: 2px; overflow: hidden; }
.rk-bar { display: block; height: 100%; border-radius: 2px; }
.rk-bar.rk-screen { background: var(--red); }
.rk-bar.rk-cut { background: var(--amber); }
.rk-bar.rk-below { background: var(--border-strong); }
.rk-val { width: 42px; flex-shrink: 0; text-align: right; color: var(--text-secondary); }
.rk-legend { margin-top: 10px; font-size: 10px; color: var(--text-muted); line-height: 1.5; }
.mode-none {           /* #431 — sub-threshold unit: no defect mode asserted */
  color: var(--text-muted);
  font-style: italic;
  cursor: help;
}
.th-sortable {         /* #430 — clickable column header (group queue by evidence grade) */
  cursor: pointer;
  user-select: none;
}
.th-sortable:hover { color: var(--text-primary); }
.th-sort-ind { color: var(--text-muted); font-size: 9px; font-weight: 600; }
.thin-evidence {       /* #430 — N<4 passes: visually demote, the rank is evidence-light */
  opacity: 0.62;
}
.thin-evidence:hover { opacity: 1; }
.thin-tag {
  display: inline-block;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--amber);
  border: 1px dashed var(--amber);
  border-radius: 3px;
  padding: 0 4px;
  margin-left: 4px;
  vertical-align: middle;
  cursor: help;
}
.action-caveat {       /* #425 (#402-F17 residual) — bogie/not-a-wheel-defect caveat beside the queue ACTION */
  color: var(--text-muted);
  font-size: 8px;
  text-transform: uppercase;
  border: 1px dashed var(--border-strong);
  border-radius: 3px;
  padding: 0 4px;
  white-space: nowrap;
  cursor: help;
}
.prov-tag {            /* #278 — provisional / insufficient-data marker on <4-pass scores */
  color: var(--amber);
  font-size: 8px;
  text-transform: uppercase;
  border: 1px solid var(--amber);
  border-radius: 3px;
  padding: 0 3px;
  margin-left: 2px;
}
.pp-crawl {            /* #326 — slow-pass tag */
  color: var(--amber);
  text-transform: uppercase;
  font-size: 8px;
  border: 1px solid var(--amber);
  border-radius: 3px;
  padding: 0 3px;
  margin-left: 2px;
}
.pp-note { font-family: var(--font-mono); font-size: 9px; color: var(--amber); margin: 0 0 3px; }
.pp-score { flex: 0 0 36px; font-family: var(--font-mono); font-size: 9px; color: var(--text-secondary); text-align: right; }   /* #384 — fixed so summary + pp-rows share identical columns */
.pp-strip-wrap { flex: 1; min-width: 0; overflow-x: auto; }   /* #384 — take the row width */
.pp-strip { width: 100%; height: 22px; display: block; }   /* #384 — fill, aligns under the schematic */
/* #384 — summary schematic is the first row of the per-pass stack, sharing the
   exact label/strip/score columns so its b1..b6 sit pixel-aligned over the
   strips. It keeps its normal height in the strip column. */
.pp-summary { align-items: flex-start; margin-bottom: 2px; }
.pp-summary .pp-strip-wrap { overflow-x: visible; }
.pp-bogie { stroke: var(--border); stroke-width: 0.75; }
.pp-wheel { fill: var(--bg-page); opacity: 0.7; }

.trainmap-key {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 12px;
}
.trainmap-key .tk-item { display: flex; align-items: center; gap: 5px; }
.trainmap-key .tk-dot {
  width: 11px; height: 11px; border-radius: 50%;
  border: 1px solid var(--border-strong);
}
/* #325: the ws-* tier classes set SVG `fill` (for the schematic circles); the
   legend dots are spans, so give them the matching background so the four
   bands are visually distinct and the printed cut points are auditable. */
.trainmap-key .tk-dot.ws-inspect { background: var(--red); }
.trainmap-key .tk-dot.ws-watch { background: var(--amber); }
.trainmap-key .tk-dot.ws-ok { background: var(--green); }
.trainmap-key .tk-dot.ws-none { background: var(--bg-elevated); }
.trainmap-key .tk-ring {
  width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--text-primary);
}
.trainmap-caveat {
  margin-top: 12px;
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.5;
  font-family: var(--font-mono);
}

/* ─────────────────  HEATMAP  ───────────────── */
.heatmap-row {
  display: flex;
  gap: 3px;
  margin-bottom: 3px;
  align-items: center;
}
/* #374 ADAPT: heatmap axle/bogie view toggle */
.hm-toggle { display: inline-flex; gap: 0; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.hm-tog-btn {
  font-family: var(--font-mono); font-size: 11px; cursor: pointer; padding: 4px 12px;
  background: var(--bg-elevated); color: var(--text-secondary); border: none;
}
.hm-tog-btn + .hm-tog-btn { border-left: 1px solid var(--border); }
.hm-tog-btn.active { background: var(--accent-soft); color: var(--accent); }
/* #374 ADAPT: within-day per-pass worst-share trend */
.pass-trend-wrap { margin-top: 14px; }
.pass-trend-head { font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; }
.pass-trend { width: 100%; height: auto; background: var(--bg-page); border: 1px solid var(--border); border-radius: 8px; display: block; }
.pass-trend-note { margin-top: 5px; font-size: 9px; color: var(--text-muted); font-family: var(--font-mono); line-height: 1.4; }
.heatmap-label {
  width: 60px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.heatmap-cell {
  flex: 1;
  height: 22px;
  border-radius: 2px;
  cursor: pointer;
}

/* ─────────────────  DEFECT TYPE CARD  ───────────────── */
.defect-card {
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
}
.defect-card.active { border-color: var(--accent); }
.defect-title { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.defect-count { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.defect-desc { font-size: 10px; color: var(--text-muted); margin-top: 4px; font-family: var(--font-mono); }
.defect-count-unit { font-size: 11px; font-weight: 500; color: var(--text-muted); letter-spacing: 0; }
.defect-members { font-size: 10px; color: var(--text-secondary); margin-top: 5px; font-family: var(--font-mono); }

/* ─────────────────  TIMELINE / SCHEDULE  ───────────────── */
.timeline {
  position: relative;
  padding: 12px 0;
}
.timeline-axis {
  height: 1px; background: var(--border); position: relative;
  margin: 30px 0;
}
.timeline-mark {
  position: absolute;
  width: 1px; height: 8px;
  background: var(--border-strong);
  top: -4px;
}
.timeline-label {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  top: 10px;
  transform: translateX(-50%);
}
.timeline-event {
  position: absolute;
  top: -32px;
  transform: translateX(-50%);
  font-size: 10px;
  display: flex; flex-direction: column; align-items: center;
}
.timeline-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  margin-bottom: 4px;
}
.timeline-dot.red { background: var(--red); box-shadow: 0 0 6px var(--red-soft); }
.timeline-dot.amber { background: var(--amber); box-shadow: 0 0 6px var(--amber-soft); }
.timeline-dot.green { background: var(--green); }

/* ─────────────────  CHAT PANEL  ───────────────── */
.chat-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px;
}
.chat-title { font-size: 13px; font-weight: 600; margin-right: auto; }
/* #422 — export-all-chats button, sits beside the Executive/Technical toggle */
.chat-export-btn {
  padding: 5px 12px;
  font-size: 11px;
  font-family: inherit;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  cursor: pointer;
  white-space: nowrap;
}
.chat-export-btn:hover { color: var(--text-primary); border-color: var(--accent); }
.chat-context {
  padding: 10px 16px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--accent);
  font-family: var(--font-mono);
}
.chat-context-label { color: var(--text-muted); font-size: 9px; letter-spacing: 0.8px; margin-bottom: 2px; }
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.chat-msg {
  font-size: 13px;
  line-height: 1.5;
  max-width: 92%;
}
.chat-msg.budget-warn {
  align-self: center;
  max-width: 100%;
  color: var(--amber, #D9A157);
  background: rgba(217, 161, 87, 0.10);
  border: 1px solid var(--amber, #D9A157);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  padding: 10px 12px;
  border-radius: 12px 12px 2px 12px;
}
.chat-msg.assistant {
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 12px 12px 12px 2px;
  color: var(--text-primary);
}
.chat-msg.assistant strong { color: var(--accent); }
/* #374 ADAPT: animated typing dots in the thinking bubble + busy lockout */
.typing-dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
  display: inline-block; opacity: 0.35; animation: typing-bounce 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: 0.2s; }
.typing-dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); } }
.chat-busy input { opacity: 0.6; cursor: not-allowed; }
.chat-msg.assistant a { color: var(--accent); text-decoration: underline; }
.chat-msg.assistant a:hover { color: var(--text-primary); }
.chat-msg.assistant ul { margin: 6px 0; padding-left: 18px; }
.chat-msg.assistant li { margin: 2px 0; }
.chat-msg.assistant.thinking { color: var(--text-muted); }
.chat-msg.assistant.thinking em {
  font-style: italic;
  animation: chat-pulse 1.2s ease-in-out infinite;
}
@keyframes chat-pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
.chat-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 10px;
}
.chat-chips button {
  font-size: 11px;
  padding: 5px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
}
.chat-chips button:hover { border-color: var(--accent); color: var(--accent); }
.chat-input {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
}
.chat-input-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex; justify-content: space-between; align-items: center;
}
.chat-suggestions {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 10px;
}
.chat-suggestion {
  font-size: 11px;
  padding: 5px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}
.chat-suggestion:hover { border-color: var(--accent); color: var(--accent); }

/* ─────────────────  FILTERS  ───────────────── */
.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-group {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
}
.filter-label {
  font-size: 10px; color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}
.filter-value {
  font-weight: 600;
  color: var(--text-primary);
}
.filter-chevron { font-size: 10px; color: var(--text-muted); margin-left: 4px; }

/* ─────────────────  TREND CHART  ───────────────── */
.trend-svg { width: 100%; height: 200px; }

/* ─────────────────  SCATTER / FLEET MAP  ───────────────── */
.fleet-map { background: var(--bg-elevated); border-radius: 6px; padding: 12px; }

/* ─────────────────  PILL TAB ─────────────────  */
.pill-tabs {
  display: inline-flex;
  background: var(--bg-elevated);
  border-radius: 18px;
  padding: 3px;
  gap: 2px;
}
.pill-tab {
  padding: 6px 12px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 14px;
}
.pill-tab.active {
  background: var(--bg-panel);
  color: var(--text-primary);
}

.legend {
  display: flex; gap: 14px; font-size: 11px; color: var(--text-muted);
}
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 2px; }

.wireframe-note {
  position: fixed;
  bottom: 12px;
  left: 12px;
  background: var(--accent);
  color: #1A1F2B;
  padding: 6px 12px;
  border-radius: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  z-index: 1000;
}
.badge-roadmap { background: var(--blue-soft); color: var(--blue); }
  .badge-nodata  { background: var(--bg-elevated); color: var(--text-muted); }
  .roadmap-tag {
    display:inline-block; padding:2px 8px; border-radius:10px;
    background: var(--blue-soft); color: var(--blue);
    font-family: var(--font-mono); font-size: 9px; font-weight:700;
    letter-spacing: 0.8px; vertical-align: middle; }
  .roadmap-overlay {
    background: repeating-linear-gradient(45deg, transparent, transparent 10px,
      rgba(92,124,176,0.04) 10px, rgba(92,124,176,0.04) 20px); }
  .caveat-bar {
    background: var(--bg-panel-2); border-bottom: 1px solid var(--border);
    padding: 8px 24px; font-size: 11px; color: var(--text-secondary);
    display:flex; align-items:center; gap:10px; }
  .caveat-bar strong { color: var(--accent); }
  /* #429 — board-level safety caveat (INSPECT≠defect, OK≠healthy, no false-pull rate) */
  .caveat-honesty { border-left: 3px solid var(--amber) !important; background: rgba(217,161,87,0.06); }
  .caveat-honesty .roadmap-tag { background: rgba(217,161,87,0.16); color: var(--amber); }
  /* #378 — inline info-icon that carries a caveat in its native title tooltip
     (replaces the always-on full-width caveat bars). */
  .info-dot {
    display:inline-flex; align-items:center; justify-content:center;
    width:16px; height:16px; border-radius:50%;
    color: var(--blue); background: var(--blue-soft);
    font-size: 11px; line-height:1; cursor: help; user-select:none;
    flex-shrink:0; }
  .info-dot:hover, .info-dot:focus { background: var(--blue); color: var(--bg-panel); outline:none; }
  .axle-cell.nodata { background: var(--bg-elevated); color: var(--text-muted); }
  .idx { font-family: var(--font-mono); }

/* ---- app additions (#227 frontend) ---- */
.login-wrap { min-height:100vh; display:flex; align-items:center; justify-content:center; }
.login-card { background:var(--bg-panel); border:1px solid var(--border); border-radius:10px;
  padding:28px; width:340px; }
.login-card h1 { font-size:16px; margin-bottom:4px; }
.login-card .sub { font-size:11px; color:var(--text-muted); font-family:var(--font-mono);
  letter-spacing:0.5px; margin-bottom:18px; }
.login-card input { width:100%; padding:10px 12px; margin-bottom:10px;
  background:var(--bg-elevated); border:1px solid var(--border-strong); border-radius:6px;
  color:var(--text-primary); font-size:13px; }
.login-card .btn.primary { width:100%; justify-content:center; padding:10px; }
.login-err { color:var(--red); font-size:11px; min-height:14px; margin-bottom:8px; }
.hidden { display:none !important; }
.loading { color:var(--text-muted); font-size:12px; padding:20px; }

/* Fit the app to the viewport so the chat input + chips are always visible
   without page scroll (Suman, demo). #app is a 100vh flex column: the chrome
   rows keep their natural height, .main fills the rest, and the dashboard
   content (.content) and chat thread (.chat-body) scroll internally while the
   chat input stays pinned. .hidden uses !important so the login gate still
   hides #app despite the id selector here. */
#app { display:flex; flex-direction:column; height:100vh; overflow:hidden; }
.topbar, .caveat-bar, .nav-tabs { flex-shrink:0; }
[data-link] { cursor:pointer; }

/* ---- language toggle (#231) ---- */
.lang-toggle {
  display:inline-flex;
  background:var(--bg-elevated);
  border:1px solid var(--border-strong);
  border-radius:16px;
  padding:2px;
  gap:2px;
}
.lang-toggle button {
  padding:5px 10px;
  font-size:11px;
  font-family:inherit;
  color:var(--text-secondary);
  background:transparent;
  border:none;
  border-radius:14px;
  cursor:pointer;
}
.lang-toggle button:hover { color:var(--text-primary); }
.lang-toggle button.active {
  background:var(--accent);
  color:#1A1F2B;
  font-weight:600;
}

/* Answer-level toggle (#267) — presenter-driven, kept deliberately prominent
   (accent ring) so it reads as a live control during a demo. */
.level-toggle {
  display:inline-flex;
  background:var(--bg-elevated);
  border:1px solid var(--accent);
  border-radius:16px;
  padding:2px;
  gap:2px;
}
.level-toggle button {
  padding:5px 12px;
  font-size:11px;
  font-family:inherit;
  font-weight:600;
  color:var(--text-secondary);
  background:transparent;
  border:none;
  border-radius:14px;
  cursor:pointer;
}
.level-toggle button:hover { color:var(--text-primary); }
.level-toggle button.active { background:var(--accent); color:#1A1F2B; }

/* ---- analysis-version toggle (#352) ---- */
/* #383 — measurement-day(s) dropdown (replaces the D1/D2/D* segmented toggle). */
.ver-select-wrap { display:inline-flex; align-items:center; }
.ver-select {
  font-family:inherit; font-size:11px; color:var(--text-primary);
  background:var(--bg-elevated); border:1px solid var(--border-strong);
  border-radius:16px; padding:5px 26px 5px 12px; cursor:pointer;
  -webkit-appearance:none; appearance:none;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%238a94a6' stroke-width='1.5'/></svg>");
  background-repeat:no-repeat; background-position:right 10px center;
}
.ver-select:hover { border-color:var(--accent); }
.ver-select:focus { outline:none; border-color:var(--accent); }

/* Per-answer "more detail" expander shown under an Executive answer (#267). */
.chat-expand { margin:2px 0 8px 2px; }
.chat-expand button {
  font-family:inherit;
  font-size:11px;
  color:var(--accent);
  background:transparent;
  border:1px solid var(--border-strong);
  border-radius:12px;
  padding:3px 11px;
  cursor:pointer;
}
.chat-expand button:hover { background:var(--bg-elevated); color:var(--text-primary); }
.chat-detail-label { font-size:11px; color:var(--text-secondary); margin:6px 0 2px 2px; }

/* ─────────────────  HOW IT WORKS tab (#257, #263)  ───────────────── */
.flow-row { display:flex; flex-wrap:wrap; align-items:stretch; gap:8px; }
.flow-stage { flex:1 1 175px; min-width:165px; background:var(--bg-elevated); border:1px solid var(--border); border-radius:8px; padding:14px; display:flex; flex-direction:column; gap:8px; }
.flow-num { width:22px; height:22px; border-radius:50%; background:var(--accent); color:#1A1F2B; font-size:12px; font-weight:700; display:flex; align-items:center; justify-content:center; font-family:var(--font-mono); }
.flow-title { font-size:14px; font-weight:600; color:var(--text-primary); }
.flow-lead { font-size:12px; color:var(--text-secondary); line-height:1.45; }
.flow-tech { font-size:10.5px; color:var(--text-muted); font-family:var(--font-mono); line-height:1.4; margin-top:auto; border-top:1px solid var(--border); padding-top:8px; }
.flow-sense-svg { width:100%; height:auto; max-height:56px; }
.flow-arrow { align-self:center; color:var(--text-muted); font-size:18px; flex:0 0 auto; }
.flow-strip { margin-top:14px; padding:12px 14px; border-left:3px solid var(--accent); background:var(--bg-elevated); border-radius:6px; font-size:12px; color:var(--text-secondary); line-height:1.5; }
.flow-strip-title { font-weight:600; color:var(--text-primary); margin-bottom:3px; }
/* #277 — metrology caveat strip: amber qualifier tone (a documented limitation,
   not an alarm), distinct from the neutral 'Where WAVE sits' strip above. */
.flow-strip-caveat { border-left-color: var(--amber); background: var(--amber-soft); }

.defect-cards { display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:10px; }
.defect-card { background:var(--bg-elevated); border:1px solid var(--border); border-radius:8px; padding:10px; cursor:pointer; transition:border-color .12s; display:flex; flex-direction:column; gap:6px; }
.defect-card:hover { border-color:var(--accent); }
.defect-card img { width:100%; height:auto; border-radius:4px; background:#fff; }
.defect-card-title { font-size:12.5px; font-weight:600; color:var(--text-primary); }
.defect-conf { font-size:9.5px; font-family:var(--font-mono); color:var(--text-muted); border:1px solid var(--border-strong); border-radius:3px; padding:1px 5px; align-self:flex-start; }
.defect-fig { width:100%; height:auto; border-radius:6px; background:#fff; margin-bottom:10px; }
.defect-conf-line { margin-bottom:10px; }
.defect-sect { font-size:12px; color:var(--text-secondary); line-height:1.5; margin-bottom:10px; }
.defect-k { display:block; font-size:10px; font-family:var(--font-mono); color:var(--text-muted); text-transform:uppercase; letter-spacing:.04em; margin-bottom:2px; }
.defect-refs { margin-top:14px; border-top:1px solid var(--border); padding-top:10px; }
.defect-refs-title { font-size:10px; font-family:var(--font-mono); color:var(--text-muted); text-transform:uppercase; letter-spacing:.04em; margin-bottom:6px; }
.defect-refs ul { margin:0; padding-left:16px; }
.defect-refs li { font-size:11px; color:var(--text-secondary); line-height:1.6; }
.defect-refs a { color:var(--accent); text-decoration:none; }
.defect-refs a:hover { text-decoration:underline; }
.ref-venue { color:var(--text-muted); font-style:italic; }

/* "Anatomy of a unit" link + modal (terminology on page 1) */
.anatomy-link { font-size:11px; color:var(--accent); cursor:pointer; margin-top:5px; }
.anatomy-link:hover { text-decoration:underline; }
.anat-ladder { font-family:var(--font-mono); font-size:11px; color:var(--text-muted); margin-bottom:12px; }
#anatomy-modal .modal-box { max-width:760px; }
.anatomy-train-wrap { background:var(--bg-elevated); border:1px solid var(--border); border-radius:8px; padding:12px; }
.anatomy-train-wrap .trainmap-svg { height:78px; }
.anat-caps { display:flex; flex-wrap:wrap; gap:14px; margin:12px 0; }
.anat-cap { font-size:11.5px; color:var(--text-secondary); }
.anat-glyph { font-family:var(--font-mono); color:var(--accent); margin-right:3px; }
.anat-note { font-size:12px; color:var(--text-secondary); border-left:3px solid var(--accent); padding:8px 10px; background:var(--bg-elevated); border-radius:6px; margin:12px 0; line-height:1.5; }
.anat-terms { width:100%; border-collapse:collapse; font-size:11.5px; margin-top:6px; }
.anat-terms td { color:var(--text-secondary); border-bottom:1px solid var(--border); padding:4px 6px; vertical-align:top; }
.anat-terms td:first-child { font-family:var(--font-mono); color:var(--text-primary); white-space:nowrap; width:34%; }
