/* =========================================================================
   cesame — design tokens + semantic atom classes.
   Pages and templates MUST NOT define their own colours/sizes — they reach
   for these classes. Every visual primitive lives here.
   ========================================================================= */

:root {
  /* — colour tokens — */
  --color-surface-page: #faf7f2;
  --color-surface-card: #ffffff;
  --color-surface-muted: #f3ede4;
  --color-fg: #1a1410;
  --color-fg-muted: #6b6258;
  --color-border: #e8e0d3;
  --color-accent: #b8593b;
  --color-accent-hover: #9b4a30;
  --color-accent-soft: #f4dcd3;
  --color-success: #1f7a4f;
  --color-success-soft: #def3e6;
  --color-danger: #b3261e;
  --color-danger-soft: #fde2df;
  --color-warning: #a87000;
  --color-warning-soft: #fdf0d3;

  /* — spacing scale — */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;
  --space-10: 4rem;
  --space-12: 5rem;

  /* — radii — */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-pill: 999px;

  /* — typography — */
  --font-display: 'Fraunces', Georgia, serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;

  /* — effects — */
  --shadow-sm: 0 1px 2px rgba(26, 20, 16, 0.06);
  --shadow-md: 0 4px 12px rgba(26, 20, 16, 0.08);
  --focus-ring: 0 0 0 3px var(--color-accent-soft);

  --max-width: 80rem;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--color-fg);
  background: var(--color-surface-page);
}
a { color: inherit; text-decoration: none; }

/* =========================================================================
   Layout helpers (token-driven, no fixed colours)
   ========================================================================= */

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack--lg { gap: var(--space-6); }
.stack--xl { gap: var(--space-8); }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.row--center { justify-content: center; }

.grid-2, .grid-3, .grid-4 { display: grid; gap: var(--space-3); }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.app-shell { min-height: 100%; display: flex; flex-direction: column; }
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
}
.page { max-width: var(--max-width); margin: 0 auto; padding: var(--space-8) var(--space-4); width: 100%; }
.page--narrow { max-width: 48rem; }
.page--auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--space-4); }

/* =========================================================================
   Typography
   ========================================================================= */

.text { color: var(--color-fg); margin: 0; }
.text--muted { color: var(--color-fg-muted); }
.text--xs { font-size: var(--text-xs); }
.text--sm { font-size: var(--text-sm); }
.text--lg { font-size: var(--text-lg); }
.text--mono { font-family: var(--font-mono); }
.text--strike { text-decoration: line-through; }
.text--right { text-align: right; }
.text--center { text-align: center; }
.text--upper { text-transform: uppercase; letter-spacing: 0.05em; }
.text--tabular { font-variant-numeric: tabular-nums; }
.text--pre { white-space: pre-line; }
.text--accent { color: var(--color-accent); }
.text--success { color: var(--color-success); }
.text--danger { color: var(--color-danger); }

.heading {
  font-family: var(--font-display);
  color: var(--color-fg);
  margin: 0;
  font-weight: 600;
}
.heading--xxl { font-size: var(--text-4xl); line-height: 1.15; }
.heading--xl { font-size: var(--text-3xl); line-height: 1.2; }
.heading--lg { font-size: var(--text-2xl); line-height: 1.25; }
.heading--md { font-size: var(--text-xl); line-height: 1.3; }
.heading--sm { font-size: var(--text-lg); line-height: 1.35; }

.link { color: var(--color-accent); }
.link:hover { color: var(--color-accent-hover); text-decoration: underline; }
.link--muted { color: var(--color-fg-muted); }
.link--muted:hover { color: var(--color-fg); }

/* =========================================================================
   Surfaces
   ========================================================================= */

