:root {
  --green: #209326;
  --green-dark: #137333;
  --green-soft: #f6fbf4;
  --line: #dcdcdc;
  --text: #242424;
  --muted: #606060;
  --danger: #c7395b;
  --page-bg: #ffffff;
  --field-bg: #ffffff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--page-bg);
  color: var(--text);
  font-family: "Nunito Sans", "Avenir Next", "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
}

[hidden] {
  display: none !important;
}

.page-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.booking-card {
  width: min(632px, 100%);
  padding: 22px 31px 20px;
  border: 1px solid var(--green-dark);
  border-radius: 13px;
  background: #fff;
}

.brand-header {
  display: flex;
  justify-content: center;
}

.brand-logo {
  width: 260px;
  max-width: 82%;
  height: auto;
  object-fit: contain;
}

h1 {
  margin: 30px 0 18px;
  color: var(--green-dark);
  text-align: center;
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: 0;
}

.appointment-form,
.form-stack {
  display: grid;
}

.appointment-form {
  gap: 12px;
}

.form-stack {
  gap: 10px;
}

.date-control,
.field-group,
.product-group,
.time-group {
  margin: 0;
}

.date-control {
  position: relative;
}

.date-field {
  position: relative;
  display: block;
  min-height: 52px;
  padding: 7px 11px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--field-bg);
  cursor: pointer;
}

.date-field span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.2;
}

.date-field strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
}

.date-field input {
  display: none;
}

.date-field:focus,
.field-group input:focus,
.field-group textarea:focus {
  border-color: var(--green-dark);
  outline: 0;
  box-shadow: 0 0 0 2px rgba(32, 147, 38, 0.08);
}

.date-picker-popover {
  position: absolute;
  z-index: 10;
  top: calc(100% + 8px);
  left: 0;
  width: min(330px, 100%);
  padding: 12px;
  border: 1px solid var(--green-dark);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 36px rgba(20, 82, 25, 0.16);
}

.date-picker-header {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  gap: 8px;
}

.date-picker-header strong {
  text-align: center;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 800;
}

.calendar-nav {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--green-dark);
  cursor: pointer;
  font-weight: 800;
}

.calendar-nav:hover {
  background: var(--green-soft);
}

.weekday-row,
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekday-row {
  margin-top: 12px;
}

.weekday-row span {
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.calendar-days {
  gap: 4px;
  margin-top: 6px;
}

.calendar-day {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
}

.calendar-day:hover:not(:disabled) {
  background: var(--green-soft);
  color: var(--green-dark);
}

.calendar-day.is-selected {
  background: var(--green);
  color: #fff;
}

.calendar-day.is-adjacent {
  color: #9b9b9b;
}

.calendar-day:disabled {
  background: #f3f3f3;
  color: #b3b3b3;
  cursor: not-allowed;
  text-decoration: line-through;
}

.time-group,
.product-group {
  padding: 0;
  border: 0;
}

.time-slots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 10px;
  padding: 4px 11px 2px;
}

.slot-button {
  width: 82px;
  min-height: 33px;
  padding: 0 6px;
  border: 1px solid var(--green-dark);
  border-radius: 5px;
  background: #fff;
  color: var(--green-dark);
  cursor: pointer;
  font-size: 0.87rem;
  font-weight: 600;
  transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.slot-button:hover,
.slot-button.is-selected {
  background: var(--green);
  color: #fff;
}

.slot-button:hover {
  transform: translateY(-1px);
}

.slot-button.is-unavailable,
.slot-button.is-unavailable:hover {
  border-color: #9aa09a;
  background: #f3f4f2;
  color: #686d68;
  cursor: not-allowed;
  filter: blur(0.7px);
  opacity: 0.64;
  transform: none;
  box-shadow: none;
}

.timezone-note {
  margin: -4px 0 0;
  color: var(--green-dark);
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.3;
}

.field-group {
  display: grid;
  gap: 4px;
}

.field-group input,
.field-group textarea {
  width: 100%;
  min-height: 52px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--field-bg);
  color: var(--text);
  outline: 0;
  font-size: 0.95rem;
}

.field-group textarea {
  min-height: 52px;
  padding-top: 14px;
  resize: vertical;
}

.field-group input::placeholder,
.field-group textarea::placeholder {
  color: #3f3f3f;
  opacity: 0.92;
}

.product-group {
  display: grid;
  gap: 8px;
}

.product-group legend {
  padding: 0;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
}

.product-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-options label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1.2;
}

.product-options input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--green);
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 43px;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 800;
  transition: background-color 150ms ease, opacity 150ms ease, transform 150ms ease;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 0;
  background: var(--green);
  color: #fff;
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.secondary-button {
  margin-top: 16px;
  border: 1px solid var(--green-dark);
  background: #fff;
  color: var(--green-dark);
}

.button-loader {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #fff;
  animation: spin 700ms linear infinite;
}

.primary-button.is-loading .button-loader {
  display: inline-block;
}

.field-error {
  color: var(--danger);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
}

.field-error:empty {
  display: none;
}

.is-invalid {
  border-color: #e3a0b1 !important;
}

.status-banner {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #f2c4d1;
  border-radius: 6px;
  background: #fff4f7;
  color: #a82a4c;
  font-size: 0.84rem;
  font-weight: 700;
}

.success-panel {
  padding: 20px 0 2px;
  text-align: center;
}

.success-panel h2 {
  margin: 14px 0 8px;
  color: var(--green-dark);
  font-size: 1.55rem;
  line-height: 1.2;
}

.success-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.check-badge {
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--green);
  position: relative;
}

