/* Calendar module (modules/calendar/views; layout agreed with Christopher 2026-12-01): the page's main box
   (components/box.css: its name on the 48px anthracite bar), a grey toolbar (actions as icon buttons on the left, the
   dates' navigation on the right), the grid, and the key in a grey footer (on phones, behind an (i) floating at the
   bottom right). The box is the screen's height and the hours scroll inside it, the day names staying at the top. Each
   day is a column of cells, one per quarter of an hour, two lines high (--calendar-row): white when bookable, softly
   hatched when not. Week view: every day side by side from 768px; below that, and in the day view, a strip of the
   week's days and one day's column. On phones the box runs edge to edge, with no page padding round it. */

/* The page is the screen's height (under the phone's top bar), never shorter than --client-min-h (a shorter screen
   scrolls the page instead), as Users. */
.admin__page:has(.calendar) {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--admin-top-h));
  height: calc(100dvh - var(--admin-top-h)); /* 100vh first for browsers without dvh */
  min-height: var(--client-min-h);
}

@media (min-width: 1200px) {
  .admin__page:has(.calendar) {
    height: 100vh;
    height: 100dvh; /* no top bar beside the sidebar */
  }
}

/* Phones: full width (Christopher, 2026-12-01), the box edge to edge under the top bar: no padding round it, square
   corners (its bar's too, below), no border. */
@media (max-width: 575.98px) {
  .admin__page:has(.calendar) {
    padding: 0;
  }

  .calendar.box {
    border-width: 0;
    border-radius: 0;
  }
}

.calendar {
  position: relative; /* holds the floating key on phones */
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0; /* the box's corners and border come from .box */
}

.calendar > .box__bar,
.calendar__bar,
.calendar__foot {
  flex: none;
}

/* The Availability drop-down can reach past the box's bottom on phones, so the box does not clip (.box does): its bar
   and its footer follow its round corners themselves, inside its border. */
.calendar.box {
  overflow: visible;
}

.calendar > .box__bar {
  border-radius: calc(var(--radius-4) - var(--border-1)) calc(var(--radius-4) - var(--border-1)) 0 0;
}

@media (max-width: 575.98px) {
  .calendar > .box__bar {
    border-radius: 0; /* phones: flush under the top bar (Christopher, 2026-12-01) */
  }
}

.calendar__sr {
  position: absolute;
  width: var(--border-1);
  height: var(--border-1);
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Dates in full from 576px, short on phones (Sat, 7 Nov), so they stay on one line. */
.calendar__long {
  display: none;
}

@media (min-width: 576px) {
  .calendar__long {
    display: inline;
  }

  .calendar__short {
    display: none;
  }
}

.calendar__head {
  position: relative;
  isolation: isolate; /* holds the linen behind the words */
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  color: var(--c-page);
  background-color: var(--c-anthracite);
  border-radius: var(--radius-2) var(--radius-2) 0 0;
}

/* Linen: a very faint crosshatch of white lines over the band. */
.calendar__head::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(
      45deg,
      var(--c-linen) 0 var(--border-1),
      transparent var(--border-1) var(--sp-1)
    ),
    repeating-linear-gradient(
      -45deg,
      var(--c-linen) 0 var(--border-1),
      transparent var(--border-1) var(--sp-1)
    );
  border-radius: inherit;
}

.calendar__title {
  font-family: var(
    --font-body
  ); /* small capitals, like the other bands' titles (Availability, the dashboard's tiles) */
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  white-space: nowrap; /* no overflow: hidden, which would move its baseline off the dates' */
  color: inherit;
}

.calendar__dates {
  flex: none;
  font-size: var(--fs-small);
  white-space: nowrap;
  color: inherit;
}

/* The grey toolbar: the actions on the left as icon buttons (Availability, the super admin's calendars), ‹ Today ›
   Day Week as one block on the right, on one line at every width (below 576px the buttons are tighter, below 400px
   narrower still). */
.calendar__bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background-color: var(--c-surface);
  border-bottom: var(--border-1) solid var(--c-line);
}

/* The strip's buttons sit in a form (they post, so no date in the address); the form adds no box. */
.calendar__go {
  display: contents;
}

/* The block: joined buttons sharing one line, lifted a little; the chosen view pressed in. */
.calendar__block {
  display: flex;
  margin-left: auto; /* on the right, after the actions */
  border-radius: var(--radius-1);
  box-shadow: var(--shadow-seg);
}

.calendar__nav,
.calendar__modes {
  display: flex;
}

.calendar__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  min-height: var(--button-h-sm);
  padding-inline: var(--sp-4);
  font-size: var(--fs-small);
  font-weight: 500;
  white-space: nowrap;
  color: var(--c-text);
  text-decoration: none;
  background-color: var(--c-page);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-1);
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease),
    box-shadow var(--duration-fast) var(--ease);
}

.calendar__button:hover {
  background-color: var(--c-off-white);
}

.calendar__button:focus-visible {
  position: relative; /* the focus ring shows over its neighbours */
}

.calendar__block .calendar__button {
  margin-left: calc(-1 * var(--border-1)); /* neighbours share one line */
  border-radius: 0;
}

.calendar__nav > :first-child {
  margin-left: 0;
  border-radius: var(--radius-1) 0 0 var(--radius-1);
}

.calendar__nav-arrow {
  width: var(--button-h-sm);
  padding-inline: 0;
}

/* The chosen view: anthracite glass, like a chosen tab. */
.calendar__button[aria-current="page"],
.calendar__modes > :first-child {
  position: relative;
  color: var(--c-page);
  background: var(--what-pill);
  border-color: var(--c-anthracite);
  box-shadow: var(--shadow-what-pill);
}

/* Day and Week only from 768px, where the week grid shows; below that every view is one day, and the bar names it
   (in the week view, the day chosen in the strip instead of the week's dates). */
.calendar__modes,
.calendar__week,
.calendar__dates-week {
  display: none;
}

@media (max-width: 767.98px) {
  .calendar__dates-day {
    display: inline;
  }

  .calendar__nav > :last-child {
    border-radius: 0 var(--radius-1) var(--radius-1) 0; /* the block's end, with Day and Week hidden */
  }
}

@media (min-width: 768px) {
  .calendar__modes,
  .calendar__dates-week {
    display: flex;
  }

  .calendar__dates-day {
    display: none;
  }
}

.calendar__modes > :first-child {
  border-radius: 0 var(--radius-1) var(--radius-1) 0;
}

