/* ============================================================================
 * AIrport 360 MVP — design-pass stylesheet ("light blueprint")
 * White/ice surfaces, deep navy structure, engineered precision.
 * Orange is reserved for signal/warning. No external assets; system fonts.
 * ========================================================================== */

:root {
  --c-navy: #0E2A47;
  --c-blue: #1B6CA8;
  --c-ice: #EAF2F9;
  --c-orange: #D95B2E;
  --c-orange-deep: #B04619;   /* orange surfaces carrying white text (AA) */
  --c-teal: #2A9D8F;
  --c-teal-deep: #1E7268;     /* teal surfaces carrying white text (AA) */
  --c-ink: #1A2B3A;
  --c-muted: #5A6B7A;
  --c-paper: #FFFFFF;
  --c-bg: #F4F8FB;
  --c-line: #C9D6E2;
  --c-hairline: rgba(14, 42, 71, 0.12);
  --c-hairline-soft: rgba(14, 42, 71, 0.08);
  --c-warn-bg: #FCEEE7;
  --c-ok-bg: #E7F4F2;
  --c-aged: #8F6320;          /* darkened for AA white-on-color chips */
  --c-imputed: #A63D2F;
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --radius: 10px;
  --radius-s: 6px;
  --shadow-1: 0 1px 2px rgba(14, 42, 71, 0.05), 0 6px 20px rgba(14, 42, 71, 0.05);
  --shadow-2: 0 2px 4px rgba(14, 42, 71, 0.07), 0 10px 28px rgba(14, 42, 71, 0.09);
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(0.25, 0.6, 0.35, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  color: var(--c-ink);
  background: var(--c-bg);
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5 { color: var(--c-navy); line-height: 1.25; }
abbr {
  cursor: help; text-decoration: none;
  border-bottom: 1px dotted var(--c-blue);
  color: var(--c-blue); font-size: 0.75em; vertical-align: super;
}
strong { font-weight: 650; }

/* Visible keyboard focus everywhere */
:focus-visible {
  outline: 2px solid var(--c-blue);
  outline-offset: 2px;
  border-radius: 3px;
}
.app-header :focus-visible,
.illustrative-banner :focus-visible {
  outline-color: #fff;
}

/* ------------------------- computation indicator ----------------------- */
/* Honest, brief run state: a thin indeterminate sweep pinned to the top of
 * the viewport while the seeded Monte Carlo executes. Numbers themselves
 * are never animated. */
body.is-computing::before {
  content: "";
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 200;
  background: linear-gradient(90deg,
    transparent 0%, var(--c-blue) 35%, var(--c-teal) 55%, transparent 75%);
  background-size: 220% 100%;
  animation: a360-sweep 0.9s linear infinite;
}
@keyframes a360-sweep {
  from { background-position: 130% 0; }
  to   { background-position: -90% 0; }
}

/* ------------------------------ banner -------------------------------- */
.illustrative-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--c-orange-deep);
  color: #fff;
  text-align: center;
  padding: 7px var(--s-4);
  font-size: 0.8rem;
  line-height: 1.45;
  letter-spacing: 0.01em;
}
.illustrative-banner strong {
  font-weight: 750;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  text-transform: uppercase;
}

