/* The Agreement's own layout, on the Auto Image App theme (CCC).
   Appearance comes from /shared/aic-app.css and its tokens.css: the .band header,
   .aic-progress, .btn, .field, .chk, .check-segment, .card, .panel .ph, .rb, .note,
   .aic-metric, .aic-eyebrow, .sect, .psh, .pill, .actionbar, .modal, .doc and .foot.
   This sheet adds only what is this page's: the two panes, the preview page, the car
   map, the signature pads, the initials and signed-copy arrangement, phone and print
   rules. It declares no token, no font and no colour of its own (Claude Design
   "Auto Image Design System", themes/app/; shared/DESIGN-CANON.md). */
:root {
  --hub-h: 39px; /* height of the one sticky bar, /shared/hub-nav.js */
}

p { margin-top: 0; }
button { cursor: pointer; }
input, select, textarea { font: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ── the shell: band, then the page's tools row (progress + actions) ───────── */
.page-tools {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 10px 28px; background: var(--page); border-bottom: 1px solid var(--line);
}
.page-tools .aic-progress { flex: 0 1 320px; margin-right: auto; }
#progressBar { width: 0; }

.layout {
  display: grid;
  grid-template-columns: minmax(440px, 650px) minmax(430px, 1fr);
  align-items: start;
  min-height: calc(100vh - var(--hub-h));
}

.form-pane {
  /* in view under the one sticky hub bar while the preview scrolls */
  position: sticky; top: var(--hub-h); align-self: start;
  overflow: auto; max-height: calc(100vh - var(--hub-h));
  padding: 24px 28px 0;
  background: var(--card); border-right: 1px solid var(--line);
}
.pane-title { max-width: 590px; margin-bottom: 12px; }
.pane-title p { margin: 0; color: var(--ink2); font-size: 13px; line-height: 1.55; }

/* the estimator's view (native "Estimator Step", Claude Design 6ea116bc): one readable column of
   cards under the band, no draft preview beside it, a section nav that stays in view */
body.staff-mode .layout, body.customer-single .layout { grid-template-columns: minmax(0, 1fr); }
body.staff-mode .document-pane, body.staff-mode .pane-title, body.staff-mode .step-count,
body.customer-single .document-pane, body.customer-single .pane-title, body.customer-single .step-count { display: none; }
body.staff-mode .form-pane, body.customer-single .form-pane { position: static; max-height: none; overflow: visible; border-right: 0; background: var(--page); }
body.staff-mode .wizard-shell, body.customer-single .wizard-shell { max-width: 760px; margin: 0 auto; }
/* the estimator's view is one long document of sections; its Send sits at the end, after the
   signature, in the page's flow - pinned to the bottom it covered the conditions and certifications
   above it (October 20 grading: 135px of a 844px phone screen). Position only: the bar's look
   (its border and shadow) stays the system's (.actionbar, aic-app.css; _palette_guard). */
body.staff-mode .form-pane .actionbar { position: static; }
/* the customer's percentage is not shown (journey stages; see applyRoleChrome) */
body.no-progress .page-tools .aic-progress { display: none; }
/* a tool, a step count or a whole tools row the stage does not offer is not drawn */
.page-tools[hidden], .page-tools [hidden], .wizard-actions[hidden], .wizard-actions [hidden], .step-count[hidden], .header-subtitle[hidden] { display: none; }
/* .field is display:flex in aic-app.css, which outranks the hidden attribute: the start page's
   Direct line showed for every customer, a known estimator included (Ben, 2026-10-20). It is
   asked only when "Other (enter direct line)" is chosen. */
.field[hidden] { display: none; }
.staff-subnav { top: var(--hub-h); padding: 0 12px; }
.staff-certify { display: grid; gap: 18px; }
#staffAnswers, #estimateUploadCard, #staffParts, #staffConditions, #staffCertify { scroll-margin-top: calc(var(--hub-h) + 58px); }
@media (max-width: 760px) { .staff-subnav { margin: 0 -14px; padding: 0 14px; } }

/* One column that never grows past the pane: content (a long option, a table)
   wraps or scrolls inside it instead of widening the step past a phone screen. */
.wizard-shell { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: 590px; }
.step-count { width: fit-content; }
.wizard-step { min-width: 0; min-height: 0; padding-bottom: 8px; overflow-wrap: anywhere; }
/* A field's control fills the field and no more: a select is otherwise as wide as
   its longest option, which on a phone pushed the whole step sideways. */
.field { min-width: 0; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; max-width: 100%; }
.step-lede { max-width: 58ch; margin: 0 0 16px; color: var(--ink); font-size: 14px; line-height: 1.55; }
.field-stack { display: grid; gap: 18px; }

/* the pane's sticky .actionbar spans the pane edge to edge */
.form-pane .actionbar {
  justify-content: space-between; align-items: center;
  margin: 8px -28px 0; padding: 12px 28px;
}
.wizard-action-right { display: flex; align-items: center; justify-content: flex-end; gap: 14px; min-width: 0; }
.wizard-actions .btn { min-width: 116px; }
.validation-summary { max-width: 270px; color: var(--red); font-size: 12.5px; font-weight: 600; text-align: right; }

/* ── panels inside a step ─────────────────────────────────────────────────── */
.note p:last-child, .rb p:last-child { margin-bottom: 0; }
.decision-stop-actions { display: grid; gap: 10px; margin-top: 14px; }
.decision-stop-actions .btn { width: 100%; }

.phase-panel { margin-bottom: 16px; padding: 10px 12px; }
.phase-panel p { margin: 4px 0 0; line-height: 1.5; }
.customer-phase, .staff-phase, .staff-phase-success { display: grid; }

.locked-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; margin-bottom: 16px; }
.locked-summary .field strong,
.signed-value {
  display: block; padding: 6px 2px; border-bottom: 1px solid var(--line-in);
  color: var(--ink); font-size: 14px; font-weight: 400; overflow-wrap: anywhere;
}