@media (min-width: 768px) {
  .calendar__week {
    display: inline-flex;
    border-radius: 0 var(--radius-1) var(--radius-1) 0;
  }

  .calendar__modes > :first-child:not([aria-current="page"]) {
    color: var(--c-text);
    background: var(--c-page);
    border-color: var(--c-line);
    border-radius: 0;
    box-shadow: none;
  }

  .calendar__modes > :first-child[aria-current="page"] {
    border-radius: 0;
  }

  .calendar__modes > :first-child:not([aria-current="page"]):hover {
    background-color: var(--c-off-white);
  }
}

@media (max-width: 575.98px) {
  .calendar__bar {
    gap: var(--sp-2);
  }

  .calendar__block .calendar__button {
    padding-inline: var(--sp-2);
  }

  .calendar__block .calendar__nav-arrow {
    width: var(--sp-8);
    padding-inline: 0;
  }
}

@media (max-width: 399.98px) {
  .calendar__block .calendar__nav-arrow {
    width: calc(
      var(--sp-6) + var(--sp-1)
    ); /* 28px: still big enough for a finger */
  }
}

/* The actions: square icon buttons in grey glass (components/button.css); the calendars' one with a small caret. */
.calendar__icon {
  flex: none;
  width: var(--button-h-sm);
  padding: 0;
}

.calendar__icon--drop {
  width: auto;
  gap: var(--sp-1);
  padding-inline: var(--sp-2);
}

/* The Calendars button names whose calendar is shown: an eye, the name, the caret. As wide as the name up to 264px;
   on phones it fills the space up to ‹ Today ›. A name too long is cut with "…". */
.calendar__whose {
  justify-content: flex-start;
  gap: var(--sp-2);
  max-width: var(--calendar-menu-w);
  padding-inline: var(--sp-3) var(--sp-2);
}

.calendar__whose .bi-eye {
  flex: none;
}

.calendar__whose-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.calendar__whose .calendar__caret {
  flex: none;
  margin-left: auto;
}

@media (max-width: 575.98px) {
  #calendar-people {
    flex: 1;
    min-width: 0;
  }

  .calendar__whose {
    width: 100%;
    max-width: none;
  }
}

.calendar__caret {
  font-size: var(--fs-xxs);
  transition: transform var(--duration-fast) var(--ease);
}

[open] > .calendar__icon .calendar__caret {
  transform: rotate(180deg);
}

/* The Availability drop-down: under the bar, the width of the box on phones, a panel at the left from 576px. */
.calendar__panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 2;
  display: none;
  gap: var(--sp-4);
  padding: var(--sp-4);
  background-color: var(--c-page);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow-1);
}

[open] > .calendar__panel {
  display: grid;
}

.calendar__drop > summary {
  list-style: none; /* no triangle: the caret shows it opens */
  cursor: pointer;
}

.calendar__drop > summary::-webkit-details-marker {
  display: none; /* Safari: its own triangle ignores list-style */
}

@media (min-width: 576px) {
  .calendar__panel {
    right: auto;
    left: var(--sp-4); /* under its button, at the left end of the bar */
    width: var(--calendar-panel-w);
  }
}

/* --- Availability: the drop-down's contents (views/availability.php), after the old site's. An anthracite heading
   flush with the panel's top, then Date & time and Slots. Phones: each day's name and date on one row, its chips
   sharing the row below. From 576px: day | date | chips on one row, chips as wide as their times. --- */
.availability {
  gap: var(--sp-6);
}

.availability__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  margin: calc(-1 * var(--sp-4)) calc(-1 * var(--sp-4)) 0; /* flush with the panel's top and sides */
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--c-page);
  background-color: var(--c-anthracite);
  border-radius: var(--radius-2) var(--radius-2) 0 0;
}

.availability__title {
  font: inherit;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: inherit;
}

.availability__week {
  font-variant-numeric: tabular-nums;
}

.availability__section {
  display: grid;
  gap: var(--sp-3);
}

.availability__sub {
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--c-anthracite);
}

/* Day on its own row, From and To side by side; from 768px all three on one row. */
.availability__form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
  align-items: start;
}

.availability__form .field:first-of-type {
  grid-column: 1 / -1;
}

/* From and To: a little less room for the arrow, so "13:00" shows in full on phones. */
.availability__form .field:not(:first-of-type) select.field__input {
  padding-right: var(--sp-8);
}

@media (min-width: 768px) {
  .availability__form {
    grid-template-columns: minmax(0, 1fr) repeat(2, var(--calendar-time-pick-w)); /* Day gets the room; the times only what they need */
  }

  .availability__form .field:first-of-type {
    grid-column: auto;
  }
}

/* Add (or, while a slot is being changed, Save changes and Cancel). */
.availability__actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end; /* the buttons sit on the right */
  align-items: center;
  gap: var(--sp-3);
}

.availability__actions [hidden] {
  display: none;
}

.availability__cancel {
  order: -1; /* Cancel left of Save changes */
  padding: 0;
  font: inherit;
  font-size: var(--fs-small);
  color: var(--c-text-muted);
  text-decoration: underline;
  background: none;
  border: 0;
  cursor: pointer;
}

/* Add and Save changes: small bright blue buttons (the site's button--bright colours). */
.availability__add {
  min-height: var(--button-h-sm);
  padding-inline: var(--sp-3);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--c-menu-button-text);
  background-color: var(--c-menu-button);
  border: var(--border-1) solid var(--c-menu-button);
  border-radius: var(--radius-1);
  cursor: pointer;
}

.availability__add:hover {
  background-color: var(--c-menu-button-hover);
  border-color: var(--c-menu-button-hover);
}

.availability__days {
  border-top: var(--border-1) solid var(--c-line);
}

.availability__day {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-2);
  align-items: center;
  padding: var(--sp-2) 0 var(--sp-2) var(--sp-3);
  font-size: var(--fs-small);
  border-bottom: var(--border-1) solid var(--c-line);
}

.availability__name,
.availability__date {
  font-weight: 600;
  color: var(--c-heading);
  font-variant-numeric: tabular-nums;
}

.availability__date-short {
  display: none;
}

.availability__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.availability__chips,
.availability__none {
  grid-column: 1 / -1;
}

/* A slot: its times (tap to change them), and an × that removes it. */
.availability__chip,
.availability__none {
  display: inline-flex;
  flex: 1;
  justify-content: center;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  font: inherit;
  font-variant-numeric: tabular-nums;
  border: var(--border-1) solid var(--c-chip-border);
  border-radius: var(--radius-pill);
}

