:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --text: #1f2a24;
  --muted: #63706a;
  --line: #dfe8e3;
  --soft-line: #edf3ef;
  --surface: #f7fbf8;
  --accent: #5cc182;
  --accent-dark: #329a5d;
  --accent-soft: #e9f8ef;
  --danger: #c9271d;
  --success: #16784c;
  --shadow: 0 18px 50px rgba(31, 42, 36, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-weight: 400;
  letter-spacing: 0;
  overflow-x: hidden;
}

.shell {
  width: 100%;
  margin: 0 auto;
}

.booking-widget h2 {
  margin: 0 0 46px;
  font-size: 40px;
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.appointment-panel {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(420px, 0.95fr);
  gap: 40px;
  min-height: 458px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.date-column {
  display: grid;
  align-content: start;
  gap: 26px;
}

.date-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--soft-line);
}

.date-button,
.slot-button,
button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.date-button {
  min-width: 120px;
  min-height: 56px;
  padding: 0 20px;
  font-size: 17px;
  font-weight: 600;
}

.date-button:hover,
.slot-button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.date-button.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.selected-date {
  min-height: 24px;
  font-size: 18px;
  font-weight: 500;
}

.slot-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.slot-button {
  min-width: 118px;
  height: 48px;
  font-size: 19px;
  font-weight: 600;
}

.slot-button.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.service-column {
  display: grid;
  align-content: start;
  gap: 18px;
}

.service-field {
  display: grid;
  gap: 10px;
  position: relative;
}

.service-field > span,
.patient-form label span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.custom-select {
  position: relative;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  min-height: 60px;
  padding: 12px 16px 12px 18px;
  border: 1px solid #cfdcd5;
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  text-align: left;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
}

.custom-select-trigger:hover,
.custom-select.is-open .custom-select-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(92, 193, 130, 0.14);
}

.custom-select-trigger:focus-visible,
input:focus-visible,
.patient-form button:focus-visible,
.slot-button:focus-visible,
.date-button:focus-visible {
  outline: 3px solid rgba(92, 193, 130, 0.28);
  outline-offset: 2px;
}

.custom-select-chevron {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.custom-select.is-open .custom-select-chevron {
  transform: rotate(225deg) translate(-2px, -2px);
}

.custom-select-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.custom-select-list {
  max-height: min(390px, 54vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
}

.custom-select-option {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 58px;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
}

.custom-select-option:hover,
.custom-select-option.is-active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.custom-select-option small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

input {
  width: 100%;
  min-height: 56px;
  border: 1px solid #cfdcd5;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  padding: 0 16px;
}

.service-summary {
  min-height: 54px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--surface);
  color: var(--muted);
  line-height: 1.45;
}

.continue-button {
  min-height: 58px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 17px;
}

.continue-button:hover {
  background: var(--accent-dark);
}

.continue-button:disabled {
  background: #b9d7c4;
  cursor: not-allowed;
}

.confirm-step {
  display: grid;
  gap: 32px;
}

.confirm-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: start;
}

.confirm-header h2 {
  margin-bottom: 28px;
}

.back-button {
  display: inline-flex;
  width: auto;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 18px;
  padding: 0;
}

.steps-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 2px;
}

.steps-indicator span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #d9e7de;
  color: #fff;
  font-weight: 600;
  position: relative;
}

.steps-indicator span:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 32px;
  width: 12px;
  height: 2px;
  background: var(--accent);
}

.steps-indicator .is-done,
.steps-indicator .is-active {
  background: var(--accent);
}

.confirm-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(420px, 0.95fr);
  gap: 30px;
  align-items: start;
}

.confirm-card {
  display: grid;
  gap: 18px;
  min-height: 240px;
  padding: 28px;
  border-radius: 26px;
  background: var(--surface);
}

.confirm-card:empty {
  display: none;
}

.success-step {
  display: grid;
  min-height: 520px;
  place-items: center;
}

.success-card {
  display: grid;
  justify-items: center;
  gap: 18px;
  width: min(720px, 100%);
  padding: 48px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  text-align: center;
}