.card {
  background: var(--color-surface-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.card--inset { padding: var(--space-4); }
.card--flat { box-shadow: none; }

.banner {
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  background: var(--color-surface-muted);
}
.banner--success { background: var(--color-success-soft); border-color: var(--color-success); color: var(--color-success); }
.banner--danger { background: var(--color-danger-soft); border-color: var(--color-danger); color: var(--color-danger); }
.banner--warning { background: var(--color-warning-soft); border-color: var(--color-warning); color: var(--color-warning); }

/* =========================================================================
   Buttons
   ========================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.2;
  padding: var(--space-2) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary { background: var(--color-accent); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--color-accent-hover); }

.btn--secondary { background: var(--color-surface-card); color: var(--color-fg); border-color: var(--color-border); }
.btn--secondary:hover:not(:disabled) { background: var(--color-surface-muted); }

.btn--ghost { color: var(--color-fg-muted); }
.btn--ghost:hover:not(:disabled) { background: var(--color-surface-muted); color: var(--color-fg); }

.btn--danger { background: var(--color-surface-card); color: var(--color-danger); border-color: var(--color-danger-soft); }
.btn--danger:hover:not(:disabled) { background: var(--color-danger-soft); }

.btn--sm { font-size: var(--text-xs); padding: var(--space-1) var(--space-3); }
.btn--lg { font-size: var(--text-base); padding: var(--space-3) var(--space-5); }
.btn--block { width: 100%; }

.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.btn-row--end { justify-content: flex-end; }

/* =========================================================================
   Forms
   ========================================================================= */

.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field__label { font-size: var(--text-sm); font-weight: 500; color: var(--color-fg); }
.field__hint { font-size: var(--text-xs); color: var(--color-fg-muted); }
.field__error { font-size: var(--text-xs); color: var(--color-danger); }

.input,
.select,
.textarea {
  width: 100%;
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--color-fg);
  background: var(--color-surface-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--focus-ring);
}
.input:disabled, .select:disabled, .textarea:disabled {
  background: var(--color-surface-muted);
  color: var(--color-fg-muted);
  cursor: not-allowed;
}
.input--error, .select--error, .textarea--error { border-color: var(--color-danger); }
.textarea { min-height: 4rem; resize: vertical; }

.checkbox-row { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.checkbox { accent-color: var(--color-accent); }

.form-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-3); }
@media (min-width: 640px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid__full { grid-column: span 2; }
}
.form-grid--3 { display: grid; grid-template-columns: 1fr; gap: var(--space-2); }
@media (min-width: 640px) { .form-grid--3 { grid-template-columns: repeat(3, 1fr); } }
.form-grid--4 { display: grid; grid-template-columns: 1fr; gap: var(--space-2); }
@media (min-width: 640px) { .form-grid--4 { grid-template-columns: repeat(4, 1fr); } }
.form-grid--5 { display: grid; grid-template-columns: 1fr; gap: var(--space-2); }
@media (min-width: 640px) { .form-grid--5 { grid-template-columns: repeat(5, 1fr); } }

.fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--color-surface-page);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* =========================================================================
   Badges & pills
   ========================================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  color: var(--color-fg-muted);
}
.badge--accent { background: var(--color-accent-soft); color: var(--color-accent); }
.badge--success { background: var(--color-success-soft); color: var(--color-success); }
.badge--danger { background: var(--color-danger-soft); color: var(--color-danger); }
.badge--warning { background: var(--color-warning-soft); color: var(--color-warning); }

.balance-pill {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 2px var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--color-success-soft);
  color: var(--color-success);
}
.balance-pill--negative { background: var(--color-danger-soft); color: var(--color-danger); }

/* =========================================================================
   Tables
   ========================================================================= */

.table-wrap {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-card);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table thead { background: var(--color-surface-muted); }
.table th {
  text-align: left;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-fg-muted);
  font-weight: 500;
  padding: var(--space-2) var(--space-4);
}
.table td { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--color-border); vertical-align: top; }
.table tr.is-archived { opacity: 0.55; }
.table tr.is-cancelled td { text-decoration: line-through; opacity: 0.6; }

/* =========================================================================
   Navigation chrome
   ========================================================================= */