.availability__chip {
  padding-block: 0;
  padding-right: var(--sp-1);
  color: var(--c-text);
  background-color: var(--c-chip);
}

.availability__chip > form {
  display: contents;
}

.availability__chip-edit,
.availability__chip-remove {
  padding: var(--sp-1) 0;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.availability__chip-edit {
  flex: 1;
  white-space: nowrap; /* "09:00–12:00" never breaks over two lines */
}

.availability__chip-remove {
  display: grid;
  place-items: center;
  width: var(--sp-6);
  height: var(--sp-6);
  padding: 0;
  font-size: var(--fs-xxs);
  color: var(--c-text-muted);
}

.availability__chip-remove:hover {
  color: var(--c-text);
  background-color: var(--c-chip-border);
}

.availability__chip:has(
  .availability__chip-edit:not([aria-pressed="true"]):hover
) {
  background-color: var(--c-accent);
}

/* The slot being changed: filled blue. */
.availability__chip:has([aria-pressed="true"]) {
  color: var(--c-menu-button-text);
  background-color: var(--c-menu-button);
  border-color: var(--c-menu-button);
}

.availability__chip:has([aria-pressed="true"]) .availability__chip-remove {
  color: inherit;
}

/* Slots' heading row: the title, and the Templates drop-down on the right. */
.availability__head {
  position: relative; /* the Templates and Edit menus open from this row's right end (full width on phones) */
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-2);
}

.availability__head > form {
  display: none; /* empty: the Templates menu's buttons post them (form="…") */
}

/* SLOTS: small capitals, like the bars' titles. */
.availability__sub--caps {
  font-size: var(--fs-xs);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

/* Templates and Edit, side by side on the right. */
.availability__tools {
  display: flex;
  gap: var(--sp-2);
}

/* Phones: the buttons without their first icon, so SLOTS, Templates and Edit fit on one row at 320px. */
@media (max-width: 575.98px) {
  .availability__templates-button > .bi:first-child {
    display: none;
  }
}

.availability__templates-button {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--button-h-sm);
  padding-inline: var(--sp-3);
  font-size: var(--fs-small);
  color: var(--c-text);
  background-color: var(--c-page);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-1);
  list-style: none; /* no triangle */
  cursor: pointer;
}

.availability__templates-button::-webkit-details-marker {
  display: none; /* Safari: its own triangle ignores list-style */
}

.availability__templates-button .bi {
  font-size: var(--fs-xxs);
  color: var(--c-text-muted);
}

.availability__menu {
  position: absolute;
  top: calc(100% + var(--sp-2));
  right: 0;
  left: 0;
  z-index: 3;
  display: grid;
  padding: 0 var(--menu-pad) var(--menu-pad); /* the title bar sits flush at the top */
  overflow: hidden;                            /* the bar keeps the rounded corners */
  background-color: var(--c-page);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow-1);
  --menu-pad: var(--sp-2);
}

/* Edit: Add a slot (Day across, From and To side by side at every width). */
.availability__menu--edit {
  gap: var(--sp-3);
  --menu-pad: var(--sp-3);
}

.availability__menu--edit .availability__form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.availability__menu--edit .availability__form .field:first-of-type {
  grid-column: 1 / -1;
}

/* Clear all slots this week: at the bottom right of Availability. */
.availability__clear-form {
  margin-left: auto;
}

.availability__clear {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-small);
  color: var(--c-error);
}

.availability__clear:hover {
  color: var(--c-error-hover);
  text-decoration: underline;
}

/* The menus' title: a small anthracite bar across the top, like Availability's own. */
.availability__menu-title {
  margin: 0 calc(-1 * var(--menu-pad)) var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--c-page);
  background-color: var(--c-anthracite);
}

.availability__menu--edit .availability__menu-title {
  margin-bottom: 0; /* the menu's own gap follows */
}

.availability__menu-item {
  display: flex;
  align-items: center;
}

.availability__use,
.availability__new,
.availability__pencil {
  font: inherit;
  font-size: var(--fs-small);
  color: var(--c-text);
  background: none;
  border: 0;
  border-radius: var(--radius-1);
  cursor: pointer;
  z-index: 0;
}

.availability__use {
  display: grid;
  flex: 1;
  padding: var(--sp-2);
  text-align: left;
}

.availability__use small {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}

.availability__pencil {
  display: grid;
  place-items: center;
  width: var(--sp-8);
  height: var(--sp-8);
  color: var(--c-text-muted);
}

.availability__new {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
  padding: var(--sp-3) var(--sp-2) var(--sp-2);
  text-align: left;
  border-top: var(--border-1) solid var(--c-line);
  border-radius: 0;
}

.availability__use:hover,
.availability__pencil:hover,
.availability__new:hover {
  background-color: var(--c-accent);
}

/* The template editor (views/availability-template.php): the sections in one form, then Delete | Cancel and Save. */
.availability__template {
  display: grid;
  gap: var(--sp-6);
}

.availability__day--weekday {
  grid-template-columns: var(--sp-10) minmax(0, 1fr);
}

@media (min-width: 576px) {
  .availability__menu {
    left: auto;
    width: var(--calendar-menu-w);
  }

  .availability__menu--edit {
    width: var(--calendar-edit-w);
  }
}

.availability__error {
  font-size: var(--fs-small);
  color: var(--c-error);
}

.availability__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
}

.availability__foot-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto; /* on the right, also when there is no Delete */
}

/* Cancel: light grey, like the dialogs' Cancel. */
.availability__dismiss {
  min-height: var(--button-h-sm);
  padding-inline: var(--sp-3);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--c-text);
  background-color: var(--c-surface);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-1);
}

.availability__dismiss:hover {
  background-color: var(--c-line);
}

.availability__delete {
  padding: 0;
  font: inherit;
  font-size: var(--fs-small);
  color: var(--c-error);
  text-decoration: underline;
  background: none;
  border: 0;
  cursor: pointer;
}

.availability__delete:hover {
  color: var(--c-error-hover);
}

/* Not available: the calendar's soft hatching on white, light enough to read the words. */
.availability__none {
  color: var(--c-text-muted);
  background: repeating-linear-gradient(
    -45deg,
    var(--c-surface) 0 var(--sp-1),
    var(--c-page) var(--sp-1) var(--sp-2)
  );
  border-color: var(--c-line);
}

