/* Appliance Repair Closeout — production styles */
:root {
  --canvas: #E4E4E7;
  --paper: #FFFFFF;
  --ink: #18181B;
  --muted: #3F3F46;
  --primary: #0F766E;
  --primary-ink: #FFFFFF;
  --primary-dark: #0B5F58;
  --accent: #B45309;
  --line: #A1A1AA;
  --hair: #D4D4D8;
  --tint: #F4F4F5;
  --ready-bg: #ECFDF5;
  --review-bg: #FFF7ED;
  --radius: 4px;
  --font-head: "Plus Jakarta Sans", "DM Sans", system-ui, sans-serif;
  --font-ui: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --focus: 0 0 0 3px rgba(15, 118, 110, 0.35);
}

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

html, body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0; color: var(--ink); }
p { margin: 0; }
.mono, .mono-input { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--primary-dark); }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--paper); color: var(--ink); padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------- Controls ---------- */
button, [data-preset-chip], .preset-chip, label.dropzone-trigger, a[data-checkout], select,
input:not([type="checkbox"]):not([type="radio"]) {
  min-height: 44px;
}
button {
  font: inherit;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
button:hover { border-color: var(--muted); background: var(--tint); }
button:active { transform: translateY(1px); background: #E4E4E7; }
button svg { flex: 0 0 auto; }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  background: var(--primary); color: var(--primary-ink);
  border: 1px solid var(--primary); border-radius: var(--radius);
  font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.btn-primary:hover { background: var(--primary-dark); color: var(--primary-ink); }
.btn-primary:active { transform: translateY(1px); background: #094E48; }

.btn-secondary { font-weight: 600; font-size: 14px; padding: 8px 12px; }
.btn-secondary:active { transform: translateY(1px); }

.btn-link {
  border: 0; background: transparent; color: var(--primary); font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px; padding: 8px 6px;
}
.btn-link:hover { background: transparent; color: var(--primary-dark); }
.btn-link:active { color: #094E48; }

/* ---------- Shell ---------- */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.app-header-stack { flex-shrink: 0; background: var(--paper); border-bottom: 1px solid var(--line); }

header.masthead, .masthead {
  background-color: #FFFFFF;
  color: #18181B;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 4px 24px;
  min-height: 52px;
}
.brand-block { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
.wordmark {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-head); font-weight: 800; font-size: 19px; letter-spacing: -0.01em;
  white-space: nowrap; max-height: 52px; line-height: 1.3; color: var(--ink);
  flex: 0 0 auto;
}
.wordmark-icon { color: var(--primary); }
.app-subtitle { color: var(--muted); font-size: 13px; line-height: 1.35; min-width: 0; }
.masthead-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.masthead-actions > * { white-space: nowrap; max-height: 50px; }

.total-pill {
  border-radius: 999px; padding: 6px 14px; gap: 8px;
  border: 1px solid var(--line); background: var(--paper);
}
.total-pill-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.total-pill-value { font-family: var(--font-ui); font-size: 13.5px; font-weight: 700; }
.total-pill[data-verdict="invoice_ready"] .total-pill-value { color: var(--primary); }
.total-pill[data-verdict="parts_review_required"] .total-pill-value { color: var(--accent); }

.btn-pro {
  background: var(--primary); color: var(--primary-ink); border-color: var(--primary);
  font-weight: 700; padding: 8px 14px;
}
.btn-pro:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-pro:active { background: #094E48; }

.scenario-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  min-height: 46px; padding: 1px 24px;
  border-top: 1px solid var(--hair);
}
.scenario-caption { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.preset-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.preset-chip {
  border-radius: var(--radius); padding: 6px 12px; font-size: 13.5px; font-weight: 600;
  background: var(--paper); border: 1px solid var(--line);
}
.preset-chip[aria-pressed="true"] { background: var(--primary); color: #fff; border-color: var(--primary); }
.preset-chip:active { transform: translateY(1px); }
#reset-btn { font-size: 13.5px; font-weight: 600; padding: 6px 12px; color: var(--muted); border-style: dashed; }
#reset-btn:active { transform: translateY(1px); }

.workflow-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 4px 24px; border-top: 1px solid var(--hair); background: var(--tint);
  font-size: 13px; color: var(--muted);
}
.workflow-bar ol { display: flex; align-items: center; gap: 8px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.workflow-bar li { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); }
.wf-num { color: var(--primary); font-size: 12px; font-weight: 600; }
.wf-arrow { color: var(--muted); }
.wf-final { color: var(--accent) !important; }
.live-cue { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--primary); font-size: 12.5px; }
.live-cue svg { width: 16px; height: 16px; }

/* ---------- Workbench ---------- */
.workbench {
  display: grid;
  grid-template-columns: minmax(0, 44fr) minmax(0, 56fr);
  align-items: start;
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
}

.inspector-pane {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--paper); border-right: 1px solid var(--line);
}
.inspector-dock { flex: 0 0 auto; padding: 10px 20px; border-bottom: 1px solid var(--hair); }
.inspector-scroll-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  padding: 4px 20px 56px;
}
.dock-jump-shelf {
  flex: 0 0 auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 20px; border-top: 1px solid var(--line); background: var(--paper);
}
.shelf-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-right: 2px; }
.shelf-btn { font-size: 13px; font-weight: 600; padding: 6px 10px; }
.shelf-btn:active { transform: translateY(1px); }
.shelf-btn-primary { margin-left: auto; background: var(--primary); color: #fff; border-color: var(--primary); }
.shelf-btn-primary:hover { background: var(--primary-dark); color: #fff; }

.trust-reassurance-bar { display: flex; align-items: center; gap: 10px; }
.trust-badge {
  flex: 0 0 auto; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--primary); background: #F0FDFA; border: 1px solid var(--primary); border-radius: 999px; padding: 4px 10px;
  white-space: nowrap;
}
.trust-reassurance-bar p { font-size: 13px; color: var(--muted); line-height: 1.4; }

.mobile-verdict-strip { display: none; }

.role-badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; line-height: 1.3; white-space: nowrap;
}
.role-badge-in { background: #18181B; color: #FFFFFF; }
.role-badge-out { background: #FFF7ED; color: #9A3412; border: 1px solid #B45309; }

/* Fieldsets */
.closeout-form { display: flex; flex-direction: column; }
.step-fieldset { border: 0; margin: 0; padding: 18px 16px 22px; min-width: 0; border-bottom: 1px solid var(--hair); }
.step-fieldset:last-child { border-bottom: 0; }
.step-legend {
  padding: 0; font-family: var(--font-head); font-weight: 700; font-size: 17px; line-height: 1.3;
  display: flex; align-items: baseline; gap: 10px; width: 100%;
}
.step-legend + * { clear: both; }
.step-num { font-size: 12px; color: var(--primary); font-weight: 600; letter-spacing: .04em; }
.step-fieldset .role-badge { margin-top: 8px; }
.step-desc { color: var(--muted); font-size: 13.5px; margin: 6px 0 12px; clear: both; }

.field-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 14px; margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; position: relative; }
.field-wide { margin-top: 4px; }
.field label { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.req-tag, .opt-tag { font-size: 11px; font-weight: 600; margin-left: 4px; letter-spacing: .02em; }
.req-tag { color: var(--accent); }
.opt-tag { color: var(--muted); font-weight: 500; }
.field-hint { font-size: 12px; color: var(--muted); line-height: 1.35; }

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 11px; width: 100%; min-width: 0;
}
.mono-input { font-family: var(--font-mono); font-size: 14px; }
select { cursor: pointer; padding-right: 30px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16' fill='none' stroke='%233F3F46' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
textarea { resize: vertical; min-height: 84px; }
input::placeholder, textarea::placeholder { color: #71717A; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--primary); }
select[data-state="verified"] { border-color: var(--primary); }
select[data-state="issue"] { border-color: var(--accent); }
input[aria-invalid="true"]:not([type="checkbox"]):not([type="radio"]) { border-color: #B91C1C; }
.validation-cue { font-size: 12px; color: #B91C1C; font-weight: 600; line-height: 1.35; }

.unit-input { position: relative; }
.unit-prefix { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-family: var(--font-mono); color: var(--muted); pointer-events: none; }
.unit-input input:not([type="checkbox"]):not([type="radio"]) { padding-left: 28px; }

.stepper-row { margin-bottom: 12px; max-width: 420px; }
.stepper { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 6px; }
.stepper input { text-align: center; }
.stepper-btn { padding: 6px; }
.stepper-btn:active { transform: translateY(1px); }

.signoff-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; margin: 4px 0 12px;
  background: var(--tint); border-radius: var(--radius);
}
.signoff-row input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--primary); cursor: pointer; flex: 0 0 auto; }
.signoff-row label { font-size: 14px; font-weight: 600; cursor: pointer; }

.prop-collapsible { margin-top: 6px; border-top: 1px dashed var(--line); }
.step-tab {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 8px 0; font-weight: 600; font-size: 14px; color: var(--primary);
}
.step-tab::-webkit-details-marker { display: none; }
.step-tab::before {
  content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s ease; flex: 0 0 auto;
}
.prop-collapsible[open] > .step-tab::before { transform: rotate(45deg); }
.step-tab:active { color: var(--primary-dark); }

.flash-recalc { animation: flashRecalc .9s ease-out 1; }
@keyframes flashRecalc {
  0% { box-shadow: 0 0 0 0 rgba(180, 83, 9, .55); background-color: #FFF7ED; }
  100% { box-shadow: 0 0 0 8px rgba(180, 83, 9, 0); background-color: var(--paper); }
}

/* ---------- Deliverable zone ---------- */
.deliverable-zone { min-width: 0; padding: 0 20px 56px; background: var(--canvas); }
.verdict-dock {
  position: sticky; top: 0; z-index: 30;
  background: var(--canvas); padding: 8px 0 6px;
  display: flex; flex-direction: column; gap: 6px;
  border-bottom: 1px solid var(--line);
}
.dock-results { min-width: 0; }
.dock-verdict {
  display: flex; align-items: center; width: 100%; gap: 8px; padding: 6px 12px; min-height: 36px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); text-align: left;
  font-family: var(--font-head); font-weight: 700; font-size: 15px; line-height: 1.3; cursor: pointer;
}
.dock-verdict:active { transform: translateY(1px); }
.dock-verdict-text { min-width: 0; }
.verdict-icon { display: inline-flex; width: 18px; height: 18px; flex: 0 0 auto; }
.verdict-icon .vi { display: none; }
.dock-verdict[data-verdict="invoice_ready"] { color: var(--primary); border-color: var(--primary); background: #F0FDFA; }
.dock-verdict[data-verdict="invoice_ready"] .vi-ready { display: block; }
.dock-verdict[data-verdict="parts_review_required"] { color: #92400E; border-color: var(--accent); background: var(--review-bg); }
.dock-verdict[data-verdict="parts_review_required"] .vi-review { display: block; }
.dock-verdict[data-verdict="awaiting_input"] { color: var(--muted); font-weight: 600; }

.dock-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.dock-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, auto)); gap: 6px; }
.kpi {
  flex-direction: column; align-items: flex-start; gap: 0; padding: 6px 10px; min-width: 84px;
  background: var(--paper); line-height: 1.2;
}
.kpi-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.kpi-value { font-size: 15px; font-weight: 600; }
.dock-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.deliverable-sheet {
  position: static;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  margin-top: 6px; padding: 26px 32px 32px;
}
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 14px; border-bottom: 2px solid var(--ink); }
.sheet-title-block { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; min-width: 0; }
.sheet-head h1 { font-size: 23px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; }
.sheet-company { font-size: 13.5px; color: var(--muted); }
.draft-stamp {
  flex: 0 0 auto; font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: #9A3412; border: 1.5px solid var(--accent); border-radius: var(--radius); padding: 6px 10px; transform: rotate(-2deg); white-space: nowrap;
}

.sheet-h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 22px 0 8px; line-height: 1.25; }

