:root {
  --brand: #c62828;            /* HOF red */
  --brand-dark: #8e1818;
  --ink: #1a1a1a;
  --ink-soft: #555;
  --muted: #7a7a7a;
  --bg: #f6f4f1;
  --card: #ffffff;
  --border: #d9d3cb;
  --border-strong: #b8b0a4;
  --focus: #2563eb;
  --success: #2e7d32;
  --warn-bg: #fff4cc;
  --warn-border: #e7b818;
  --danger: #b71c1c;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Header ---------- */
.site-header {
  background: #fff;
  border-bottom: 3px solid var(--brand);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  height: 56px;
  width: auto;
  display: block;
}

.brand-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.3;
  border-left: 2px solid var(--border);
  padding-left: 14px;
}

.contact {
  font-size: 13px;
  color: var(--muted);
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}

.lang-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms ease, color 120ms ease;
}

.lang-btn:hover {
  background: #f2efea;
}

.lang-btn.active {
  background: var(--brand);
  color: #fff;
}

@media (max-width: 640px) {
  .brand-logo { height: 44px; }
  .brand-sub { display: none; }
  .header-right {
    align-items: flex-start;
    width: 100%;
  }
  .contact { font-size: 12px; }
}

/* ---------- Layout ---------- */
.wrap {
  max-width: 840px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

.site-footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- Progress steps ---------- */
.steps {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.steps .pip {
  flex: 1 1 0;
  min-width: 28px;
  height: 6px;
  border-radius: 3px;
  background: #e3ddd2;
  transition: background 0.2s;
}

.steps .pip.done {
  background: var(--brand);
}

.steps .pip.current {
  background: var(--brand);
  opacity: 0.55;
}

/* ---------- Form sections ---------- */
.step {
  display: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.step.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

h1, h2 {
  margin: 0 0 8px;
  color: var(--ink);
}

h1 { font-size: 26px; }
h2 { font-size: 22px; border-bottom: 2px solid var(--brand); padding-bottom: 8px; margin-bottom: 18px; }

.lede {
  font-size: 16px;
  color: var(--ink-soft);
  margin: 8px 0 18px;
}

.section-intro {
  color: var(--ink-soft);
  margin: 0 0 14px;
}

/* ---------- Fields ---------- */
.field {
  display: block;
  margin-bottom: 14px;
}

.field > span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.field em {
  color: var(--brand);
  font-style: normal;
  margin-left: 2px;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="date"],
.field input[type="number"],
.field textarea,
.field select {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.field input.invalid,
.field textarea.invalid,
.field select.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(183, 28, 28, 0.12);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .site-header { padding: 12px 16px; }
  .wrap { padding: 16px; }
  .step { padding: 18px; }
}

fieldset.sub {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px 6px;
  margin: 14px 0;
  background: #fafaf8;
}

fieldset.sub legend {
  padding: 0 6px;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}

.check-row, .radio-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 8px 0;
  cursor: pointer;
  font-size: 14px;
}

.check-row input, .radio-row input {
  margin-top: 3px;
  flex-shrink: 0;
}

/* ---------- Initials lists ---------- */
.initial-list {
  padding: 0;
  margin: 0 0 20px;
  list-style: none;
  counter-reset: initial-counter;
}

.initial-list li {
  counter-increment: initial-counter;
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}

.initial-list li::before {
  content: counter(initial-counter) ".";
  position: absolute;
  margin-left: -24px;
  font-weight: 600;
  color: var(--muted);
}

.initial-list li p, .initial-list li ul, .initial-list li > div {
  margin: 0;
  color: var(--ink-soft);
}

.initial-field {
  margin-bottom: 0;
}

.initials-label {
  font-size: 12px !important;
}

.initials-input {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
}

.inline-input {
  display: inline-block !important;
  width: 110px !important;
  padding: 4px 8px !important;
  font-size: 14px !important;
  margin: 0 4px !important;
}

.fee-schedule {
  margin: 8px 0;
  padding-left: 20px;
}

.fee-schedule li {
  margin: 2px 0;
}

.fine-print {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 8px;
}

@media (max-width: 640px) {
  .initial-list li { grid-template-columns: 1fr; }
}

/* ---------- Rules list ---------- */
.rules-list {
  padding-left: 22px;
  color: var(--ink-soft);
}

.rules-list li {
  margin-bottom: 10px;
  padding-left: 4px;
}

/* ---------- Acknowledgment card ---------- */
.acknowledgment {
  background: #fff8e1;
  border: 1px solid #e7b818;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin: 18px 0;
}

.acknowledgment .check-row {
  margin: 0;
}

.card-warning {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin: 14px 0;
  font-size: 13px;
  color: #6b4b00;
}

/* ---------- Signature pads ---------- */
.signature-block {
  margin: 24px 0 10px;
  padding: 16px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fafaf8;
}

.sig-statement {
  margin: 0 0 14px;
  color: var(--ink-soft);
}

.sig-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 640px) {
  .sig-pair { grid-template-columns: 1fr; }
}

.sig-wrap {
  display: flex;
  flex-direction: column;
}

.sig-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.sig-label em {
  color: var(--brand);
  font-style: normal;
  margin-left: 2px;
}

.signature-pad {
  width: 100%;
  height: 140px;
  border: 1px solid var(--border-strong);
  border-bottom: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: #fff;
  touch-action: none;
  display: block;
}

.clear-sig {
  align-self: flex-start;
}

/* ---------- Buttons ---------- */
.step-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:active { transform: translateY(1px); }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--border-strong);
}