.nav { border-bottom: 1px solid var(--color-border); background: var(--color-surface-card); }
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
}
.nav__brand { font-family: var(--font-display); font-size: var(--text-xl); color: var(--color-fg); }
.nav__links { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.nav__link { font-size: var(--text-sm); color: var(--color-fg-muted); }
.nav__link:hover { color: var(--color-fg); }
.nav__link--cta { color: var(--color-accent); font-weight: 500; }

.footer { border-top: 1px solid var(--color-border); background: var(--color-surface-card); padding: var(--space-6) var(--space-4); margin-top: auto; }
.footer__inner { max-width: var(--max-width); margin: 0 auto; font-size: var(--text-sm); color: var(--color-fg-muted); }

/* =========================================================================
   Hero / page chrome
   ========================================================================= */

.hero {
  background: linear-gradient(180deg, var(--color-surface-page), var(--color-surface-card));
  padding: var(--space-12) var(--space-4);
  text-align: center;
}
.hero--bg {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image:
    linear-gradient(180deg, rgba(26, 20, 16, 0.35), rgba(26, 20, 16, 0.55)),
    var(--hero-bg-image);
  background-size: cover;
  background-position: center;
  color: var(--color-surface-page);
}
.hero--bg .heading,
.hero--bg .text,
.hero--bg .text--muted { color: var(--color-surface-page); }
.hero__inner {
  max-width: 56rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: center;
}

.section { padding: var(--space-8) 0; }
.section__title { font-family: var(--font-display); font-size: var(--text-2xl); margin: 0 0 var(--space-4); }

/* =========================================================================
   Specifics
   ========================================================================= */

.usage-bar { display: flex; align-items: center; gap: var(--space-3); }
.usage-bar__label { width: 9rem; flex-shrink: 0; font-size: var(--text-xs); color: var(--color-fg-muted); }
.usage-bar__track { flex: 1; height: 0.75rem; background: var(--color-surface-muted); border-radius: var(--radius-pill); overflow: hidden; }
.usage-bar__fill { height: 100%; background: var(--color-accent); }
.usage-bar__value { width: 4rem; text-align: right; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.usage-bar__count { width: 3rem; text-align: right; font-size: var(--text-xs); color: var(--color-fg-muted); font-variant-numeric: tabular-nums; }

.metric { background: var(--color-surface-card); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-sm); }
.metric__label { font-size: var(--text-xs); color: var(--color-fg-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.metric__value { font-family: var(--font-display); font-size: var(--text-3xl); margin-top: var(--space-2); }

.kv { display: flex; flex-direction: column; gap: var(--space-1); }
.kv__key { font-size: var(--text-xs); color: var(--color-fg-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.kv__value { font-size: var(--text-base); color: var(--color-fg); }

.code-block {
  background: var(--color-surface-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}

.divider { height: 1px; background: var(--color-border); border: 0; margin: var(--space-4) 0; }

.list-bare { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.list-bare__item { padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border); }
.list-bare__item:last-child { border-bottom: 0; }

.lang-switcher { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-fg-muted); }
.lang-switcher__btn { background: transparent; border: 0; padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm); cursor: pointer; color: inherit; font-size: var(--text-sm); }
.lang-switcher__btn:hover { background: var(--color-surface-muted); }
.lang-switcher__btn--active { font-weight: 600; color: var(--color-fg); }

/* =========================================================================
   Design system gallery scaffolding
   ========================================================================= */

.ds-section { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-6) 0; border-top: 1px solid var(--color-border); }
.ds-section:first-of-type { border-top: 0; }
.ds-section__title { font-family: var(--font-display); font-size: var(--text-xl); margin: 0; }
.ds-frame { border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-5); background: var(--color-surface-card); }
.ds-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
.ds-swatch__chip { height: 3rem; border-radius: var(--radius-md); border: 1px solid var(--color-border); }

/* =========================================================================
   Schedule grid (rehearsal register)
   ========================================================================= */

.schedule {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  --schedule-hours-col: 4rem;
  --schedule-row-height: 2rem;
  --schedule-rows: 30; /* 8h → 23h, 30 half-hours; route templates emit accordingly */
}
.schedule__header {
  display: grid;
  grid-template-columns: var(--schedule-hours-col) repeat(7, 1fr);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-muted);
}
.schedule__corner { border-right: 1px solid var(--color-border); }
.schedule__day-head {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  text-align: center;
  border-right: 1px solid var(--color-border);
  font-weight: 500;
}
.schedule__day-head:last-child { border-right: 0; }
.schedule__day-head--today { background: var(--color-accent-soft); color: var(--color-accent); }

.schedule__body {
  display: grid;
  grid-template-columns: var(--schedule-hours-col) repeat(7, 1fr);
  position: relative;
}
.schedule__hours {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--color-border);
  background: var(--color-surface-page);
}
.schedule__hour {
  height: var(--schedule-row-height);
  padding: 0 var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-fg-muted);
  font-variant-numeric: tabular-nums;
  border-bottom: 1px dashed var(--color-border);
  display: flex;
  align-items: flex-start;
}
.schedule__hour:nth-child(2n) { border-bottom-style: solid; }