.determination .sheet-h2 { margin-top: 18px; }
.det-banner { padding: 12px 14px; border-radius: var(--radius); background: var(--tint); border-left: 4px solid var(--line); min-height: 76px; cursor: pointer; }
.det-banner[data-verdict="invoice_ready"] { background: var(--ready-bg); border-left-color: var(--primary); }
.det-banner[data-verdict="parts_review_required"] { background: var(--review-bg); border-left-color: var(--accent); }
.det-verdict { font-family: var(--font-head); font-weight: 800; font-size: 20px; line-height: 1.2; }
.det-banner[data-verdict="invoice_ready"] .det-verdict { color: var(--primary); }
.det-banner[data-verdict="parts_review_required"] .det-verdict { color: #92400E; }
.det-banner[data-verdict="awaiting_input"] .det-verdict { color: var(--muted); font-size: 16px; font-weight: 700; }
.det-explain { font-size: 13.5px; color: var(--muted); margin-top: 4px; min-height: 2.8em; }
.det-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 10px; border-top: 1px solid var(--hair); }
.det-cell { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; cursor: pointer; border-right: 1px solid var(--hair); min-width: 0; }
.det-cell:last-child { border-right: 0; }
.det-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.det-value { font-size: 19px; font-weight: 600; }

.pro-seal {
  display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 10px 12px;
  border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line);
}
.seal-icon { color: var(--accent); flex: 0 0 auto; }
.seal-copy { flex: 1 1 auto; min-width: 0; }
.seal-title { font-size: 14px; font-weight: 700; }
.seal-copy p { font-size: 13px; color: var(--muted); line-height: 1.4; }