.check-badge::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 12px;
  width: 17px;
  height: 10px;
  border-left: 3px solid #fff;
  border-bottom: 3px solid #fff;
  transform: rotate(-45deg);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

@media (max-width: 640px) {
  .page-shell {
    align-items: flex-start;
    padding: 12px 10px calc(12px + env(safe-area-inset-bottom));
  }

  .booking-card {
    padding: 26px 22px 28px;
  }

  .brand-logo {
    width: 220px;
  }

  h1 {
    margin-top: 34px;
    font-size: 1.72rem;
  }

  .time-slots {
    padding-inline: 0;
    gap: 8px;
  }

  .slot-button {
    flex: 1 1 104px;
  }
}

@media (max-width: 420px) {
  .page-shell {
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  }

  .booking-card {
    min-height: calc(100dvh - 16px);
    padding: 16px 12px 12px;
    border-radius: 7px;
  }

  .brand-logo {
    width: 176px;
  }

  h1 {
    margin: 18px 0 16px;
    font-size: 1.3rem;
  }

  .appointment-form {
    gap: 9px;
  }

  .form-stack {
    gap: 10px;
  }

  .timezone-note {
    margin: -3px 0 -1px;
    font-size: 0.7rem;
    line-height: 1.25;
  }

  .date-field {
    min-height: 48px;
    padding: 7px 9px;
  }

  .date-field span {
    font-size: 0.74rem;
  }

  .date-field strong {
    margin-top: 2px;
    font-size: 0.84rem;
  }

  .date-picker-popover {
    width: 100%;
    padding: 8px;
  }

  .date-picker-header {
    grid-template-columns: 28px 1fr 28px;
  }

  .date-picker-header strong {
    font-size: 0.82rem;
  }

  .calendar-nav {
    width: 28px;
    height: 28px;
  }

  .weekday-row {
    margin-top: 8px;
  }

  .calendar-days {
    gap: 3px;
  }

  .calendar-day {
    font-size: 0.72rem;
  }

  .time-slots {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    padding: 5px 0;
  }

  .slot-button {
    width: 100%;
    min-height: 33px;
    padding: 0 4px;
    font-size: 0.76rem;
  }

  .field-group input,
  .field-group textarea {
    min-height: 42px;
    padding: 0 9px;
    font-size: 0.84rem;
  }

  .field-group textarea {
    min-height: 50px;
    padding-top: 12px;
  }

  .product-group {
    gap: 4px;
  }

  .product-group legend {
    font-size: 0.78rem;
    line-height: 1.1;
  }

  .product-options {
    display: grid;
    gap: 2px;
  }

  .product-options label {
    font-size: 0.74rem;
  }

  .product-options input {
    width: 12px;
    height: 12px;
  }

  .primary-button,
  .secondary-button {
    min-height: 43px;
    border-radius: 5px;
    font-size: 0.84rem;
  }
}

@media (max-width: 420px) and (max-height: 700px) {
  .booking-card {
    padding: 14px 10px 12px;
  }

  .brand-logo {
    width: 135px;
  }

  h1 {
    margin: 14px 0 13px;
    font-size: 1.02rem;
  }

  .appointment-form,
  .form-stack {
    gap: 8px;
  }

  .timezone-note {
    font-size: 0.64rem;
    line-height: 1.25;
  }

  .date-field {
    min-height: 34px;
    padding: 4px 7px;
  }

  .date-field span {
    font-size: 0.58rem;
  }

  .date-field strong {
    margin-top: 1px;
    font-size: 0.64rem;
  }

  .time-slots {
    gap: 5px;
    padding: 4px 0 3px;
  }

  .slot-button {
    min-height: 24px;
    padding: 0 3px;
    font-size: 0.64rem;
  }

  .field-group input,
  .field-group textarea {
    min-height: 32px;
    padding: 0 7px;
    font-size: 0.72rem;
  }

  .field-group textarea {
    min-height: 34px;
    padding-top: 8px;
  }

  .product-group legend {
    font-size: 0.7rem;
  }

  .product-options label {
    font-size: 0.65rem;
  }

  .product-options input {
    width: 10px;
    height: 10px;
  }

  .primary-button,
  .secondary-button {
    min-height: 34px;
    font-size: 0.72rem;
  }
}

@media (max-width: 320px) {
  .page-shell {
    padding: 6px 5px calc(6px + env(safe-area-inset-bottom));
  }

  .booking-card {
    min-height: calc(100dvh - 12px);
    padding: 8px 8px 7px;
  }

  .brand-logo {
    width: 120px;
  }

  h1 {
    margin: 8px 0;
    font-size: 0.96rem;
  }

  .appointment-form,
  .form-stack {
    gap: 6px;
  }

  .timezone-note {
    font-size: 0.58rem;
    line-height: 1.2;
  }

  .slot-button {
    min-height: 21px;
    font-size: 0.6rem;
  }

  .date-field {
    min-height: 34px;
    padding: 4px 7px;
  }

  .date-field span {
    font-size: 0.58rem;
  }

  .date-field strong {
    margin-top: 1px;
    font-size: 0.64rem;
  }

  .field-group input {
    min-height: 29px;
    font-size: 0.72rem;
  }

  .field-group textarea {
    min-height: 31px;
    padding-top: 8px;
    font-size: 0.72rem;
  }

  .product-group legend {
    font-size: 0.68rem;
  }

  .product-options label {
    font-size: 0.64rem;
  }

  .product-options input {
    width: 10px;
    height: 10px;
  }

  .primary-button,
  .secondary-button {
    min-height: 32px;
    font-size: 0.7rem;
  }
}