@media (min-width: 576px) {
  .availability__day {
    grid-template-columns: var(--sp-10) var(--sp-8) minmax(0, 1fr);
  }

  .availability__day--weekday {
    grid-template-columns: var(--sp-12) minmax(0, 1fr);
  }

  .availability__date {
    margin-right: var(--sp-4);
    text-align: right;
  }

  .availability__date-short {
    display: inline;
  }

  .availability__date-long {
    display: none;
  }

  .availability__chips,
  .availability__none {
    grid-column: auto;
  }

  .availability__chip,
  .availability__none {
    flex: none;
  }

  .availability__none {
    justify-self: start;
  }
}

/* The grid: the hours, then one column per day, edge to edge in the box, stretching down to the footer. */
.calendar__grid {
  display: grid;
  flex: 1;
  grid-template-rows: 1fr;
  min-height: 0;
  overflow-y: auto; /* the hours scroll inside the box */
  overscroll-behavior: contain;
}

.calendar__one {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.calendar__strip {
  flex: none;
}

.calendar__times,
.calendar__day {
  display: grid;
  grid-template-rows: auto 1fr; /* the day names, then the hours */
}

.calendar__grid--day .calendar__times,
.calendar__grid--day .calendar__day {
  grid-template-rows: 1fr;
}

.calendar__grid--week {
  display: none;
  grid-template-columns: var(--calendar-time-w) repeat(7, minmax(0, 1fr));
}

.calendar__grid--day {
  grid-template-columns: var(--calendar-time-w) minmax(0, 1fr);
}

@media (min-width: 768px) {
  .calendar__grid--week {
    display: grid;
  }

  .calendar__one--week {
    display: none;
  }
}

/* Each day's name above its column, on one line (Tue 1/12); today's on cream, with an anthracite line under it. */
.calendar__corner,
.calendar__date {
  position: sticky; /* stays at the top while the hours scroll */
  top: 0;
  z-index: 1;
  display: block;
  height: var(--sp-12);
  background-color: var(--c-page);
  border-bottom: var(--border-1) solid var(--c-line);
}

.calendar__date {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-weight: 400;
  line-height: var(--lh-heading);
  white-space: nowrap;
  color: var(--c-text-muted);
}

.calendar__date strong {
  font-weight: 500;
  color: var(--c-text);
}

.calendar__day--today .calendar__date {
  background-color: var(--c-ground);
  box-shadow: inset 0 calc(-1 * var(--sp-1) / 2) 0 var(--c-anthracite);
}

.calendar__hours,
.calendar__cells {
  display: grid;
  grid-auto-rows: minmax(
    var(--calendar-row),
    1fr
  ); /* taller when the box has room */
}

/* Each hour's time at the top of its row, under the hour's line. */
.calendar__hour {
  grid-row: span 4;
  padding: var(--sp-1) var(--sp-2);
  font-size: var(--fs-xs);
  text-align: right;
  color: var(--c-text-muted);
  font-variant-numeric: tabular-nums;
  border-top: var(--border-1) solid var(--c-line);
}

.calendar__hours > :first-child,
.calendar__cells > :first-child {
  border-top: 0; /* the line above is the day names' or the strip's */
}

.calendar__day {
  border-left: var(--border-1) solid var(--c-line); /* the line between days runs up through their names */
}

/* Not bookable: soft diagonal lines across the whole day's column, so they run on unbroken from cell to cell; a
   bookable cell covers them in white. (Not background-attachment: fixed on each cell: phone browsers do not keep a
   fixed background inside a box that scrolls, so the lines went as the grid scrolled.) */
.calendar__cells {
  background-color: var(--c-page);
  background-image: repeating-linear-gradient(
    -45deg,
    var(--c-surface) 0 var(--sp-1),
    transparent var(--sp-1) var(--sp-2)
  );
}

.calendar__cell--open {
  background: var(--c-page);
}

.calendar__cell--hour {
  border-top: var(--border-1) solid var(--c-line);
}

/* Phones and the day view: the week's days as a strip, the short name in small capitals over the date (1/12). The day
   shown on cream (no line: the colour says it, Christopher 2026-12-01); today's name darker; a short grey bar under
   days with bookings; days without availability paler. */
.calendar__strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--sp-1);
  padding: var(--sp-2);
  border-bottom: var(--border-1) solid var(--c-line);
}

.calendar__strip-day {
  display: grid;
  justify-items: center;
  gap: var(--border-1);
  padding: var(--sp-2) 0 var(--sp-1);
  font-size: var(--fs-xxs);
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--c-text-muted);
  background: none;
  border: 0;
  border-radius: var(--radius-1);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease);
}

.calendar__strip-day strong {
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: normal;
  color: var(--c-text);
}

.calendar__strip-day:hover {
  background-color: var(--c-off-white);
}

.calendar__strip-day--today {
  color: var(--c-text);
}

.calendar__strip-day--off {
  opacity: 0.6;
}

.calendar__strip-day[aria-current="date"] {
  background-color: var(--c-ground);
}

.calendar__strip-dot {
  width: var(--sp-3);
  height: calc(var(--sp-1) / 2);
  margin-top: var(--sp-1);
  border-radius: var(--radius-pill);
}

.calendar__strip-dot--on {
  background-color: var(--c-line-strong);
}

/* The grey footer from 576px, the key's (i) at its right (.calendar__legend), its left free for later (Christopher,
   2026-12-03): one row, as high as the (i) with the toolbar's space round it. In the key, the reason for the
   hatching from 1200px. */
.calendar__foot {
  display: none;
  height: calc(var(--button-h-sm) + 2 * var(--sp-3));
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-small);
  color: var(--c-text-muted);
  background-color: var(--c-surface);
  border-top: var(--border-1) solid var(--c-line);
  border-radius: 0 0 calc(var(--radius-4) - var(--border-1)) calc(var(--radius-4) - var(--border-1));
}

.calendar__key {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-3);
}

@media (min-width: 576px) {
  .calendar__foot {
    display: block;
  }

}

.calendar__key li {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.calendar__key-more {
  display: none;
}

@media (min-width: 1200px) {
  .calendar__key-more {
    display: inline;
  }
}

.calendar__swatch {
  flex: none;
  width: var(--sp-5);
  height: var(--sp-4);
  background-color: var(--c-page);
  background-image: repeating-linear-gradient(
    -45deg,
    var(--c-surface) 0 var(--border-1),
    transparent var(--border-1) var(--sp-1)
  );
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-1);
}

.calendar__swatch--free {
  background: var(--c-accent);
  border-color: var(--c-chip-border);
}

