:root {
  color-scheme: light;
  --background: transparent;
  --text: #17211b;
  --muted: #5d6b62;
  --line: #d7ded9;
  --surface: #ffffff;
  --surface-alt: #f6f8f6;
  --accent: #0f7b55;
  --accent-soft: #e8f4ef;
  --accent-strong: #0a5f42;
  --button: var(--accent);
  --button-hover: var(--accent-strong);
  --button-text: #ffffff;
  --danger: #a33d32;
  --unavailable: #f8f1f0;
  --shadow: 0 14px 38px rgb(23 33 27 / 10%);
  --font-family: Inter;
  font-family:
    var(--font-family), ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

.scheduler {
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 16px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 340px);
  gap: 12px;
  margin-bottom: 14px;
}

.meeting-details {
  margin-bottom: 16px;
}

.meeting-details h2 {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 1.65rem;
  line-height: 1.15;
}

.meeting-meta {
  display: grid;
  gap: 10px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 750;
}

.meeting-meta p {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  max-width: 420px;
  line-height: 1.35;
}

.meeting-meta svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin-top: 1px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.user-selection {
  margin-bottom: 16px;
}

.user-selection h2 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 750;
}

.user-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.user-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 9px;
  text-align: left;
}

.user-card:hover,
.user-card[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.user-card img {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--surface-alt);
}

.user-card span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.user-card strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-card span span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

label,
.selected-time {
  display: grid;
  gap: 6px;
}

label span,
.selected-time span {
  color: var(--muted);
  font-size: 0.85rem;
}

label strong {
  color: var(--danger);
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 10px;
}

textarea {
  resize: vertical;
}

.picker {
  position: relative;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(340px, 380px);
  gap: 16px;
  align-items: start;
}

.booking-success-overlay {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  min-height: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 24px;
}

.booking-success-panel {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
  text-align: center;
}

.booking-success-panel h2 {
  margin: 0;
  color: var(--accent-strong);
  font-size: 1.35rem;
  line-height: 1.2;
}

.booking-success-panel p {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
}

.booking-success-details {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 14px;
  width: 100%;
  margin: 4px 0 0;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  text-align: left;
}

.booking-success-details dt {
  color: var(--muted);
  font-size: 0.86rem;
}

.booking-success-details dd {
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.booking-success-panel a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 6px;
  background: var(--button);
  color: var(--button-text);
  padding: 9px 14px;
  text-decoration: none;
  font-weight: 700;
}

.booking-success-panel a:hover {
  background: var(--button-hover);
}

.calendar,
.times {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.calendar {
  padding: 14px;
}

.timezone-control {
  margin-top: 12px;
}

.timezone-control span {
  font-size: 0.76rem;
}

.timezone-control select {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 0.82rem;
}

.timezone-combobox {
  position: relative;
}

.timezone-combobox input {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 0.82rem;
}

.timezone-options {
  margin-top: 4px;
  max-height: 190px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.timezone-option {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 7px 9px;
  text-align: left;
  font-size: 0.82rem;
}

.timezone-option:hover,
.timezone-option.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.timezone-option[aria-selected="true"] {
  font-weight: 750;
}

.timezone-empty {
  padding: 8px 9px;
  color: var(--muted);
  font-size: 0.82rem;
}

.calendar-header {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.calendar-header h1,
.times h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.3;
  text-align: center;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
}

.icon-button:hover:not(:disabled) {
  border-color: var(--accent);
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

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

.weekday-grid {
  gap: 4px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-align: center;
}

.calendar-grid {
  gap: 6px;
}

.day {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.day:hover:not(:disabled),
.day[aria-selected="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.day:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.day.outside-month {
  color: var(--muted);
  background: var(--surface);
}

.day.today::before {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}

.day.available::after,
.day.loading::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 7px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  transform: translateX(-50%);
  background: var(--accent);
}

.day.loading::after {
  background: var(--muted);
}

.day.unavailable {
  background: var(--unavailable);
}

.times {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  min-height: 220px;
}

.times h2 {
  text-align: left;
}

.slot-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  min-height: 42px;
}

.slot {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.empty-slots {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.slot:hover,
.slot[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.booking-form {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  min-width: 0;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  overflow: hidden;
  transition:
    max-height 240ms ease,
    opacity 180ms ease;
}

.booking-form.expanding {
  will-change: max-height, opacity;
}

.booking-form button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--button);
  color: var(--button-text);
  cursor: pointer;
  font-weight: 700;
}

#turnstileContainer {
  min-height: 65px;
  min-width: 300px;
  overflow: visible;
}

.booking-form button:hover {
  background: var(--button-hover);
}

.booking-form button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.message {
  margin: 14px 0 0;
  min-height: 24px;
  color: var(--muted);
}

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

@media (max-width: 700px) {
  .scheduler {
    padding: 12px;
  }

  .toolbar,
  .picker {
    grid-template-columns: 1fr;
  }

  .times {
    min-height: 0;
  }

  .calendar {
    padding: 12px;
  }

  .calendar-header {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    margin-bottom: 10px;
  }

  .icon-button {
    width: 38px;
    height: 38px;
  }

  .weekday-grid {
    margin-bottom: 4px;
  }

  .calendar-grid {
    gap: 2px;
  }

  .day {
    aspect-ratio: auto;
    min-height: 44px;
    border-color: transparent;
    border-radius: 999px;
    background: transparent;
  }

  .day:hover:not(:disabled),
  .day[aria-selected="true"] {
    border-color: var(--accent);
    background: var(--accent-soft);
  }

  .day.outside-month,
  .day.unavailable {
    background: transparent;
  }

  .day.today::before {
    top: 6px;
    right: 50%;
    transform: translateX(14px);
  }

  .day.available::after,
  .day.loading::after {
    bottom: 4px;
  }

  .timezone-control {
    margin-top: 8px;
  }

  .slot-grid {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  }
}

@media (max-width: 390px) {
  .calendar {
    padding: 10px 8px;
  }

  .calendar-grid {
    gap: 1px;
  }

  .day {
    min-height: 40px;
  }
}
