/* ---------- Tokens ---------- */
:root {
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --ink: #061B31;
  --body: #64748D;
  --muted: #6B7280;
  --line: #E5EDF5;
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-weak: #E0F2FE;
  --accent-weak-2: #EFF6FF;
  --success: #15BE53;
  --success-text: #108C3D;
  --success-weak: #DCFCE7;
  --error: #DC2626;
  --error-weak: #FEF2F2;
  --shadow-tile:
    rgba(50,50,93,0.08) 0px 30px 45px -30px,
    rgba(0,0,0,0.05) 0px 18px 36px -18px;
  --shadow-btn: 0 0 0 1px rgba(37,99,235,0.1), 0 2px 4px rgba(37,99,235,0.18), 0 8px 20px -4px rgba(37,99,235,0.35);
  --consent-banner-clearance: 0px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100vh; }
html { scroll-padding-bottom: calc(var(--consent-banner-clearance) + env(safe-area-inset-bottom)); }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  font-feature-settings: "ss01";
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}
body.consent-banner-visible {
  padding-bottom: calc(var(--consent-banner-clearance) + env(safe-area-inset-bottom));
}
h1,h2,h3,h4 { margin: 0; font-weight: 300; letter-spacing: -0.025em; color: var(--ink); }
p { margin: 0; color: var(--body); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.nav-inner {
  max-width: 1240px; margin: 0 auto; padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 500; font-size: 17px; letter-spacing: -0.02em; color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--ink); display: grid; place-items: center;
  color: var(--surface);
  font-family: 'Geist Mono', monospace;
  font-size: 12px; font-weight: 500;
}
.brand-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-left: 2px; }
.nav-back {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--body); text-decoration: none;
  transition: color .15s;
}
.nav-back:hover { color: var(--ink); }
.nav-back svg { width: 14px; height: 14px; }

.consent-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 100;
  display: none;
  max-width: 760px;
  margin: 0 auto;
  padding: 14px;
  background: color-mix(in srgb, var(--surface) 98%, transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-tile);
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}
.consent-banner.show { display: flex; }
.consent-banner p { font-size: 13px; line-height: 1.4; }
.consent-actions { display: flex; gap: 8px; flex-shrink: 0; }
@media (max-width: 640px) {
  .consent-banner { flex-direction: column; align-items: stretch; }
  .consent-actions { width: 100%; }
  .consent-actions .btn { flex: 1; justify-content: center; }
}

/* ---------- Layout ---------- */
.shell {
  max-width: 1100px; margin: 0 auto; padding: 48px 32px 80px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}
@media (max-width: 900px) { .shell { grid-template-columns: minmax(0, 1fr); gap: 24px; } }
.shell > main { min-width: 0; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky; top: 80px;
}
.process-toggle {
  display: none;
  width: 100%;
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.process-toggle-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.process-toggle h2 {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.process-toggle p {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.4;
}
.process-toggle-icon {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--body);
  flex-shrink: 0;
  transition: transform .18s ease;
}
.process-toggle-icon svg {
  width: 14px;
  height: 14px;
}
.sidebar-head {
  margin-bottom: 28px;
}
.eyebrow {
  font-family: 'Geist Mono', monospace;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); display: block; margin-bottom: 8px;
}
.sidebar-head h2 {
  font-size: 22px; line-height: 1.15;
}

.steps { display: flex; flex-direction: column; gap: 0; position: relative; }
.steps::before {
  content: "";
  position: absolute;
  left: 13px; top: 28px; bottom: 28px;
  width: 1px;
  background: var(--line);
}
.step {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 10px 0;
  position: relative;
}
.step-bullet {
  flex-shrink: 0;
  width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--surface);
  display: grid; place-items: center;
  font-family: 'Geist Mono', monospace;
  font-size: 11px; color: var(--muted);
  position: relative; z-index: 1;
  transition: all .2s;
}
.step.active .step-bullet {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.step.done .step-bullet {
  border-color: var(--success);
  background: var(--success-weak);
  color: var(--success-text);
}
.step.done .step-bullet svg { width: 12px; height: 12px; }
.step-text {}
.step-label {
  font-size: 13px; font-weight: 500; color: var(--ink);
  letter-spacing: -0.005em;
}
.step.inactive .step-label { color: var(--muted); }
.step-desc {
  font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.4;
}

.sidebar-note {
  margin-top: 32px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-tile);
}
.sidebar-note .note-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--success-weak);
  display: grid; place-items: center;
  color: var(--success-text);
  margin-bottom: 12px;
}
.sidebar-note h4 {
  font-size: 13px; font-weight: 500; margin-bottom: 6px;
}
.sidebar-note p {
  font-size: 12px; line-height: 1.5; color: var(--body);
}