.calendar__swatch--paid {
  background: var(--c-success-bg);
  border-color: var(--c-success-border);
}

/* The key behind an (i), opening upwards in a white panel: on phones floating over the grid's bottom right corner;
   from 576px at the right of the grey footer, sitting in it (no shadow). */
.calendar__legend {
  position: absolute;
  right: var(--sp-4);
  bottom: var(--sp-4);
  z-index: 2;
}

.calendar__legend > summary {
  list-style: none;
  box-shadow: var(--shadow-1);
  cursor: pointer;
}

.calendar__legend > summary::-webkit-details-marker {
  display: none; /* Safari: its own triangle ignores list-style */
}

.calendar__legend-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + var(--sp-2));
  width: max-content; /* as wide as its words */
  padding: var(--sp-2);
  background-color: var(--c-page);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow-1);
}

.calendar__legend-panel .calendar__key {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: var(--sp-2) var(--sp-3);
  padding: 0 var(--sp-2) var(--sp-2);
  font-size: var(--fs-small);
  color: var(--c-text);
}

.calendar__legend-panel li {
  white-space: nowrap;
}

@media (min-width: 576px) {
  .calendar__legend {
    bottom: var(--sp-3);
  }

  .calendar__legend > summary {
    box-shadow: var(--shadow-glass);
  }
}

.calendar__legend-panel > .calendar__menu-title {
  margin-bottom: var(--sp-2);
  border-bottom: var(--border-1) solid var(--c-line);
}

/* A drop-down's title: small capitals (the calendars, the key). */
.calendar__menu-title {
  padding: var(--sp-1) var(--sp-2) var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--c-text-muted);
}

/* Super admin: the list of calendars under their drop-down, a tick by the one shown. */
.calendar__people {
  gap: 0;
  padding: var(--sp-2);
}

@media (min-width: 576px) {
  .calendar__people {
    width: var(--calendar-menu-w);
  }
}

.calendar__person {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2);
  font-size: var(--fs-small);
  text-align: start;
  color: var(--c-text);
  background: none;
  border: 0;
  border-radius: var(--radius-1);
  cursor: pointer;
}

.calendar__person .bi {
  visibility: hidden;
}

.calendar__person:hover {
  background-color: var(--c-ground);
}

.calendar__person[aria-current="page"] {
  font-weight: 600;
  background-color: var(--c-surface);
}

.calendar__person[aria-current="page"] .bi {
  visibility: visible;
}

/* A booking: a card in a soft colour by kind (a free call pale blue, a paid consultation green) over the quarters it
   takes (rows-1 is 15 minutes, rows-4 an hour): the name, then the time; the kind and how it happens in the day view.
   In the week grid the end time shows from 992px, where the columns are wide enough. */
.calendar__booking {
  display: flex;
  flex-direction: column;
  margin: var(--border-1) var(--sp-1);
  padding: var(--sp-1) var(--sp-2);
  overflow: hidden;
  font-size: var(--fs-small);
  line-height: var(--lh-heading);
  border: var(--border-1) solid;
  border-radius: var(--radius-1);
}

.calendar__booking > * {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.calendar__booking strong {
  font-weight: 600;
}

.calendar__booking--free {
  color: var(--c-accent-text);
  background-color: var(--c-accent);
  border-color: var(--c-chip-border);
}

.calendar__booking--paid {
  color: var(--c-success-text);
  background-color: var(--c-success-bg);
  border-color: var(--c-success-border);
}

.calendar__grid--week .calendar__booking-more {
  display: none;
}

@media (max-width: 991.98px) {
  .calendar__grid--week .calendar__booking-end {
    display: none;
  }
}

.calendar__booking--rows-1 {
  grid-row: span 1;
}
.calendar__booking--rows-2 {
  grid-row: span 2;
}
.calendar__booking--rows-3 {
  grid-row: span 3;
}
.calendar__booking--rows-4 {
  grid-row: span 4;
}
.calendar__booking--rows-5 {
  grid-row: span 5;
}
.calendar__booking--rows-6 {
  grid-row: span 6;
}
.calendar__booking--rows-7 {
  grid-row: span 7;
}
.calendar__booking--rows-8 {
  grid-row: span 8;
}
.calendar__booking--rows-9 {
  grid-row: span 9;
}
.calendar__booking--rows-10 {
  grid-row: span 10;
}
.calendar__booking--rows-11 {
  grid-row: span 11;
}
.calendar__booking--rows-12 {
  grid-row: span 12;
}
.calendar__booking--rows-13 {
  grid-row: span 13;
}
.calendar__booking--rows-14 {
  grid-row: span 14;
}
.calendar__booking--rows-15 {
  grid-row: span 15;
}
.calendar__booking--rows-16 {
  grid-row: span 16;
}
.calendar__booking--rows-17 {
  grid-row: span 17;
}
.calendar__booking--rows-18 {
  grid-row: span 18;
}
.calendar__booking--rows-19 {
  grid-row: span 19;
}
.calendar__booking--rows-20 {
  grid-row: span 20;
}
.calendar__booking--rows-21 {
  grid-row: span 21;
}
.calendar__booking--rows-22 {
  grid-row: span 22;
}
.calendar__booking--rows-23 {
  grid-row: span 23;
}
.calendar__booking--rows-24 {
  grid-row: span 24;
}

/* An event: amber; an invitation not answered yet: the same, dashed on white. A button: it opens the event's pop-up. */
button.calendar__booking {
  font: inherit;
  font-size: var(--fs-small);
  text-align: start;
  cursor: pointer;
}

.calendar__booking--event {
  color: var(--c-warning-text);
  background-color: var(--c-warning-bg);
  border-color: var(--c-warning-border);
}

.calendar__booking--invited {
  background-color: var(--c-page);
  border-style: dashed;
}

.calendar__booking--event:hover {
  border-color: var(--c-warning-dot);
}

/* A new time asked for (Change time), held until the client answers: dashed green on white, "Waiting" under it; the
   booking at its old time says "Moving". */
.calendar__booking--held {
  color: var(--c-success-text);
  background-color: var(--c-page);
  border: var(--border-1) dashed var(--c-success-border);
}

.calendar__booking-note {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-xs);
}

/* Time off: the whole day lilac with fine lines, its name at the top (tap: its pop-up). */
.calendar__cells {
  position: relative; /* holds the time off's name */
}

