:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #67645f;
  --paper: #fffdf8;
  --surface: #ffffff;
  --grid: #24211e;
  --month: #f2e8d8;
  --weekend: #fff5ec;
  --all-free: #7ef07e;
  --working: #ffe45c;
  --today: #f2b84b;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.page {
  min-height: 100dvh;
  padding: 20px;
}

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  max-width: 100%;
  margin-bottom: 14px;
}

.page-header h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 2.3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.page-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.calendar-shell {
  width: 100%;
  height: calc(100dvh - 88px);
  min-height: 360px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--grid);
  box-shadow: 0 12px 36px rgb(55 42 24 / 9%);
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.calendar-shell:focus-visible {
  outline: 3px solid rgb(242 184 75 / 55%);
  outline-offset: 3px;
}

.calendar-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.calendar-table th,
.calendar-table td {
  border-right: 1px solid var(--grid);
  border-bottom: 1px solid var(--grid);
  background: var(--surface);
}

.calendar-table tr > :last-child {
  border-right: 0;
}

.calendar-table thead {
  position: sticky;
  top: 0;
  z-index: 5;
}

.corner-cell {
  position: sticky;
  left: 0;
  z-index: 8 !important;
  background: var(--paper) !important;
}

.month-cell {
  background: var(--month) !important;
  text-align: center;
}

.name-heading {
  position: sticky;
  left: 0;
  z-index: 8 !important;
  background: var(--paper) !important;
  text-align: left;
}

.day-cell,
.weekday-cell,
.calendar-cell {
  text-align: center;
}

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

.person-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface) !important;
  text-align: left;
  white-space: nowrap;
}

.is-weekend {
  background: var(--weekend) !important;
}

.calendar-cell.is-all-free {
  background: var(--all-free) !important;
}

.calendar-cell.is-working {
  background: var(--working) !important;
}

.is-today {
  box-shadow: inset 3px 0 0 var(--today), inset -3px 0 0 var(--today);
}

.day-cell.is-today {
  box-shadow: inset 3px 3px 0 var(--today), inset -3px 0 0 var(--today);
}

.calendar-cell.is-today {
  box-shadow: inset 3px 0 0 var(--today), inset -3px 0 0 var(--today);
}

tbody tr:last-child > * {
  border-bottom: 0;
}

@media (max-width: 700px) {
  .page {
    padding: 12px;
  }

  .page-header {
    display: block;
    margin-bottom: 10px;
  }

  .page-header p {
    margin-top: 4px;
  }

  .calendar-shell {
    height: calc(100dvh - 92px);
  }
}
