:root {
  --purple: #1d2858;
  --purple-dark: #141a3d;
  --purple-light: #E8EBF2;
  --purple-outline: #B8BFD3;
  --accent: #26bec8;
  --accent-dark: #1aa0a9;
  --accent-light: #E5F7F8;
  --pink: #FE2B64;
  --pink-light: #FDE8EC;
  --green: #10B981;
  --text: #1F2124;
  --muted: #6B7280;
  --border: #E5E7EB;
  --bg: #F5F5F7;
  --white: #FFFFFF;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

/* Header */
.header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.header .logo-mark {
  height: 32px;
  width: auto;
  max-width: 180px;
  display: inline-block;
}

.header .brand {
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  border-left: 1px solid var(--border);
  padding-left: 12px;
  margin-left: 4px;
}

.header .spacer { flex: 1; }

.header .patient-chip {
  background: var(--purple-light);
  color: var(--purple-dark);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

/* Page title */
.page-head {
  padding: 28px 32px 0;
}

.page-head h1 {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.page-head .subtitle {
  color: var(--muted);
  margin: 0;
}

/* Stepper */
.stepper {
  display: flex;
  align-items: center;
  padding: 24px 32px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  margin-top: 20px;
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--muted);
}

.step.active .step-circle {
  background: var(--pink-light);
  border-color: var(--pink);
  color: var(--pink);
}

.step.completed .step-circle {
  background: var(--green);
  border-color: var(--green);
  color: var(--white);
}

.step-label {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

.step.active .step-label {
  color: var(--text);
  font-weight: 600;
}

.step.completed .step-label {
  color: var(--text);
}

.step-line {
  flex: 1;
  height: 1px;
  background: var(--border);
  margin: 0 16px;
}

.step-line.completed {
  background: var(--green);
}

/* Main content area */
.content {
  padding: 24px 32px;
  padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  max-width: 900px;
}

.card h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 20px;
}

/* Form fields */
.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  max-width: 520px;
  padding: 10px 14px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(29, 40, 88, 0.12);
}
.field textarea { min-height: 88px; resize: vertical; line-height: 1.45; }

/* Compact pill-choice radio group — replaces legacy <select> in short-answer
   fields. Wraps within the .field column; single-answer (radio inputs).
   Uses :has(input:checked) so no JS is required. */
.field-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 520px;
}
.pill-choice {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 13px;
  line-height: 1.25;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
}
.pill-choice input {
  position: absolute; opacity: 0; pointer-events: none;
  inset: 0; margin: 0;
}
.pill-choice:hover { border-color: var(--purple-outline); background: var(--purple-light); }
.pill-choice:has(input:checked) {
  border-color: var(--purple);
  background: var(--purple-light);
  color: var(--purple-dark);
  font-weight: 600;
}
@media (max-width: 640px) {
  .pill-choice { padding: 10px 14px; font-size: 14px; }
}

/* Free-form input field used inside qf-items (sliding-fee, etc.). */
.qf-input, .qf-textarea, .qf-select {
  width: 100%; box-sizing: border-box; margin-left: 42px; max-width: calc(100% - 42px);
  padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--white); color: var(--text); font-size: 15px; font-family: inherit;
  transition: border-color 0.15s;
}
.qf-textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
.qf-input:focus, .qf-textarea:focus, .qf-select:focus { outline: 0; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(29, 40, 88, 0.12); }
@media (max-width: 640px) {
  .qf-input, .qf-textarea, .qf-select { margin-left: 0; max-width: 100%; }
}
/* Two-column input row (inside a qf-item). */
.qf-input-row { display: flex; gap: 10px; padding-left: 42px; }
.qf-input-row .qf-input, .qf-input-row .qf-select { margin-left: 0; max-width: none; }
@media (max-width: 640px) {
  .qf-input-row { flex-direction: column; padding-left: 0; }
}
/* Checkbox stack for multi-select qf-items. */
.qf-checks { display: flex; flex-direction: column; gap: 6px; padding-left: 42px; }
@media (max-width: 640px) {
  .qf-checks { padding-left: 0; }
}
.qf-check {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
  background: var(--white);
}
.qf-check input { accent-color: var(--purple); }
.qf-check:hover { border-color: var(--purple-outline); background: var(--purple-light); }
.qf-check.selected { border-color: var(--purple); background: var(--purple-light); }
.qf-check-label { font-size: 14px; color: var(--text); }