.calendar__day--off .calendar__cells {
  background-color: var(--c-leave-bg);
  background-image: repeating-linear-gradient(
    -45deg,
    var(--c-leave-border) 0 var(--border-1),
    transparent var(--border-1) var(--sp-2)
  );
}

.calendar__day--off .calendar__cell--open,
.calendar__day--busy .calendar__cell--open {
  background: none; /* the whole day is away or busy, bookable or not */
}

.calendar__off {
  position: absolute;
  top: var(--sp-2);
  right: var(--sp-1);
  left: var(--sp-1);
  padding: var(--sp-1) var(--sp-2);
  overflow: hidden;
  font-size: var(--fs-small);
  font-weight: 600;
  text-align: start;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--c-leave-text);
  background-color: var(--c-leave-bg);
  border: var(--border-1) solid var(--c-leave-border);
  border-radius: var(--radius-1);
  cursor: default;
}

/* In the week grid, a day of time off has its name on lilac too, so it shows wherever the hours are scrolled. */
.calendar__day--off .calendar__date {
  background-color: var(--c-leave-bg);
}

.calendar__strip-day--away {
  background-color: var(--c-leave-bg);
}

.calendar__swatch--event {
  background: var(--c-warning-bg);
  border-color: var(--c-warning-border);
}

.calendar__swatch--invited {
  background: var(--c-page);
  border: var(--border-1) dashed var(--c-warning-dot);
}

.calendar__swatch--away {
  background-color: var(--c-leave-bg);
  border-color: var(--c-leave-border);
}

/* New: a menu under the button, each choice on one line with a short line under it; Appointment comes later. */
.calendar__new {
  gap: 0;
  padding: var(--sp-2);
}

@media (min-width: 576px) {
  .calendar__new {
    width: max-content;
  }
}

.calendar__new-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2);
  font-size: var(--fs-small);
  text-align: start;
  white-space: nowrap;
  color: var(--c-text);
  background: none;
  border: 0;
  border-radius: var(--radius-1);
  cursor: pointer;
}

.calendar__new-item small {
  display: block;
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}

.calendar__new-item .bi {
  font-size: var(--fs-lead);
  color: var(--c-text-muted);
}

.calendar__new-item:hover {
  background-color: var(--c-ground);
}

.calendar__new-item[disabled] {
  opacity: 0.55;
  cursor: default;
}

.calendar__new-item[disabled]:hover {
  background: none;
}

.calendar__soon {
  margin-left: auto;
  padding: 0 var(--sp-2);
  font-size: var(--fs-xxs);
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--c-text-muted);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-1);
}

/* The events' and time off's pop-ups (views/events.php): never taller than the screen; the bar and the buttons stay,
   the fields between them scroll (the date picker and the list of people can make them long). */
.calendar__dialog > .dialog__form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 2 * var(--sp-4));
  max-height: calc(100dvh - 2 * var(--sp-4)); /* 100vh first for browsers without dvh */
}

.calendar__dialog .dialog__header,
.calendar__dialog .dialog__footer {
  flex: none;
}

.calendar__dialog-body {
  display: grid;
  gap: var(--sp-4);
  min-height: 0;
  overflow-y: auto;
}

/* New appointment's form inside the pop-up's body: laid out the same, but only the body scrolls, so nothing cuts off
   the fields' focus rings at the sides (Christopher, 2026-12-03). */
.calendar__appointment-fields {
  display: grid;
  gap: var(--sp-4);
}

.calendar__times-pick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
}

.calendar__people-pick {
  display: grid;
  gap: var(--sp-2);
  margin: 0;
  padding: var(--sp-3);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-1);
}

.calendar__people-legend {
  padding-inline: var(--sp-1);
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}

.calendar__pick {
  align-items: center;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-small);
}

.calendar__pick .pick__text {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.calendar__dialog-note {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3);
  font-size: var(--fs-small);
  color: var(--c-text);
  background-color: var(--c-surface);
  border-radius: var(--radius-1);
}

.calendar__dialog-note--wait {
  color: var(--c-success-text);
  background-color: var(--c-success-bg);
}

.calendar__dialog-note--warn {
  color: var(--c-warning-text);
  background-color: var(--c-warning-bg);
}

.calendar__dialog-footer {
  align-items: center;
}

.calendar__dialog-buttons {
  display: flex;
  gap: var(--sp-2);
  margin-left: auto;
}

/* New appointment's footer: what happens next behind an (i) on the left; its words open upwards (agreed 2026-12-03). */
.calendar__appointment-foot {
  position: relative;
}

.calendar__appointment-tip .tip__text {
  top: auto;
  right: auto;
  bottom: 100%;
  left: var(--sp-4);
  margin-bottom: var(--sp-1);
}

.calendar__delete {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 0;
  font-size: var(--fs-small);
  color: var(--c-error);
  background: none;
  border: 0;
  cursor: pointer;
}

.calendar__delete:hover {
  color: var(--c-error-hover);
}

/* A booking's pop-up (agreed with Christopher, 2026-12-02): the bar 48px like a box's; the client's name and kind on
   top, a button to their file with a chevron on the right (no background); When, Meet by and Phone as lined rows with
   a grey icon, Change time a link under the time; Cancel appointment a chip in the middle of the footer. */
.calendar__dialog--booking .dialog__header {
  min-height: var(--bar-h);
}

/* With Clients, a button laid over the whole name block opens the client file; the (i) beside the type sits above
   it, so it can be pressed on its own. */
.calendar__who-form {
  display: contents;
}

.calendar__who-open {
  position: absolute;
  inset: 0;
  width: 100%;
  padding: 0;
  background: none;
  border: 0;
  border-radius: var(--radius-1);
  cursor: pointer;
}

.calendar__who {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: 0;
  font: inherit;
  text-align: left;
  color: inherit;
  background: none;
  border: 0;
  border-radius: var(--radius-1);
}

.calendar__who {
  position: relative; /* holds its button and its (i)'s words, which open under the block */
}

.calendar__who--open .tip__button {
  position: relative;
  z-index: 1;
}

.calendar__who-text {
  display: grid;
  flex: 1;
  gap: var(--sp-1);
  min-width: 0;
}

.calendar__who-name {
  font-family: var(--font-heading);
  font-size: var(--fs-h4);
  font-weight: 500;
  line-height: var(--lh-heading);
  color: var(--c-heading);
}

.calendar__who-kind {
  display: flex; /* its (i) at the right end of the row */
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-small);
  color: var(--c-text-muted);
}

.calendar__who-go {
  flex: none;
  color: var(--c-text-muted);
  transition: color var(--duration-fast) var(--ease);
}