.schedule__col {
  position: relative;
  border-right: 1px solid var(--color-border);
  background-image:
    linear-gradient(to bottom, transparent calc(var(--schedule-row-height) - 1px), var(--color-border) 1px, transparent 0);
  background-size: 100% var(--schedule-row-height);
  height: calc(var(--schedule-row-height) * var(--schedule-rows));
  cursor: crosshair;
  user-select: none;
  /* Stop the browser turning a vertical drag into a page scroll on touch. */
  touch-action: none;
}
.schedule__col:last-child { border-right: 0; }

.schedule__block {
  position: absolute;
  left: 4px;
  right: 4px;
  border-radius: var(--radius-sm);
  background: var(--color-accent-soft);
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  pointer-events: none;
}
.schedule__block--cancelled {
  background: var(--color-surface-muted);
  color: var(--color-fg-muted);
  border-color: var(--color-border);
  text-decoration: line-through;
}
.schedule__block-time { font-weight: 600; }
.schedule__block-duration {
  font-size: var(--text-xs);
  color: var(--color-accent);
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}
.schedule__block-member { font-size: var(--text-xs); }
.schedule__block-note {
  font-size: var(--text-xs);
  color: var(--color-fg-muted);
  font-style: italic;
  white-space: pre-line;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule__selection {
  position: absolute;
  left: 4px;
  right: 4px;
  border-radius: var(--radius-sm);
  background: rgba(184, 89, 59, 0.18);
  border: 2px dashed var(--color-accent);
  cursor: move;
  touch-action: none;
  /* Lay the live preview (time, duration, member, note) like a block. */
  padding: 12px 6px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  font-size: var(--text-xs);
  color: var(--color-accent);
}
/* `display: flex` above outranks the UA `[hidden] { display: none }` rule,
   so each day's empty selection would render as a 24px stub at the top of
   its column. Re-assert hidden so it stays invisible until JS shows it. */
.schedule__selection[hidden] { display: none; }
.schedule__selection > * { pointer-events: none; }
.schedule__selection-time {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.schedule__selection-duration {
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}
.schedule__selection-duration:empty { display: none; }
.schedule__selection-member { font-size: var(--text-xs); }
.schedule__selection-member:empty { display: none; }
.schedule__selection-note {
  font-size: var(--text-xs);
  font-style: italic;
  opacity: 0.85;
  white-space: pre-line;
  overflow: hidden;
  text-overflow: ellipsis;
}
.schedule__selection-note:empty { display: none; }
.schedule__selection-handle {
  position: absolute;
  left: 0;
  right: 0;
  height: 8px;
  background: var(--color-accent);
  opacity: 0.45;
  cursor: ns-resize;
  touch-action: none;
}
.schedule__selection-handle--top { top: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.schedule__selection-handle--bottom { bottom: 0; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

/* =========================================================================
   Combobox (fuzzy autocomplete picker)
   ========================================================================= */

.combobox {
  position: relative;
}
.combobox__search { width: 100%; }
.combobox__list {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0;
  padding: var(--space-1);
  list-style: none;
  background: var(--color-surface-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  max-height: 16rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
/* `display: flex` above outranks the UA `[hidden] { display: none }` rule,
   so re-assert the hidden state explicitly. */
.combobox__list[hidden] { display: none; }
.combobox__option {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.combobox__option[hidden] { display: none; }
.combobox__empty[hidden] { display: none; }
.combobox__option:hover,
.combobox__option--active {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}
.combobox__option-primary { font-weight: 500; }
.combobox__option-secondary {
  font-size: var(--text-xs);
  color: var(--color-fg-muted);
}
.combobox__option--active .combobox__option-secondary { color: var(--color-accent); }
.combobox__empty {
  padding: var(--space-2) var(--space-3);
  color: var(--color-fg-muted);
  font-size: var(--text-sm);
  list-style: none;
}

/* =========================================================================
   Register wizard (mobile pane switcher)
   ========================================================================= */

/* Desktop default: panes flow as a normal stack, the mobile nav is hidden. */
.register-step__nav { display: none; }

@media (max-width: 640px) {
  /* Show only the active pane on mobile so the schedule has the full screen. */
  .register-step[data-register-step="schedule"] [data-register-pane="member"],
  .register-step[data-register-step="member"] [data-register-pane="schedule"] {
    display: none;
  }
  .register-step__nav {
    display: flex;
    justify-content: space-between;
    gap: var(--space-2);
    position: sticky;
    bottom: 0;
    background: var(--color-surface-card);
    border-top: 1px solid var(--color-border);
    padding: var(--space-3);
    margin: var(--space-4) calc(-1 * var(--space-4)) 0;
    z-index: 30;
  }
  /* When only the back-button is rendered, anchor it to the left. */
  [data-register-pane="member"] .register-step__nav { justify-content: flex-start; }
}

/* =========================================================================
   Mobile / touch tweaks
   ========================================================================= */

@media (max-width: 640px) {
  /* On mobile, the schedule occupies the full viewport minus the page chrome
     (admin nav + page heading + bottom step-nav ≈ 14rem). Rows stay tappable
     (2.5rem); the schedule scrolls vertically inside its own bounds when the
     full 8h–23h window doesn't fit. */
  .schedule {
    --schedule-row-height: 2.5rem;
    height: calc(100dvh - 14rem);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }
  /* One day column = one swipe-page wide. The fixed hours column keeps its
     own track so the sticky-left rule below has something to anchor to. */
  .schedule__header,
  .schedule__body {
    grid-template-columns: var(--schedule-hours-col) repeat(7, calc(100vw - var(--schedule-hours-col) - 2 * var(--space-4)));
    min-width: 0;
  }
  .schedule__day-head,
  .schedule__col {
    scroll-snap-align: start;
  }
  .schedule__day-head { font-size: var(--text-xs); padding: var(--space-2) var(--space-1); }
  /* Day-headers stick to the top, hours/corner stick to the left, so the
     user always sees both the current day and time markers while scrolling. */
  .schedule__header {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--color-surface-muted);
  }
  .schedule__corner,
  .schedule__hours {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--color-surface-card);
  }
  .schedule__corner {
    background: var(--color-surface-muted);
    z-index: 4;
  }

  /* Bigger tap targets on the picker dropdown. */
  .combobox__option { padding: var(--space-3); }
}

/* Pointer-coarse devices (phones, tablets) regardless of width. */
@media (pointer: coarse) {
  .schedule__col { cursor: default; }
  .combobox__option { padding: var(--space-3); }
  /* Bigger drag handles for fingertips. */
  .schedule__selection-handle { height: 14px; }
  .schedule__selection-time { top: 14px; }
}
