/* HVAC Field Service Ledger: dark cockpit telemetry logbook */
:root {
  --canvas: #090D16;
  --workspace: #111827;
  --masthead: #030712;
  --body-ink: #F9FAFB;
  --muted-ink: #CBD5E1;
  --primary-action: #2563EB;
  --primary-action-ink: #FFFFFF;
  --semantic-accent: #F59E0B;
  --border: #334155;
  --input-bg: #0F172A;
  --focus: #38BDF8;
  --alarm: #F87171;
  --pass: #34D399;
  --placeholder: #94A3B8;
  --paper: #FFFFFF;
  --paper-ink: #111827;
  --paper-muted: #475569;
  --paper-line: #CBD5E1;
  --paper-tint: #F8FAFC;
  --font-head: 'Rajdhani', 'Arial Narrow', sans-serif;
  --font-ui: 'Rubik', system-ui, sans-serif;
  --font-mono: 'Share Tech Mono', ui-monospace, monospace;
  --bezel: 2px;
  --pad-x: 16px;
}

*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--body-ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; margin: 0; }
p { margin: 0; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

button, select, summary, [data-edit-target], [data-preset-chip], a[href], .locked-input { cursor: pointer; }

button {
  font: inherit;
  color: inherit;
  min-height: 44px;
  padding: 6px 14px;
  border-radius: var(--bezel);
}
button:active, a[data-checkout]:active, [data-preset-chip]:active { transform: translateY(1px); }

/* ---------- header stack ---------- */
.app-header-stack { flex-shrink: 0; }

header.masthead {
  background-color: #030712;
  color: #F9FAFB;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "id actions" "sub actions";
  column-gap: 16px;
  row-gap: 1px;
  align-items: center;
  padding: 6px var(--pad-x);
  border-bottom: 1px solid var(--border);
}
.masthead-id { grid-area: id; display: flex; align-items: baseline; gap: 14px; min-width: 0; flex-wrap: wrap; }
.wordmark {
  display: flex; align-items: center; gap: 8px;
  font-size: 22px; font-weight: 700; letter-spacing: 0.02em;
  white-space: nowrap; max-height: 52px;
}
.wordmark-icon { color: var(--semantic-accent); flex: 0 0 auto; align-self: center; }
.spec-ref { font-family: var(--font-mono); font-size: 12px; color: var(--muted-ink); letter-spacing: 0.04em; }
.masthead-sub { grid-area: sub; font-size: 13px; color: var(--muted-ink); line-height: 1.35; }
.masthead-actions { grid-area: actions; display: flex; align-items: center; gap: 10px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; white-space: nowrap;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--focus); }
[data-state="incomplete"] .status-dot, [data-state="held"] .status-dot { background: var(--semantic-accent); }
[data-state="repair"] .status-dot { background: var(--alarm); }
[data-state="within"] .status-dot { background: var(--pass); }

.btn-pro {
  background: transparent;
  border: 1px solid var(--primary-action);
  color: var(--body-ink);
  font-weight: 500; white-space: nowrap; max-height: 50px;
  padding: 6px 18px;
}
.btn-pro:hover { background: rgba(37, 99, 235, 0.18); }

.scenario-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding: 4px var(--pad-x);
  background: var(--workspace);
  border-bottom: 1px solid var(--border);
}
.scenario-caption {
  font-family: var(--font-mono); font-size: 12px; color: var(--muted-ink);
  text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap;
}
.scenario-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.preset-chip, [data-preset-chip] {
  min-height: 44px; padding: 6px 12px;
  background: var(--input-bg); border: 1px solid var(--border);
  color: var(--body-ink); font-size: 13px; white-space: nowrap;
}
.preset-chip:hover { border-color: var(--focus); }
.preset-chip[aria-pressed="true"] { border-color: var(--focus); background: rgba(56, 189, 248, 0.14); box-shadow: inset 0 -2px 0 var(--focus); }
.sample-badge {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--semantic-accent); color: #FCD34D;
}
.btn-reset {
  margin-left: auto;
  display: inline-flex; flex-direction: column; align-items: flex-start; justify-content: center;
  background: transparent; border: 1px solid var(--border);
  font-size: 13px; font-weight: 500; line-height: 1.15; text-align: left; white-space: nowrap;
}
.btn-reset span { font-size: 11px; font-weight: 400; color: var(--muted-ink); }
.btn-reset:hover { border-color: var(--muted-ink); }
.undo-notice { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted-ink); }
.btn-undo { background: transparent; border: 1px solid var(--focus); color: var(--body-ink); font-size: 13px; }