.handoff-panel, .link-panel, .policy-card, .estimate-upload-card, .ocr-card, .staff-deposit-summary,
.staff-completion-card, .estimator-signature-block, .customer-narrative, .carmap-wrap,
.payment-stack, .charges-summary-notes, .payment-commitment { padding: 16px; }

.handoff-panel { display: grid; gap: 10px; margin-bottom: 16px; line-height: 1.5; }
.handoff-panel p { margin-bottom: 0; }

.link-panel { display: grid; gap: 8px; }
.link-panel strong { color: var(--ink); font-weight: 600; }
.link-panel p { margin: 0; line-height: 1.45; }
.link-panel code {
  display: block; max-height: 104px; overflow: auto; padding: 8px 10px;
  background: var(--sub); border: 1px solid var(--line); border-radius: 3px;
  font-family: var(--mono); font-size: 12px; line-height: 1.35; word-break: break-all; white-space: normal;
}
.copy-status { min-height: 18px; color: var(--blue-dd) !important; font-size: 12.5px; font-weight: 600; }

/* the charges: each amount is an .aic-metric, the total its .priority */
.charge-lines { display: grid; gap: 10px; }
.deposit-preview { display: grid; gap: 4px; }
.deposit-preview .lbl { margin-top: 0; }
.deposit-preview[hidden] { display: none; } /* an unrequested charge stays hidden */
.charge-detail { display: grid; gap: 14px; }
.deposit-controls { display: grid; gap: 12px; }
.payment-stack { display: grid; gap: 6px; }
.payment-stack > strong { font-size: 14px; font-weight: 600; }
.payment-stack p { margin: 0 0 6px; line-height: 1.45; }
.payment-stack--customer, .payment-stack--review { margin-bottom: 16px; }
.charges-summary-notes { margin-top: 16px; }
.charges-summary-notes p { margin: 0 0 8px; font-weight: 600; }
.charges-summary-notes ul { display: grid; gap: 6px; margin: 0; padding-left: 20px; line-height: 1.45; }
.handoff-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.conditional-fields[hidden] { display: none; }