/* Inline pill-choice row used inside a qf-item for short-option scales
   (frequency, yes/no attestations, etc.). */
.qf-pills { display: flex; flex-wrap: wrap; gap: 8px; padding-left: 42px; }
@media (max-width: 640px) {
  .qf-pills { padding-left: 0; }
}

/* Pill tab group */
.pill-tabs {
  display: inline-flex;
  background: var(--purple-light);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 24px;
}

.pill-tab {
  background: transparent;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}

.pill-tab.active {
  background: var(--white);
  color: var(--purple-dark);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* Bulleted help list */
.help-list {
  margin: 0 0 20px;
  padding-left: 20px;
  color: var(--text);
  font-size: 14px;
}

.help-list li {
  margin-bottom: 4px;
}

/* Drop zone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  background: var(--white);
  transition: border-color 0.15s, background 0.15s;
}

.dropzone.drag-over {
  border-color: var(--purple);
  background: var(--purple-light);
}

.dropzone-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.dropzone-or {
  color: var(--muted);
  font-size: 14px;
  margin: 8px 0;
}

.dropzone-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px;
}

.preview {
  background: var(--purple-light);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 8px;
  max-width: 640px;
}

.preview-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 2px;
}

.preview-name {
  font-weight: 600;
  color: var(--purple-dark);
  font-size: 14px;
  word-break: break-all;
}

/* Bottom bar */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  z-index: 10;
}

.bottom-bar-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn-link {
  color: var(--purple);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 4px;
  font-family: inherit;
}

.btn-link:hover { color: var(--purple-dark); }