/* ------------------------------ header -------------------------------- */
.app-header {
  background: var(--c-navy);
  color: #fff;
  padding: var(--s-5) var(--s-5) 0 var(--s-5);
}
.app-header > * { max-width: 1100px; margin-left: auto; margin-right: auto; }
.product-name {
  color: #fff; margin: 0;
  font-size: 1.55rem; font-weight: 750; letter-spacing: -0.015em;
}
.tagline {
  color: rgba(234, 242, 249, 0.82);
  margin: var(--s-1) 0 var(--s-4) 0;
  font-size: 0.88rem;
  max-width: 62ch;
}
.version-chips { margin-bottom: var(--s-4); display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip {
  display: inline-flex; align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  font-family: var(--font-mono);
}
.main-nav {
  display: flex; flex-wrap: wrap; gap: var(--s-1);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: var(--s-1);
}
.nav-btn {
  background: transparent;
  color: rgba(234, 242, 249, 0.78);
  border: none;
  border-bottom: 3px solid transparent;
  padding: 10px var(--s-4) 12px var(--s-4);
  min-height: 44px;
  font-size: 0.92rem;
  font-family: inherit;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 160ms var(--ease), border-color 160ms var(--ease);
}
.nav-btn:hover:not(:disabled) { color: #fff; }
.nav-btn:disabled { opacity: 0.38; cursor: default; }
.nav-btn.nav-active { border-bottom-color: #fff; color: #fff; font-weight: 650; }

/* ------------------------------- layout -------------------------------- */
.app-main { max-width: 1100px; margin: 0 auto; padding: var(--s-6) var(--s-5) var(--s-5) var(--s-5); }

/* Gentle entry when a view is shown; numbers are not individually animated */
.view:not([hidden]) { animation: a360-view-in 220ms var(--ease) both; }
@keyframes a360-view-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

.view-kicker {
  color: var(--c-blue);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 var(--s-1) 0;
}
.view-title { margin: 0 0 var(--s-2) 0; font-size: 1.45rem; font-weight: 750; letter-spacing: -0.01em; }
.view-intro { color: var(--c-muted); margin-top: 0; max-width: 70ch; }

.panel, .form-block, .answer-panel, .comparison-card, .whatif-panel, .glossary {
  background: var(--c-paper);
  border: 1px solid var(--c-hairline);
  border-radius: var(--radius);
  padding: var(--s-5);
  margin-bottom: var(--s-4);
  box-shadow: var(--shadow-1);
}

/* Section headings inside panels read as engineered kickers */
.panel h3, .whatif-panel h3, .comparison-card h3, .glossary h3, .answer-panel h3 {
  margin: 0 0 var(--s-3) 0;
  color: var(--c-blue);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.panel h4 { font-size: 0.98rem; margin: var(--s-5) 0 var(--s-3) 0; }
.panel h5 { font-size: 0.85rem; margin: 0 0 var(--s-2) 0; }

/* ------------------------------- presets ------------------------------- */
.preset-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}
.preset-card {
  text-align: left;
  background: var(--c-paper);
  border: 1px solid var(--c-hairline);
  border-radius: var(--radius);
  padding: var(--s-4);
  min-height: 44px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: var(--s-1);
  font-family: inherit;
  box-shadow: var(--shadow-1);
  transition: box-shadow 180ms var(--ease), transform 180ms var(--ease), border-color 180ms var(--ease);
}
.preset-card:hover {
  border-color: var(--c-blue);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}
.preset-card-title { font-weight: 700; color: var(--c-navy); font-size: 0.95rem; }
.preset-card-sub { font-size: 0.8rem; color: var(--c-muted); line-height: 1.45; }
.preset-card-blank { border-style: dashed; box-shadow: none; background: transparent; }
.preset-chips { margin-bottom: var(--s-4); display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip-btn {
  background: var(--c-ice);
  border: 1px solid var(--c-hairline);
  color: var(--c-navy);
  border-radius: 999px;
  padding: 8px 16px;
  min-height: 40px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 550;
  transition: background 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease);
}
.chip-btn:hover { background: var(--c-blue); border-color: var(--c-blue); color: #fff; }

/* -------------------------------- form --------------------------------- */
fieldset.form-block { border: 1px solid var(--c-hairline); min-width: 0; }
legend {
  font-weight: 700;
  color: var(--c-blue);
  padding: 0 var(--s-2);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--s-4) var(--s-3); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; font-weight: 600; color: var(--c-navy); }
.field input, .field select, .field textarea {
  font: inherit; font-weight: 400; color: var(--c-ink);
  border: 1px solid var(--c-line); border-radius: var(--radius-s);
  padding: 9px 10px; background: #fff;
  min-height: 40px;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.field textarea { min-height: 0; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--c-blue);
  box-shadow: 0 0 0 3px rgba(27, 108, 168, 0.18);
}
.field input[type="checkbox"] { min-height: 0; width: 17px; height: 17px; accent-color: var(--c-blue); }
.field-wide { grid-column: 1 / -1; }
.field-check { flex-direction: row; align-items: center; gap: var(--s-2); font-weight: 600; padding: var(--s-2) 0; min-height: 40px; }
.field-hint { font-weight: 400; color: var(--c-muted); font-size: 0.78rem; line-height: 1.45; }
.field-label { margin-bottom: 2px; }
.zone-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 2px; font-weight: 400; }
.zone-item { font-size: 0.85rem; display: flex; align-items: center; gap: var(--s-2); padding: 6px var(--s-2); min-height: 40px; border-radius: var(--radius-s); }
.zone-item:hover { background: var(--c-ice); }
.zone-item input[type="checkbox"] { accent-color: var(--c-blue); width: 16px; height: 16px; }
.zone-class { color: var(--c-muted); font-size: 0.7rem; font-family: var(--font-mono); }
.coverage-preview { margin-top: var(--s-4); font-size: 0.85rem; }
.run-row { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-2) 0 var(--s-4) 0; }
.btn-primary {
  background: var(--c-blue); color: #fff; border: none; border-radius: var(--radius-s);
  padding: 12px var(--s-6); min-height: 44px;
  font-size: 0.98rem; font-weight: 700; font-family: inherit; letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(14, 42, 71, 0.18);
  transition: background 160ms var(--ease), box-shadow 160ms var(--ease), transform 160ms var(--ease);
}
.btn-primary:hover:not(:disabled) { background: var(--c-navy); box-shadow: var(--shadow-2); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.6; cursor: progress; }
.btn-secondary {
  background: #fff; color: var(--c-blue); border: 1px solid var(--c-blue);
  border-radius: var(--radius-s); padding: 9px var(--s-4); min-height: 40px;
  font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}
.btn-secondary:hover { background: var(--c-ice); }
.run-status { color: var(--c-muted); font-size: 0.88rem; }
.run-error { color: var(--c-imputed); font-weight: 700; }

/* ------------------------------- results ------------------------------- */
.decision-support-note {
  background: var(--c-ice); border-left: 3px solid var(--c-blue);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  padding: var(--s-3) var(--s-4); font-size: 0.88rem;
  max-width: 78ch;
}
.repro-line {
  font-family: var(--font-mono); font-size: 0.73rem; line-height: 1.6; color: var(--c-muted);
  border: 1px dashed var(--c-line); border-radius: var(--radius-s);
  padding: var(--s-3) var(--s-4); margin-bottom: var(--s-4); background: var(--c-paper);
}
.repro-line strong { color: var(--c-navy); }
.cap-banner {
  border: 1px solid var(--c-aged); border-left-width: 4px; background: var(--c-warn-bg);
  border-radius: var(--radius-s); padding: var(--s-3) var(--s-4); margin-bottom: var(--s-4); font-size: 0.88rem;
}
.cap-banner-hit { border-color: var(--c-orange-deep); font-weight: 600; }
.answer-panel { border-left: 4px solid var(--c-teal); }
.answer-sentence { font-size: 1.12rem; font-weight: 650; line-height: 1.5; margin: 0 0 var(--s-3) 0; letter-spacing: -0.005em; max-width: 72ch; }
.answer-high { color: var(--c-orange-deep); }
.answer-mid { color: var(--c-navy); }
.answer-low { color: var(--c-navy); }
.answer-freq { color: var(--c-ink); margin: 0 0 var(--s-3) 0; max-width: 82ch; }
.answer-owner { color: var(--c-muted); font-size: 0.82rem; margin: 0; }
.whatif-note { color: var(--c-muted); font-size: 0.85rem; margin: calc(-1 * var(--s-2)) 0 var(--s-3) 0; }
.whatif-controls { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-5); font-size: 0.9rem; align-items: center; }
.whatif-controls label { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 40px; cursor: pointer; }
.whatif-controls input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--c-blue); }
.whatif-controls select {
  margin-left: var(--s-1); font: inherit; padding: 6px 8px; min-height: 36px;
  border: 1px solid var(--c-line); border-radius: var(--radius-s); background: #fff; color: var(--c-ink);
}
.comparison-sentence { font-weight: 600; max-width: 82ch; }
.estimand-note { color: var(--c-muted); font-size: 0.78rem; }

