:root {
  --ink: #1f2933;
  --muted: #66717c;
  --line: #e5ddd0;
  --sand: #f8f2e8;
  --blue: #2d6f95;
  --blue-dark: #164a66;
  --danger: #a43d2d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #fffaf2;
}

button,
input {
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 0.75rem 0.95rem;
  color: white;
  background: var(--blue);
  cursor: pointer;
}

button.secondary {
  background: var(--blue-dark);
}

button.danger {
  background: var(--danger);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 700;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem clamp(1rem, 5vw, 4rem);
  color: white;
  background: var(--blue-dark);
}

header h1 {
  margin: 0;
}

header a {
  color: white;
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem;
  background: white;
}

.panel h2,
.panel h1 {
  margin-top: 0;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-head h2 {
  margin-bottom: 0;
}

.grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stack,
.list {
  display: grid;
  gap: 1rem;
}

.occupancy-panel {
  margin-bottom: 1rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  color: var(--muted);
  font-weight: 700;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.dot {
  width: 0.75rem;
  height: 0.75rem;
  display: inline-block;
  border-radius: 999px;
}

.dot.free {
  background: #e8f4ed;
}

.dot.booked {
  background: #d97857;
}

.admin-calendar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.calendar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.calendar-controls button {
  width: 3rem;
  height: 3rem;
  padding: 0;
  font-size: 1.25rem;
}

.calendar-controls strong {
  text-align: center;
}

.month {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  background: #fffaf2;
}

.month h3 {
  margin: 0 0 0.85rem;
}

.weekdays,
.days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.3rem;
}

.weekdays {
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
}

.day,
.empty {
  min-height: 2.2rem;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-weight: 700;
}

.day.free {
  color: var(--ink);
  background: #e8f4ed;
}

.day.booked {
  color: white;
  background: #d97857;
}

.upcoming {
  margin-top: 1.5rem;
  border-top: 1px solid var(--line);
  padding-top: 1.25rem;
}

.upcoming h3 {
  margin: 0 0 0.9rem;
}

.upcoming-list {
  display: grid;
  gap: 0.5rem;
}

.upcoming-row {
  display: grid;
  grid-template-columns: 1fr 1fr 0.6fr auto;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem;
  background: #fffaf2;
}

.upcoming-row small {
  color: var(--muted);
  font-weight: 700;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
}

.row div,
.row span,
.row small {
  display: grid;
  gap: 0.2rem;
}

.inline {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.table {
  display: grid;
  gap: 0.5rem;
}

.table-row,
.user-row {
  display: grid;
  grid-template-columns: 1fr 1fr 0.7fr auto;
  gap: 0.75rem;
  align-items: center;
}

.user-row {
  grid-template-columns: 1fr auto auto auto;
}

.check {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  white-space: nowrap;
}

.check input {
  width: auto;
}

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

.eyebrow {
  margin: 0 0 0.35rem;
  color: #bd7654;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.alert {
  margin-bottom: 1rem;
  border-radius: 8px;
  padding: 1rem;
  font-weight: 700;
}

.alert.error {
  color: #8a1f11;
  background: #ffe2dd;
}

.alert.success {
  color: #14532d;
  background: #dcfce7;
}

@media (max-width: 860px) {
  .two,
  .table-row,
  .user-row,
  .upcoming-row {
    grid-template-columns: 1fr;
  }

  .admin-calendar {
    grid-template-columns: 1fr;
  }

  .calendar-controls {
    gap: 0.5rem;
  }

  .panel-head {
    display: grid;
  }

  .row,
  .inline {
    align-items: stretch;
    flex-direction: column;
  }
}
