:root {
  --bg: #f4f4f4;
  --panel: #ffffff;
  --text: #1f1f1f;
  --muted: #666666;
  --line: #d8d8d8;
  --field: #fbfbfb;
  --button: #242424;
  --button-hover: #000000;
  --soft: #f7f7f7;
  --selected: #e8e8e8;
  --error: #9f1d1d;
  --success: #1f6b3a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.page {
  width: min(1060px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(28px, 6vw, 56px) 0;
}

.page-head {
  max-width: 720px;
  margin-bottom: 24px;
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.page-head p,
.section-copy,
.form-footer p,
.summary-bar p {
  color: var(--muted);
}

.page-head p {
  margin: 10px 0 0;
}

.booking-card {
  padding: clamp(16px, 3vw, 24px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.service-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.booking-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 16px;
}

.booking-card.is-form-mode .service-row,
.booking-card.is-form-mode .booking-stage {
  display: none;
}

.form-card {
  display: none;
}

.booking-card.is-form-mode .form-card {
  display: block;
}

.panel,
.form-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: clamp(14px, 2.4vw, 20px);
}

.section-head,
.form-head,
.form-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

h2 {
  margin: 4px 0 0;
  font-size: 1.25rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.step-tag,
.summary-bar span {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.month-switcher {
  display: grid;
  grid-template-columns: 42px minmax(140px, 1fr) 42px;
  align-items: center;
  gap: 8px;
}

.month-label {
  text-align: center;
}

.month-nav,
.text-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
}

.month-nav {
  width: 42px;
  height: 42px;
  font-size: 1.5rem;
  line-height: 1;
}

.month-nav:disabled,
.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.weekdays {
  margin: 18px 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.day-button {
  display: grid;
  min-height: 58px;
  place-items: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
}

.day-button:hover:not(:disabled),
.day-button:focus-visible,
.time-slot:hover,
.time-slot:focus-visible {
  border-color: #777777;
}

.day-button:disabled {
  cursor: not-allowed;
  color: #a3a3a3;
  background: #f2f2f2;
}

.day-button.outside-month {
  visibility: hidden;
}

.day-button.is-selected,
.time-slot.is-selected {
  border-color: var(--button);
  background: var(--selected);
}

.day-number {
  font-weight: 700;
}

.day-hint {
  color: var(--muted);
  font-size: 0.74rem;
}

.time-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-copy {
  margin: 8px 0 0;
}

.time-slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.time-slot {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font-weight: 700;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #ffffff;
}

.button {
  display: inline-flex;
  min-height: 46px;
  width: fit-content;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  background: var(--button);
  color: #ffffff;
  font-weight: 700;
}

.button:hover:not(:disabled),
.button:focus-visible {
  background: var(--button-hover);
}

.summary-bar {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.summary-bar p {
  margin: 4px 0 0;
}

.text-button {
  min-height: 40px;
  padding: 0 12px;
}

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

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.field-full {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

textarea {
  min-height: 92px;
  padding: 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #777777;
  background: #ffffff;
}

.consent-inline {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--muted);
  font-weight: 400;
}

.consent-inline input {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin-top: 2px;
  accent-color: var(--button);
}

.error-message {
  min-height: 1.1em;
  color: var(--error);
  font-size: 0.82rem;
}

.has-error input,
.has-error textarea,
.has-error select {
  border-color: rgba(159, 29, 29, 0.65);
}

.booking-bot-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-footer {
  margin-top: 16px;
}

.form-footer p {
  margin: 0;
}

.status {
  display: none;
  margin: 10px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
}

.status.is-visible {
  display: block;
}

.status[data-tone="success"] {
  border-color: rgba(31, 107, 58, 0.35);
  color: var(--success);
}

.status[data-tone="error"] {
  border-color: rgba(159, 29, 29, 0.35);
  color: var(--error);
}

@media (max-width: 840px) {
  .booking-stage,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .section-head,
  .form-head,
  .form-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .month-switcher {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
  }

  .button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .page {
    width: min(100% - 24px, 1060px);
    padding-top: 24px;
  }

  .booking-card,
  .panel,
  .form-card {
    padding: 14px;
  }

  .day-button {
    min-height: 48px;
  }

  .day-hint {
    display: none;
  }

  .time-slots {
    grid-template-columns: 1fr;
  }
}