.chain-panel { border-top: 3px solid var(--c-blue); }
.chain-panel h3 { color: var(--c-navy); font-size: 1.05rem; letter-spacing: -0.005em; text-transform: none; }
.chain-event { color: var(--c-muted); font-size: 0.88rem; margin-top: calc(-1 * var(--s-2)); }
.headline-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--s-3); }
.headline-item {
  background: var(--c-ice); border-radius: var(--radius-s); padding: var(--s-4);
  display: flex; flex-direction: column; gap: var(--s-1);
  border: 1px solid var(--c-hairline-soft);
}
.headline-central { border: 1px solid var(--c-blue); box-shadow: inset 0 0 0 1px var(--c-blue); }
.headline-label { font-size: 0.7rem; color: var(--c-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; line-height: 1.4; }
.headline-value { font-size: 1.32rem; font-weight: 600; color: var(--c-navy); font-family: var(--font-mono); letter-spacing: -0.01em; }
.headline-sub { font-size: 0.76rem; color: var(--c-muted); line-height: 1.4; }
.chart-slot { margin: var(--s-4) 0; }
.sev-note { color: var(--c-orange-deep); font-size: 0.85rem; }

/* charts (SVG, class-styled): quiet axes, confident data ink */
.chart { width: 100%; height: auto; background: transparent; }
.dist-bar { fill: var(--c-blue); opacity: 0.88; }
.chart-axis { stroke: var(--c-line); stroke-width: 1; shape-rendering: crispEdges; }
.chart-tick, .chart-label { font-size: 10px; fill: var(--c-muted); font-family: var(--font-mono); }
.chart-plain { font-size: 8.5px; fill: var(--c-muted); }
.chart-value { font-size: 10px; fill: var(--c-ink); font-family: var(--font-mono); }
.chart-axis-label { font-size: 10px; fill: var(--c-muted); }
.chart-band-label { font-size: 9px; fill: var(--c-muted); letter-spacing: 0.04em; }
.band-shade-0 { fill: var(--c-ice); opacity: 0.55; }
.band-shade-1 { fill: var(--c-line); opacity: 0.22; }
.marker { stroke-width: 1.5; }
.marker-central { stroke: var(--c-orange); }
.marker-median { stroke: var(--c-teal-deep); }
.marker-p90 { stroke: var(--c-navy); stroke-dasharray: 4 3; }
.marker-label { font-size: 9.5px; font-family: var(--font-mono); }
.marker-label-central { fill: var(--c-orange-deep); }
.marker-label-median { fill: var(--c-teal-deep); }
.marker-label-p90 { fill: var(--c-navy); }
.sev-bar.sev-A { fill: var(--c-orange); }
.sev-bar.sev-B { fill: #C4652F; }
.sev-bar.sev-C { fill: #B07D2B; }
.sev-bar.sev-D { fill: var(--c-blue); }
.sev-bar.sev-E { fill: var(--c-teal); }
.sev-name { font-weight: 700; }
.exceed-bar { fill: var(--c-muted); opacity: 0.55; }

/* matrix */
.matrix-wrap, .table-wrap { overflow-x: auto; border-radius: var(--radius-s); }
.matrix-table { border-collapse: collapse; width: 100%; font-size: 0.8rem; }
.matrix-table th, .matrix-table td { border: 1px solid var(--c-hairline); padding: var(--s-2); text-align: center; }
.matrix-table thead th { background: var(--c-ice); font-size: 0.78rem; }
.matrix-corner { font-size: 0.68rem; color: var(--c-muted); font-weight: 500; }
.band-name { font-weight: 400; font-size: 0.68rem; color: var(--c-muted); }
.sev-head { text-align: left; background: var(--c-ice); }
.matrix-cell { min-width: 72px; height: 46px; background: var(--c-paper); position: relative; }
.cell-occupied { background: var(--c-ice); }
.cell-assigned { outline: 2px solid var(--c-blue); outline-offset: -2px; font-weight: 700; }
.cell-register { outline: 2px dashed var(--c-orange); outline-offset: -5px; }
.cell-tag { display: block; font-size: 0.6rem; color: var(--c-blue); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.cell-tag-reg { color: var(--c-orange-deep); }
.occ { font-family: var(--font-mono); }
.occupancy-phrase { font-size: 0.85rem; color: var(--c-ink); max-width: 82ch; }
.mapping-rule { background: var(--c-ice); border: 1px solid var(--c-hairline-soft); border-radius: var(--radius-s); padding: var(--s-4); margin: var(--s-4) 0; }
.mapping-rule h5 { margin: 0 0 var(--s-2) 0; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--c-blue); }
.rule-text { font-style: italic; }
.rule-fixed { font-size: 0.85rem; }
.band-config-note { font-size: 0.8rem; color: var(--c-muted); }
.register-compare { border: 1px solid var(--c-hairline); border-radius: var(--radius-s); padding: var(--s-4); margin: var(--s-4) 0; font-size: 0.9rem; }
.register-compare h5 { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--c-blue); }
.register-below { border-color: var(--c-orange-deep); border-left-width: 4px; background: var(--c-warn-bg); }
.register-below h5 { color: var(--c-orange-deep); }

/* tables */
.mini-table, .ledger-table { border-collapse: collapse; width: 100%; font-size: 0.82rem; }
.mini-table th, .mini-table td, .ledger-table th, .ledger-table td {
  border: 1px solid var(--c-hairline); padding: var(--s-2) var(--s-3); text-align: left; vertical-align: top;
}
.mini-table th, .ledger-table th {
  background: var(--c-ice); color: var(--c-navy);
  font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase;
}
.ledger-source { font-size: 0.72rem; color: var(--c-muted); }
.ledger-flags { color: var(--c-aged); }
.ledger-prior td, .ledger-posterior td { background: var(--c-ice); }
.ledger-total td { background: var(--c-ice); font-weight: 600; }
.ledger-reducing td { background: var(--c-ok-bg); }
.ledger-none { color: var(--c-muted); font-style: italic; }
.ev-chip {
  display: inline-block; border-radius: 4px; padding: 1px 7px; font-weight: 700;
  font-size: 0.72rem; font-family: var(--font-mono);
}
.ev-P { background: var(--c-navy); color: #fff; }
.ev-E { background: var(--c-aged); color: #fff; }
.ev-I { background: var(--c-orange-deep); color: #fff; font-weight: 400; }

/* coverage */
.cov-chip { display: inline-block; border-radius: 4px; padding: 2px 9px; font-size: 0.75rem; font-weight: 700; color: #fff; margin-right: var(--s-1); }
.cov-observed { background: var(--c-teal-deep); }
.cov-aged { background: var(--c-aged); }
.cov-imputed { background: var(--c-imputed); }
.cov-row-aged td { background: var(--c-warn-bg); }
.cov-row-imputed td { background: var(--c-warn-bg); }
.widening-note { font-size: 0.88rem; max-width: 88ch; }

/* sign-off */
.signoff-panel { border-top: 3px solid var(--c-navy); }
.signoff-note { color: var(--c-muted); font-size: 0.85rem; margin-top: calc(-1 * var(--s-2)); }
.downgrade-gate {
  grid-column: 1 / -1;
  border: 1px solid var(--c-orange-deep); border-left-width: 4px; background: var(--c-warn-bg);
  border-radius: var(--radius-s); padding: var(--s-4);
}
.downgrade-gate h4 { margin-top: 0; color: var(--c-orange-deep); font-size: 0.95rem; }
.signoff-status { margin-left: var(--s-3); color: var(--c-imputed); font-weight: 600; font-size: 0.88rem; }

/* glossary */
.glossary dl { margin: 0; }
.glossary dt { font-weight: 700; color: var(--c-navy); margin-top: var(--s-3); font-size: 0.88rem; }
.glossary dd { margin: 2px 0 0 0; color: var(--c-muted); font-size: 0.86rem; }

/* method */
.method-text {
  background: var(--c-paper); border: 1px solid var(--c-hairline);
  border-radius: var(--radius); padding: var(--s-6);
  box-shadow: var(--shadow-1); max-width: 82ch;
}
.method-text > p { max-width: 74ch; }
.method-text h3 { font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--c-blue); margin-top: var(--s-6); }
.reference-list li { margin-bottom: var(--s-2); font-size: 0.9rem; }
.ref-link { color: var(--c-blue); text-decoration: underline; text-underline-offset: 2px; }
.method-footnote { color: var(--c-muted); font-size: 0.85rem; }

/* self-test */
.selftest-summary { font-weight: 700; font-size: 1.05rem; padding: var(--s-4); border-radius: var(--radius-s); }
.selftest-pass { background: var(--c-ok-bg); color: var(--c-navy); border: 1px solid var(--c-teal-deep); }
.selftest-fail { background: var(--c-warn-bg); color: var(--c-imputed); border: 1px solid var(--c-imputed); }
.selftest-table td { font-size: 0.78rem; }
.st-fail td { background: var(--c-warn-bg); }

/* footer */
.app-footer {
  max-width: 1100px; margin: 0 auto; padding: var(--s-4) var(--s-5) var(--s-6) var(--s-5);
  color: var(--c-muted); font-size: 0.78rem;
}
.app-footer p { border-top: 1px solid var(--c-hairline); padding-top: var(--s-4); margin: 0; max-width: 92ch; }

/* ------------------------------- record -------------------------------- */
.record-toolbar { margin-bottom: var(--s-4); display: flex; align-items: center; gap: var(--s-3); }
.record-status { color: var(--c-muted); font-size: 0.88rem; }
.record {
  background: var(--c-paper); border: 1px solid var(--c-hairline); border-radius: var(--radius);
  padding: var(--s-6); font-size: 0.85rem; box-shadow: var(--shadow-1);
}
.record-header h2 { margin-top: 0; font-size: 1.25rem; }
.record-id-table { border-collapse: collapse; width: 100%; font-size: 0.82rem; margin-bottom: var(--s-2); }
.record-id-table td { border: 1px solid var(--c-hairline); padding: var(--s-1) var(--s-2); }
.record-id-table td:nth-child(odd) { background: var(--c-ice); font-weight: 600; width: 15%; }
.record-manifest td { font-family: var(--font-mono); font-size: 0.76rem; }
.record-disclaimer { border: 1px solid var(--c-orange-deep); border-left-width: 4px; border-radius: var(--radius-s); padding: var(--s-2) var(--s-3); font-size: 0.8rem; background: var(--c-warn-bg); }
.record-section { margin-top: var(--s-5); }
.record-section h3 { border-bottom: 2px solid var(--c-navy); padding-bottom: var(--s-1); font-size: 1rem; }
.record-echo td:first-child { width: 32%; background: var(--c-ice); font-weight: 600; }
.record-gate { border: 1px solid var(--c-orange-deep); border-left-width: 4px; border-radius: var(--radius-s); padding: var(--s-2) var(--s-3); background: var(--c-warn-bg); }
.record-draft-note { font-weight: 700; }
.sig-block { margin-top: var(--s-5); }
.sig-line {
  display: flex; justify-content: space-between;
  border-top: 1px solid var(--c-ink); margin-top: var(--s-6); padding-top: var(--s-1);
  font-size: 0.8rem; color: var(--c-muted);
}
.sig-line span:last-child { min-width: 120px; border-left: 1px solid var(--c-ink); padding-left: var(--s-2); }
.manifest-pre {
  font-family: var(--font-mono); font-size: 0.62rem; white-space: pre-wrap;
  background: var(--c-ice); padding: var(--s-3); border-radius: var(--radius-s);
  max-height: 300px; overflow: auto;
}
.record-page-footer { display: none; }
.print-footer { display: none; }

/* --------------------------- reduced motion ---------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------ responsive ----------------------------- */
@media (max-width: 760px) {
  .app-main { padding: var(--s-4); }
  .app-header { padding: var(--s-4) var(--s-4) 0 var(--s-4); }
  .form-grid, .headline-grid, .preset-row { grid-template-columns: 1fr; }
  .view-title { font-size: 1.25rem; }
  .answer-sentence { font-size: 1.05rem; }
  .whatif-controls { gap: var(--s-2) var(--s-4); }
  .record { padding: var(--s-4); }
  .method-text { padding: var(--s-4); }
}

/* -------------------------------- print -------------------------------- */
@page { size: A4; margin: 14mm 12mm 18mm 12mm; }
@media print {
  body { background: #fff; font-size: 10.5px; }
  .illustrative-banner, .app-header, .app-footer, .noprint,
  #view-assess, #view-results, #view-method, #view-selftest { display: none !important; }
  #view-record { display: block !important; animation: none !important; }
  #view-record[hidden] { display: block !important; }
  .app-main { max-width: none; padding: 0; }
  .record { border: none; box-shadow: none; padding: 0; font-size: 10.5px; }
  .record-id-table td, .mini-table th, .mini-table td,
  .ledger-table th, .ledger-table td { border-color: #9AA7B4; }
  .mini-table, .ledger-table { font-size: 8.5px; }
  .manifest-pre { max-height: none; overflow: visible; }
  .table-wrap, .matrix-wrap { overflow: visible; }
  .record-section { break-inside: avoid-page; }
  .record-onepage { break-after: page; }
  .record-page-footer { display: block; font-size: 8px; color: #444; margin-top: 8mm; }
  .print-footer {
    display: block; position: fixed; bottom: 0; left: 0; right: 0;
    font-size: 7.5px; color: #444; text-align: center;
    border-top: 0.5px solid #999; padding-top: 1mm; background: #fff;
  }
  /* keep grayscale-legible: chips get borders, not just color */
  .ev-chip, .cov-chip { border: 1px solid #000; color: #000 !important; background: #fff !important; }
  .cell-assigned { outline: 3px solid #000; }
  .cell-register { outline: 2px dashed #000; }
  .record-disclaimer, .record-gate { background: #fff; }
}

/* ---- feedback round 1 additions (reuses existing palette variables) ---- */
.legend-role {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--c-blue); background: var(--c-ice); border-radius: 4px; padding: 2px 8px; margin-left: var(--s-2);
}
.nm-chip {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--c-muted); border: 1px solid rgba(14, 42, 71, 0.25); border-radius: 4px;
  padding: 1px 6px; margin-left: var(--s-1); vertical-align: middle;
}
.answer-kicker {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--c-blue); margin: 0 0 var(--s-2) 0;
}
.gate-rule {
  font-size: 0.8rem; color: var(--c-muted); line-height: 1.5;
  border-left: 3px solid var(--c-orange-deep); padding-left: var(--s-3); margin: var(--s-2) 0;
}
.xcheck-warn { color: var(--c-orange-deep); font-weight: 600; }
.whatif-changes { font-size: 0.9rem; margin: var(--s-3) 0 var(--s-2) 0; }
.whatif-table td:first-child { font-weight: 600; white-space: nowrap; }
.whatif-sentence { border-left: 3px solid var(--c-blue); padding-left: var(--s-3); margin: var(--s-3) 0; }
.whatif-controls .btn-secondary { min-height: 40px; }
.cap-widen-note { border-left: 3px solid var(--c-orange-deep); padding-left: var(--s-3); }
@media print {
  .legend-role, .nm-chip { border: 1px solid #000; color: #000; background: #fff; }
}

/* ============================== FIELD MODE ==============================
 * Mobile-first progressive-disclosure layer. Big touch targets (>=48px),
 * few words per screen, generous type. Reuses the blueprint palette vars. */

.mode-switch {
  position: absolute; top: 10px; right: 14px; z-index: 60;
  background: rgba(255, 255, 255, 0.1); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 999px;
  padding: 10px 18px; min-height: 44px;
  font: inherit; font-size: 0.85rem; font-weight: 700; letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 160ms var(--ease);
}
.mode-switch:hover { background: rgba(255, 255, 255, 0.22); }
.app-header { position: relative; }

/* banner compact/expand */
.banner-more {
  background: transparent; border: 1px solid rgba(255, 255, 255, 0.6); color: #fff;
  border-radius: 999px; font: inherit; font-size: 0.7rem; padding: 2px 10px;
  margin-left: 8px; cursor: pointer; min-height: 24px;
}
body:not(.mode-field) .banner-long { display: inline; }

/* field-mode chrome: hide the full-evidence furniture; the switch stays */
.mode-field .main-nav, .mode-field .version-chips, .mode-field .tagline { display: none; }
.mode-field .app-header { padding-bottom: var(--s-4); }
.mode-field .app-footer { font-size: 0.72rem; }

/* stepper */
.view-field { max-width: 640px; margin: 0 auto; }
.field-steps {
  list-style: none; display: flex; gap: var(--s-1); padding: 0; margin: 0 0 var(--s-4) 0;
}
.field-steps li { flex: 1; }
.field-step-btn {
  width: 100%; min-height: 52px; border-radius: var(--radius-s);
  border: 1px solid var(--c-hairline); background: var(--c-paper);
  font: inherit; font-weight: 750; color: var(--c-muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px;
}
.field-step-btn span { font-size: 0.62rem; font-weight: 650; letter-spacing: 0.02em; }
.field-step-btn.step-active { border-color: var(--c-blue); color: var(--c-navy); box-shadow: inset 0 0 0 1px var(--c-blue); background: var(--c-ice); }
.field-step-btn.step-done { color: var(--c-teal-deep); }
.field-step-btn:disabled { opacity: 0.4; cursor: default; }

.field-panel {
  background: var(--c-paper); border: 1px solid var(--c-hairline); border-radius: var(--radius);
  padding: var(--s-5); box-shadow: var(--shadow-1); margin-bottom: var(--s-4);
}
.field-title { margin: 0 0 var(--s-3) 0; font-size: 1.35rem; letter-spacing: -0.01em; }
.field-subtitle { font-size: 1.02rem; margin: var(--s-5) 0 var(--s-2) 0; }
.field-sub { color: var(--c-muted); font-size: 0.92rem; max-width: 60ch; }

/* job cards */
.field-jobcards { display: grid; grid-template-columns: 1fr; gap: var(--s-3); }
.field-jobcard {
  display: grid; grid-template-columns: 52px 1fr; grid-template-rows: auto auto;
  align-items: center; column-gap: var(--s-3); text-align: left;
  background: var(--c-paper); border: 1px solid var(--c-hairline); border-radius: var(--radius);
  padding: var(--s-4); min-height: 76px; cursor: pointer; font-family: inherit;
  box-shadow: var(--shadow-1);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.field-jobcard:hover { border-color: var(--c-blue); box-shadow: var(--shadow-2); }
.jobcard-icon { grid-row: 1 / 3; font-size: 2rem; text-align: center; }
.jobcard-title { font-size: 1.08rem; font-weight: 750; color: var(--c-navy); }
.jobcard-sub { font-size: 0.85rem; color: var(--c-muted); line-height: 1.4; }
.field-jobcard-other { border-style: dashed; box-shadow: none; }
/* immediate tap feedback (field fix round): the picked card reads as picked */
.field-jobcard.jobcard-selected {
  border-color: var(--c-blue); background: var(--c-ice);
  outline: 2px solid var(--c-blue); outline-offset: -2px;
}
.field-jobcard.jobcard-selected .jobcard-title::after {
  content: " ✓"; color: var(--c-blue);
}
.field-jobline { font-size: 0.9rem; font-weight: 650; color: var(--c-blue); margin: calc(-1 * var(--s-2)) 0 var(--s-3) 0; }

.field-otherjob { margin-top: var(--s-4); display: flex; flex-direction: column; gap: var(--s-4); }
.field-otherjob[hidden] { display: none; }
.field-otherjob .field input, .field-otherjob .field textarea { min-height: 48px; font-size: 1rem; }
.field-2col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }

/* chips */
.field-chipset { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.field-chip {
  background: var(--c-ice); border: 1px solid var(--c-hairline); color: var(--c-navy);
  border-radius: 999px; padding: 12px 18px; min-height: 48px;
  font: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background 140ms var(--ease), border-color 140ms var(--ease), color 140ms var(--ease);
}
.field-chip:hover { border-color: var(--c-blue); }
.field-chip.chip-on { background: var(--c-navy); border-color: var(--c-navy); color: #fff; }
.field-chipset-big .field-chip { min-height: 56px; font-size: 1rem; }
.chip-icon { font-size: 1.25rem; }
.field-condline { font-size: 0.95rem; color: var(--c-ink); background: var(--c-ice); border-radius: var(--radius-s); padding: var(--s-3) var(--s-4); }

/* big next buttons */
.btn-field-next {
  display: block; width: 100%; margin-top: var(--s-5);
  background: var(--c-blue); color: #fff; border: none; border-radius: var(--radius-s);
  min-height: 56px; font: inherit; font-size: 1.08rem; font-weight: 750; cursor: pointer;
  box-shadow: 0 1px 2px rgba(14, 42, 71, 0.18);
  transition: background 160ms var(--ease);
}
.btn-field-next:hover { background: var(--c-navy); }
.btn-field-go { background: var(--c-navy); }

/* traffic */
.field-traffic { font-size: 1.15rem; line-height: 1.6; max-width: 46ch; }

/* result */
.field-answer { font-size: 1.28rem; font-weight: 700; line-height: 1.45; letter-spacing: -0.005em; margin: 0 0 var(--s-4) 0; color: var(--c-navy); }
.field-answer.answer-high { color: var(--c-orange-deep); }
.fchance { font-size: 0.98rem; line-height: 1.55; margin: var(--s-2) 0; }
.fchance-cap { border-left: 3px solid var(--c-orange-deep); padding-left: var(--s-3); }
.ffresh { font-size: 0.95rem; border-radius: var(--radius-s); padding: var(--s-3) var(--s-4); }
.ffresh-ok { background: var(--c-ok-bg); }
.ffresh-warn { background: var(--c-warn-bg); }

.fmatrix-pair { display: grid; grid-template-columns: 1fr; gap: var(--s-4); }
.fmatrix-block h4 { margin: 0 0 var(--s-2) 0; font-size: 0.9rem; }
.fmatrix-wrap { overflow-x: auto; }
.fmatrix { border-collapse: collapse; width: 100%; max-width: 340px; }
.fmatrix th { font-size: 0.7rem; color: var(--c-muted); padding: 2px 4px; font-weight: 650; }
.fm-cell { border: 1px solid var(--c-hairline); height: 34px; min-width: 34px; background: var(--c-paper); text-align: center; }
.fm-occ { background: var(--c-ice); }
.fm-here { outline: 3px solid var(--c-blue); outline-offset: -3px; background: var(--c-ice); }
.fm-tag { font-size: 0.58rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.06em; color: var(--c-blue); }
.fm-caption { font-size: 0.88rem; max-width: 52ch; margin: var(--s-2) 0 0 0; }
.fm-solid { font-size: 0.82rem; color: var(--c-muted); max-width: 52ch; margin: var(--s-1) 0 0 0; }

.field-checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.field-checklist li {
  display: flex; gap: var(--s-3); align-items: flex-start;
  background: var(--c-ice); border-radius: var(--radius-s); padding: var(--s-3) var(--s-4);
  font-size: 0.95rem; line-height: 1.5;
}
.fcheck-box { flex: 0 0 22px; height: 22px; margin-top: 2px; border: 2px solid var(--c-blue); border-radius: 5px; background: #fff; }
.field-fullev { margin-top: var(--s-4); width: 100%; min-height: 48px; font-size: 0.95rem; }

/* sign-off */
#fieldStep5 .field { margin-bottom: var(--s-4); }
#fieldStep5 .field input, #fieldStep5 .field textarea { min-height: 48px; font-size: 1rem; }
#ffDecision .field-chip { flex: 1 1 auto; justify-content: center; }
.field-gate {
  border: 1px solid var(--c-orange-deep); border-left-width: 5px; background: var(--c-warn-bg);
  border-radius: var(--radius-s); padding: var(--s-4); margin-bottom: var(--s-4);
}
.field-gate .field-subtitle { margin-top: 0; color: var(--c-orange-deep); }
.field-gate p { font-size: 0.95rem; line-height: 1.55; }
.field-signoff-status { color: var(--c-imputed); font-weight: 650; min-height: 1.2em; }
.field-label-sub { display: block; font-size: 0.82rem; font-weight: 450; color: var(--c-muted); margin: 2px 0 4px 0; }
#ffRatPicks .field-chip { font-size: 0.9rem; text-align: left; }
#ffRatPickWrap[hidden] { display: none; }
/* run retry state: plain words, never a stuck spinner */
#fieldRunStatus.run-error { color: var(--c-orange-deep); font-weight: 700; }
.btn-field-next[disabled] { opacity: 0.55; cursor: default; }

@media (min-width: 700px) {
  .field-jobcards { grid-template-columns: 1fr 1fr; }
  .fmatrix-pair { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .mode-switch { position: static; display: block; margin: var(--s-2) 0 var(--s-2) 0; }
  .mode-field .product-name { font-size: 1.3rem; }
}
@media print {
  .mode-switch, .banner-more, #view-field { display: none !important; }
}