@media (max-width: 900px) {
  .sidebar {
    position: static;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-tile);
    padding: 16px;
  }
  .sidebar-head { display: none; }
  .process-toggle { display: block; }
  .sidebar-body {
    display: none;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
  }
  .sidebar.is-open .sidebar-body { display: block; }
  .sidebar.is-open .process-toggle-icon { transform: rotate(180deg); }
  .steps::before { bottom: 22px; }
  .step { padding: 8px 0; }
  .sidebar-note {
    margin-top: 18px;
    padding: 14px;
    box-shadow: none;
  }
}

@media (max-width: 600px) {
  .shell { padding: 28px 18px 56px; }
  .submit-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .submit-left { text-align: center; }
  .submit-bar .btn {
    width: 100%;
    justify-content: center;
  }
  .sig-wrap canvas { height: 220px; }
  .airport-option { padding: 12px 10px; }
}

/* ---------- Form card ---------- */
.reactivation-gate {
  display: none;
  padding: 36px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-tile);
}
.reactivation-gate.show,
html.reactivation-pending .reactivation-gate {
  display: block;
}
.reactivation-gate [hidden] { display: none; }
html.reactivation-pending #form-intro,
html.reactivation-pending #claim-form {
  display: none;
}
.reactivation-gate-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  border-radius: 10px;
  background: var(--accent-weak-2);
  color: var(--accent);
}
.reactivation-gate-icon svg {
  width: 22px;
  height: 22px;
}
.reactivation-gate .form-title {
  max-width: 560px;
  line-height: 1.08;
}
.reactivation-gate-copy {
  max-width: 620px;
  margin-top: 14px;
  font-size: 15px;
}
.reactivation-gate-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0 0;
}
.reactivation-gate-details[hidden] { display: none; }
.reactivation-gate-details div {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}
.reactivation-gate-details dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
}
.reactivation-gate-details dd {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}
.reactivation-gate-status,
.reactivation-gate-error {
  margin-top: 20px;
  font-size: 13px;
}
.reactivation-gate-error {
  color: var(--error);
}
.reactivation-gate-error:empty { display: none; }
.reactivation-gate .btn {
  margin-top: 22px;
}
.reactivation-gate-help {
  margin-top: 18px;
  font-size: 12px;
}
.reactivation-gate-help a {
  color: var(--accent);
  font-weight: 500;
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-tile);
  overflow: hidden;
}
.form-section {
  padding: 32px 36px;
  border-bottom: 1px solid var(--line);
}
.form-section:last-of-type { border-bottom: none; }
.form-section-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px;
}
.form-section-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-weak);
  display: grid; place-items: center;
  font-family: 'Geist Mono', monospace;
  font-size: 11px; color: var(--accent);
  flex-shrink: 0;
}
.form-section-head h3 {
  font-size: 16px; font-weight: 500; letter-spacing: -0.01em;
}
.form-section-head p {
  font-size: 13px; color: var(--muted); margin-top: 1px;
}
.form-section-head p a { color: var(--accent); }
.required-marker {
  margin-left: 2px;
  color: var(--accent);
}

/* ---------- Fields ---------- */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
}
.field-full { grid-column: 1 / -1; }
@media (max-width: 600px) { .field-grid { grid-template-columns: 1fr; } .field-full { grid-column: 1; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field[hidden],
.participant-card [hidden] {
  display: none !important;
}
[data-flight-section][hidden],
[data-flight-section].is-hidden {
  display: none !important;
}

.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--body) 50%), linear-gradient(135deg, var(--body) 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px;
  background-repeat: no-repeat;
  background-size: 5px 5px;
  padding-right: 36px;
}