.calendar__who--open:has(.calendar__who-open:hover) .calendar__who-go {
  color: var(--c-text);
}

.calendar__rows {
  margin: 0;
  font-size: var(--fs-small);
  border-top: var(--border-1) solid var(--c-line);
}

.calendar__rows > div {
  display: grid;
  grid-template-columns: var(--sp-6) var(--sp-24) minmax(0, 1fr);
  gap: var(--sp-2);
  padding-block: var(--sp-3);
}

.calendar__rows > div + div {
  border-top: var(--border-1) solid var(--c-line);
}

.calendar__rows i,
.calendar__rows dt {
  color: var(--c-text-muted);
}

.calendar__rows dd {
  display: grid;
  justify-items: start;
  gap: var(--sp-1);
  margin: 0;
}

.calendar__rows dd span {
  color: var(--c-text-muted);
}

.calendar__rows a,
.calendar__link {
  color: var(--c-accent-text);
  text-decoration: underline;
}

.calendar__link {
  padding: 0;
  font: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

.calendar__link:hover,
.calendar__rows a:hover {
  color: var(--c-text);
}

.calendar__booking-footer {
  flex-direction: column;
  justify-content: center;
  gap: var(--sp-3);
  background-color: var(--c-off-white);
}

.calendar__booking-footer .calendar__dialog-buttons {
  margin-left: 0;
}

/* While a new time waits: Cancel change and Confirm at the bottom right. */
.calendar__booking-footer:has(.calendar__dialog-buttons) {
  flex-direction: row;
  justify-content: flex-end;
}

/* When's links: Edit time | Cancel appt, the second in red (Christopher, 2026-12-02). */
.calendar__links {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}

.calendar__rows dd .calendar__links-bar {
  color: var(--c-line);
}

.calendar__link--danger {
  color: var(--c-error);
}

.calendar__link--danger:hover {
  color: var(--c-error-hover);
}

/* Cancel appointment's Payment row: refunded in green, not refunded in amber. */
.calendar__rows dd.calendar__money--refund {
  color: var(--c-success-text);
}

.calendar__rows dd.calendar__money--none {
  color: var(--c-warning-text);
}

/* A new time waiting, as a row under When: "Waiting for Tom" with its (i); the words open across the row. */
.calendar__rows > div {
  position: relative;
}

.calendar__waiting {
  display: inline-flex;
  align-items: center;
}

/* Change time (agreed 2026-12-02): laid out as the booking's pop-up, then "New time" and its fields. */
.calendar__sub { /* a pale blue band, to make the new time stand out (Christopher, 2026-12-03: option A) */
  display: flex;
  align-items: center;
  margin: 0;
  padding: var(--sp-3) var(--sp-4);
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--c-text);
  background-color: var(--c-chip);
  border: var(--border-1) solid var(--c-chip-border);
  border-radius: var(--radius-1);
}

/* Change time's Ask, with a chevron joined to its right for the menu: Ask or Confirm now (agreed 2026-12-03). The
   menu opens upwards, at the right, over the fields. */
.calendar__ask {
  position: relative;
  display: inline-flex;
  gap: var(--border-1);
}

.calendar__ask-main {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.calendar__ask-more {
  padding: 0 var(--sp-2);
  list-style: none;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.calendar__ask-more::-webkit-details-marker {
  display: none; /* Safari: its own triangle ignores list-style */
}

.calendar__ask-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + var(--sp-2));
  z-index: 2;
  display: grid;
  width: max-content;
  max-width: var(--tip-w);
  padding: var(--sp-1);
  background-color: var(--c-page);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow-glass);
}

.calendar__ask-item {
  display: grid;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-3);
  font: inherit;
  text-align: left;
  color: var(--c-text);
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: var(--radius-1);
}

.calendar__ask-item:hover {
  background-color: var(--c-surface);
}

.calendar__ask-item strong {
  font-size: var(--fs-small);
}

.calendar__ask-item span {
  font-size: var(--fs-xs);
  line-height: var(--lh-body);
  color: var(--c-text-muted);
}

/* Helper text in the booking's pop-ups behind an (i) at the right of the consultation's type row (the site's .tip;
   Christopher, 2026-12-03). Its words open under the name block from the right, so the pop-up's edges never cut them off. */
.calendar__who .calendar__tip {
  position: static;
  margin-left: auto;
}

.calendar__tip .tip__text {
  top: 100%;
  right: 0;
  left: auto;
  margin-top: var(--sp-1);
  font-weight: 400;
}


/* An event someone else made: what it is, as label and value rows. */
.calendar__facts {
  display: grid;
  gap: var(--sp-2);
  margin: 0;
  font-size: var(--fs-small);
}

.calendar__facts > div {
  display: grid;
  grid-template-columns: var(--sp-16) minmax(0, 1fr);
  gap: var(--sp-3);
}

.calendar__facts dt {
  color: var(--c-text-muted);
}

.calendar__facts dd {
  margin: 0;
}

/* The date picker (site.js, data-date): a month under the date field, inside the pop-up, pushing what is under it down.
   Today in bold; the chosen day on cream with an anthracite edge; other months' days faint. */
.datepick {
  margin-top: calc(-1 * var(--sp-2));
  padding: var(--sp-3);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-2);
}

.datepick[hidden] {
  display: none;
}

.datepick__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
  font-size: var(--fs-small);
  font-weight: 600;
}

.datepick__head button {
  display: grid;
  place-items: center;
  width: var(--button-h-sm);
  height: var(--button-h-sm);
  color: var(--c-text);
  background: var(--c-page);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-1);
  cursor: pointer;
}

.datepick__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--border-1);
  text-align: center;
}

.datepick__grid > span {
  padding-bottom: var(--sp-1);
  font-size: var(--fs-xxs);
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  color: var(--c-text-muted);
}

.datepick__grid button {
  height: var(--sp-10);
  font-size: var(--fs-small);
  color: var(--c-text);
  background: none;
  border: var(--border-1) solid transparent;
  border-radius: var(--radius-1);
  cursor: pointer;
}

.datepick__grid button:hover {
  background-color: var(--c-off-white);
}

.datepick__out {
  opacity: 0.45;
}

.datepick__grid .datepick__today {
  font-weight: 700;
}

.datepick__grid [aria-pressed="true"] {
  font-weight: 600;
  background-color: var(--c-ground);
  border-color: var(--c-anthracite);
}