.btn-outline {
  color: var(--purple);
  background: var(--white);
  border: 1px solid var(--purple-outline);
  padding: 9px 18px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-outline:hover {
  background: var(--purple-light);
  border-color: var(--purple);
}

.btn-primary {
  background: var(--purple);
  color: var(--white);
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.btn-primary:hover { background: var(--purple-dark); }

/* Success screen */
/* Card front/back capture */
.card-capture-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 640px;
  margin-bottom: 24px;
}

.card-capture-row.single {
  grid-template-columns: 1fr;
  max-width: 320px;
}

.card-capture {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.card-capture:hover {
  border-color: var(--purple);
  background: var(--purple-light);
}

.card-capture.has-file {
  border-style: solid;
  border-color: var(--green);
  background: #F0FDF4;
}

.card-capture-icon {
  font-size: 28px;
  margin-bottom: 8px;
  color: var(--purple);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.card-capture-icon svg {
  width: 32px;
  height: 32px;
}

.card-capture.has-file .card-capture-icon { color: var(--green); }

/* Captured-card thumbnail preview */
.card-capture-preview {
  display: none;
  width: 100%;
  max-width: 220px;
  border-radius: 8px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.card-capture.has-file .card-capture-preview { display: block; }
.card-capture.has-file .card-capture-icon { display: none; }

.card-capture-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.card-capture-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Two-column form */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 640px;
}

.field-row .field input,
.field-row .field textarea,
.field-row .field select { max-width: 100%; }
.field-row .field-pills { max-width: 100%; }

/* Section heading */
.section-heading {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 8px 0 12px;
}

/* Card-UX form controls (medical history checkboxes + acknowledgment cards). */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}
.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--divider, #d1d1d6);
  border-radius: 12px;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.choice:hover { border-color: var(--purple, #1d2858); }
.choice input { width: 18px; height: 18px; accent-color: var(--purple, #1d2858); flex-shrink: 0; }
.choice:has(input:checked) { border-color: var(--purple, #1d2858); background: rgba(29, 40, 88, 0.05); }

.ack-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--divider, #d1d1d6);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  margin-bottom: 10px;
  transition: border-color 0.12s, background 0.12s;
}
.ack-card:hover { border-color: var(--purple, #1d2858); }
.ack-card input { width: 20px; height: 20px; accent-color: var(--purple, #1d2858); flex-shrink: 0; margin-top: 1px; }
.ack-card:has(input:checked) { border-color: var(--purple, #1d2858); background: rgba(29, 40, 88, 0.05); }

/* Verification banner */
.verify-banner {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  align-items: flex-start;
}

.verify-banner.verified {
  background: #F0FDF4;
  border: 1px solid #86EFAC;
}

.verify-banner-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.verify-banner-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
}

.verify-banner-sub {
  font-size: 13px;
  color: var(--muted);
}

/* Benefits table */
.benefits {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 640px;
  margin-bottom: 20px;
}

.benefits-head {
  background: #FAFAFB;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.benefits-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.benefits-row:last-child { border-bottom: none; }

.benefits-label {
  color: var(--muted);
}

.benefits-value {
  font-weight: 600;
  color: var(--text);
}

.benefits-value.positive { color: var(--green); }

/* Progress bar within a row */
.benefits-bar {
  margin-top: 6px;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.benefits-bar-fill {
  height: 100%;
  background: var(--purple);
  border-radius: 999px;
}

.benefits-row-stacked {
  flex-direction: column;
  gap: 4px;
}

.benefits-row-stacked .top {
  display: flex;
  justify-content: space-between;
}

/* Verify action */
.verify-action {
  display: flex;
  justify-content: flex-start;
  max-width: 640px;
}

/* Forms list */
.forms-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 640px;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}

.form-row:hover {
  border-color: var(--purple);
  box-shadow: 0 1px 4px rgba(29, 40, 88, 0.08);
}

.form-row.completed {
  background: #F0FDF4;
  border-color: #86EFAC;
}

.form-row-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--purple-light);
  color: var(--purple);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.form-row-icon svg {
  width: 22px;
  height: 22px;
}

.form-row.completed .form-row-icon {
  background: var(--green);
  color: var(--white);
}

.form-row-body { flex: 1; min-width: 0; }

.form-row-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
}

.form-row-meta {
  font-size: 13px;
  color: var(--muted);
}

.form-row-status {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}

.form-row.completed .form-row-status { color: var(--green); }

.form-row-chevron {
  color: var(--muted);
  font-size: 20px;
  flex-shrink: 0;
}

.forms-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 640px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--purple-light);
  border-radius: var(--radius);
}

.forms-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--white);
  border-radius: 999px;
  overflow: hidden;
}

.forms-progress-fill {
  height: 100%;
  background: var(--purple);
  border-radius: 999px;
  transition: width 0.3s;
}

.forms-progress-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--purple-dark);
  white-space: nowrap;
}

/* PDF-style form sheet */
.pdf-sheet {
  background: var(--white);
  max-width: 820px;
  margin: 0 auto;
  padding: 56px 64px;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  font-family: "Times New Roman", Times, Georgia, serif;
  color: #111;
}

.pdf-sheet h1 {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.pdf-sheet .pdf-subtitle {
  text-align: center;
  color: #555;
  margin: 0 0 28px;
  font-size: 14px;
  font-style: italic;
}

.pdf-sheet h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 28px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1.5px solid #111;
}

.pdf-sheet p,
.pdf-sheet li {
  font-size: 14px;
  line-height: 1.6;
}

.pdf-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
  margin-bottom: 12px;
}

.pdf-row.full { grid-template-columns: 1fr; }
.pdf-row.thirds { grid-template-columns: 2fr 1fr 1fr; }

.pdf-field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #333;
  margin-bottom: 4px;
}

.pdf-field input,
.pdf-field textarea,
.pdf-field select {
  width: 100%;
  border: none;
  border-bottom: 1px solid #333;
  background: transparent;
  padding: 4px 2px;
  font-size: 14px;
  font-family: inherit;
  color: #111;
  border-radius: 0;
}

.pdf-field textarea {
  border: 1px solid #333;
  padding: 6px 8px;
  resize: vertical;
  min-height: 60px;
}

.pdf-field input:focus,
.pdf-field textarea:focus,
.pdf-field select:focus {
  outline: none;
  border-color: var(--purple);
  background: var(--purple-light);
}

.pdf-checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin: 8px 0 16px;
}

.pdf-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

.pdf-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--purple);
}

