:root {
  color-scheme: light;
  --ink: #1d2633;
  --muted: #617085;
  --line: #d9e1ea;
  --soft: #f4f7f9;
  --paper: #ffffff;
  --brand: #127a7a;
  --brand-dark: #0d5d5d;
  --accent: #e36f4c;
  --danger: #b83939;
  --ok: #20724f;
  --shadow: 0 24px 70px rgba(29, 38, 51, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(18, 122, 122, 0.11), transparent 38%),
    linear-gradient(315deg, rgba(227, 111, 76, 0.12), transparent 42%),
    #edf3f5;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.app {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.shell {
  width: min(1120px, 100%);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(217, 225, 234, 0.85);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border-radius: 18px;
  overflow: hidden;
}

.welcome {
  min-height: 650px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
}

.welcome-main {
  padding: clamp(34px, 7vw, 76px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 30px;
}

.eyebrow {
  margin: 0;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1.05;
  letter-spacing: 0;
}

.welcome-copy {
  margin: 0;
  max-width: 660px;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.7;
}

.primary-action {
  width: fit-content;
  min-height: 56px;
  padding: 0 26px;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-weight: 800;
  box-shadow: 0 14px 30px rgba(18, 122, 122, 0.28);
  transition: transform 160ms ease, background 160ms ease;
}

.primary-action:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

.welcome-side {
  min-height: 100%;
  background:
    linear-gradient(rgba(13, 93, 93, 0.78), rgba(13, 93, 93, 0.62)),
    url("https://images.unsplash.com/photo-1576091160550-2173dba999ef?auto=format&fit=crop&w=1200&q=80") center / cover;
  color: white;
  padding: 34px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 16px;
}

.side-stat {
  border-top: 1px solid rgba(255, 255, 255, 0.42);
  padding-top: 16px;
}

.side-stat strong {
  display: block;
  font-size: 34px;
  line-height: 1;
}

.side-stat span {
  display: block;
  margin-top: 7px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
}

.scheduler {
  display: none;
  min-height: 720px;
  grid-template-columns: minmax(0, 1fr) 360px;
}

.scheduler.active,
.welcome.active {
  display: grid;
}

.welcome:not(.active) {
  display: none;
}

.calendar-area {
  padding: 28px;
  border-right: 1px solid var(--line);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.topbar h2,
.panel h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.topbar p,
.panel-note {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
}

.dot.open {
  background: var(--brand);
}

.dot.full {
  background: var(--danger);
}

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

.weekday {
  min-height: 24px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.day {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 10px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.day:not(.empty):not(:disabled):hover,
.day.selected {
  border-color: var(--brand);
  box-shadow: 0 10px 26px rgba(18, 122, 122, 0.12);
  transform: translateY(-1px);
}

.day.empty {
  visibility: hidden;
}

.day:disabled {
  background: #eef1f4;
  color: #8d98a5;
  cursor: not-allowed;
}

.date-number {
  font-size: 20px;
  font-weight: 850;
}

.date-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.day.full-day {
  border-color: rgba(184, 57, 57, 0.28);
  background: #f7eeee;
}

.panel {
  position: relative;
  padding: 28px;
  background: #fbfcfd;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  max-height: calc(100vh - 64px);
}

.selected-date {
  padding: 14px 16px;
  border-radius: 8px;
  background: #eaf5f4;
  color: var(--brand-dark);
  font-weight: 850;
}

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

.slot {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 750;
}

.slot:hover:not(:disabled),
.slot.selected {
  border-color: var(--brand);
  background: #edf8f7;
}

.slot:disabled {
  background: #edf0f2;
  color: #8793a1;
}

.slot small {
  color: inherit;
  font-weight: 750;
  opacity: 0.72;
}

.form {
  display: none;
  grid-gap: 14px;
  gap: 14px;
}

.form.visible {
  display: grid;
}

.field {
  display: grid;
  gap: 7px;
}

label {
  color: #39475a;
  font-size: 13px;
  font-weight: 850;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
  transition: border 160ms ease, box-shadow 160ms ease;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(18, 122, 122, 0.14);
}

.complete {
  min-height: 50px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 850;
}

.complete:disabled {
  background: #cfd5dc;
  color: #798594;
}

.confirmation {
  display: none;
  padding: 16px;
  border-radius: 8px;
  background: #edf7f1;
  color: var(--ok);
  line-height: 1.55;
}

.confirmation.active {
  display: block;
}

.system-status {
  padding: 12px 14px;
  border: 1px solid #dbe6ef;
  border-radius: 8px;
  background: #f5f8fb;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.system-status.ready {
  border-color: rgba(32, 114, 79, 0.22);
  background: #edf7f1;
  color: var(--ok);
}

.system-status.error {
  border-color: rgba(184, 57, 57, 0.24);
  background: #f8eeee;
  color: var(--danger);
}

.change-button {
  position: fixed;
  right: 24px;
  bottom: 24px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 8px;
  background: #233142;
  color: white;
  font-weight: 850;
  box-shadow: 0 14px 36px rgba(35, 49, 66, 0.28);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

.change-button.visible {
  display: inline-flex;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  max-width: min(520px, calc(100% - 36px));
  padding: 13px 16px;
  border-radius: 8px;
  background: #1f2c3a;
  color: white;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  line-height: 1.45;
  text-align: center;
  z-index: 5;
}

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

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(29, 38, 51, 0.52);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 6;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  width: min(480px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  background: var(--paper);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: grid;
  gap: 18px;
}

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

.modal-header h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--line);
  color: var(--ink);
}

.modal-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-actions button {
  flex: 1 1 120px;
  min-height: 46px;
  border-radius: 8px;
  font-weight: 850;
}

.btn-secondary {
  background: var(--soft);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--line);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #9a2f2f;
}

.btn-brand {
  background: var(--brand);
  color: white;
}

.btn-brand:hover:not(:disabled) {
  background: var(--brand-dark);
}

.booking-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  line-height: 1.55;
}

.booking-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--brand-dark);
}

.booking-card p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.booking-card + .booking-card {
  margin-top: 10px;
}

.lookup-result {
  display: grid;
  gap: 12px;
}

.no-booking {
  padding: 14px 16px;
  border-radius: 8px;
  background: #f8eeee;
  color: var(--danger);
  font-size: 14px;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .welcome,
  .scheduler {
    grid-template-columns: 1fr;
  }

  .welcome-side {
    min-height: 260px;
  }

  .calendar-area {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .panel {
    max-height: none;
  }
}

@media (max-width: 620px) {
  .app {
    padding: 0;
    place-items: stretch;
  }

  .shell {
    min-height: 100vh;
    border-radius: 0;
  }

  .welcome-main,
  .calendar-area,
  .panel {
    padding: 22px;
  }

  .topbar {
    flex-direction: column;
  }

  .calendar-grid {
    gap: 6px;
  }

  .weekday {
    font-size: 11px;
  }

  .day {
    min-height: 78px;
    padding: 8px;
  }

  .date-number {
    font-size: 17px;
  }

  .date-meta {
    font-size: 11px;
  }

  .change-button {
    right: 14px;
    bottom: 14px;
    font-size: 14px;
    padding: 0 14px;
  }

  .modal {
    padding: 22px;
  }

  .modal-actions button {
    flex: 1 1 100%;
  }
}
