/* ============================================
   MOTOR INCIDENT REPORT — MOBILE-FIRST STYLES
   Brand: #ff6600 orange · #1c1740 navy
   ============================================
   Strategy: base styles target a 320–480px phone.
   min-width breakpoints progressively enhance:
     · 640px : roomier fields, 3-col cards
     · 960px : two-column shell with sidebar stepper,
               in-flow nav (replaces sticky bottom)
   ============================================ */

:root {
  --orange: #ff6600;
  --orange-soft: #ff7a1f;
  --orange-tint: #fff1e6;
  --orange-glow: rgba(255, 102, 0, 0.18);

  --navy: #1c1740;
  --navy-700: #2a2452;
  --navy-500: #4a4570;
  --navy-300: #8a87a3;
  --navy-200: #c5c3d2;

  --white: #ffffff;
  --paper: #fafaf7;
  --light-grey: #f3f3f0;
  --line: #e7e6e1;
  --line-strong: #d4d3cc;

  --success: #16a34a;
  --warn: #ea580c;
  --danger: #dc2626;

  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(28, 23, 64, 0.06);
  --shadow: 0 8px 24px -8px rgba(28, 23, 64, 0.12), 0 2px 4px rgba(28, 23, 64, 0.04);
  --shadow-lg: 0 24px 48px -12px rgba(28, 23, 64, 0.18);
  --shadow-up: 0 -4px 16px -4px rgba(28, 23, 64, 0.08);

  --serif: 'Uniform', 'Helvetica Neue', Arial, sans-serif;
  --sans: 'Poppins', -apple-system, system-ui, sans-serif;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --nav-height: 4.5rem;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--navy);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top right, rgba(255, 102, 0, 0.04), transparent 50%),
    radial-gradient(ellipse at bottom left, rgba(28, 23, 64, 0.04), transparent 50%),
    var(--paper);
}

/* ============= HEADER (mobile) ============= */
.app-header {
  background: var(--navy);
  color: var(--white);
  border-bottom: 3px solid var(--orange);
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-logo img {
  height: 30px;
  width: auto;
  display: block;
}

.brand-text {
  flex: 1;
  min-width: 0;
}

.brand-title {
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.005em;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  display: none; /* shown ≥640px */
  font-size: 0.7rem;
  color: var(--navy-200);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}

.ref-pill {
  flex-shrink: 0;
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.32rem 0.65rem;
  border-radius: 100px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.ref-pill.saved {
  background: rgba(255, 102, 0, 0.18);
  border-color: rgba(255, 102, 0, 0.42);
  color: #ffb380;
}

/* Header save button (mobile only) — sized to match .ref-pill */
.header-save {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  flex-shrink: 0;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.5;
  background: rgba(255, 102, 0, 0.16);
  border: 1px solid rgba(255, 102, 0, 0.45);
  color: #ffb380;
  padding: 0.32rem 0.65rem;
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.1s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.header-save svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.header-save:active {
  background: rgba(255, 102, 0, 0.32);
  color: #ffd6b0;
  transform: scale(0.96);
}

.header-save:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Restore-draft banner */
.restore-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.85rem 1.25rem;
  background: var(--orange-tint);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.restore-text strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.2;
}

.restore-text span {
  font-size: 0.78rem;
  color: var(--navy-500);
}

.restore-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.restore-btn {
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.restore-btn.discard {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--navy-500);
}

.restore-btn.discard:active {
  border-color: var(--navy-500);
  color: var(--navy);
}

.restore-btn.load {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--white);
}

.restore-btn.load:active {
  background: var(--orange-soft);
  transform: scale(0.97);
}

/* Mobile step progress in header */
.header-progress {
  background: var(--navy-700);
  padding: 0.55rem 0.95rem 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.step-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.step-counter {
  color: var(--navy-200);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  font-size: 0.65rem;
  flex-shrink: 0;
}

.step-name-label {
  color: var(--white);
  font-weight: 600;
  font-size: 0.85rem;
  text-align: right;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.005em;
}

.progress-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 100px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--orange-soft));
  border-radius: 100px;
  width: 0%;
  transition: width 0.4s var(--ease);
}

/* ============= LAYOUT (mobile) ============= */
.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.85rem 0.85rem calc(var(--nav-height) + 1.5rem);
}