#disruption-type:required:invalid,
#flight-date:required:invalid,
#flight-date:required:invalid::-webkit-datetime-edit {
  color: var(--muted);
}

#disruption-type option {
  color: var(--ink);
}

.field label {
  font-size: 12px; font-family: 'Geist Mono', monospace;
  letter-spacing: 0.02em; color: var(--body);
}
.field label .req { color: var(--accent); margin-left: 2px; }
.input {
  width: 100%;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 14px;
  font-family: 'Geist', sans-serif;
  font-size: 16px; color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}
.input::placeholder { color: var(--muted); }
.input[type="date"],
.input[type="time"] {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}
@supports (-webkit-touch-callout: none) {
  @media (hover: none) and (pointer: coarse) {
    .input[type="date"],
    .input[type="time"] {
      -webkit-appearance: none;
      appearance: none;
      position: relative;
      text-align: left;
    }

    .input[type="date"]::-webkit-date-and-time-value,
    .input[type="time"]::-webkit-date-and-time-value {
      min-height: 1.5em;
      text-align: left;
    }

    .input[type="date"]:not(.has-value)::-webkit-date-and-time-value,
    .input[type="time"]:not(.has-value)::-webkit-date-and-time-value {
      color: transparent;
    }

    .input[type="date"]:not(.has-value)::before,
    .input[type="time"]:not(.has-value)::before {
      content: attr(placeholder);
      position: absolute;
      top: 50%;
      left: 14px;
      right: 44px;
      transform: translateY(-50%);
      color: var(--muted);
      overflow: hidden;
      pointer-events: none;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }
}
.input.mono { font-family: 'Geist Mono', monospace; letter-spacing: 0.02em; }
.input.error { border-color: var(--error); box-shadow: 0 0 0 4px color-mix(in srgb, var(--error) 10%, transparent); }
.field-hint { font-size: 11px; color: var(--muted); font-family: 'Geist Mono', monospace; }
.field-error {
  display: none;
  font-size: 12px;
  color: var(--error);
}
.field-error.show { display: block; }
.field-warning {
  padding: 10px 12px;
  border: 1px solid #FCD34D;
  border-radius: 8px;
  background: #FFFBEB;
  color: #92400E;
  font-size: 12px;
  line-height: 1.45;
}
.flight-mode {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.flight-mode label {
  position: relative;
  cursor: pointer;
}
.flight-mode input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.flight-mode span {
  display: block;
  min-width: 104px;
  padding: 8px 14px;
  border-radius: 7px;
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  transition: background .15s, color .15s, box-shadow .15s;
}
.flight-mode input:checked + span {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(6, 27, 49, .08);
}
.flight-mode input:focus-visible + span {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
@media (max-width: 420px) {
  .flight-mode { width: 100%; }
  .flight-mode label { flex: 1; }
  .flight-mode span {
    min-width: 0;
    padding-inline: 10px;
  }
}
.airport-search,
.airline-search {
  position: relative;
}
.airport-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  gap: 4px;
  max-height: 240px;
  overflow: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow-tile);
}
.airport-results[hidden] { display: none; }
.airport-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--body);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.airport-option:hover,
.airport-option:focus,
.airport-option.active {
  outline: none;
  background: var(--accent-weak-2);
}
.airport-option[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: .72;
}
.airport-option .autocomplete-option-disabled {
  grid-column: 2;
  color: var(--danger);
  font-weight: 650;
}
.airport-option strong {
  grid-row: span 2;
  align-self: center;
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  color: var(--accent);
}
.airport-option-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.autocomplete-retry {
  justify-self: start;
  margin: 0 10px 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.autocomplete-retry:focus-visible {
  border-radius: 3px;
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.airport-option span {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
}
.airport-option small {
  color: var(--muted);
  font-size: 11px;
}
.inline-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.inline-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.inline-check label {
  font-family: 'Geist', sans-serif;
  font-size: 13px;
  line-height: 1.45;
  letter-spacing: 0;
  color: var(--body);
  cursor: pointer;
}
.signature-orientation-hint { display: none; }
@media (max-width: 600px) and (orientation: portrait) {
  .signature-orientation-hint {
    display: block;
    margin: 0 0 16px;
    color: var(--body);
    font-size: 13px;
    line-height: 1.45;
  }
}
.participants-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.participants-intro p,
.participant-note {
  font-size: 13px;
  line-height: 1.45;
}
.participants-list {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}
.participants-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}
.participants-footer[hidden] { display: none; }
.participants-footer .secondary-btn { min-height: 44px; }
.participant-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(6, 27, 49, 0.06);
}
.participant-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.participant-card-head strong {
  font-size: 13px;
}
.participant-remove-confirm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -2px 0 14px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--error) 28%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--error) 5%, var(--surface));
}
.participant-remove-confirm[hidden] { display: none; }
.participant-remove-confirm p {
  color: var(--body);
  font-size: 12px;
  line-height: 1.45;
}
.participant-remove-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}
.participant-remove-actions .secondary-btn {
  min-width: 64px;
}
.participant-remove-actions .secondary-btn.danger {
  border-color: color-mix(in srgb, var(--error) 45%, var(--line));
  color: var(--error);
}
.participant-signing-method {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.participant-signing-method legend {
  margin-bottom: 6px;
  padding: 0;
  color: var(--body);
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  letter-spacing: .02em;
}
.participant-signing-method legend .req {
  margin-left: 2px;
  color: var(--accent);
}
.participant-signing-method.error .flight-mode {
  border-color: var(--error);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--error) 12%, transparent);
}
.participant-signing-method .flight-mode span {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}
.participant-signature-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}
.participant-signature-options span { min-width: 0; }
.participant-head-actions { display: flex; gap: 8px; flex-shrink: 0; }
.participant-card-head > strong { min-width: 0; overflow-wrap: anywhere; }
.participant-summary { margin-top: 8px; font-size: 13px; color: var(--body); overflow-wrap: anywhere; }
.participant-card.is-collapsed .participant-card-head { margin-bottom: 0; }
.participant-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--body);
  padding: 9px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.secondary-btn:hover { color: var(--ink); border-color: color-mix(in srgb, var(--line) 50%, var(--muted)); }