.workflow-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap;
  padding: 3px var(--pad-x);
  background: var(--canvas);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.workflow-bar ol { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 0; padding: 0; list-style: none; }
.workflow-bar li { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); }
.workflow-bar li + li::before { content: "→"; color: var(--muted-ink); margin-right: 4px; }
.workflow-bar a { color: var(--body-ink); text-decoration: none; letter-spacing: 0.04em; padding: 2px 0; }
.workflow-bar a:hover { text-decoration: underline; }
.flow-state { color: var(--muted-ink); }
.flow-state[data-state="open"] { color: #FCD34D; }
.flow-state[data-state="done"] { color: #6EE7B7; }
.live-cue { display: flex; align-items: center; gap: 6px; color: var(--muted-ink); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pass); }

/* ---------- role badges ---------- */
.role-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  line-height: 1.2;
  white-space: nowrap;
}
.role-badge-in { background: #422006; color: #FDE68A; border: 1px solid var(--semantic-accent); }
.role-badge-out { background: #0C2A4A; color: #BAE6FD; border: 1px solid var(--focus); }

/* ---------- cockpit ---------- */
.cockpit { background: var(--canvas); }

.inspector-pane {
  background: var(--workspace);
  border-right: 1px solid var(--border);
  min-width: 0;
}
.pane-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px var(--pad-x);
  border-bottom: 1px solid var(--border);
}
.pane-title { font-size: 18px; font-weight: 600; letter-spacing: 0.02em; }

.inspector-scroll-body { padding: 10px var(--pad-x) 56px; }

.trust-reassurance-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: var(--bezel);
  background: var(--input-bg);
}
.trust-badge {
  flex: 0 0 auto; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: #6EE7B7; border: 1px solid #065F46; border-radius: 999px; padding: 2px 8px;
}
.trust-reassurance-bar p { font-size: 12px; color: var(--muted-ink); line-height: 1.35; min-width: 0; }

