
:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f8f6;
  color: #17231d;
  --green: #176b48;
  --green-dark: #104d35;
  --green-soft: #e8f4ed;
  --green-pale: #f3faf6;
  --border: #dce7e0;
  --muted: #627168;
  --error: #a72a2a;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: #f5f8f6; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px max(20px, calc((100vw - 780px) / 2));
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 40px; height: 40px; border-radius: 8px; }
.brand-name { margin: 0; font-size: 17px; font-weight: 800; }
.brand-meta { margin: 1px 0 0; color: var(--muted); font-size: 12px; }
.secure-label { color: var(--green-dark); font-size: 12px; font-weight: 800; }

.page {
  width: min(780px, calc(100% - 28px));
  margin: 24px auto 48px;
}

.hero, .booking-card, .success {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 12px 34px rgba(31, 73, 51, 0.07);
}

.hero { padding: 24px; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: #12271c;
  font-size: clamp(27px, 5vw, 38px);
  line-height: 1.12;
  letter-spacing: 0;
}

.availability-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 800;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.clinic-description {
  margin: 14px 0 18px;
  color: var(--muted);
  line-height: 1.55;
}

.clinic-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.fact {
  min-height: 76px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--green-pale);
}

.fact-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 900;
}

.fact-copy { min-width: 0; }
.fact-label {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.fact-value {
  margin: 0;
  color: #203329;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
}

.booking-card { margin-top: 14px; padding: 24px; }

.progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.progress-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.progress-number {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  background: #eef2ef;
}

.progress-step.active { color: var(--green-dark); }
.progress-step.active .progress-number {
  color: #ffffff;
  background: var(--green);
}
.progress-line { flex: 1; height: 1px; background: var(--border); }

.section-heading { margin: 0 0 5px; font-size: 21px; }
.section-copy { margin: 0 0 18px; color: var(--muted); line-height: 1.5; }
.subheading {
  margin: 22px 0 5px;
  color: #26382e;
  font-size: 14px;
  font-weight: 850;
}
.helper { margin: 0 0 10px; color: var(--muted); font-size: 13px; }

.status {
  display: none;
  margin-bottom: 16px;
  padding: 13px 14px;
  border-radius: 10px;
  line-height: 1.45;
}
.status.visible { display: block; }
.status.error { color: var(--error); background: #fdeeee; }
.status.info { color: var(--green-dark); background: var(--green-soft); }

.date-strip {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 2px 2px 9px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}

.date-button {
  min-width: 112px;
  min-height: 78px;
  flex: 0 0 auto;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: #26362e;
  background: #ffffff;
  text-align: left;
  scroll-snap-align: start;
}
.date-button:hover, .slot-button:hover { border-color: #62a483; }
.date-button.selected, .slot-button.selected {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-soft);
}
.date-day { font-size: 12px; font-weight: 850; }
.date-value { font-size: 15px; font-weight: 850; }
.date-slots { color: var(--muted); font-size: 11px; font-weight: 700; }

.slot-groups { display: grid; gap: 16px; }
.slot-group-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}
.slot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.slot-button {
  min-height: 46px;
  border: 1px solid #cbd8d0;
  border-radius: 9px;
  color: #26362e;
  background: #ffffff;
  font-weight: 800;
}

.selected-appointment {
  display: none;
  align-items: center;
  gap: 11px;
  margin: 24px 0 18px;
  padding: 13px;
  border: 1px solid #b9dbc8;
  border-radius: 10px;
  background: var(--green-pale);
}
.selected-appointment.visible { display: flex; }
.selected-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #ffffff;
  background: var(--green);
  font-weight: 900;
}
.selected-label { margin: 0 0 2px; color: var(--muted); font-size: 11px; font-weight: 800; }
.selected-value { margin: 0; color: var(--green-dark); font-size: 14px; font-weight: 850; }

.patient-section {
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.patient-section.hidden { display: none; }
.patient-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label, .field-label { color: #25372d; font-size: 13px; font-weight: 850; }
.optional { color: var(--muted); font-weight: 650; }
.required { color: var(--green-dark); font-weight: 750; }

.field input, .field textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid #c9d4ce;
  border-radius: 9px;
  padding: 12px;
  color: #17221d;
  background: #ffffff;
  outline: none;
}
.field input:focus, .field textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px #dcefe4;
}
.field textarea { min-height: 92px; resize: vertical; }
.field-error {
  display: none;
  margin: 0;
  color: var(--error);
  font-size: 12px;
  font-weight: 700;
}
.field-error.visible { display: block; }

.phone-control {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
}
.phone-prefix {
  min-height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid #c9d4ce;
  border-right: 0;
  border-radius: 9px 0 0 9px;
  color: #36483e;
  background: #f4f7f5;
  font-weight: 800;
}
.phone-control input { border-radius: 0 9px 9px 0; }

.gender-chips {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.gender-option input { position: absolute; opacity: 0; pointer-events: none; }
.gender-option span {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  background: #ffffff;
  font-size: 13px;
  font-weight: 800;
}
.gender-option input:checked + span {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-soft);
}

.consent {
  grid-column: 1 / -1;
  min-height: 54px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: #45564c;
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
}
.consent input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--green); }
.privacy-note { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }

.primary {
  grid-column: 1 / -1;
  min-height: 52px;
  border: 0;
  border-radius: 10px;
  color: #ffffff;
  background: var(--green);
  font-weight: 850;
}
.primary:hover { background: var(--green-dark); }
.primary:disabled { color: #89958e; background: #e7ece9; }

.success { display: none; padding: 28px; }
.success.visible { display: block; }
.success-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 50%;
  color: var(--green);
  background: var(--green-soft);
  font-size: 24px;
  font-weight: 900;
}
.success h2 { margin: 0 0 8px; font-size: 27px; }
.success-copy { margin: 0; color: var(--muted); line-height: 1.55; }
.success-details {
  display: grid;
  gap: 9px;
  margin: 20px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--green-pale);
}
.success-row { display: flex; justify-content: space-between; gap: 18px; }
.success-row span { color: var(--muted); }
.success-row strong { color: #203329; text-align: right; }
.success-note { color: var(--muted); line-height: 1.55; }
.success-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.secondary {
  min-height: 46px;
  border: 1px solid #b9d7c6;
  border-radius: 9px;
  color: var(--green-dark);
  background: #ffffff;
  font-weight: 800;
}

.hidden { display: none !important; }
.honeypot { position: absolute; left: -10000px; opacity: 0; }

@media (max-width: 640px) {
  .secure-label { display: none; }
  .page { width: 100%; margin: 0 auto; }
  .hero, .booking-card, .success {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .hero { padding: 20px; }
  .booking-card { margin-top: 10px; padding: 20px 18px 108px; }
  .clinic-facts { grid-template-columns: 1fr; }
  .fact { min-height: 58px; }
  .progress-label { display: none; }
  .date-button { min-width: 104px; }
  .slot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .patient-fields { grid-template-columns: 1fr; }
  .field.full, .gender-chips, .consent, .primary { grid-column: 1; }
  .primary {
    position: sticky;
    bottom: 14px;
    z-index: 5;
    box-shadow: 0 10px 28px rgba(20, 77, 51, 0.22);
  }
  .success { padding: 24px 20px 40px; }
  .success-actions { grid-template-columns: 1fr; }
}