.inconsistency-panel { margin-top: 16px; }
.inconsistency-title { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.inconsistency-panel ul { margin: 0; padding-left: 20px; }
.inconsistency-panel li { margin-bottom: 6px; line-height: 1.45; }
.inconsistency-panel li:last-child { margin-bottom: 0; }

.customer-narrative { margin-bottom: 16px; line-height: 1.55; }
.customer-narrative p { margin: 0 0 10px; }
.customer-narrative p:last-child { margin-bottom: 0; }
.customer-narrative strong { color: var(--blue-dd); font-weight: 600; }
.customer-narrative em { font-style: normal; font-weight: 600; }
.customer-narrative .narrative-lead { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.narrative-warnings { margin-top: 16px; }
.action-link { justify-content: center; }

/* ── questions ─────────────────────────────────────────────────────────────── */
.field-label { display: flex; align-items: flex-start; gap: 8px; line-height: 1.35; }
.field-label label { min-width: 0; cursor: pointer; }
/* the phone entry is a one-line textarea: it reads as the field's underline input */
.field .phone-entry {
  min-height: 0; height: auto; padding: 6px 2px; overflow: hidden; resize: none; white-space: nowrap;
  border: none; border-bottom: 1px solid var(--line-in); border-radius: 0; background: transparent;
}
.field .phone-entry:focus { border: none; border-bottom: 2px solid var(--blue); box-shadow: none; padding-bottom: 5px; }
.field-control.invalid input,
.field-control.invalid select,
.field-control.invalid .phone-entry { border-bottom-color: var(--red); }
.field-control.invalid textarea:not(.phone-entry) { border-color: var(--red); }
.chk.invalid .bx { border-color: var(--red); }
.error-text { display: none; color: var(--red); font-size: 12.5px; font-weight: 600; }
.field-control.invalid .error-text { display: block; }
.required-mark { color: var(--red); }
.field-optional { color: var(--ink2); font-weight: 400; }
.conditional-note { margin: 0; }

/* .chk draws the box (.bx); the real checkbox lies over it, invisible, to take the tap */
.chk { position: relative; }
.chk > input[type="checkbox"] { position: absolute; left: 0; top: 5px; width: 16px; height: 16px; margin: 0; opacity: 0; cursor: pointer; }
.chk label { cursor: pointer; line-height: 1.45; }
.chk .info-tip { margin-left: auto; }
.wizard-step .chk { margin-top: 14px; }

.info-tip { position: relative; display: inline-flex; align-items: center; flex: 0 0 auto; margin-top: 1px; outline: 0; }
.info-icon {
  display: inline-grid; place-items: center; width: 18px; height: 18px;
  color: var(--blue-dd); background: var(--blue-bg); border: 1px solid var(--blue-line); border-radius: 50%;
  font-size: 11px; font-weight: 700; line-height: 1;
}
.info-bubble {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  width: 300px; max-width: calc(100vw - 48px); padding: 10px 12px; visibility: hidden;
  color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .05); font-size: 12.5px; line-height: 1.45;
}
.info-tip:hover .info-bubble, .info-tip:focus .info-bubble, .info-tip:focus-within .info-bubble { visibility: visible; }

/* the car map: a page-specific drawing, painted in tokens */
.field-carmap .field-label { margin-bottom: 4px; }
.carmap-hint { margin: 0 0 10px; color: var(--ink2); font-size: 12.5px; }
.carmap-wrap { display: grid; gap: 12px; background: var(--sub); }
.car-map { display: block; width: 100%; max-width: 300px; height: auto; margin: 0 auto; }
.car-orient-label { fill: var(--blue-dd); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; pointer-events: none; user-select: none; }
.car-wheels .car-wheel { fill: var(--ink); stroke: var(--ink); stroke-width: 1.5; pointer-events: none; }
.car-glass .car-glass-band { fill: var(--blue-bg); stroke: var(--blue-line); stroke-width: 1; pointer-events: none; }
.car-map .zone { fill: #fff; stroke: var(--line-in); stroke-width: 1.5; cursor: pointer; }
.car-map .zone:hover { fill: var(--blue-bg); stroke: var(--blue-d); }
.car-map .zone.selected { fill: var(--blue); stroke: var(--blue-dd); }
.car-map .zone:focus { outline: 0; stroke: var(--blue-d); stroke-width: 2.5; }
.car-zone-label { fill: var(--ink2); font-size: 9px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; pointer-events: none; user-select: none; }
/* only the selected zone's own label (it follows its zone): a "~" here whitened every later label */
.car-map .zone.selected + .car-zone-label { fill: #fff; }
.carmap-extras { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.carmap-extra-btn.selected { background: var(--blue); color: #fff; }
.carmap-summary { margin: 0; padding-top: 6px; border-top: 1px solid var(--line-in); text-align: center; font-size: 13px; font-weight: 600; }

/* the shop's policies inside a step */
.policy-list { display: grid; gap: 12px; margin-top: 16px; }
.policy-heading .sect { padding: 0 0 6px; margin: 0; }
.policy-heading p { margin-bottom: 10px; color: var(--ink2); font-size: 13px; line-height: 1.55; }
.policy-terms { display: grid; gap: 8px; font-size: 13.5px; line-height: 1.55; }
.policy-terms p { margin-bottom: 0; }

/* signatures */
.signature-grid { display: grid; grid-template-columns: 1fr 160px; gap: 14px; }
.signature-mode { margin: 16px 0; }
.signature-mode .mode-btn { min-width: 92px; }
.signature-pad-wrap { overflow: hidden; background: var(--card); border: 1px solid var(--line-in); border-radius: 3px; }
#signaturePad, .estimator-signature-block #estimatorSignaturePad { display: block; width: 100%; height: 180px; touch-action: none; }

/* ── the preview pane: the agreement as a page ─────────────────────────────── */
.document-pane { min-width: 0; background: var(--page); }
.document-toolbar { position: sticky; top: var(--hub-h); z-index: 10; }
.document-scroll { display: grid; gap: 24px; justify-items: center; padding: 28px; }
.page { position: relative; width: min(100%, 780px); aspect-ratio: 612 / 792; overflow: hidden; }
.page.page-doc { aspect-ratio: auto; overflow: visible; padding: 36px 40px; }
.doc-head { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.doc-head .psh { margin: 8px 0 0; }
.doc-sect { padding-top: 16px; break-inside: avoid-page; }
.doc-sect .sect { padding-top: 0; }
.doc-note { margin: 8px 0 0; color: var(--ink2); font-size: 13px; line-height: 1.45; }
.doc-signature { display: block; max-width: 240px; max-height: 72px; margin-top: 10px; }
.review-list { display: grid; gap: 10px; }
.review-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.review-item strong { display: block; margin-bottom: 4px; font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.review-item span { color: var(--ink2); line-height: 1.45; }

/* the review dialog is the system's .modal, as wide as the agreement needs to read whole */
dialog.review-modal { width: min(1040px, calc(100vw - 32px)); max-width: none; padding: 0; border: 0; color: var(--ink); }
dialog.review-modal::backdrop { background: var(--scrim); }
.review-modal form { margin: 0; }
/* header and footer stay in place at any height; only the agreement scrolls between them (native Customer Review, 6ea116bc) */
dialog.review-modal[open] { display: flex; flex-direction: column; overflow: hidden; max-height: min(90dvh, 900px); }
.review-modal form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.review-modal .mh, .review-modal .mf { flex: none; }
.review-modal .mh { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.review-modal .mb { flex: 1 1 auto; min-height: 0; overflow: auto; }

/* ── the estimator's cards ─────────────────────────────────────────────────── */
.card-eyebrow { display: block; margin-bottom: 6px; }
.estimate-upload-head p { margin: 0 0 12px; line-height: 1.45; }
.upload-cta { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: auto; min-height: 76px; }
.upload-icon { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 14px; font-weight: 600; line-height: 1; }
.upload-cta:hover .upload-icon { background: var(--blue-d); }
.estimate-upload-preview {
  display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; padding: 12px;
  background: var(--sub); border: 1px solid var(--line); border-radius: 3px;
}
.estimate-thumb {
  display: grid; place-items: center; width: 64px; height: 80px; overflow: hidden; object-fit: cover;
  background: var(--card); border: 1px solid var(--line-in); border-radius: 3px;
}
.estimate-thumb.pdf-thumb { color: var(--blue-dd); background: var(--blue-bg); border-color: var(--blue-line); font-size: 11px; font-weight: 600; letter-spacing: .06em; }
.estimate-upload-meta { min-width: 0; }
.estimate-upload-meta strong { display: block; font-size: 14px; font-weight: 600; word-break: break-word; }
.estimate-upload-meta small { color: var(--ink2); font-size: 12px; }
.estimate-upload-actions { display: flex; gap: 8px; grid-column: 1 / -1; margin-top: 4px; }

.ocr-card.ocr-pending { background: var(--sub); color: var(--ink2); }
.ocr-card.ocr-pending p { margin-bottom: 0; }
.ocr-card.ocr-extracting { background: var(--blue-bg); }
.ocr-progress { display: flex; align-items: center; gap: 14px; color: var(--blue-dd); }
.ocr-progress p { margin: 0; line-height: 1.4; }
.ocr-spinner { flex: 0 0 auto; width: 22px; height: 22px; border: 3px solid var(--blue-line); border-top-color: var(--blue); border-radius: 50%; animation: ocr-spin .75s linear infinite; }
@keyframes ocr-spin { to { transform: rotate(360deg); } }
.ocr-helper { margin: 0 0 14px; font-size: 13px; line-height: 1.45; }
.ocr-card .signature-grid + .field-control { margin-top: 14px; }

.staff-deposit-summary .charge-lines { margin-top: 4px; }
.deposit-summary-empty { background: var(--sub); color: var(--ink2); }
.deposit-summary-empty p { margin: 0; line-height: 1.45; }
.estimator-signature-block p { margin: 6px 0 12px; line-height: 1.45; }
.estimator-signature-block .signature-mode { margin: 0 0 14px; }
.staff-completion-card { display: grid; gap: 8px; }
.staff-completion-card .charge-lines { margin-top: 6px; }
.dispatch-note { margin: 0 0 16px; color: var(--ink2); font-size: 12.5px; line-height: 1.5; }

/* where the car is: the SOP's stages as one-tap buttons */
.stage-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.stage-grid button { flex: 0 1 auto; }

/* the finished estimate, shown in full before its terms (journey) */
.estimate-view { display: block; width: 100%; height: min(70vh, 720px); margin: 12px 0; background: var(--card); border: 1px solid var(--line); }
img.estimate-view { height: auto; }
.estimate-view-note { display: none; }
.caveat-row .caveat-id { width: 5.5em; margin-left: 6px; }

/* ── initials and the signed copy (commitments.ts, narrative.ts): each section is a
   .panel with its .ph strip, as the signed PDF draws it ────────────────────── */
.initials-box {
  display: inline-flex; align-items: center; justify-content: center; min-width: 56px; height: 40px; padding: 0 6px;
  background: var(--card); border: 1.5px solid var(--ink); font-size: 14px; font-weight: 700; letter-spacing: .02em;
}
.initials-done { display: flex; align-items: center; gap: 10px; margin: 6px 0; color: var(--ink2); }
.initials-entry { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.initials-entry input { width: 7.5em; text-transform: uppercase; font-weight: 600; letter-spacing: .04em; }
.initials-with-label { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.initials-with-label small { color: var(--ink3); font-size: 11px; }
/* the signed copy's initials: the .field the PDF draws - caption, the initials on an underline, revision and time */
.initials-field { flex: none; width: 10.5em; padding-top: 0; }
.initials-field label { text-align: center; }
.initials-value { display: block; min-height: 1.75em; padding: 4px 2px 5px; border-bottom: 1px solid var(--line-in); color: var(--ink); font-size: 14px; font-weight: 700; text-align: center; }
.initials-field small { display: block; margin-top: 3px; color: var(--ink3); font-size: 10.5px; line-height: 1.35; text-align: right; }
.commitment-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; }
.commitment-head .sect { margin: 0; padding: 0; }
.commitment-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; margin: 8px 0 0; }
.commitment-facts dt { color: var(--ink2); }
.commitment-facts dd { margin: 0; }
.payment-commitment .initials-control { margin-top: 12px; }

.signed-copy { margin: 16px 0; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.signed-copy .psh { margin-bottom: 12px; }
.signed-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 4px 24px; padding: 10px 15px 14px; }
.signed-panel { margin-top: 12px; }
/* a long name beside a section title wraps at the right instead of squeezing the title */
.signed-panel .ph { align-items: flex-start; gap: 10px; }
.signed-panel .ph .r { min-width: 0; text-align: right; overflow-wrap: anywhere; }
.signed-body { padding: 12px 15px; }
.signed-body p { margin: 0 0 10px; }
.signed-body p:last-child { margin-bottom: 0; }
.signed-commitment + .signed-commitment { border-top: 1px solid var(--line); }
.signed-commitment { padding: 10px 0; }
.signed-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px 24px; }
.signed-condition { align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.signed-condition:last-child { border-bottom: 0; }
.signed-condition p { flex: 1 1 260px; margin: 0; }
.signed-note { color: var(--ink2); font-size: 13px; }
.signed-signatures { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 20px 36px; margin-top: 14px; }
.signed-signature { display: flex; flex-direction: column; gap: 4px; }
.signed-signature-mark { display: flex; align-items: flex-end; min-height: 52px; padding-bottom: 6px; border-bottom: 1.5px solid var(--ink); }
.signed-signature-mark img { max-width: 100%; max-height: 48px; }
.signed-signature strong { font-size: 13.5px; font-weight: 600; }
.signed-typed { color: var(--blue); font-size: 17px; font-style: italic; }
.signed-who { color: var(--ink2); font-size: 12.5px; }

/* the advance order (Claude Design "Agreement Parts Review", 2026-10-15): layout only */
.advance-changes { margin-bottom: 14px; }
.advance-changes .drow { cursor: default; }
.advance-note, .advance-changes .advance-note { margin: 8px 0 12px; padding: 0 15px 0 0; font-size: 12.5px; color: var(--ink2); }
.advance-changes .advance-note { padding: 9px 15px; margin: 0; }
.advance-parts tr { cursor: default; }
.advance-parts .advance-total td { font-weight: 600; border-bottom: 0; }
.advance-restock, .advance-words { margin: 0 0 10px; }
.advance-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto; gap: 12px; align-items: end; margin-bottom: 8px; }
/* narrow screens: the part's name gets the whole line; its price and Remove share the next */
@media (max-width: 520px) {
  .advance-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; margin-bottom: 14px; }
  .advance-row > .field:first-child { grid-column: 1 / -1; }
}
.advance-deposit { margin: 10px 0 0; font-size: 13px; color: var(--ink2); }
.advance-deposit b { color: var(--ink); padding-left: 6px; }

/* ── the phone-first landing page (no token): only the band and one card ───── */
body.landing-mode .document-pane,
body.landing-mode .page-tools,
body.landing-mode .step-count,
body.landing-mode .pane-title,
body.landing-mode .wizard-actions { display: none !important; }
body.landing-mode .layout { grid-template-columns: 1fr; }
body.landing-mode .form-pane {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 32px 20px 40px; max-height: none; overflow: visible; border-right: 0; background: var(--page);
}
body.landing-mode .wizard-shell { width: 100%; max-width: 520px; gap: 0; }
.landing-card { display: grid; gap: 16px; padding: 24px; }
.landing-card .psh { margin-bottom: 0; }
.landing-subtitle { margin: 0; line-height: 1.5; }
.landing-fields { display: grid; gap: 16px; }
.landing-consent { margin-top: 4px; padding: 10px 12px; background: var(--sub); }
.landing-consent a { color: var(--blue-dd); text-decoration: underline; }
.landing-submit { width: 100%; }
.landing-status { min-height: 18px; margin: 0; color: var(--red); font-size: 13px; text-align: center; }
.landing-dev-link { padding: 10px; background: var(--sub); border: 1px solid var(--line); border-radius: 3px; font-size: 12px; word-break: break-all; }
.landing-dev-link a { color: var(--blue-dd); text-decoration: underline; }
.landing-footer { margin: 0; color: var(--ink2); font-size: 12.5px; text-align: center; }

/* ── the policy pages (privacy.html, terms.html): .card.doc in a narrow .wrap ── */
.policy-main { max-width: 860px; padding-top: 16px; }
.policy-meta { margin: 0 0 18px; }
.policy-article section { margin-bottom: 22px; }
.policy-article section:last-child { margin-bottom: 0; }
.policy-article h2:first-child { margin-top: 0; }

/* ── widths ────────────────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(420px, 600px) minmax(360px, 1fr); }
  .form-pane { padding: 22px 24px 0; }
  .form-pane .actionbar { margin: 8px -24px 0; padding: 12px 24px; }
  .document-scroll { padding: 24px; }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .form-pane { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .document-toolbar { position: static; }
  .wizard-shell, .pane-title { max-width: none; }
  .signature-grid, .locked-summary { grid-template-columns: 1fr; }
  /* Back and Next side by side, so the pinned bar is one row of controls, not a stack of them */
  .form-pane .actionbar { flex-direction: row; align-items: flex-end; gap: 10px; }
  .wizard-action-right { flex: 1 1 auto; flex-direction: column; align-items: stretch; gap: 8px; }
  .wizard-action-right .btn, .validation-summary { width: 100%; }
  .validation-summary { max-width: none; text-align: left; }
  .validation-summary:empty { display: none; }
}

@media (max-width: 760px) {
  body { background: var(--card); }
  .page-tools { flex-wrap: wrap; padding: 8px 14px; }
  .page-tools .aic-progress { flex: 1 1 100%; margin-right: 0; }
  .header-subtitle, .pane-title p { display: none; }
  .layout { display: block; min-height: auto; }
  .form-pane { padding: 16px 14px 0; background: var(--card); border-bottom: 0; }
  .form-pane .actionbar { margin: 8px -14px 0; padding: 10px 14px 12px; }
  .wizard-shell { gap: 14px; }
  .step-lede { margin-bottom: 14px; }
  .field-stack { gap: 16px; }
  .field input, .field select, .field textarea { font-size: 16px; } /* no zoom on focus (iOS) */
  .wizard-actions .btn { height: 44px; }
  .handoff-actions { grid-template-columns: 1fr; }
  .info-bubble { position: fixed; right: 14px; bottom: 86px; left: 14px; top: auto; width: auto; max-width: none; }
  .document-pane { display: none; }
  .estimate-view--embed { display: none; }
  .estimate-view-note { display: block; }
  .estimate-upload-preview { grid-template-columns: 56px 1fr; gap: 10px; }
  .estimate-thumb { width: 56px; height: 70px; }
  .estimate-upload-actions { flex-wrap: wrap; }
  .estimator-signature-block #estimatorSignaturePad { height: 150px; }
  body.landing-mode .form-pane { padding: 20px 14px 32px; }
  .landing-card { padding: 18px; }
  /* narrow phones: the agreement takes the dialog's whole width; facts stack */
  dialog.review-modal { width: calc(100vw - 12px); }
  .review-modal .mb { padding: 12px 10px; }
  .page.page-doc { padding: 16px 12px; box-shadow: none; }
  .signed-body, .signed-facts { padding-left: 12px; padding-right: 12px; }
  .signed-condition p { flex-basis: 100%; }
}

@media (max-width: 400px) {
  .estimate-upload-actions .btn { flex: 1 1 calc(50% - 4px); }
  .ocr-card .signature-grid { gap: 12px; }
}

@media print {
  .band, .page-tools, .form-pane, .document-toolbar, dialog { display: none; }
  .layout { display: block; }
  .document-scroll { padding: 0; background: #fff; }
  .page { width: 100%; box-shadow: none; border: 0; page-break-after: always; }
}