.pdf-signature {
  border-bottom: 1.5px solid #111;
  height: 52px;
  position: relative;
  cursor: crosshair;
  background: transparent;
  margin-top: 24px;
}

.pdf-signature.signed {
  font-family: "Snell Roundhand", "Brush Script MT", cursive;
  font-size: 30px;
  font-style: italic;
  display: flex;
  align-items: center;
  padding-left: 8px;
  color: #1a1a80;
}

.pdf-signature-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #333;
  margin-top: 6px;
}

/* Signature draw pad */
.sig-pad-wrap {
  position: relative;
  margin-top: 12px;
  border: 1.5px solid #111;
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}
.sig-pad {
  display: block;
  width: 100%;
  height: 160px;
  touch-action: none; /* keep finger drawing from scrolling the page */
  cursor: crosshair;
}
.sig-pad-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #9CA3AF;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  pointer-events: none;
}
.sig-pad-clear {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--purple);
  background: #fff;
  border: 1px solid var(--purple-outline);
  border-radius: 5px;
  padding: 3px 10px;
  cursor: pointer;
}

.pdf-actions {
  margin-top: 32px;
  text-align: right;
}

.pdf-link-button {
  background: transparent;
  border: 1px solid #333;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  margin-right: 8px;
  font-family: inherit;
}

/* Gray page bg around the PDF sheet */
body.pdf-body {
  background: #E7E5EA;
}

/* Payment screen */
.balance-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 640px;
  margin-bottom: 16px;
  background: var(--white);
}

.balance-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.balance-row:last-child { border-bottom: none; }

.balance-row input[type="checkbox"] {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--purple);
  flex-shrink: 0;
}

.balance-info { flex: 1; min-width: 0; }

.balance-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.balance-meta {
  font-size: 12px;
  color: var(--muted);
}

.balance-amount {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
}

.balance-amount.past-due { color: #B91C1C; }

.payment-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--purple-light);
  border-radius: var(--radius);
  max-width: 640px;
  margin-bottom: 24px;
}

.payment-total-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--purple-dark);
}

.payment-total-amount {
  font-size: 22px;
  font-weight: 700;
  color: var(--purple-dark);
}

.payment-method-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 640px;
  margin-bottom: 16px;
}

.payment-method {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  transition: border-color 0.15s, background 0.15s;
}

.payment-method:hover { border-color: var(--purple); }

.payment-method.selected {
  border-color: var(--purple);
  background: var(--purple-light);
}

.payment-method input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--purple);
  flex-shrink: 0;
}

.payment-method-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--purple-light);
  color: var(--purple);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.payment-method-icon svg { width: 20px; height: 20px; }

.payment-method.selected .payment-method-icon {
  background: var(--white);
}

.payment-method-label {
  font-size: 14px;
  font-weight: 600;
}

.payment-method-sub {
  font-size: 12px;
  color: var(--muted);
}

.card-form { max-width: 640px; }
.card-form .field-row { grid-template-columns: 2fr 1fr 1fr; }

.payment-confirmation {
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  background: #F0FDF4;
  border: 1px solid #86EFAC;
  border-radius: var(--radius);
  max-width: 640px;
  margin-bottom: 16px;
}

.payment-confirmation-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.payment-confirmation-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
}

.payment-confirmation-sub {
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 640px) {
  .payment-method-row { grid-template-columns: 1fr; }
  .card-form .field-row { grid-template-columns: 1fr; }
  .payment-total-amount { font-size: 20px; }
}

/* Review screen */
.review-hero {
  background: var(--purple);
  color: var(--white);
  padding: 28px 32px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  max-width: 720px;
}
.review-hero.incomplete {
  background: #FEF3C7;
  color: #78350F;
}
.review-hero.incomplete .review-hero-label { color: #B45309; }
.review-hero.incomplete .review-hero-sub { color: #92400E; }

/* On the Review step itself: green circle once every step is complete. */
.step.active.review-done .step-circle {
  background: var(--green);
  border-color: var(--green);
  color: var(--white);
}

/* Demo-only invisible "Start over" hotspot in the bottom-left of the bar. */
.demo-restart {
  opacity: 0;
  width: 80px;
  cursor: pointer;
}
.demo-restart:focus-visible { opacity: 1; }

.review-hero-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.85;
  margin-bottom: 6px;
}

.review-hero-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.review-hero-sub {
  font-size: 14px;
  opacity: 0.9;
}

.review-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 720px;
  margin-bottom: 24px;
}