.btn-ghost:hover { background: #f0ece4; }

.btn-link {
  background: none;
  color: var(--ink-soft);
  font-size: 12px;
  padding: 4px 0;
  margin-top: 4px;
}

.btn-link:hover { color: var(--brand); text-decoration: underline; }

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

/* ---------- Conditional blocks ---------- */
.conditional {
  display: none;
}

.conditional.show {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* ---------- Checklists ---------- */
.checklist {
  padding-left: 20px;
  color: var(--ink-soft);
}

.checklist li {
  margin: 6px 0;
}

/* ---------- Medication tables ---------- */
.med-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.med-table th, .med-table td {
  border: 1px solid var(--border);
  padding: 6px;
  text-align: left;
  vertical-align: top;
}

.med-table th {
  background: #f0ece4;
  font-weight: 600;
  font-size: 12px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.med-table input {
  width: 100%;
  border: none;
  font-size: 14px;
  font-family: inherit;
  padding: 4px;
  background: transparent;
}

.med-table input:focus {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
  background: #fff;
}

/* ---------- History grid ---------- */
.history-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}

@media (max-width: 640px) {
  .history-grid { grid-template-columns: 1fr; }
}

.history-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #fff;
}

.history-item .history-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.history-item .h-label {
  font-weight: 600;
  font-size: 14px;
}

.history-item .h-radios {
  display: flex;
  gap: 10px;
  font-size: 13px;
}

.history-item .h-radios label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.history-item .h-comment {
  width: 100%;
  margin-top: 6px;
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-family: inherit;
  display: none;
}

.history-item.yes .h-comment {
  display: block;
}

/* ---------- Review summary ---------- */
.review-summary {
  background: #fafaf8;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
  font-size: 14px;
}

.review-summary h3 {
  margin: 14px 0 6px;
  color: var(--brand);
  font-size: 15px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.review-summary h3:first-child {
  margin-top: 0;
}

.review-summary dl {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 4px 12px;
  margin: 0;
}

.review-summary dt {
  font-weight: 600;
  color: var(--ink-soft);
}

.review-summary dd {
  margin: 0;
  color: var(--ink);
  word-break: break-word;
}

@media (max-width: 640px) {
  .review-summary dl { grid-template-columns: 1fr; gap: 2px 0; }
  .review-summary dt { margin-top: 6px; }
}

/* ---------- Success ---------- */
.success-card {
  text-align: center;
  padding: 30px 20px;
}

.success-icon {
  width: 64px;
  height: 64px;
  line-height: 64px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 36px;
  font-weight: 700;
  margin: 0 auto 16px;
}

/* ---------- Overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: grid;
  place-items: center;
  z-index: 1000;
}

.overlay[hidden] { display: none; }

.overlay-card {
  background: #fff;
  padding: 28px 36px;
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow);
  max-width: 320px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #eee;
  border-top-color: var(--brand);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