/* Stepper sidebar hidden on mobile */
.stepper { display: none; }

/* ============= FORM AREA (mobile) ============= */
.form-area {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

#claimForm {
  display: flex;
  flex-direction: column;
}

.step {
  border: none;
  margin: 0;
  padding: 1.5rem 1.1rem 1.25rem;
  display: none;
  animation: stepIn 0.32s var(--ease);
}

.step.is-active { display: block; }

@keyframes stepIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.step-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.step-eyebrow {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 0.5rem;
}

.step-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 0.4rem 0;
  color: var(--navy);
}

.step-lede {
  font-size: 0.9rem;
  color: var(--navy-500);

  margin: 0;
  line-height: 1.5;
}

/* ============= FORM FIELDS (mobile) ============= */
.field {
  display: block;
  margin-bottom: 1.05rem;
}

.field-row {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1.05rem;
}

.field-row.two { grid-template-columns: 1fr; } /* mobile stack */
.field-row .field { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.4rem;
  letter-spacing: -0.005em;
}

.field-label em,
.toggle-label em {
  font-style: normal;
  color: var(--danger);
  font-weight: 700;
  margin-left: 2px;
}

.field-label em.muted,
.toggle-label em.muted {
  color: var(--navy-300);
  font-weight: 400;
  font-style: normal;
  margin-left: 2px;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  padding: 0.85rem 0.95rem;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--white);
  font-family: var(--sans);
  font-size: 16px;       /* prevents iOS zoom on focus */
  line-height: 1.4;
  color: var(--navy);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
  font-feature-settings: "ss01", "tnum";
}

/* Date/time on iOS render at fixed height — give them room */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
  min-height: 50px;
}

input::placeholder, textarea::placeholder { color: var(--navy-300); }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
}

textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.55;
}

select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='none' stroke='%231c1740' stroke-width='2' stroke-linecap='round' d='M3 5l3 3 3-3'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.95rem center;
  padding-right: 2.5rem;
}

input.invalid, textarea.invalid, select.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

/* ============= CHOICE CARDS (mobile = stacked rows) ============= */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.choice-card {
  position: relative;
  display: block;
  cursor: pointer;
}

.choice-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-body {
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  padding: 0.95rem 1rem;
  background: var(--white);
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  transition: all 0.2s var(--ease);
  min-height: 72px;
}

.choice-card:active .choice-body {
  transform: scale(0.99);
}

.choice-card input:checked + .choice-body {
  border-color: var(--orange);
  background: var(--orange-tint);
  box-shadow: 0 0 0 1px var(--orange);
}

.choice-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--light-grey);
  color: var(--navy);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all 0.2s var(--ease);
}

.choice-icon svg { width: 22px; height: 22px; }

.choice-card input:checked + .choice-body .choice-icon {
  background: var(--orange);
  color: var(--white);
}

.choice-text {
  flex: 1;
  min-width: 0;
}

.choice-name {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--navy);
  margin-bottom: 0.2rem;
  letter-spacing: -0.005em;
}

.choice-desc {
  font-size: 0.83rem;
  color: var(--navy-500);
  line-height: 1.4;
}

/* ============= TOGGLE CARDS (mobile) ============= */
.toggle-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  margin-bottom: 1.05rem;
}

.toggle-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 0.95rem;
}

.toggle-card.full { margin-bottom: 1.05rem; }

.toggle-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.55rem;
}

.toggle-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 0.4rem;
}

.toggle-options.grid { grid-template-columns: repeat(auto-fit, minmax(85px, 1fr)); }
.toggle-options.grid-4 { grid-template-columns: repeat(2, 1fr); }

.toggle-options label {
  position: relative;
  cursor: pointer;
}

