:root {
  color-scheme: light;
  --bg: #f5f6f4;
  --panel: #ffffff;
  --ink: #1e2328;
  --muted: #66707a;
  --line: #dde2e7;
  --accent: #176b5b;
  --accent-dark: #0f4e42;
  --accent-soft: #e5f2ee;
  --warning: #b25f17;
  --danger: #b42318;
  --shadow: 0 16px 40px rgba(30, 35, 40, 0.08);
  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;
  background: var(--bg);
  color: var(--ink);
}

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

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.toolbar h1,
.toolbar p,
h2,
.subscription-box p {
  margin: 0;
}

.toolbar h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.toolbar-actions,
.form-actions,
.copy-row,
.list-head,
.form-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

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

.booking-form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.side-stack {
  display: grid;
  gap: 18px;
}

.user-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.user-form {
  display: grid;
  gap: 12px;
}

.form-head {
  justify-content: space-between;
}

.user-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

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

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.14);
}

.time-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.primary-button,
.ghost-button,
.icon-button,
.danger-button {
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
  padding: 0 16px;
  font-weight: 750;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.ghost-button {
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
  padding: 0 14px;
  font-weight: 700;
}

.ghost-button:hover {
  border-color: #b8c2ca;
  background: #f9faf9;
}

.danger-button {
  background: #fff7f6;
  border-color: #ffd7d2;
  color: var(--danger);
  padding: 0 12px;
  font-weight: 700;
}

.icon-button {
  width: 36px;
  min-height: 36px;
  background: #f4f6f7;
  border-color: var(--line);
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

.primary-button:active,
.ghost-button:active,
.icon-button:active,
.danger-button:active {
  transform: translateY(1px);
}

.status {
  min-height: 20px;
  margin: 0;
  color: var(--accent);
  font-size: 14px;
  font-weight: 650;
}

.panel-status {
  min-height: 0;
}

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

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.calendar-panel {
  display: grid;
  gap: 0;
  overflow: hidden;
}

.subscription-box {
  display: grid;
  gap: 14px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #fbfcf8 100%);
}

.subscription-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
  gap: 12px;
  align-items: end;
}

.copy-row {
  align-items: stretch;
}

.copy-row input {
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
}

.subscription-info {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.list-head {
  justify-content: space-between;
  padding: 18px 20px 10px;
}

.list-head > div {
  display: grid;
  gap: 4px;
}

.list-head select {
  width: min(220px, 45%);
}

.list-head span {
  color: var(--warning);
  font-size: 13px;
  font-weight: 800;
}

.count-pill {
  color: var(--warning);
  font-size: 13px;
  font-weight: 800;
}

.user-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

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

.user-name {
  margin: 0 0 7px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.user-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.user-meta span {
  background: #f3f5f5;
  border-radius: 999px;
  padding: 5px 8px;
  font-weight: 700;
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.user-actions > * {
  min-height: 38px;
}

.modal {
  width: min(520px, calc(100% - 24px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
}

.modal::backdrop {
  background: rgba(30, 35, 40, 0.34);
}

.modal-card {
  display: grid;
  gap: 16px;
  width: 100%;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(30, 35, 40, 0.22);
}

.modal[open] .modal-card {
  animation: modal-scale-in 140ms ease-out;
}

@keyframes modal-scale-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.booking-list {
  list-style: none;
  margin: 0;
  padding: 0 20px 16px;
  display: grid;
  gap: 10px;
}

.booking-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  background: #ffffff;
}

.booking-title {
  margin: 0 0 7px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.booking-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.booking-meta span {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 5px 8px;
  font-weight: 700;
}

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

.empty-state {
  margin: 6px 20px 20px;
  padding: 28px;
  border: 1px dashed #c9d1d8;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state.compact {
  margin: 0;
  padding: 20px;
}

.empty-state[hidden] {
  display: none;
}

.month-calendar {
  display: grid;
  gap: 12px;
  padding: 18px 20px 20px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.month-calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.calendar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.calendar-weekdays span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.calendar-day {
  min-width: 0;
  min-height: 74px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  align-content: space-between;
  justify-items: start;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 120ms ease;
}

.calendar-day:hover {
  border-color: #b8c2ca;
  background: #ffffff;
}

.calendar-day:active {
  transform: translateY(1px);
}

.calendar-day-number {
  font-size: 14px;
  font-weight: 800;
}

.calendar-count {
  max-width: 100%;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 4px 7px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.calendar-day.muted-day {
  background: #f6f7f7;
  color: #9aa3ab;
}

.calendar-day.today {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.12);
}

.calendar-day.has-bookings {
  background: #f7fbf9;
}

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

  .toolbar,
  .workspace,
  .booking-item,
  .subscription-head {
    grid-template-columns: 1fr;
  }

  .toolbar {
    display: grid;
  }

  .booking-form,
  .user-panel,
  .calendar-panel {
    box-shadow: 0 10px 28px rgba(30, 35, 40, 0.07);
  }

  .toolbar-actions,
  .booking-actions,
  .user-actions,
  .user-head-actions {
    width: 100%;
  }

  .toolbar-actions > *,
  .booking-actions > *,
  .user-actions > *,
  .user-head-actions > *,
  .form-actions .primary-button {
    flex: 1;
  }

  .workspace {
    display: grid;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: 100%;
    padding: 10px;
  }

  .toolbar h1 {
    font-size: 30px;
  }

  .booking-form,
  .user-panel,
  .subscription-box,
  .month-calendar {
    padding: 14px;
  }

  .time-grid,
  .copy-row,
  .list-head,
  .form-actions,
  .month-calendar-head {
    grid-template-columns: 1fr;
    display: grid;
  }

  .copy-row .ghost-button,
  .list-head select {
    width: 100%;
  }

  .list-head {
    align-items: stretch;
    padding: 14px 14px 10px;
  }

  .booking-list {
    padding: 0 14px 14px;
  }

  .booking-item {
    padding: 12px;
  }

  .booking-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .calendar-controls {
    display: grid;
    grid-template-columns: 42px 1fr 42px;
  }

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

  .calendar-day {
    min-height: 58px;
    padding: 6px;
    border-radius: 7px;
  }

  .calendar-day-number {
    font-size: 13px;
  }

  .calendar-count {
    padding: 3px 5px;
    font-size: 11px;
  }

  .modal-card {
    padding: 18px;
  }
}

@media (max-width: 380px) {
  .calendar-day {
    min-height: 52px;
    padding: 5px;
  }

  .calendar-count {
    width: 100%;
    text-align: center;
  }
}