.success-mark {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 38px;
  font-weight: 600;
}

.success-card h2 {
  margin: 0;
  font-size: 40px;
  line-height: 1.12;
}

.success-card p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.success-id {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 500;
}

.success-button {
  width: min(320px, 100%);
  min-height: 56px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
}

.success-button:hover {
  background: var(--accent-dark);
}

.confirm-doctor {
  display: flex;
  gap: 18px;
  align-items: center;
}

.doctor-avatar {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 30px;
  font-weight: 600;
}

.confirm-doctor strong {
  display: block;
  margin-bottom: 6px;
  font-size: 19px;
}

.confirm-doctor p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.confirm-list {
  display: grid;
  gap: 13px;
  margin: 0;
}

.confirm-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  font-size: 16px;
  line-height: 1.45;
}

.confirm-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.patient-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 0;
}

.patient-form button {
  grid-column: 1 / -1;
}

.captcha-field {
  grid-column: 1 / -1;
  min-height: 100px;
}

.patient-form label {
  display: grid;
  gap: 7px;
}

.patient-form input.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(214, 45, 32, 0.08);
}

.field-error {
  color: var(--danger);
  font-size: 13px;
  line-height: 1.35;
}

.selected-slot {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
  line-height: 1.4;
}

.patient-form button {
  min-height: 56px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  margin-top: 8px;
}

.patient-form button:hover {
  background: var(--accent-dark);
}

button:disabled,
input:disabled {
  cursor: wait;
  opacity: 0.65;
}

.status {
  margin-top: 16px;
  min-height: 24px;
  color: var(--muted);
  font-size: 16px;
}

.status.is-error {
  color: var(--danger);
}

.status.is-success {
  color: var(--success);
}

.empty-state {
  color: var(--muted);
}

@media (max-width: 960px) {
  .booking-widget h2 {
    margin-bottom: 28px;
    font-size: 30px;
  }

  .appointment-panel {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 18px;
  }

  .date-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 18px;
  }

  .date-button {
    min-width: max-content;
    font-size: 16px;
  }

  .confirm-header,
  .confirm-grid {
    grid-template-columns: 1fr;
  }

  .confirm-header {
    display: grid;
  }

  .steps-indicator {
    order: -1;
    justify-content: end;
  }

  .patient-form {
    grid-template-columns: 1fr;
  }

  .success-card {
    padding: 32px 18px;
  }

  .success-card h2 {
    font-size: 30px;
  }
}

@media (max-width: 520px) {
  .booking-widget h2 {
    font-size: 30px;
    line-height: 1.08;
  }

  .confirm-header {
    gap: 18px;
  }

  .confirm-header h2 {
    margin-bottom: 22px;
    font-size: 30px;
    line-height: 1.06;
  }

  .steps-indicator {
    justify-content: flex-start;
    max-width: 100%;
    overflow: hidden;
    padding-top: 0;
  }

  .steps-indicator span {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
  }

  .steps-indicator span:not(:last-child)::after {
    left: 30px;
    width: 10px;
  }

  .back-button {
    font-size: 20px;
  }

  .confirm-grid {
    gap: 22px;
  }

  .patient-form {
    width: 100%;
    gap: 16px;
  }

  .patient-form label,
  .patient-form input,
  .patient-form button {
    min-width: 0;
  }

  input {
    min-height: 58px;
    font-size: 16px;
    border-radius: 14px;
  }

  .confirm-card {
    padding: 20px;
    border-radius: 20px;
  }

  .confirm-doctor {
    align-items: flex-start;
  }

  .doctor-avatar {
    width: 58px;
    height: 58px;
    font-size: 23px;
  }

  .service-summary,
  .service-trigger-text,
  .slot-button {
    font-size: 14px;
  }

  .date-button {
    font-size: 16px;
  }
}

@media (max-width: 640px) {
  .custom-select-menu {
    position: fixed;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 14px;
    max-height: 68vh;
  }

  .custom-select-list {
    max-height: 62vh;
  }

  .slot-button {
    min-width: calc(50% - 5px);
  }
}