.secondary-btn.danger:hover { color: var(--error); border-color: var(--error); }
[data-participant-action="add"] { min-height: 44px; }
.secondary-btn:disabled {
  cursor: not-allowed;
  opacity: .55;
}
@media (max-width: 640px) {
  .participants-intro {
    align-items: stretch;
    flex-direction: column;
  }
  .participants-intro .secondary-btn {
    width: 100%;
  }
  .participants-footer .secondary-btn {
    width: 100%;
  }
  .participant-card-head .secondary-btn {
    min-height: 44px;
  }
  .participant-remove-confirm {
    align-items: stretch;
    flex-direction: column;
  }
  .participant-remove-actions .secondary-btn {
    flex: 1;
    min-height: 44px;
  }
  .participant-signature-options {
    grid-template-columns: 1fr;
  }
}
.participant-signature-block {
  display: grid;
  gap: 12px;
}
.primary-signature {
  display: grid;
  gap: 16px;
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.primary-signature-copy {
  display: grid;
  gap: 6px;
}
.primary-signature-copy > p {
  font-size: 13px;
  line-height: 1.45;
}
.primary-signature-copy > p a { color: var(--accent); }
.primary-signature-minor-context {
  color: var(--ink);
  font-weight: 500;
}
.participant-signature-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

/* ---------- File upload ---------- */
.upload-zone {
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  padding: 28px 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  cursor: pointer;
  background: var(--bg);
  transition: border-color .2s, background .2s;
  text-align: center;
  position: relative;
}
.upload-zone:hover,
.upload-zone.drag { border-color: var(--accent); background: var(--accent-weak-2); }
.upload-zone.error {
  border-color: var(--error);
  background: var(--error-weak);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--error) 10%, transparent);
}
.upload-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.upload-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent-weak);
  display: grid; place-items: center;
  color: var(--accent);
}
.upload-icon svg { width: 20px; height: 20px; }
.upload-label { font-size: 14px; font-weight: 500; color: var(--ink); }
.upload-label-mobile { display: none; }
@media (max-width: 640px) {
  .upload-label-desktop { display: none; }
  .upload-label-mobile { display: inline; }
}
.upload-sub { font-size: 12px; color: var(--muted); }
.upload-files {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 12px; width: 100%;
}
.upload-file-item {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center; gap: 10px;
  min-width: 0; padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}
