:root {
  color-scheme: light dark;
  --bg-gradient: radial-gradient(circle at 20% 20%, #2d4de0, #131528 60%);
  --card-bg: rgba(19, 20, 33, 0.72);
  --card-border: rgba(255, 255, 255, 0.08);
  --surface: rgba(12, 13, 22, 0.7);
  --accent: #7f8cff;
  --accent-soft: rgba(127, 140, 255, 0.2);
  --accent-strong: rgba(127, 140, 255, 0.4);
  --text-primary: #f5f6ff;
  --text-secondary: rgba(245, 246, 255, 0.7);
  --danger: #ff7f98;
  --success: #7fffb0;
  --shadow: 0 18px 45px rgba(8, 12, 38, 0.5);
  font-family: "Inter", "SF Pro Display", "Roboto", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #02030a;
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow-x: hidden;
}

.background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: var(--bg-gradient);
  filter: blur(60px);
  opacity: 0.85;
}

.app-shell {
  position: relative;
  width: min(1100px, 100%);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  padding: 32px;
  border-radius: 32px;
  background: linear-gradient(145deg, rgba(12, 13, 22, 0.85), rgba(9, 10, 18, 0.65));
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  animation: shellEnter 0.8s ease forwards;
}

@keyframes shellEnter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.title-block h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 36px);
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.month-switcher {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.month-label {
  font-weight: 600;
  letter-spacing: 0.04em;
}

.ghost-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 999px;
  transition: background 0.2s ease;
}

.ghost-btn:hover,
.ghost-btn:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

.ghost-btn.small {
  font-size: 0.9rem;
  padding: 4px 12px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.control-card {
  padding: 20px;
  border-radius: 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  animation: cardEnter 0.6s ease forwards;
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.control-card h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

.control-card__intro {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.control-card__subtitle {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.chip {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.chip.active {
  background: var(--accent);
  color: #0c0d16;
  transform: translateY(-2px);
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.service-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  font: inherit;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  transition: border 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.service-card__title {
  font-weight: 600;
  color: var(--text-primary);
}

.service-card__description {
  font-size: 0.9rem;
  line-height: 1.3;
}

.service-card:hover,
.service-card:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.service-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(127, 140, 255, 0.4);
}

.service-card.active {
  background: var(--accent-strong);
  border-color: var(--accent);
  color: var(--text-primary);
  transform: translateY(-2px);
}

.service-card.active .service-card__title {
  color: var(--text-primary);
}

.calendar {
  display: grid;
  gap: 8px;
}

.calendar-header,
.calendar-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar-cell {
  position: relative;
  padding: 12px 0;
  text-align: center;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s ease, background 0.25s ease;
  color: var(--text-secondary);
}

.calendar-cell.weekday {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.45);
  cursor: default;
}

.calendar-cell.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.calendar-cell.available:hover {
  transform: translateY(-3px);
  background: rgba(127, 140, 255, 0.15);
}

.calendar-cell.selected {
  background: var(--accent);
  color: #0c0d16;
  box-shadow: 0 10px 25px rgba(127, 140, 255, 0.35);
}

.slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.slot-btn {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.25s ease, background 0.2s ease;
}

.slot-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(127, 140, 255, 0.25);
}

.slot-btn.active {
  background: var(--accent);
  color: #0c0d16;
}

.hint {
  margin: 0 0 12px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.bookings {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bookings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.booking-card {
  margin: 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.booking-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.booking-meta {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.booking-actions {
  margin-top: 8px;
  display: flex;
  gap: 12px;
  position: relative;
  z-index: 2;
}

.primary-btn,
.destructive-btn {
  padding: 12px 18px;
  border-radius: 999px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  z-index: 2;
}

.primary-btn {
  background: var(--accent);
  color: #0c0d16;
  box-shadow: 0 15px 35px rgba(127, 140, 255, 0.35);
}

.primary-btn:hover {
  transform: translateY(-2px);
}

.destructive-btn {
  background: rgba(255, 127, 152, 0.15);
  color: var(--danger);
  border: 1px solid rgba(255, 127, 152, 0.4);
}

.destructive-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(255, 127, 152, 0.2);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  padding: 14px 22px;
  border-radius: 14px;
  background: rgba(12, 13, 22, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 4, 12, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.dialog-backdrop.visible {
  opacity: 1;
  pointer-events: all;
}

.dialog {
  width: min(420px, 90%);
  background: var(--surface);
  border-radius: 24px;
  border: 1px solid var(--card-border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transform: translateY(24px);
  transition: transform 0.3s ease;
}

.dialog-backdrop.visible .dialog {
  transform: translateY(0);
}

.dialog__header,
.dialog__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.dialog__slot {
  margin: 0;
  color: var(--text-secondary);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.field input,
.field textarea {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px;
  color: var(--text-primary);
  font: inherit;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.booking-list {
  display: grid;
  gap: 16px;
}

.empty-state {
  padding: 24px;
  text-align: center;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  color: var(--text-secondary);
}

@media (max-width: 720px) {
  body {
    padding: 12px;
  }
  .app-shell {
    padding: 20px;
    border-radius: 24px;
  }
  .controls {
    grid-template-columns: 1fr;
  }
}