.toggle-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-options span {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.65rem 0.5rem;
  background: var(--white);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--navy-500);
  transition: all 0.18s var(--ease);
  user-select: none;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.toggle-options input:checked + span {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

.toggle-options label.check input:checked + span {
  background: var(--orange);
  border-color: var(--orange);
}

/* ============= CONDITIONAL ============= */
.conditional, .conditional-block {
  display: none;
  animation: condIn 0.3s var(--ease);
}

.conditional.is-visible, .conditional-block.is-visible {
  display: block;
}

@keyframes condIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============= SKETCH CANVAS (mobile) ============= */
.diagram-wrap {
  margin: 1.25rem 0;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
}

.diagram-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.85rem;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.diagram-head .field-label { margin: 0; }

.diagram-tools {
  display: flex;
  gap: 0.35rem;
}

.tool-btn {
  background: var(--white);
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: var(--sans);
  color: var(--navy-500);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  min-height: 36px;
  -webkit-tap-highlight-color: transparent;
}

.tool-btn:hover { border-color: var(--navy-300); color: var(--navy); }

.tool-btn[aria-pressed="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

.tool-btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--navy-300);
}

.tool-btn.ghost:hover { color: var(--danger); }

#sketchCanvas {
  display: block;
  width: 100%;
  height: 240px;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--white);
  cursor: crosshair;
  touch-action: none;
}

/* ============= UPLOAD ZONE (mobile) ============= */
.upload-zone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  background: var(--paper);
  margin-bottom: 0.85rem;
  -webkit-tap-highlight-color: transparent;
}

.upload-zone:hover, .upload-zone.dragging {
  border-color: var(--orange);
  background: var(--orange-tint);
}

.upload-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.85rem;
  background: var(--white);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--orange);
  border: 1.5px solid var(--line);
}

.upload-icon svg { width: 22px; height: 22px; }

.upload-text strong {
  display: block;
  font-size: 0.95rem;
  color: var(--navy);
  margin-bottom: 0.25rem;
}

.upload-text span {
  font-size: 0.82rem;
  color: var(--navy-500);
}