.upload-file-item .fi-icon {
  width: 44px; height: 44px; border-radius: 6px;
  background: var(--accent-weak); display: grid; place-items: center;
  color: var(--accent); border: 0; padding: 0; font: inherit; font-size: 11px;
}
.fi-details { min-width: 0; }
.upload-file-item .fi-name { display: block; color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-file-item .fi-size { font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--muted); }
.upload-file-item .fi-remove {
  background: none; border: none; cursor: pointer; color: var(--muted);
  width: 44px; height: 44px; padding: 10px; border-radius: 6px; display: grid; place-items: center;
  transition: color .15s;
}
.upload-file-item .fi-remove:hover { color: var(--error); }
.upload-file-item .fi-remove svg { width: 14px; height: 14px; }
.upload-file-item.invalid { border-color: var(--error); background: var(--error-weak); }
.fi-error { color: var(--error); font-size: 12px; margin-top: 4px; overflow-wrap: anywhere; }
.fi-preview { cursor: zoom-in; overflow: hidden; }
.fi-preview img { width: 100%; height: 100%; object-fit: cover; }
.fi-preview:disabled { cursor: default; }
.fi-preview-note { display: block; font-size: 12px; color: var(--muted); }
.fi-preview:focus-visible, .fi-remove:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-preview-open { overflow: hidden; }
.photo-preview-dialog {
  width: min(900px, calc(100% - 32px)); max-height: calc(100dvh - 32px);
  margin: auto; padding: 20px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); overflow: auto;
}
.photo-preview-dialog::backdrop { background: rgb(6 27 49 / 65%); }
.photo-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.photo-preview-head h2 { font-size: 20px; }
.photo-preview-head button { min-height: 44px; }
.photo-preview-name { margin: 12px 0; overflow-wrap: anywhere; font-size: 13px; }
.photo-preview-dialog img { display: block; width: 100%; max-height: calc(100dvh - 180px); object-fit: contain; }
.photo-preview-dialog [hidden] { display: none; }
.photo-preview-error { font-size: 14px; }

/* ---------- Signature ---------- */
.sig-wrap {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  position: relative;
  transition: border-color .2s;
}
.sig-wrap.active { border-color: var(--accent); }
.sig-wrap.error {
  border-color: var(--error);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--error) 10%, transparent);
}
.sig-wrap canvas {
  display: block;
  width: 100%; height: 180px;
  touch-action: none;
  cursor: crosshair;
}
.sig-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.sig-hint {
  font-size: 11px; color: var(--muted);
  font-family: 'Geist Mono', monospace;
  letter-spacing: 0.03em;
  display: flex; align-items: center; gap: 6px;
}
.sig-hint svg { width: 12px; height: 12px; }
.sig-actions { display: flex; gap: 8px; }
.sig-btn {
  min-height: 44px; min-width: 44px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--body); background: none;
  border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 10px; cursor: pointer; font-family: inherit;
  transition: all .15s;
}
.sig-btn:hover { color: var(--ink); border-color: color-mix(in srgb, var(--line) 50%, var(--muted)); }
.sig-btn.danger:hover { color: var(--error); border-color: var(--error); }
.sig-btn svg { width: 12px; height: 12px; }
.sig-placeholder {
  position: absolute; inset: 0; bottom: 45px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  font-size: 13px; color: var(--muted);
  gap: 8px;
}
.sig-placeholder svg { width: 16px; height: 16px; }

/* ---------- Consent ---------- */
.consent {
  padding: 20px 36px 28px;
  border-top: 1px solid var(--line);
}
.check-row {
  display: flex; gap: 12px; align-items: flex-start;
  margin-bottom: 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0;
  transition: border-color .15s, background .15s, padding .15s;
}
.check-row:last-child { margin-bottom: 0; }
.check-row.error {
  padding: 10px 12px;
  background: var(--error-weak);
  border-color: color-mix(in srgb, var(--error) 45%, var(--line));
}
.check-row input[type="checkbox"] {
  margin-top: 2px; flex-shrink: 0;
  accent-color: var(--accent);
  width: 16px; height: 16px; cursor: pointer;
}
.check-row label {
  font-size: 13px; color: var(--body); line-height: 1.5; cursor: pointer;
}
.check-row label a { color: var(--accent); }

