:root {
  --ink: #172026;
  --muted: #64727c;
  --line: #dce4e8;
  --surface: #ffffff;
  --page: #f5f7f3;
  --free: #dff2e6;
  --free-ink: #195f38;
  --selected: #ffe59e;
  --selected-ink: #735000;
  --booked: #ffd5d0;
  --booked-ink: #8a231b;
  --accent: #2364aa;
  --accent-dark: #174878;
  --shadow: 0 18px 50px rgba(23, 32, 38, 0.12);
}

* {
  box-sizing: border-box;
}

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

.admin-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.admin-link:hover {
  text-decoration: underline;
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
}

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

.calendar-panel {
  padding: 24px;
}

.booking-panel {
  padding: 22px;
  position: sticky;
  top: 24px;
}

.admin-panel {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.booking-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.booking-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f9fbfc;
}

.booking-item strong {
  display: block;
  margin-bottom: 4px;
}

.booking-item-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.booking-item button {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  background: var(--surface);
  cursor: pointer;
}

.topbar,
.month-controls,
.legend,
.time-row {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.9rem, 4vw, 3.2rem);
  line-height: 1;
}

h2 {
  font-size: 1.3rem;
}

h3 {
  font-size: 1rem;
}

.month-controls {
  gap: 10px;
}

.month-title {
  min-width: 185px;
  text-align: center;
  font-weight: 800;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfc;
  color: var(--ink);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

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

.legend {
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend i {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(23, 32, 38, 0.14);
}

.legend .free {
  background: var(--free);
}

.legend .selected {
  background: var(--selected);
}

.legend .partial {
  background: #dcecff;
}

.legend .booked {
  background: var(--booked);
}

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

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

.day {
  aspect-ratio: 1;
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--free);
  color: var(--free-ink);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px;
  text-align: left;
}

.day:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.day.outside {
  opacity: 0.38;
}

.day.selected {
  background: var(--selected);
  color: var(--selected-ink);
  border-color: #d09b00;
}

.day.booked {
  background: var(--booked);
  color: var(--booked-ink);
}

.day.partial {
  background: #dcecff;
  color: #174878;
}

.day-number {
  font-size: 1.1rem;
  font-weight: 900;
}

.slot-options {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
}

.slot-button {
  min-width: 0;
  border: 1px solid rgba(23, 32, 38, 0.16);
  border-radius: 6px;
  padding: 5px 2px;
  background: rgba(255, 255, 255, 0.78);
  color: currentColor;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}

.slot-button:hover:not(:disabled),
.slot-button.selected {
  border-color: var(--accent);
  background: var(--selected);
  color: var(--selected-ink);
}

.slot-button.booked {
  background: rgba(255, 255, 255, 0.36);
  color: var(--booked-ink);
  text-decoration: line-through;
  cursor: not-allowed;
}

.day-state {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.panel-heading {
  margin-bottom: 18px;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fbfcfd;
}

input:focus,
textarea:focus {
  outline: 3px solid rgba(35, 100, 170, 0.18);
  border-color: var(--accent);
}

textarea {
  resize: vertical;
}

.time-row {
  gap: 12px;
}

.time-row label {
  flex: 1;
}

.submit-button {
  border: 0;
  border-radius: 8px;
  padding: 13px 16px;
  color: white;
  background: var(--accent);
  font-weight: 900;
  cursor: pointer;
}

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

.submit-button:not(:disabled):hover {
  background: var(--accent-dark);
}

.status {
  min-height: 24px;
  margin: 14px 0;
  color: var(--muted);
  font-weight: 700;
}

.status.success {
  color: var(--free-ink);
}

.status.error {
  color: var(--booked-ink);
}

.bookings-list {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.booking-item {
  display: grid;
  gap: 3px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.booking-item strong {
  color: var(--ink);
}

.booking-item span {
  color: var(--muted);
}

.empty {
  color: var(--muted);
}

.admin-shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
  display: grid;
  gap: 18px;
}

.admin-header,
.admin-list-header,
.admin-auth-row,
.admin-booking-actions {
  display: flex;
  align-items: center;
}

.admin-header,
.admin-list-header {
  justify-content: space-between;
  gap: 12px;
}

.admin-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.admin-help {
  margin: 8px 0 14px;
  color: var(--muted);
}

.admin-auth-row {
  gap: 10px;
}

.admin-auth-row input {
  flex: 1;
}

.admin-booking-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.admin-booking-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9fbfc;
  display: grid;
  gap: 5px;
}

.admin-booking-item strong {
  font-size: 1rem;
}

.admin-booking-item span {
  color: var(--muted);
  font-size: 0.92rem;
}

.admin-booking-actions {
  margin-top: 4px;
}

.admin-booking-actions button {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: var(--surface);
  cursor: pointer;
}

.admin-booking-actions button:hover {
  border-color: var(--booked-ink);
  color: var(--booked-ink);
}

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

  .booking-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 10px 0;
  }

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

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .month-controls {
    width: 100%;
    justify-content: space-between;
  }

  .month-title {
    min-width: 0;
  }

  .weekdays,
  .calendar-grid {
    gap: 4px;
  }

  .day {
    min-height: 52px;
    padding: 6px;
  }

  .slot-button {
    padding: 4px 1px;
    font-size: 0.68rem;
  }

  .day-state {
    display: none;
  }

  .admin-auth-row {
    flex-wrap: wrap;
  }

  .admin-auth-row .submit-button,
  .admin-auth-row .icon-button {
    width: 100%;
  }
}