.datepick__field .field__input {
  cursor: pointer;
}

/* New appointment (views/appointments.php): the client's matches, each a choice, New client last; its fields show
   once it is chosen. While the field has the cursor, the matches are a drop-down joined under the field, over the
   pop-up, scrolling after about 4. Once one is chosen the field holds their name, with an X on its right to clear it
   (agreed 2026-12-03). */
.calendar__client {
  position: relative; /* block, not grid: so the open drop-down sits where it would be, under the field */
}

.calendar__client:focus-within:not(:has(:checked)) .calendar__find .field__input {
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

.calendar__client:has(:checked) .calendar__find .field__input {
  padding-right: var(--field-h); /* room for the X */
  cursor: default;
}

.calendar__client-clear {
  position: absolute;
  top: 0;
  right: 0;
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--field-h);
  height: var(--field-h);
  padding: 0;
  font-size: var(--fs-small);
  color: var(--c-text-muted);
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: var(--radius-1);
}

.calendar__client-clear:hover {
  color: var(--c-text);
}

.calendar__client:has(:checked) .calendar__client-clear {
  display: inline-flex;
}

.calendar__find .field__error:empty {
  display: none;
}

.calendar__matches {
  display: none;
  margin-top: calc(-1 * var(--border-1));
  background-color: var(--c-page);
  border: var(--border-1) solid var(--c-line);
  border-radius: 0 0 var(--radius-1) var(--radius-1);
}

.calendar__client:focus-within:not(:has(:checked)) .calendar__matches {
  position: absolute; /* where it would be, under the field */
  right: 0;
  left: 0;
  z-index: 3;
  display: grid;
  max-height: var(--calendar-matches-h);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: var(--shadow-glass);
}

.calendar__match {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-small);
  border-top: var(--border-1) solid var(--c-line);
  cursor: pointer;
}

.calendar__match:first-child {
  border-top: 0;
}

.calendar__match:hover,
.calendar__match:has(:checked) {
  background-color: var(--c-ground);
}

.calendar__match:has(:checked) {
  font-weight: 600;
}

.calendar__match:has(:focus-visible) {
  box-shadow: var(--focus-ring);
}

.calendar__match input {
  flex: none;
  margin: 0;
  accent-color: var(--c-anthracite);
}

.calendar__match > span {
  display: grid;
  min-width: 0;
}

.calendar__match small {
  overflow: hidden;
  font-size: var(--fs-xs);
  font-weight: 400;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--c-text-muted);
}

.calendar__match--new > span {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.calendar__match-none {
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-small);
  color: var(--c-text-muted);
}

.calendar__new-client {
  display: none;
  gap: var(--sp-4);
}

.calendar__dialog:has(input[name="client"][value="new"]:checked) .calendar__new-client {
  display: grid;
}

.calendar__choice {
  display: grid;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  border: 0;
}

/* A head consultant in another consultant's calendar (heads.php): what is not their partners' is grey "Busy", with no
   name; a day of time off is a grey day. */
.calendar__booking--busy {
  color: var(--c-text-muted);
  background-color: var(--c-surface);
  background-image: repeating-linear-gradient(-45deg, var(--c-line) 0 var(--border-1), transparent var(--border-1) var(--sp-2));
  border-color: var(--c-line);
}

.calendar__day--busy .calendar__cells {
  background-color: var(--c-surface);
  background-image: repeating-linear-gradient(-45deg, var(--c-line) 0 var(--border-1), transparent var(--border-1) var(--sp-2));
}

.calendar__off--busy {
  color: var(--c-text-muted);
  background-color: var(--c-surface);
  border-color: var(--c-line);
  cursor: default;
}

.calendar__swatch--busy {
  background-color: var(--c-surface);
  background-image: repeating-linear-gradient(-45deg, var(--c-line) 0 var(--border-1), transparent var(--border-1) var(--sp-1));
  border-color: var(--c-line);
}

/* The toolbar's menus (Availability, New, Calendars; agreed with Christopher 2026-12-03): a title in small capitals
   with a line under it, then the items with a line between each (none after the last). */
.calendar__menu {
  gap: 0;
  padding: var(--sp-2);
}

.calendar__menu > .calendar__menu-title,
.calendar__menu-head {
  border-bottom: var(--border-1) solid var(--c-line);
}

.calendar__menu-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-right: var(--sp-2);
}

.calendar__menu-note {
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  color: var(--c-text-muted);
}

.calendar__new-item,
.calendar__person {
  padding: var(--sp-3) var(--sp-2);
  border-radius: 0;
}

.calendar__new-item + .calendar__new-item,
.calendar__person + .calendar__person,
.availability__row + .availability__row {
  border-top: var(--border-1) solid var(--c-line);
}

/* Availability's two folding rows, Time off and Consultation slots: an icon, the name with a short line under it, and
   a chevron on the right that turns down when open. Only one is open at a time (<details name>). */
.availability__row > summary {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-2);
  font-size: var(--fs-small);
  color: var(--c-text);
  list-style: none;
  cursor: pointer;
}

.availability__row > summary::-webkit-details-marker {
  display: none; /* Safari: its own triangle ignores list-style */
}

.availability__row > summary:hover {
  background-color: var(--c-ground);
}

.availability__row > summary > .bi:first-child {
  font-size: var(--fs-lead);
  color: var(--c-text-muted);
}

.availability__row > summary > span {
  display: grid;
  flex: 1;
}

.availability__row > summary small {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}

.availability__row[open] > summary {
  font-weight: 600;
}

.availability__chevron {
  color: var(--c-text-muted);
  transition: transform var(--duration-fast) var(--ease);
}

.availability__row[open] .availability__chevron {
  transform: rotate(90deg);
}

@media (prefers-reduced-motion: reduce) {
  .availability__chevron {
    transition: none;
  }
}

.availability__row-body {
  display: grid;
  gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-2) var(--sp-4);
}

/* Time off: what is planned, each in lilac with an × to delete it; then From and Until, each on its own line. */
.availability__offs {
  display: grid;
  gap: var(--sp-2);
}

.availability__off {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-small);
  color: var(--c-leave-text);
  background-color: var(--c-leave-bg);
  border: var(--border-1) solid var(--c-leave-border);
  border-radius: var(--radius-1);
}

.availability__off-remove {
  display: grid;
  place-items: center;
  padding: 0;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

.availability__off-form {
  display: grid;
  gap: var(--sp-3);
}

.availability__row-end {
  display: flex;
  justify-content: flex-end;
}