.sheet-subgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 24px; }

.record-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.record-table th, .record-table td { text-align: left; vertical-align: top; padding: 7px 8px; border-bottom: 1px solid var(--hair); line-height: 1.4; }
.record-table tbody th { font-weight: 600; color: var(--muted); width: 42%; font-size: 13px; }
.record-table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--line); }
.record-table td { overflow-wrap: anywhere; }
.record-table tbody tr { cursor: pointer; }
.record-table tbody tr:hover, [data-edit-target]:hover { background-color: #FAFAFA; }
.record-table tbody tr:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; box-shadow: none; }
.checklist-table tbody th { width: auto; color: var(--ink); font-weight: 500; font-size: 14px; }
.checklist-table td:nth-child(2) { color: var(--muted); width: 22%; }
.checklist-table td:last-child { width: 28%; }
.status-tag { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.status-verified { color: var(--primary); }
.status-issue { color: #92400E; }
.status-not_recorded { color: var(--muted); }
.empty-val { color: #52525B; }

.ack-lines { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; margin-top: 26px; }
.ack-line { border-top: 1px solid var(--ink); padding-top: 4px; font-size: 12px; color: var(--muted); }

.sheet-disclaimer p { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.free-watermark { margin-top: 22px; padding-top: 10px; border-top: 1px solid var(--hair); font-size: 12px; color: var(--muted); text-align: center; letter-spacing: .03em; }

/* ---------- Horizon bar ---------- */
.cockpit-horizon-bar {
  flex: 0 0 28px; height: 28px; display: flex; align-items: center; gap: 20px; justify-content: space-between;
  padding: 0 20px; background: var(--paper); border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden;
}
.horizon-item { display: inline-flex; align-items: center; gap: 6px; }
.horizon-item svg { width: 16px; height: 16px; color: var(--primary); }

.mobile-hud { display: none; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80; background: rgba(24, 24, 27, .55);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-backdrop[hidden] { display: none; }
.pro-modal {
  width: min(720px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto;
  background: var(--paper); color: var(--ink); border-radius: var(--radius); border: 1px solid var(--line);
  padding: 22px 24px 20px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h2 { font-size: 20px; font-weight: 800; line-height: 1.2; }
.modal-close { padding: 8px; width: 44px; }
.modal-close:active { transform: translateY(1px); }
.modal-lead { color: var(--muted); margin: 8px 0 14px; font-size: 14.5px; }
.modal-lead strong { color: var(--ink); }
.table-scroll { overflow-x: auto; }
.free-vs-pro-table { width: 100%; border-collapse: collapse; font-size: 14px; color: #18181B; }
.free-vs-pro-table th, .free-vs-pro-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.free-vs-pro-table thead th { background: #18181B; color: #FFFFFF; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.free-vs-pro-table tbody th { font-weight: 700; }
.free-vs-pro-table td:last-child { color: #115E59; font-weight: 600; }
.modal-cta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.modal-note { font-size: 13px; color: var(--muted); }
.license-note { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--hair); font-size: 13px; color: var(--muted); }

/* ---------- Desktop cockpit ---------- */
@media (min-width: 901px) {
  html, body { height: 100vh; height: 100dvh; overflow: hidden; }
  .app-shell { height: 100vh; height: 100dvh; min-height: 0; }
  .workbench { overflow: hidden; height: 100%; align-items: stretch; }
  .inspector-pane { height: 100%; overflow: hidden; }
  .deliverable-zone { height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .scroll-panel {
    -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%);
  }
  .scroll-panel.is-scroll-end { -webkit-mask-image: none; mask-image: none; }
  .deliverable-sheet .sheet-disclaimer { padding-bottom: 8px; }
}

@media (min-width: 901px) and (max-width: 1360px) {
  .pro-price-inline { display: none; }
  .dock-actions .btn-secondary svg { display: none; }
}

@media (min-width: 901px) and (max-width: 1180px) {
  .app-subtitle { font-size: 12px; }
  .total-pill-label { display: none; }
  .deliverable-zone { padding-left: 14px; padding-right: 14px; }
  .masthead, .scenario-toolbar, .workflow-bar { padding-left: 20px; padding-right: 20px; }
  .deliverable-sheet { padding: 22px 20px 26px; }
  .dock-actions .btn-secondary { padding: 6px 10px; font-size: 13px; }
  .kpi { min-width: 64px; padding: 6px 8px; }
  .kpi-label { letter-spacing: .03em; font-size: 10px; }
  .cue-long { display: none; }
  .dock-scroll-cue { text-transform: capitalize; }
  .trust-reassurance-bar { align-items: flex-start; }
}

/* ---------- Tablet / mobile ---------- */
@media (max-width: 900px) {
  html, body { height: auto; overflow: visible; }
  body { padding-bottom: 72px; }
  .app-shell { min-height: 0; }
  .masthead { flex-wrap: wrap; padding: 8px 16px; align-items: flex-start; }
  .brand-block { flex: 1 1 0; }
  .scenario-toolbar { padding: 8px 16px; }
  .workflow-bar { padding: 6px 16px; }
  .workbench { grid-template-columns: minmax(0, 1fr); }
  .inspector-pane { border-right: 0; border-bottom: 1px solid var(--line); }
  .inspector-dock { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
  .inspector-scroll-body { overflow: visible; padding: 4px 16px 24px; }
  .dock-jump-shelf { padding: 10px 16px; }
  .deliverable-zone { padding: 0 12px 32px; }
  .verdict-dock { position: static; }
  .cockpit-horizon-bar { display: none; }
  .mobile-verdict-strip {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; width: 100%;
    justify-content: flex-start; white-space: normal; text-align: left; padding: 8px 12px;
    background: var(--tint); border: 1px solid var(--line);
  }
  .mvs-item { font-size: 13.5px; font-weight: 600; min-width: 0; }
  .mvs-label { color: var(--muted); font-weight: 600; }
  .mvs-verdict { flex-basis: 100%; font-family: var(--font-head); }
  .mobile-verdict-strip[data-verdict="invoice_ready"] .mvs-verdict { color: var(--primary); }
  .mobile-verdict-strip[data-verdict="parts_review_required"] .mvs-verdict { color: #92400E; }
  .mobile-hud {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--line);
  }
  .hud-verdict { font-weight: 700; font-size: 14px; min-width: 0; font-family: var(--font-head); }
  .mobile-hud[data-verdict="invoice_ready"] .hud-verdict { color: var(--primary); }
  .mobile-hud[data-verdict="parts_review_required"] .hud-verdict { color: #92400E; }
  .hud-btn { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; padding: 8px 12px; flex: 0 0 auto; }
  .hud-btn:hover { background: var(--primary-dark); color: #fff; }
  .hud-btn:active { background: #094E48; }
}

@media (max-width: 680px) {
  fieldset [class*="grid"], form [class*="grid"], .field-pair, .prop-grid, .sheet-subgrid {
    grid-template-columns: minmax(0, 1fr);
  }
  .stepper { grid-template-columns: 44px minmax(0, 1fr) 44px; }
  .deliverable-sheet { padding: 18px 14px 22px; }
  .sheet-head { flex-direction: column; }
  .ack-lines { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .masthead { padding-top: 2px; padding-bottom: 2px; }
  .app-subtitle { font-size: 13px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; line-height: 1.28; }
  .wordmark { font-size: 17px; }
  header.masthead { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
  .brand-block { display: contents; }
  .wordmark { grid-column: 1; grid-row: 1; align-self: center; }
  .masthead-actions { grid-column: 2; grid-row: 1; }
  .app-subtitle { grid-column: 1 / -1; grid-row: 2; }
  .total-pill { display: none; }
  .pro-price-inline { display: none; }
  .scenario-toolbar { gap: 6px; justify-content: space-between; }
  .scenario-caption { flex-basis: 100%; }
  .preset-strip { display: contents; }
  .preset-chip, #reset-btn { flex: 1 1 calc(50% - 6px); max-width: 48%; font-size: 13px; white-space: normal; line-height: 1.25; padding: 6px 12px; }
  .workflow-bar ol { gap: 4px 6px; font-size: 12.5px; }
  .wf-arrow svg { width: 16px; height: 16px; }
  .trust-reassurance-bar { flex-direction: column; align-items: flex-start; gap: 6px; }
  .dock-row { flex-direction: column; align-items: stretch; }
  .dock-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi { min-width: 0; padding: 6px 12px; }
  .kpi-label { font-size: 10px; }
  .kpi-value { font-size: 0.88rem; }
  .dock-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dock-actions .dock-scroll-cue { grid-column: 1 / -1; }
  .dock-actions .btn-secondary { padding: 8px 12px; font-size: 13.5px; }
  .det-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .det-cell { padding: 8px 12px; }
  .det-value { font-size: 0.88rem; }
  .det-label { font-size: 11px; }
  .record-table { font-size: 13px; }
  .record-table th, .record-table td { padding: 7px 6px; }
  .checklist-table td:nth-child(2) { display: none; }
  .checklist-table thead th:nth-child(2) { display: none; }
  .pro-seal { flex-wrap: wrap; padding: 12px; }
  .shelf-btn-primary { margin-left: 0; flex-basis: 100%; }
  .pro-modal { padding: 16px 14px; }
  .free-vs-pro-table { font-size: 13px; }
  .free-vs-pro-table th, .free-vs-pro-table td { padding: 8px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Print ---------- */
@media print {
  @page { margin: 14mm; }
  html, body { height: auto !important; overflow: visible !important; background: #FFFFFF !important; color: #111827 !important; padding: 0 !important; }
  .app-header-stack, .inspector-pane, .verdict-dock, .cockpit-horizon-bar, .mobile-hud, .modal-backdrop,
  .skip-link, .no-print, .pro-seal, nav, form, button { display: none !important; }
  .app-shell, .workbench { display: block !important; height: auto !important; overflow: visible !important; }
  .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 { border: 0 !important; margin: 0 !important; padding: 0 !important; color: #111827 !important; background: #FFFFFF !important; }
  #executive-deliverable * { color: #111827 !important; background: transparent !important; box-shadow: none !important; }
  .record-table { page-break-inside: auto; }
  .record-table tr, .det-banner, .ack-lines { page-break-inside: avoid; break-inside: avoid; }
  .sheet-h2 { page-break-after: avoid; break-after: avoid; }
  .free-watermark { display: block !important; }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.deliverable-sheet:focus-visible { box-shadow: var(--focus); }

/* Stable record geometry: reserve lines for free-text cells so presets update in place */
.record-table td[data-out="symptom"], .record-table td[data-out="service_address"], .record-table td[data-out="appliance"],
.record-table td[data-out="crossref_basis"], .record-table td[data-out="next-checks"], .record-table td[data-out="next-parts"] { height: calc(2.8em + 14px); }
.record-table td[data-out="exceptions"], .record-table td[data-out="tech_notes"] { height: calc(5.6em + 14px); }
.det-banner { min-height: 96px; }
.notes-table tbody th { width: 24%; }
@media (min-width: 901px) and (max-width: 1180px) { .cockpit-horizon-bar { gap: 12px; font-size: 11px; padding: 0 14px; } }

/* Sign-off row: keep the visible checkbox compact but give the row a 44px tap band */
label[for="field-signoff"] { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }

/* Undo toast: non-blocking safety for destructive actions */
.undo-toast { position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 14px; padding: 10px 18px; border: 1px solid var(--line); border-radius: 999px; background: #0F172A; color: #E2E8F0; font-size: 13px; box-shadow: 0 10px 28px rgba(2, 6, 23, 0.4); }
.undo-toast[hidden] { display: none; }
.undo-toast button { min-height: 44px; padding: 4px 14px; border: 1px solid #14B8A6; border-radius: 999px; background: transparent; color: #5EEAD4; font-weight: 700; cursor: pointer; }
.undo-toast button:hover { background: rgba(13, 148, 136, 0.15); }

/* Severity monotonicity: safety and invalid-value holds use a stronger treatment than parts review */
.dock-verdict[data-verdict="safety_review_required"], .dock-verdict[data-verdict="value_invalid"] { color: #9F1239; border-color: #E11D48; background: #FFF1F2; }
.det-banner[data-verdict="safety_review_required"], .det-banner[data-verdict="value_invalid"] { background: #FFF1F2; border-left-color: #E11D48; }
.det-banner[data-verdict="safety_review_required"] .det-verdict, .det-banner[data-verdict="value_invalid"] .det-verdict { color: #9F1239; }
.total-pill[data-verdict="safety_review_required"] .total-pill-value, .total-pill[data-verdict="value_invalid"] .total-pill-value { color: #BE123C; }
.total-pill[data-verdict="identity_incomplete"] .total-pill-value { color: var(--accent); }
@media (max-width: 640px) {
  .mobile-verdict-strip[data-verdict="safety_review_required"] .mvs-verdict, .mobile-verdict-strip[data-verdict="value_invalid"] .mvs-verdict { color: #9F1239; }
  .step-legend { flex-direction: column; align-items: flex-start; gap: 2px; }
}

/* Seal card lives below the sheet in the rail: give it a paper card surface so
   its link contrast matches the sheet context (4.5:1+). */
.deliverable-zone .pro-seal { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 14px; padding: 12px 14px; }