.review-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.review-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #F0FDF4;
  color: var(--green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.review-item-icon.skipped {
  background: #FEF3C7;
  color: #B45309;
}

.review-item-icon svg { width: 18px; height: 18px; }

.review-item-body { flex: 1; min-width: 0; }

.review-item-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.review-item-sub {
  font-size: 12px;
  color: var(--muted);
}

.review-edit {
  font-size: 13px;
  font-weight: 600;
  color: var(--purple);
  text-decoration: none;
  flex-shrink: 0;
}

.review-edit:hover { text-decoration: underline; }

.review-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  max-width: 720px;
  margin-bottom: 20px;
}

.review-panel h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 12px;
}

.review-panel ul {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  color: var(--text);
}

.review-panel li { margin-bottom: 6px; }


.success {
  text-align: center;
  padding: 56px 32px;
}

.success-check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 20px;
}

.success h2 {
  margin-bottom: 8px;
}

.success p {
  color: var(--muted);
  margin: 0;
}

/* ===== Mobile ===== */
@media (max-width: 640px) {
  body {
    padding-bottom: 24px;
    -webkit-text-size-adjust: 100%;
  }

  /* On mobile, bottom bar scrolls with content instead of floating.
     This guarantees nothing is ever hidden below the fold. */
  .bottom-bar {
    position: static;
    margin-top: 24px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -1px 3px rgba(0,0,0,0.04);
  }

  /* Header */
  .header {
    padding: 12px 16px;
    gap: 8px;
  }
  .header .logo-mark { height: 28px; width: auto; max-width: 140px; }
  .header .brand {
    font-size: 14px;
    padding-left: 8px;
  }
  .header .patient-chip {
    padding: 4px 10px;
    font-size: 12px;
  }

  /* Page heading */
  .page-head { padding: 18px 16px 0; }
  .page-head h1 { font-size: 20px; }
  .page-head .subtitle { font-size: 14px; }

  /* Stepper — pill-style numbers, hide labels, scroll horizontally */
  .stepper {
    padding: 14px 16px;
    margin-top: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0;
  }
  .stepper::-webkit-scrollbar { display: none; }
  .step-label { display: none; }
  .step-circle {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
  .step-line { margin: 0 6px; min-width: 12px; }

  /* Content + cards */
  .content { padding: 16px; }
  .card {
    padding: 20px 18px;
    border-radius: 10px;
  }
  .card h2 { font-size: 18px; margin-bottom: 16px; }

  /* Form fields — bigger touch targets, prevent iOS zoom on focus */
  .field { margin-bottom: 16px; }
  .field input,
  .field textarea,
  .field select {
    font-size: 16px;
    padding: 12px 14px;
    max-width: 100%;
  }

  /* Pill tabs — full width */
  .pill-tabs {
    display: flex;
    width: 100%;
    margin-bottom: 16px;
  }
  .pill-tab {
    flex: 1;
    padding: 10px 12px;
    font-size: 14px;
  }

  /* Help list */
  .help-list { font-size: 14px; }

  /* Upload tiles — stack vertically */
  .upload-options { grid-template-columns: 1fr; gap: 12px; }
  .card-capture-row { grid-template-columns: 1fr; gap: 12px; }
  .card-capture-row.single { max-width: 100%; }
  .card-capture { min-height: 120px; padding: 20px 12px; }

  /* Two-column form rows collapse */
  .field-row { grid-template-columns: 1fr; gap: 0; }

  /* Forms list */
  .forms-list { gap: 10px; }
  .form-row { padding: 14px; gap: 12px; }
  .form-row-icon { width: 36px; height: 36px; }
  .form-row-icon svg { width: 20px; height: 20px; }
  .form-row-title { font-size: 14px; }
  .form-row-meta { font-size: 12px; }
  .form-row-status { font-size: 12px; }
  .forms-progress { padding: 10px 14px; }
  .forms-progress-text { font-size: 12px; }

  /* Insurance benefits */
  .benefits { max-width: 100%; }
  .benefits-row { padding: 10px 14px; font-size: 13px; }
  .verify-banner { padding: 14px 16px; gap: 10px; }
  .verify-banner-icon { width: 28px; height: 28px; font-size: 16px; }
  .verify-banner-title { font-size: 14px; }
  .verify-banner-sub { font-size: 12px; }

  /* Review screen */
  .review-summary { grid-template-columns: 1fr; gap: 10px; }
  .review-hero {
    padding: 20px 18px;
    border-radius: 10px;
  }
  .review-hero-title { font-size: 18px; }
  .review-hero-sub { font-size: 13px; }
  .review-panel { padding: 16px 18px; }
  .review-panel h3 { font-size: 14px; }
  .review-panel ul { font-size: 13px; }

  /* PDF-style forms — drop the "paper" look on small screens */
  .pdf-sheet {
    padding: 24px 18px;
    border-radius: 6px;
    box-shadow: none;
    font-size: 14px;
  }
  .pdf-sheet h1 { font-size: 18px; }
  .pdf-sheet .pdf-subtitle { font-size: 12px; margin-bottom: 18px; }
  .pdf-sheet h3 { font-size: 12px; margin: 20px 0 10px; }
  .pdf-row,
  .pdf-row.thirds { grid-template-columns: 1fr; gap: 12px; }
  .pdf-field input,
  .pdf-field textarea,
  .pdf-field select { font-size: 16px; }
  .pdf-checkbox { font-size: 14px; }
  .pdf-signature.signed { font-size: 24px; }

  /* Bottom bar */
  .bottom-bar {
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    gap: 6px;
  }
  .bottom-bar-right {
    gap: 6px;
    flex-shrink: 0;
  }
  .btn-link {
    font-size: 13px;
    padding: 8px 4px;
    flex-shrink: 1;
    min-width: 0;
  }
  .btn-outline,
  .btn-primary {
    padding: 10px 12px;
    font-size: 13px;
    white-space: nowrap;
  }
}

/* Smaller phones */
@media (max-width: 380px) {
  .header .brand { display: none; }
  .btn-link { font-size: 12px; }
  .btn-outline,
  .btn-primary {
    padding: 10px 10px;
    font-size: 12px;
  }
}
/* ---------- Traditional single-page questionnaire (qf-*) ---------- */

.qf-card {
  max-width: 760px;
  margin: 0 auto 24px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 32px 24px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
@media (max-width: 640px) {
  .qf-card { padding: 22px 18px 16px; border-radius: 14px; }
}

.qf-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
  margin-bottom: 20px;
}
.qf-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text);
}
.qf-lede {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 16px;
}
.qf-status {
  display: flex;
  align-items: center;
  gap: 12px;
}
.qf-status-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.qf-status-fill {
  height: 100%;
  background: var(--purple);
  border-radius: 999px;
  transition: width 0.25s ease;
}
.qf-status-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.qf-items {
  display: flex;
  flex-direction: column;
}