.file-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.file-list li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.file-list .file-name {
  flex: 1;
  color: var(--navy);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.file-list .file-size {
  color: var(--navy-300);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  font-size: 0.8rem;
}

.file-list .file-remove {
  background: none;
  border: none;
  color: var(--navy-300);
  cursor: pointer;
  padding: 0.4rem 0.5rem;
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
  border-radius: 4px;
  -webkit-tap-highlight-color: transparent;
}

.file-list .file-remove:active { background: rgba(220, 38, 38, 0.1); color: var(--danger); }

/* ============= BANK / SUB SECTIONS ============= */
.bank-section, .declaration {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.subsection-title {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.4rem 0;
  color: var(--navy);
  letter-spacing: -0.005em;
}

.subsection-note {
  font-size: 0.85rem;
  color: var(--navy-500);
  margin: 0 0 1rem 0;
}

/* ============= DECLARATION ============= */
.declaration p {
  font-size: 0.87rem;
  line-height: 1.55;
  color: var(--navy-500);
  background: var(--paper);
  padding: 0.95rem 1rem;
  border-radius: var(--radius);
  border-left: 3px solid var(--orange);
  margin: 0.85rem 0 1.25rem;
}

.check-confirm {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  margin-top: 1rem;
  -webkit-tap-highlight-color: transparent;
}

.check-confirm input {
  margin-top: 0.15rem;
  accent-color: var(--orange);
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.check-confirm span {
  font-size: 0.9rem;
  color: var(--navy);
  line-height: 1.5;
}

.check-confirm:has(input:checked) {
  background: var(--orange-tint);
  border-color: var(--orange);
}

/* ============= REVIEW ============= */
.review-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.review-grid {
  display: grid;
  gap: 0.4rem;
  background: var(--paper);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  max-height: 360px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.review-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.15rem;
  padding: 0.55rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.86rem;
}

.review-row:last-child { border-bottom: none; }

.review-row .label {
  color: var(--navy-500);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

.review-row .value {
  color: var(--navy);
  font-weight: 500;
  word-break: break-word;
}

.review-row .value.empty {
  color: var(--navy-300);
  font-style: italic;
  font-weight: 400;
}

.review-section-head {
  font-family: var(--serif);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.85rem 0 0.4rem;
  border-bottom: 2px solid var(--orange);
  margin-top: 0.5rem;
}

.review-section-head:first-child { margin-top: 0; padding-top: 0; }

/* ============= NAV (mobile = sticky bottom) ============= */
.form-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 0.85rem;
  padding-bottom: max(0.7rem, env(safe-area-inset-bottom));
  background: var(--white);
  border-top: 1px solid var(--line);
  box-shadow: var(--shadow-up);
  z-index: 40;
}

.nav-spacer { display: none; } /* not used on mobile flex layout */

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0 0.95rem;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  background: var(--white);
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  letter-spacing: -0.005em;
  min-height: 48px;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-btn.ghost {
  background: transparent;
  border-color: var(--line-strong);
  flex-shrink: 0;
  padding: 0 0.85rem;
}

.nav-btn.ghost:active { background: var(--paper); }

.nav-btn.ghost:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.nav-btn.link {
  background: transparent;
  border-color: transparent;
  color: var(--navy-500);
  font-weight: 500;
  font-size: 0.88rem;
  flex-shrink: 0;
  padding: 0 0.5rem;
  display: none; /* hidden on mobile — header has its own save button */
}

.nav-btn.link:active { color: var(--orange); }

.nav-btn.primary {
  background: var(--orange);
  color: var(--white);
  border-color: var(--orange);
  box-shadow: 0 4px 12px -2px var(--orange-glow);
  flex: 1;
}

.nav-btn.primary:active {
  background: var(--orange-soft);
  border-color: var(--orange-soft);
  transform: translateY(1px);
}

/* On very narrow screens, hide back/save text labels (icon-only / minimal) */
@media (max-width: 360px) {
  .nav-btn .nav-text { display: none; }
  .nav-btn.ghost { padding: 0 0.7rem; }
}

/* ============= SUCCESS MODAL ============= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 23, 64, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 100;
  animation: backdropIn 0.25s var(--ease);
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  text-align: center;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.4s var(--ease-spring);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--orange-tint);
  color: var(--orange);
  display: grid;
  place-items: center;
  margin: 0 auto 1rem;
}

.modal-icon svg { width: 32px; height: 32px; }

.modal h2 {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.modal p {
  margin: 0.4rem 0;
  color: var(--navy-500);
  font-size: 0.92rem;
}

.modal p strong {
  color: var(--orange);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.modal-sub {
  font-size: 0.85rem !important;
  margin: 0.85rem 0 1.5rem !important;
}

.modal .nav-btn {
  position: static; /* override fixed if it were inherited */
  width: 100%;
  flex: none;
}

/* ============= TOAST ============= */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 0.85rem);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: var(--white);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all 0.3s var(--ease-spring);
  z-index: 200;
  pointer-events: none;
  border-left: 3px solid var(--orange);
  max-width: calc(100vw - 2rem);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================
   ≥ 640px — small tablets / large phones landscape
   Roomier fields, multi-col cards
   ============================================ */
@media (min-width: 640px) {
  .header-inner {
    padding: 0.95rem 1.25rem;
    gap: 0.95rem;
  }
  .brand-logo img { height: 36px; }
  .brand-title { font-size: 1.1rem; }
  .brand-sub { display: block; }
  .ref-pill { font-size: 0.78rem; padding: 0.4rem 0.85rem; }

  /* Desktop & tablet: header save hidden, in-nav "Save Draft" shown */
  .header-save { display: none; }
  .nav-btn.link { display: inline-flex; align-items: center; }

  .header-progress { padding: 0.6rem 1.25rem 0.85rem; }
  .step-name-label { font-size: 0.92rem; }

  .shell { padding: 1.25rem 1.25rem calc(var(--nav-height) + 1.5rem); }

  .step { padding: 1.85rem 1.85rem 1.5rem; }
  .step-title { font-size: 1.85rem; }
  .step-lede { font-size: 0.95rem; max-width: 56ch; }

  .field-row { gap: 1rem; }
  .field-row.two { grid-template-columns: 1fr 1fr; }

  /* 3-col choice cards with stacked icon over text */
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.85rem;
  }
  .choice-body {
    display: block;
    padding: 1.15rem 1rem;
    min-height: 0;
  }
  .choice-icon { margin-bottom: 0.85rem; }

  .toggle-row { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .toggle-options.grid-4 { grid-template-columns: repeat(4, 1fr); }

  #sketchCanvas { height: 320px; }

  .review-row {
    grid-template-columns: minmax(140px, 32%) 1fr;
    gap: 1rem;
  }
  .review-row .label { font-size: 0.86rem; }
}

/* ============================================
   ≥ 960px — desktop layout
   Sidebar stepper appears, nav goes back in flow
   ============================================ */
@media (min-width: 960px) {
  .header-progress { display: none; } /* sidebar takes over */

  .shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2.75rem;
    align-items: start;
    padding: 2.25rem 1.75rem 4rem;
  }

  /* Stepper sidebar */
  .stepper {
    display: block;
    position: sticky;
    top: 100px;
  }

  .step-list {
    list-style: none;
    margin: 0 0 1.5rem 0;
    padding: 0;
    position: relative;
  }

  .step-list::before {
    content: '';
    position: absolute;
    left: 13px;
    top: 14px;
    bottom: 14px;
    width: 2px;
    background: var(--line);
    z-index: 0;
  }

  .step-list li {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.55rem 0;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: color 0.2s var(--ease);
  }

  .step-list .step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--white);
    border: 2px solid var(--line-strong);
    display: grid;
    place-items: center;
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--navy-300);
    flex-shrink: 0;
    transition: all 0.25s var(--ease);
  }

  .step-list .step-name {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--navy-500);
    transition: color 0.2s var(--ease);
  }

  .step-list li:hover .step-name { color: var(--navy); }

  .step-list li.is-active .step-num {
    background: var(--orange);
    border-color: var(--orange);
    color: var(--white);
    box-shadow: 0 0 0 4px var(--orange-glow);
  }

  .step-list li.is-active .step-name {
    color: var(--navy);
    font-weight: 600;
  }

  .step-list li.is-done .step-num {
    background: var(--navy);
    border-color: var(--navy);
    color: var(--white);
  }

  .step-list li.is-done .step-num::after {
    content: '✓';
    font-size: 0.85rem;
  }

  .step-list li.is-done .step-num span { display: none; }
  .step-list li.is-done .step-name { color: var(--navy); }

  .progress-meta {
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
  }

  .desktop-track {
    height: 6px;
    background: var(--light-grey);
    margin-bottom: 0.5rem;
  }

  .progress-text {
    font-size: 0.78rem;
    color: var(--navy-500);
    letter-spacing: 0.02em;
  }

  #progressText {
    font-weight: 600;
    color: var(--navy);
    font-variant-numeric: tabular-nums;
  }

  /* Form area becomes a contained card; nav is in-flow */
  .form-area {
    overflow: hidden; /* corners clip the in-flow nav cleanly */
  }

  .step {
    padding: 2.5rem 3rem 2rem;
  }

  .step-title { font-size: 2rem; }

  /* Nav back into normal flow at bottom of form */
  .form-nav {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    background: var(--paper);
    box-shadow: none;
    border-top: 1px solid var(--line);
    padding: 1.25rem 3rem;
    padding-bottom: 1.25rem;
    gap: 0.5rem;
  }

  .nav-spacer {
    display: block;
    flex: 1;
  }

  .nav-btn { padding: 0 1.25rem; font-size: 0.92rem; }
  .nav-btn.ghost { padding: 0 1.1rem; }
  .nav-btn.primary {
    flex: 0 0 auto;
  }

  .nav-btn.ghost:hover {
    border-color: var(--navy);
    background: var(--white);
  }

  .nav-btn.link:hover { color: var(--orange); }

  .nav-btn.primary:hover {
    background: var(--orange-soft);
    border-color: var(--orange-soft);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -2px var(--orange-glow);
  }

  .nav-btn.primary:active { transform: translateY(0); }

  /* Toast back to standard bottom position (no fixed nav above it) */
  .toast { bottom: 2rem; }

  .modal { padding: 2.25rem 2.5rem; }
  .modal-icon { width: 72px; height: 72px; }
  .modal-icon svg { width: 38px; height: 38px; }
  .modal h2 { font-size: 1.6rem; }
}

/* ============================================
   Reduced motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================
   Print — review summary friendly
   ============================================ */
@media print {
  .stepper, .form-nav, .app-header, .toast, .modal-backdrop { display: none !important; }
  .step { display: block !important; padding: 1rem 0; page-break-inside: avoid; }
  .form-area { box-shadow: none; border: none; }
  body { background: white; }
}