form { margin: 0; }
.step { border: 0; margin: 0; padding: 0; min-width: 0; }
.step + .step { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.step-head { float: left; width: 100%; padding: 0; margin-bottom: 10px; }
.step-head + * { clear: both; }
.step-head h3 { font-size: 17px; font-weight: 700; letter-spacing: 0.04em; color: var(--body-ink); }
.step-note { font-size: 12.5px; color: var(--muted-ink); margin-bottom: 10px; }

.field-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 12px; margin-bottom: 10px; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.field-wide { grid-column: 1 / -1; }
label { font-size: 13px; font-weight: 500; line-height: 1.3; color: var(--body-ink); }
.req, .opt { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; margin-left: 4px; font-weight: 400; }
.req { color: #FCD34D; }
.opt { color: var(--muted-ink); }
.hint { font-size: 12px; color: var(--muted-ink); line-height: 1.35; }

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  background: var(--input-bg);
  color: var(--body-ink);
  border: 1px solid var(--border);
  border-radius: var(--bezel);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
textarea { resize: vertical; font-family: var(--font-ui); font-size: 14px; }
input::placeholder, textarea::placeholder { color: var(--placeholder); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input.is-missing { border-color: var(--semantic-accent); }
input.is-invalid, select.is-invalid, input[aria-invalid="true"] { border-color: var(--alarm); box-shadow: inset 0 0 0 1px var(--alarm); }
.validation-cue { font-size: 12.5px; color: #FCA5A5; line-height: 1.3; }
input.is-missing ~ .validation-cue, .field:has(input.is-missing) .validation-cue { color: #FCD34D; }

.prop-collapsible { border: 1px solid var(--border); border-radius: var(--bezel); margin: 4px 0 10px; }
.prop-collapsible[open] { padding-bottom: 2px; }
.prop-collapsible > :not(summary) { margin-left: 10px; margin-right: 10px; }
.step-tab {
  display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 10px;
  font-size: 13px; color: var(--muted-ink); list-style: none;
}
.step-tab::-webkit-details-marker { display: none; }
.step-tab::before { content: "▸"; color: var(--focus); }
.prop-collapsible[open] > .step-tab::before { content: "▾"; }
.step-tab:hover { color: var(--body-ink); }

.additions-list { display: flex; flex-direction: column; gap: 10px; }
.addition-row { border: 1px solid var(--border); border-left: 2px solid var(--semantic-accent); border-radius: var(--bezel); padding: 6px 10px 2px; background: rgba(15, 23, 42, 0.55); }
.addition-row .field-pair { margin-bottom: 8px; }
.addition-row .field-wide { margin-bottom: 8px; }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.row-title { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: #FCD34D; }
.btn-row-remove {
  display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 1px solid transparent;
  color: var(--muted-ink); font-size: 12.5px; padding: 6px 8px;
}
.btn-row-remove:hover { color: var(--body-ink); border-color: var(--border); }
.additions-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.additions-count { font-family: var(--font-mono); font-size: 12px; color: var(--muted-ink); }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--input-bg); border: 1px solid var(--border); color: var(--body-ink);
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
.btn-secondary:hover { border-color: var(--focus); }

.locked-block { margin-top: 14px; padding: 10px; border: 1px dashed var(--border); border-radius: var(--bezel); }
.locked-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; margin-bottom: 8px; color: var(--muted-ink); }
.locked-input { background: repeating-linear-gradient(135deg, #0F172A 0 8px, #131c2e 8px 16px) !important; }
.lock-note { font-size: 12px; color: var(--muted-ink); }

.flash-recalc { animation: flash-recalc 1.2s ease-out; }
@keyframes flash-recalc {
  0% { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.85); }
  100% { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0); }
}

.dock-jump-shelf {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px var(--pad-x);
  border-top: 1px solid var(--border);
  background: var(--masthead);
}
.shelf-status { font-family: var(--font-mono); font-size: 12px; color: var(--muted-ink); min-width: 0; }

/* ---------- right pane ---------- */
.deliverable-zone { min-width: 0; background: var(--canvas); padding-bottom: 72px; }

.deliverable-dock {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--workspace);
  border-bottom: 1px solid var(--border);
  padding: 6px var(--pad-x);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
}
.dock-synopsis { display: contents; }
.dock-head { flex: 1 1 100%; display: flex; align-items: center; gap: 10px; min-width: 0; }
.dock-verdict {
  flex: 1 1 auto; min-width: 0;
  font-size: 14px; font-weight: 500; line-height: 1.35;
  padding-left: 10px; border-left: 3px solid var(--focus);
}
.dock-verdict[data-state="incomplete"], .dock-verdict[data-state="held"] { border-left-color: var(--semantic-accent); color: #FDE68A; }
.dock-verdict[data-state="repair"] { border-left-color: var(--alarm); color: #FECACA; }
.dock-verdict[data-state="within"] { border-left-color: var(--pass); color: #A7F3D0; }
.dock-kpis { display: flex; gap: 6px; margin: 0; flex: 0 1 auto; min-width: 0; }
.kpi {
  min-width: 0; padding: 3px 10px; border: 1px solid var(--border); border-radius: var(--bezel); background: var(--input-bg);
  display: flex; flex-direction: column; justify-content: center; min-height: 44px;
}
.kpi dt { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-ink); line-height: 1.2; white-space: nowrap; }
.kpi dd { margin: 0; font-family: var(--font-mono); font-size: 15px; line-height: 1.2; white-space: nowrap; }
.dock-actions { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }

.deliverable-sheet {
  position: relative;
  margin: 8px var(--pad-x) 0;
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: var(--bezel);
  border: 1px solid var(--border);
  outline-offset: 3px;
}
[data-deliverable="sheet"] { container-type: inline-size; position: relative; padding: 24px 28px 20px; overflow: hidden; }
.draft-mark {
  position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%) rotate(-24deg);
  font-family: var(--font-head); font-weight: 700; font-size: 150px; letter-spacing: 0.12em;
  color: rgba(15, 23, 42, 0.045); pointer-events: none; user-select: none; z-index: 0;
}
[data-deliverable="sheet"] > :not(.draft-mark) { position: relative; z-index: 1; }

.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 2px solid var(--paper-ink); }
.sheet-kicker { font-family: var(--font-mono); font-size: 12px; color: var(--paper-muted); letter-spacing: 0.04em; }
.sheet-title { font-size: 26px; font-weight: 700; color: var(--paper-ink); }
.sheet-stamp {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; padding: 5px 10px;
  border: 2px solid #B45309; color: #92400E; border-radius: var(--bezel); white-space: nowrap;
}
.sheet-stamp[data-state="repair"] { border-color: #B91C1C; color: #991B1B; }
.sheet-stamp[data-state="within"] { border-color: #047857; color: #065F46; }

.sheet-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; margin: 0; padding: 10px 0; border-bottom: 1px solid var(--paper-line); }
@container (min-width: 700px) { .sheet-meta { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sheet-meta > div { padding: 6px 0; min-width: 0; }
.sheet-meta dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--paper-muted); }
.sheet-meta dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
#m-status { font-weight: 600; }

.sheet-section { padding-top: 18px; min-width: 0; }
.sheet-section h3 { font-size: 17px; font-weight: 700; letter-spacing: 0.03em; color: var(--paper-ink); margin-bottom: 8px; text-transform: uppercase; }
.det-headline { font-size: 16px; font-weight: 500; margin-bottom: 10px; }
.det-headline[data-state="repair"] { color: #991B1B; }
.det-headline[data-state="within"] { color: #065F46; }
.det-headline[data-state="incomplete"], .det-headline[data-state="held"] { color: #92400E; }
.det-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.det-card { border: 1px solid var(--paper-line); border-radius: var(--bezel); padding: 10px 12px; min-width: 0; background: var(--paper-tint); }
.det-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--paper-muted); }
.det-value { font-family: var(--font-head); font-size: 30px; font-weight: 700; line-height: 1.12; font-variant-numeric: tabular-nums; }
.det-sub { font-size: 12px; color: var(--paper-muted); overflow-wrap: anywhere; }
[data-state="repair"] .det-card:first-child .det-value { color: #B91C1C; }
.det-next { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 12px; padding: 10px 12px; border-left: 3px solid #2563EB; background: #EFF6FF; }
.det-next[data-state="incomplete"], .det-next[data-state="held"] { border-left-color: #B45309; background: #FFFBEB; }
.det-next[data-state="repair"] { border-left-color: #B91C1C; background: #FEF2F2; }
.det-next-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--paper-muted); flex: 1 1 100%; }
.det-next-text { flex: 1 1 260px; font-size: 14px; }
.btn-edit { background: var(--paper); border: 1px solid #1D4ED8; color: #1D4ED8; font-size: 13px; }

.inspector-gate {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 14px; padding: 6px 12px;
  border: 1px dashed var(--paper-line); border-radius: var(--bezel);
  color: #334155; font-size: 13px;
}
.inspector-gate p { flex: 1 1 240px; }
.btn-quiet { background: transparent; border: 1px solid transparent; color: #1D4ED8; text-decoration: underline; font-size: 13px; }

.conflict-alert { margin-top: 14px; padding: 10px 14px; border-left: 4px solid #B45309; background: #FFFBEB; color: #78350F; font-size: 13.5px; }
.conflict-title { font-weight: 600; }
.conflict-alert ul { margin: 4px 0; padding-left: 18px; }
.conflict-foot { font-size: 12.5px; }

.sheet-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 28px; align-items: start; }
@container (min-width: 640px) { .sheet-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.data-table th, .data-table td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--paper-line); vertical-align: top; overflow-wrap: anywhere; }
.data-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--paper-muted); font-weight: 500; }
.data-table tbody th { font-weight: 500; }
.data-table .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.data-table td { font-family: var(--font-mono); }
.data-table tbody tr:hover { background: var(--paper-tint); }
.schedule-table tr[data-current="true"] { background: #EFF6FF; box-shadow: inset 3px 0 0 #2563EB; }
.schedule-table tr[data-current="true"][data-tol="fail"] { background: #FEF2F2; box-shadow: inset 3px 0 0 #B91C1C; }
.chron-table th:first-child, .chron-table td:first-child { width: 44px; }
.chron-table tr[data-reason="before_window"] td, .chron-table tr[data-reason="after_service_date"] td { color: #92400E; }
.chron-table tr[data-reason="invalid"] td { color: #991B1B; }
.row-note { display: block; font-family: var(--font-ui); font-size: 11.5px; color: var(--paper-muted); }
.table-foot { font-size: 12px; color: var(--paper-muted); margin-top: 6px; }

.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--paper-line); font-size: 13.5px; }
.tol, .tol-pill {
  flex: 0 0 52px; text-align: center; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em;
  padding: 2px 6px; border-radius: 999px; border: 1px solid;
}
.tol[data-tol="pass"] { background: #D1FAE5; color: #065F46; border-color: #6EE7B7; }
.tol[data-tol="fail"] { background: #FEE2E2; color: #991B1B; border-color: #FCA5A5; }
.tol[data-tol="warn"], .tol[data-tol="hold"] { background: #FEF3C7; color: #92400E; border-color: #FCD34D; }

.math-details summary { font-size: 13px; color: var(--paper-muted); min-height: 32px; }
.math-line { font-family: var(--font-mono); font-size: 13px; padding: 8px 10px; background: var(--paper-tint); border: 1px solid var(--paper-line); border-radius: var(--bezel); margin: 6px 0 10px; }
.audit-list { margin: 0; font-size: 13px; }
.audit-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--paper-line); }
.audit-list dt { color: var(--paper-muted); }
.audit-list dd { margin: 0; font-family: var(--font-mono); text-align: right; }

.plain-list { margin: 0; padding-left: 18px; font-size: 13.5px; }
.plain-list li { margin-bottom: 6px; }
.notes-line { font-size: 13px; margin-top: 8px; color: #334155; }
.disclaimer { font-size: 12.5px; color: var(--paper-muted); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--paper-line); }

.signoff-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.sign-slot {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px; text-align: left;
  min-height: 92px; padding: 10px 12px; background: var(--paper-tint); border: 1px dashed #94A3B8; color: var(--paper-ink);
}
.sign-role { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--paper-muted); }
.sign-line { display: block; height: 26px; border-bottom: 1px solid #64748B; }
.sign-lock { font-size: 12.5px; color: #1D4ED8; }
.sign-note { font-size: 12px; color: var(--paper-muted); margin-top: 8px; }

.sheet-foot { margin-top: 22px; padding-top: 10px; border-top: 1px solid var(--paper-line); text-align: center; }
.free-watermark { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; color: var(--paper-muted); }

[data-edit-target]:not(button):hover { background-color: rgba(37, 99, 235, 0.06); }
.deliverable-dock [data-edit-target]:hover { background-color: rgba(56, 189, 248, 0.08); }

/* ---------- horizon & hud ---------- */
.cockpit-horizon-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  height: 28px; padding: 0 var(--pad-x);
  background: var(--masthead); border-top: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 11px; color: var(--muted-ink);
  white-space: nowrap; overflow: hidden;
}
.mobile-hud { display: none; }

/* ---------- dialogs ---------- */
.modal {
  width: min(680px, calc(100vw - 24px)); max-height: calc(100dvh - 32px);
  padding: 0; border: 1px solid var(--border); border-radius: var(--bezel);
  background: var(--workspace); color: var(--body-ink);
}
.modal::backdrop { background: rgba(3, 7, 18, 0.78); }
.modal-small { width: min(440px, calc(100vw - 24px)); }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal h2 { font-size: 24px; font-weight: 700; }
.btn-close { background: transparent; border: 1px solid var(--border); padding: 6px 10px; display: inline-flex; align-items: center; }
.modal-price { font-size: 14px; color: var(--muted-ink); }
.modal-price strong { color: var(--body-ink); font-size: 18px; }
.free-vs-pro-table { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--masthead); }
.free-vs-pro-table th, .free-vs-pro-table td { padding: 8px 10px; border: 1px solid var(--border); text-align: left; vertical-align: top; color: var(--body-ink); }
.free-vs-pro-table thead th { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; background: var(--workspace); }
.free-vs-pro-table tbody th { font-weight: 500; }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; align-self: flex-start;
  min-height: 44px; padding: 10px 20px; border-radius: var(--bezel);
  background: var(--primary-action); color: var(--primary-action-ink);
  font-weight: 600; text-decoration: none; white-space: nowrap;
}
.btn-primary:hover { background: #1D4ED8; }
a[data-checkout] { min-height: 44px; }
.modal-fine { font-size: 12.5px; color: var(--muted-ink); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.btn-primary-action { background: var(--primary-action); color: var(--primary-action-ink); border: 1px solid var(--primary-action); font-weight: 600; }

/* ---------- desktop cockpit ---------- */
@media (min-width: 901px) {
  html,
  body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  body { display: flex; flex-direction: column; }
  .cockpit {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(360px, 450px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    align-items: start;
  }
  .inspector-pane {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
  }
  .inspector-scroll-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
  .dock-jump-shelf {
    flex: 0 0 auto;
  }
  .deliverable-zone {
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
  [data-scroll-fade] {
    -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 36px), transparent 100%);
    mask-image: linear-gradient(to bottom, black calc(100% - 36px), transparent 100%);
  }
  [data-scroll-fade].at-end { -webkit-mask-image: none; mask-image: none; }
  .cockpit-horizon-bar { flex: 0 0 28px; }
  .deliverable-zone .sheet-grid + .sheet-grid, .signoff { margin-top: 8px; }
}

@media (min-width: 901px) and (max-width: 1180px) {
  .spec-ref { display: none; }
  header.masthead { grid-template-areas: "id actions" "sub sub"; }
  .cockpit-horizon-bar span:nth-child(3) { display: none; }
}

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  html, body { height: auto; overflow: visible; }
  body { padding-bottom: 64px; }
  .cockpit { display: block; }
  .inspector-pane { border-right: 0; border-bottom: 1px solid var(--border); }
  .inspector-scroll-body { padding-bottom: 16px; }
  .deliverable-dock { position: static; }
  .deliverable-zone { padding-bottom: 24px; }
  .cockpit-horizon-bar { display: none; }
  header.masthead { grid-template-areas: "id pro" "status status" "sub sub"; padding: 8px 12px; row-gap: 4px; }
  .masthead-actions { display: contents; }
  .status-pill { grid-area: status; justify-self: start; }
  .btn-pro { grid-area: pro; }
  .spec-ref { display: none; }
  .masthead-sub { font-size: 12.5px; }
  .live-cue { font-size: 11.5px; }
  .mobile-hud {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: 56px; padding: 6px 12px;
    background: var(--masthead); border-top: 1px solid var(--border);
  }
  .hud-verdict {
    flex: 1 1 auto; min-width: 0; font-family: var(--font-mono); font-size: 13px;
    white-space: nowrap; overflow: hidden; padding-left: 8px; border-left: 3px solid var(--focus);
  }
  .hud-verdict[data-state="incomplete"], .hud-verdict[data-state="held"] { border-left-color: var(--semantic-accent); }
  .hud-verdict[data-state="repair"] { border-left-color: var(--alarm); }
  .hud-verdict[data-state="within"] { border-left-color: var(--pass); }
  .btn-hud { flex: 0 0 auto; background: var(--input-bg); border: 1px solid var(--focus); font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }
  .dock-jump-shelf { padding: 8px 12px; }
}

@media (max-width: 680px) {
  fieldset [class*="grid"],
  form [class*="grid"],
  .field-pair,
  .prop-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .det-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .det-cards > :last-child { grid-column: 1 / -1; }
  .signoff-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  :root { --pad-x: 12px; }
  .wordmark { font-size: 18px; white-space: normal; min-width: 0; max-height: none; line-height: 1.15; }
  .flow-word, .flow-state { display: none; }
  .workflow-bar { flex-wrap: nowrap; }
  .pane-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .scenario-chips { flex-wrap: nowrap; }
  .preset-chip { flex: 1 1 0; min-width: 0; padding: 6px 6px; font-size: 12.5px; white-space: normal; line-height: 1.2; }
  .scenario-bar { padding: 6px 12px; gap: 6px 8px; }
  .scenario-caption { flex: 1 1 100%; }
  .scenario-chips { flex: 1 1 100%; }
  .btn-reset { margin-left: 0; }
  .workflow-bar { padding: 4px 12px; }
  .deliverable-dock { padding: 10px 12px; gap: 8px; }
  .dock-head { flex-wrap: wrap; }
  .dock-kpis { flex: 1 1 100%; flex-wrap: wrap; }
  .kpi { flex: 1 1 calc(50% - 6px); max-width: 48%; }
  .dock-actions { margin-left: 0; flex: 1 1 100%; }
  .dock-actions > button { flex: 1 1 calc(50% - 6px); max-width: 48%; }
  .deliverable-sheet { margin: 10px 12px 0; }
  [data-deliverable="sheet"] { padding: 16px 12px 14px; }
  .sheet-title { font-size: 22px; }
  .det-value { font-size: 26px; }
  .draft-mark { font-size: 90px; }
  .trust-reassurance-bar { flex-wrap: wrap; gap: 4px 8px; padding: 6px 10px; }
  .trust-badge { display: none; }
  .modal-body { padding: 16px 12px; }
  .free-vs-pro-table th, .free-vs-pro-table td { padding: 6px; font-size: 12.5px; }
}

/* ---------- print ---------- */
@media print {
  @page { margin: 14mm; }
  html, body { height: auto !important; overflow: visible !important; background: #FFFFFF !important; color: #111827; padding: 0; display: block; }
  .app-header-stack, .inspector-pane, .deliverable-dock, .cockpit-horizon-bar, .mobile-hud, dialog, .inspector-gate, button, .btn-edit, .masthead, nav, form { display: none !important; }
  .cockpit, .deliverable-zone { display: block !important; height: auto !important; overflow: visible !important; padding: 0 !important; background: #FFFFFF !important; -webkit-mask-image: none !important; mask-image: none !important; }
  #executive-deliverable { display: block !important; margin: 0; border: 0; color: #111827; background: #FFFFFF; }
  [data-deliverable="sheet"] { padding: 0; overflow: visible; }
  .signoff-grid, .sign-note { display: none !important; }
  .signoff::after { content: "Dual inspector sign-off is not part of this free draft."; font-size: 12px; color: #475569; }
  .free-watermark { display: block !important; color: #111827; }
  .draft-mark { color: rgba(17, 24, 39, 0.06); position: fixed; top: 45%; }
  .sheet-section, .det-cards, .check-list li, .data-table tr, .conflict-alert { break-inside: avoid; page-break-inside: avoid; }
  .data-table thead { display: table-header-group; }
  .sheet-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; }
  [data-edit-target]:hover, .data-table tbody tr:hover { background: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .flash-recalc { animation: none; outline: 2px solid var(--semantic-accent); }
  * { scroll-behavior: auto !important; }
}

/* ---------- related tools & footer note ---------- */
.related-tools { margin: 24px var(--pad-x) 0; padding: 16px 0 0; border-top: 1px solid var(--border); }
.related-tools h2 { font-size: 18px; font-weight: 700; letter-spacing: 0.03em; margin-bottom: 10px; }
.related-tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.related-tool-card {
  display: flex; flex-direction: column; gap: 4px; min-height: 44px; padding: 12px 14px;
  background: var(--workspace); border: 1px solid var(--border); border-radius: var(--bezel);
  color: var(--body-ink); text-decoration: none;
}
.related-tool-card:hover { border-color: var(--focus); }
.related-tool-card h3 { font-size: 15px; font-weight: 600; color: #93C5FD; }
.related-tool-card p { font-size: 12.5px; color: var(--muted-ink); line-height: 1.4; }
.trust-footer { margin: 16px var(--pad-x) 0; font-size: 12px; color: var(--muted-ink); }
.trust-footer a { color: #93C5FD; }
@media print { .related-tools, .trust-footer { display: none !important; } }

/* Review fix (2026-10-19): facility width */
.field-pair .field:has(#f-facility) { grid-column: 1 / -1; min-width: 0; }
#f-facility, #f-address { min-width: 0; width: 100%; }

/* Review fix (2026-10-19): mobile masthead */
@media (max-width: 600px) {
  .masthead { padding-top: 6px !important; padding-bottom: 6px !important; }
  .masthead .masthead-sub { display: none !important; }
}

/* Review fix (2026-10-19): step-head float fix */
.step-head { float: none !important; }
.step-head + * { clear: none !important; }

/* Review fix (2026-10-19): closed details fix */
.prop-collapsible:not([open]) > :not(summary) { display: none !important; }