.qf-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.qf-item:last-child { border-bottom: none; padding-bottom: 8px; }
.qf-item:first-child { padding-top: 4px; }

.qf-item-head {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
}
.qf-item-num {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--purple-light);
  color: var(--purple-dark);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}
.qf-item-body { flex: 1; }
.qf-item-section {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--purple);
  background: var(--purple-light);
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
}
.qf-item-stem {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text);
  margin: 0;
}

.qf-scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding-left: 42px;
}
@media (max-width: 640px) {
  .qf-scale {
    grid-template-columns: 1fr;
    padding-left: 0;
  }
}

.qf-scale-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 6px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
  min-height: 68px;
}
.qf-scale-opt:hover {
  border-color: var(--purple-outline);
  background: var(--purple-light);
}
.qf-scale-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.qf-scale-opt.selected {
  border-color: var(--purple);
  background: var(--purple-light);
}
.qf-scale-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  position: relative;
  transition: border-color 0.15s;
}
.qf-scale-opt:hover .qf-scale-dot { border-color: var(--purple-outline); }
.qf-scale-opt.selected .qf-scale-dot { border-color: var(--purple); }
.qf-scale-opt.selected .qf-scale-dot::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--purple);
}
.qf-scale-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}
.qf-scale-opt.selected .qf-scale-label { color: var(--purple-dark); font-weight: 600; }
@media (max-width: 640px) {
  .qf-scale-opt {
    flex-direction: row;
    justify-content: flex-start;
    padding: 12px 14px;
    gap: 12px;
    min-height: 48px;
    text-align: left;
  }
  .qf-scale-label { font-size: 15px; }
}