/* ---------- Submit bar ---------- */
.submit-bar {
  padding: 24px 36px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 70%, var(--surface));
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.submit-left { font-size: 13px; color: var(--muted); }
.submit-left strong { color: var(--ink); }
.form-alert {
  display: none;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--error) 35%, var(--line));
  border-radius: 8px;
  background: var(--error-weak);
  color: var(--error);
  font-size: 13px;
  line-height: 1.45;
}
.form-alert.show { display: block; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 7px;
  font-size: 14px; font-weight: 500; letter-spacing: -0.01em;
  cursor: pointer; border: 1px solid transparent;
  transition: all .18s ease;
  font-family: inherit; text-decoration: none;
}
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:disabled {
  opacity: 0.45; cursor: not-allowed; transform: none;
  box-shadow: none;
}
.btn-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, #fff 35%, transparent);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.btn.loading .btn-spinner { display: inline-block; }
.btn.loading .btn-icon { display: none; }
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Success state ---------- */
.success-state {
  display: none;
}
.success-state.show { display: block; }
.success-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 48px 44px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-tile);
  animation: fadeUp .35s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.success-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--success-weak);
  display: grid; place-items: center;
  color: var(--success-text);
  margin: 0 auto 20px;
}
.success-card h2 { font-size: 26px; margin-bottom: 12px; }
.success-card > p { font-size: 15px; line-height: 1.55; max-width: 34ch; margin: 0 auto 24px; }
.success-delivery-summary {
  display: grid;
  gap: 12px;
  width: min(100%, 620px);
  margin: 0 auto 24px;
  text-align: left;
}
.success-delivery-summary:empty { display: none; }
.success-delivery-message {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--body);
  font-size: 13px;
  line-height: 1.5;
}
.success-ref-row {
  display: none;
  align-items: center;
  justify-content: space-between;
  max-width: 390px;
  margin: 0 auto 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  overflow: hidden;
}
.success-ref-row.show { display: flex; }
.success-ref-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 14px;
}
.success-ref-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--muted);
}
.success-ref-text {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.success-ref-label {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}
.success-ref {
  font-family: 'Geist Mono', monospace;
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.success-ref-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--bg) 68%, var(--surface));
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  color: var(--body);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 0 14px;
  transition: background .15s, color .15s;
}
.success-ref-copy:hover {
  background: var(--accent-weak-2);
  color: var(--ink);
}
.success-ref-copy svg { width: 13px; height: 13px; margin-right: 6px; }

.prefill-note {
  display: none;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--body);
  font-size: 13px;
  line-height: 1.5;
}
.prefill-note.show {
  display: block;
}
.prefill-note strong {
  display: block;
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 4px;
}
.prefill-note p {
  margin: 0;
}
.prefill-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.prefill-checklist span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 2px;
}
.prefill-checklist ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.prefill-checklist li {
  display: flex;
  align-items: center;
  gap: 7px;
}
.prefill-checklist li + li {
  margin-top: 2px;
}
.prefill-checklist li::before {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 15px;
  font-size: 11px;
  line-height: 1;
}
.prefill-checklist .done-list li::before {
  content: "✓";
  color: #047857;
  background: #D1FAE5;
  font-weight: 600;
}
.prefill-checklist .todo-list li::before {
  content: "";
  border: 1px solid var(--line);
  background: var(--surface);
}
.prefill-note.loading {
  color: var(--muted);
}
@media (max-width: 600px) {
  .prefill-checklist {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* ---------- Mobile padding overrides (after base rules) ---------- */
.form-title { font-size: 32px; }
#form-intro .form-title { margin-top: 6px; }
@media (max-width: 600px) {
  .reactivation-gate {
    padding: 28px 22px;
  }
  .reactivation-gate-details {
    grid-template-columns: 1fr;
  }
  .reactivation-gate .btn {
    width: 100%;
    justify-content: center;
  }
  .form-section { padding: 24px 20px; }
  .consent { padding: 18px 20px 24px; }
  .submit-bar { padding: 20px; }
  .form-title { font-size: 26px; }
  .success-card { padding: 32px 24px; }
}