.btn-primary[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Score badge on the staff forms panel */

/* -------- Clinic directions map (confirm.html) -------- */
.clinic-map {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 720px;
  margin: 0 0 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.clinic-map iframe {
  display: block;
  width: 100%;
  height: 240px;
  border: 0;
}
.clinic-map-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.clinic-map-address {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}
.clinic-map-address strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.clinic-map-footer .btn-outline {
  white-space: nowrap;
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .clinic-map iframe { height: 200px; }
  .clinic-map-footer {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }
  .clinic-map-footer .btn-outline { align-self: flex-start; }
}

/* Date inputs only need room for MM/DD/YYYY — cap their width on mobile so they don't
   stretch across a field-row cell and look lopsided next to text inputs. Applies to any
   date input (HIPAA DOB & Date Signed, Medical History DOB, etc.). Specificity bumped
   so this beats .field-row .field input { max-width: 100% } which would otherwise win. */
@media (max-width: 640px) {
  .field input[type="date"],
  .field-row .field input[type="date"] { max-width: 220px; }
}

/* Supplemental copy inside cards — unified size with the page subtitle so all muted/intro
   text reads as one category. Color is applied here too; override per-use via inline style
   or a page-specific class if content needs the primary text color. */
.card-note {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}
@media (max-width: 640px) {
  .card-note { font-size: 14px; }
}

/* DOB picker — three fields side-by-side regardless of viewport (overrides the generic
   .field-row mobile-stack behavior). Short month labels (Jan–Dec) keep it comfortable at 360px+. */
.dob-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  align-items: start;
}
.dob-grid .field { min-width: 0; }
.dob-grid .field select { width: 100%; }

/* Shared gate dialog — used by id-upload.html (photo ID gate) and welcome.html (DOB gate). */
.gate-dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  max-width: 90vw;
  width: 340px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
}
.gate-dialog::backdrop { background: rgba(10, 15, 30, 0.45); }
.gate-dialog-inner { padding: 24px; }
.gate-dialog-inner h3 { margin: 0 0 8px; font-size: 18px; letter-spacing: -0.01em; }
.gate-dialog-inner p { margin: 0 0 20px; color: var(--muted, #6b7280); line-height: 1.45; }
.gate-dialog-inner .btn-primary { width: 100%; justify-content: center; }

/* Multi-step form progression — used by long forms (medical history) so patients
   get a manageable chunk at a time instead of an endless scroll. */
.step-pane { display: none; }
.step-pane.active { display: block; }
.step-progress { margin: -8px 0 24px; }
.step-progress-bar {
  height: 6px;
  background: var(--border, #e5e7eb);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.step-progress-fill {
  height: 100%;
  background: #1d2858;
  border-radius: 3px;
  transition: width 0.25s ease;
}
.step-progress-text {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

/* "Pulled from last visit" banner — signals pre-populated return-patient data. */
.last-visit-banner {
  font-size: 13px;
  color: #1d2858;
  background: rgba(29, 40, 88, 0.08);
  border-left: 3px solid #1d2858;
  padding: 10px 12px;
  border-radius: 8px;
  margin: 0 0 20px;
  line-height: 1.5;
}

/* Hard attestation checkbox — gates the Next button on pre-populated steps so the
   patient actively confirms the pulled-in data is still accurate. */
.attestation-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  background: #fafafa;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  margin: 24px 0 0;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
}
.attestation-check input[type="checkbox"] {
  margin: 2px 0 0;
  accent-color: #1d2858;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}
.attestation-check:has(input:checked) {
  border-color: #1d2858;
  background: rgba(29, 40, 88, 0.05);
}
