/* Rally — club dashboard. App style: framed sheet (seed 2044078335).
   One tinted L-frame (the grey-green of a court surround) holds the sidebar and the 48px top bar with
   no rule between them; the day sits on a white sheet inset 8px from the right and bottom, 1px edge,
   16px corners, no shadow. Colour is on data and status only: court blue for court bookings (the main
   data element), and each kind of session keeps one hue across the timeline, the tags and revenue.

   Grid at 1440: sheet = 1440 − 228 sidebar − 8 inset = 1204; content = 1204 − 2 × 24 = 1156
   = 12 × 83 + 11 × 16 (+4 rounding). Rows: 6 + 6, then 8 + 4 (771 + 16 + 369). */

:root {
  --frame: #eef1ec;
  --sheet: #ffffff;
  --raised: #f5f7f4;
  --active: #dfe4dd;
  --border: #e3e7e1;
  --rule: #eef1ed;
  --control: #ccd3ca;
  --text: #0d1b16;
  --muted: #56635d;
  --faint: #66706b;
  --primary: #0d1b16;
  --primary-ink: #ffffff;

  --chart-1: #2a63c9; /* court blue: court bookings, today's takings */
  --positive: #247b50;
  --negative: #c4242a;
  --pill-positive-bg: #dcfae5;
  --pill-positive-ink: #04250e;
  --pill-negative-bg: #ffedea;
  --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb;
  --pill-warning-ink: #92400e;
  --pill-neutral-bg: #eceeea;
  --pill-neutral-ink: #34413b;

  /* each kind of session: a pale fill and an edge of its own hue */
  --k-booking: #dce7f8;
  --k-booking-edge: #2a63c9;
  --k-open: #ebf5c2;
  --k-open-edge: #8aa412;
  --k-clinic: #ffe1d3;
  --k-clinic-edge: #e4521d;
  --k-league: #e3e7e1;
  --k-league-edge: #6c7872;

  --font: var(--ui);
  --fs-title: 24px;
  --fs-kpi: 28px;
  --fs-section: 16px;
  --fs-body: 14px;
  --fs-sub: 13px;
  --fs-small: 12px;

  --sidebar: 228px;
  --topbar: 48px;
  --pad: 24px;
  --gap: 16px;
  --card-pad: 20px;
  --radius-sheet: 16px;
  --radius-card: 8px;
  --radius-control: 6px;
  --radius-chip: 4px;
  --control-h: 32px;
}

body {
  background: var(--frame);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 20px;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--chart-1);
  outline-offset: 2px;
  border-radius: 4px;
}

.tabular,
.num,
table,
.kpi-value {
  font-variant-numeric: tabular-nums;
}

/* ---------- shell ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  grid-template-rows: var(--topbar) minmax(0, 1fr);
  min-height: 100svh;
}

.sidebar {
  grid-column: 1;
  grid-row: 1 / 3;
  position: sticky;
  top: 0;
  height: 100svh;
  display: flex;
  flex-direction: column;
  padding: 0 12px 16px;
  overflow: auto;
}
.sb-logo {
  height: var(--topbar);
  padding: 0 8px;
  font-size: 20px;
}
.club-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin: 8px 0 16px;
  padding: 8px;
  border: 1px solid var(--control);
  border-radius: var(--radius-card);
  background: var(--sheet);
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease;
}
.club-switch:hover {
  border-color: #9fa9a3;
}
.club-switch svg {
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.club-meta {
  display: grid;
  line-height: 18px;
}
.club-meta strong {
  font-weight: 600;
}
.club-meta span {
  font-size: var(--fs-small);
  color: var(--muted);
}

.sb-nav,
.sb-foot {
  display: grid;
  gap: 2px;
}
.sb-nav a,
.sb-foot > a {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius-control);
  color: var(--muted);
  text-decoration: none;
  transition: background-color 150ms ease, color 150ms ease;
}
.sb-nav svg,
.sb-foot svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sb-nav a:hover,
.sb-foot > a:hover {
  background: #e6eae4;
  color: var(--text);
}
.sb-nav a.active {
  background: var(--active);
  color: var(--text);
  font-weight: 500;
}
.sb-count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--negative);
  color: #fff;
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.sb-count-muted {
  background: var(--active);
  color: var(--text);
}
.sb-nav a.active .sb-count-muted {
  background: var(--sheet);
}
.sb-foot {
  margin-top: auto;
}
.sb-plan {
  margin-top: 10px;
  padding: 10px 8px 4px;
}
.sb-plan p {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-small);
  color: var(--muted);
}
.sb-plan strong {
  color: var(--text);
  font-weight: 600;
}
.sb-plan-track {
  height: 4px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--active);
}
.sb-plan-track span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--text);
}

.topbar {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px 0 8px;
  position: relative;
}
.topbar .tb-logo,
.topbar .menu-btn {
  display: none;
}
.search {
  position: absolute;
  left: calc(50vw - var(--sidebar));
  top: 8px;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(548px, 38vw);
  height: 32px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--control);
  border-radius: var(--radius-control);
  background: var(--sheet);
}
.search svg {
  width: 14px;
  height: 14px;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  stroke-linecap: round;
}
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: var(--fs-body);
}
.search input::placeholder {
  color: var(--faint);
}
.search:focus-within {
  border-color: var(--chart-1);
  outline: 2px solid rgba(42, 99, 201, 0.25);
}
.search kbd {
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  font-family: var(--font);
  font-size: var(--fs-small);
  line-height: 18px;
  color: var(--muted);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.clock {
  font-size: var(--fs-sub);
  color: var(--muted);
}
.clock strong {
  color: var(--text);
  font-weight: 600;
}
.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}
.icon-btn:hover {
  background: #e3e8e1;
  color: var(--text);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--negative);
}
.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #eef6c8;
  color: #3b4a07;
  font-size: var(--fs-small);
  font-weight: 600;
}

/* the sheet */
.sheet {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  margin: 0 8px 8px 0;
  padding: var(--pad);
  border: 1px solid var(--border);
  border-radius: var(--radius-sheet);
  background: var(--sheet);
}

/* ---------- buttons and small controls ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--control-h);
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font-size: var(--fs-body);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 120ms var(--ease-out);
}
.btn:active {
  transform: translateY(1px);
}
.btn svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: var(--fs-sub);
}
.btn-ink {
  background: var(--primary);
  color: var(--primary-ink);
}
.btn-ink:hover {
  background: #26352f;
}
.btn-outline {
  background: var(--sheet);
  border-color: var(--control);
  color: var(--text);
}
.btn-outline:hover {
  border-color: #9fa9a3;
  background: var(--raised);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
}
.btn-ghost:hover {
  background: var(--raised);
}
.btn-red {
  background: var(--negative);
  color: #fff;
}
.btn-red:hover {
  background: #a51d22;
}
.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.pill,
.rec,
.warn,
.muted-tag,
.tag {
  display: inline-flex;
  align-items: center;
  flex: none;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--radius-chip);
  font-size: var(--fs-small);
  font-style: normal;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  vertical-align: 1px;
}
.rec {
  background: var(--pill-positive-bg);
  color: var(--pill-positive-ink);
}
.warn {
  background: var(--pill-warning-bg);
  color: var(--pill-warning-ink);
}
.muted-tag {
  background: var(--pill-neutral-bg);
  color: var(--pill-neutral-ink);
}

.tag.t-booking {
  background: var(--k-booking);
  color: #163a7a;
}
.tag.t-open {
  background: var(--k-open);
  color: #3a4707;
}
.tag.t-clinic,
.tag.t-lesson {
  background: var(--k-clinic);
  color: #7a2a0c;
}
.tag.t-league,
.tag.t-ladder,
.tag.t-maint {
  background: var(--k-league);
  color: #2c3732;
}

.av {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: var(--fs-small);
  font-weight: 600;
}
.av-sm {
  width: 26px;
  height: 26px;
  font-size: 11px;
}
.av-green {
  background: #dcefe3;
  color: #1c5a3a;
}
.av-blue {
  background: #dfe8f8;
  color: #1c4690;
}
.av-orange,
.av-violet {
  background: #fde6dc;
  color: #8a2f0c;
}
.av-red {
  background: #fde3e3;
  color: #8a1d22;
}
.av-ball {
  background: #eef6c8;
  color: #3b4a07;
}

/* ---------- title row ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}
.page-head h1 {
  font-family: var(--display);
  font-size: var(--fs-title);
  font-weight: 600;
  line-height: 30px;
  letter-spacing: -0.015em;
}
.page-date {
  margin-top: 2px;
  color: var(--muted);
}
.page-sub {
  margin-top: 4px;
  font-size: 16px;
  line-height: 22px;
}
.page-sub strong {
  color: var(--negative);
  font-weight: 600;
}
.page-sub strong.ok {
  color: var(--positive);
}
.page-facts {
  display: flex;
  gap: 28px;
  margin: 0;
}
.page-facts dt {
  font-size: var(--fs-small);
  color: var(--muted);
}
.page-facts dd {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 0;
  white-space: nowrap;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot-ok {
  background: var(--positive);
}

/* ---------- KPIs: one container split by dividers ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.kpi {
  padding: 16px var(--card-pad);
  min-width: 0;
}
.kpi + .kpi {
  border-left: 1px solid var(--border);
}
.kpi-label {
  color: var(--muted);
}
.kpi-value {
  margin-top: 6px;
  font-size: var(--fs-kpi);
  font-weight: 500;
  line-height: 32px;
  letter-spacing: -0.01em;
}
.kpi-of {
  font-size: 16px;
  color: var(--muted);
  font-weight: 400;
}
.kpi-sub {
  margin-top: 6px;
  font-size: var(--fs-sub);
  line-height: 18px;
  color: var(--muted);
}
.kpi-sub strong {
  color: var(--text);
  font-weight: 600;
}
.delta {
  font-weight: 600;
  color: var(--muted);
}
.delta.good {
  color: var(--positive);
}
.delta.bad {
  color: var(--negative);
}

/* ---------- grid and cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap);
}
.card {
  min-width: 0;
  padding: var(--card-pad);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--sheet);
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.card-head h2,
.card-head h3,
.block-head h2 {
  font-size: var(--fs-section);
  font-weight: 600;
  line-height: 22px;
}
.note {
  margin-top: 2px;
  font-size: var(--fs-sub);
  line-height: 18px;
  color: var(--muted);
}
.note strong {
  color: var(--text);
  font-weight: 600;
}
.muted {
  color: var(--muted);
}

/* ---------- needs your attention ---------- */
.attention {
  margin-top: 32px;
}
.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.block-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--negative);
  color: #fff;
  font-size: var(--fs-small);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.count.clear {
  background: var(--pill-positive-bg);
  color: var(--pill-positive-ink);
}
.block-head .note {
  margin: 0;
}

.attn-card {
  grid-column: span 6;
  display: flex;
  flex-direction: column;
}
.attn-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.attn-kicker {
  font-size: var(--fs-sub);
  color: var(--muted);
}
.attn-head h3 {
  margin-top: 2px;
  font-size: var(--fs-section);
  font-weight: 600;
  line-height: 22px;
}
.attn-when {
  flex: none;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-chip);
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 22px;
  font-variant-numeric: tabular-nums;
}
.attn-red .attn-when {
  background: var(--pill-negative-bg);
  color: var(--pill-negative-ink);
}
.attn-amber .attn-when {
  background: var(--pill-warning-bg);
  color: var(--pill-warning-ink);
}
.attn-card.is-resolved .attn-when {
  background: var(--pill-positive-bg);
  color: var(--pill-positive-ink);
}
.attn-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.clash {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}
.clash-item {
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  font-size: var(--fs-sub);
  line-height: 18px;
}
.clash-item .tag {
  margin-bottom: 6px;
  width: fit-content;
}
.clash-item strong {
  font-size: var(--fs-body);
  font-weight: 600;
}
.clash-vs {
  align-self: center;
  font-size: var(--fs-small);
  color: var(--muted);
}
.hint {
  padding: 10px 12px;
  border-radius: var(--radius-control);
  background: var(--raised);
  font-size: var(--fs-sub);
  line-height: 19px;
}
.hint strong {
  font-weight: 600;
}
.attn-text {
  line-height: 21px;
}
.attn-text strong {
  font-weight: 600;
}
.choices {
  display: grid;
  gap: 8px;
}
.choice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: border-color 150ms ease;
}
.choice:hover {
  border-color: #aab3ad;
}
.choice:has(input:checked) {
  border-color: var(--text);
  outline: 1px solid var(--text);
  outline-offset: -2px;
}
.choice input {
  flex: none;
  margin: 3px 0 0;
  accent-color: var(--text);
}
.choice strong {
  font-weight: 600;
}
.choice-sub {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-sub);
  line-height: 18px;
  color: var(--muted);
}
.coach {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.attn-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}
.resolved {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: var(--radius-control);
  background: var(--pill-positive-bg);
  color: var(--pill-positive-ink);
}
.resolved-muted {
  background: var(--raised);
  color: var(--text);
}
.resolved-ico svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.resolved strong {
  font-weight: 600;
}
.resolved p {
  margin-top: 2px;
  font-size: var(--fs-sub);
  line-height: 19px;
}

/* waitlist */
.wait-list {
  display: grid;
}
.wait-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
}
.wait-item + .wait-item {
  border-top: 1px solid var(--rule);
}
.wait-main {
  flex: 1;
  min-width: 0;
}
.wait-top {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
}
.wait-top strong {
  font-weight: 600;
}
.wait-meta {
  font-size: var(--fs-sub);
  color: var(--muted);
}
.match {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: var(--fs-sub);
  line-height: 18px;
  font-weight: 500;
}
.match.blocked {
  color: var(--muted);
}
.match.ok {
  color: var(--positive);
}
.match.pending {
  color: var(--text);
}
.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--control);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.wait-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.hint-small {
  padding: 8px 12px;
}

/* also today */
.todo-card {
  grid-column: span 6;
}
.todo-item {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 56px;
  padding: 10px 0;
}
.todo-item + .todo-item {
  border-top: 1px solid var(--rule);
}
.todo-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.tone-red {
  background: var(--negative);
}
.tone-amber {
  background: #c97a12;
}
.tone-blue {
  background: var(--chart-1);
}
.tone-green {
  background: var(--positive);
}
.todo-main {
  flex: 1;
  min-width: 0;
  display: grid;
}
.todo-main strong {
  font-weight: 600;
}
.todo-main span {
  font-size: var(--fs-sub);
  line-height: 18px;
  color: var(--muted);
}
.todo-item.done .todo-main strong {
  font-weight: 500;
}
.todo-actions {
  display: flex;
  gap: 6px;
  flex: none;
}

/* ---------- courts today: the timeline ---------- */
.schedule {
  margin-top: var(--gap);
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: var(--fs-small);
  color: var(--muted);
}
.legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tdot {
  flex: none;
  width: 14px;
  height: 10px;
  border-radius: 2px;
  border-left: 2px solid var(--k-booking-edge);
  background: var(--k-booking);
}
.tdot.t-open {
  background: var(--k-open);
  border-left-color: var(--k-open-edge);
}
.tdot.t-league {
  background: var(--k-league);
  border-left-color: var(--k-league-edge);
}
.tdot.t-ladder {
  background: #fff;
  border: 1px solid var(--k-league-edge);
}
.tdot.t-clinic {
  background: var(--k-clinic);
  border-left-color: var(--k-clinic-edge);
}
.tdot.t-lesson {
  background: #fff;
  border: 1px solid var(--k-clinic-edge);
}
.tdot.t-maint {
  background: #f4f6f3 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6'%3E%3Cpath d='M-1 7 7 -1M-1 1 1 -1M5 7 7 5' stroke='%23c3cac2' stroke-width='1.2'/%3E%3C/svg%3E");
  border: 0;
}
.tdot.t-open-slot {
  background: transparent;
  border: 1px dashed #7d9bd1;
}

.timeline-scroll {
  overflow-x: auto;
  margin: 0 calc(-1 * var(--card-pad));
  padding: 0 var(--card-pad);
}
.timeline {
  --label: 112px;
  position: relative;
  min-width: 1060px;
}
.timeline.is-narrow {
  --label: 76px;
  min-width: 0;
}
.timeline.is-narrow .tl-sub {
  display: none;
}
.timeline.is-narrow .tl-block {
  padding: 0 4px 0 5px;
}
.timeline.is-narrow .tl-open span {
  display: none;
}
.tl-head {
  display: grid;
  grid-template-columns: var(--label) 1fr;
  height: 40px;
}
.tl-hours {
  position: relative;
}
.tl-hours > span {
  position: absolute;
  bottom: 6px;
  translate: -50% 0;
  font-size: var(--fs-small);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.tl-hours > span:first-of-type {
  translate: 0 0;
}
.tl-hours > span:last-of-type {
  translate: -100% 0;
}
.tl-prime-label {
  position: absolute;
  top: 0;
  height: 16px;
  font-size: var(--fs-small);
  line-height: 16px;
  font-weight: 600;
  color: #1c4690;
  text-align: center;
}
.tl-row {
  display: grid;
  grid-template-columns: var(--label) 1fr;
  height: 48px;
}
.tl-row + .tl-row .tl-track {
  border-top: 1px solid var(--rule);
}
.tl-row:has(.conflict) {
  height: 76px;
}
.tl-label {
  display: grid;
  align-content: center;
  line-height: 17px;
}
.tl-label strong {
  font-weight: 600;
}
.tl-label span {
  font-size: var(--fs-small);
  color: var(--muted);
}
.tl-track {
  position: relative;
}
.tl-prime {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(42, 99, 201, 0.06);
}
.tl-past {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  background: rgba(13, 27, 22, 0.025);
}
.tl-grid {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--rule);
}
.tl-open {
  position: absolute;
  top: 7px;
  bottom: 7px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  border: 1px dashed #c2cbc4;
  border-radius: var(--radius-chip);
  font-size: var(--fs-small);
  color: var(--muted);
  overflow: hidden;
  white-space: nowrap;
}
.tl-open.prime {
  border-color: #7d9bd1;
  color: #1c4690;
  font-weight: 600;
}
.tl-block {
  position: absolute;
  top: 6px;
  bottom: 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  padding: 0 7px 0 7px;
  border: 0;
  border-left: 3px solid var(--k-booking-edge);
  border-radius: var(--radius-chip);
  background: var(--k-booking);
  color: var(--text);
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  transition: filter 150ms ease;
}
.tl-block:hover {
  filter: brightness(0.96);
}
.tl-title,
.tl-sub {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tl-title {
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 15px;
}
.tl-sub {
  font-size: 11px;
  line-height: 14px;
  color: #3d4a44;
}
.tl-block.t-open {
  background: var(--k-open);
  border-left-color: var(--k-open-edge);
}
.tl-block.t-league {
  background: var(--k-league);
  border-left-color: var(--k-league-edge);
}
.tl-block.t-ladder {
  background: #fff;
  border: 1px solid var(--k-league-edge);
}
.tl-block.t-clinic {
  background: var(--k-clinic);
  border-left-color: var(--k-clinic-edge);
}
.tl-block.t-lesson {
  background: #fff;
  border: 1px solid var(--k-clinic-edge);
}
.tl-block.t-maint {
  background: #f4f6f3 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6'%3E%3Cpath d='M-1 7 7 -1M-1 1 1 -1M5 7 7 5' stroke='%23c3cac2' stroke-width='1.2'/%3E%3C/svg%3E");
  border: 0;
  padding-left: 10px;
}
.tl-block.st-done {
  opacity: 0.55;
}
.tl-block.st-cancelled {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--muted);
}
.tl-block.st-cancelled .tl-title {
  text-decoration: line-through;
}
.tl-block.st-pending {
  background: #fff;
  border: 1px dashed var(--k-league-edge);
}
.tl-block.st-noshow {
  background: #fff;
  border: 1px solid #d2b48a;
  opacity: 1;
}
/* what needs a decision: the one place for full colour */
.tl-block.conflict,
.tl-block.st-nocoach {
  border: 1.5px solid var(--negative);
}
.tl-block.conflict {
  background: var(--pill-negative-bg);
  bottom: auto;
  height: 30px;
}
.tl-block.conflict.lane-0 {
  top: 6px;
}
.tl-block.conflict.lane-1 {
  top: 40px;
}
.tl-block.conflict .tl-sub {
  display: none;
}
.tl-flag {
  position: absolute;
  top: 50%;
  right: 6px;
  translate: 0 -50%;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--negative);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.tl-block:has(.tl-flag) {
  padding-right: 26px;
}
.tl-live {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--positive);
}
.tl-now {
  position: absolute;
  top: 18px;
  bottom: 0;
  left: calc(var(--label) + (100% - var(--label)) * var(--now));
  width: 2px;
  margin-left: -1px;
  background: var(--chart-1);
  pointer-events: none;
}
.tl-now span {
  position: absolute;
  top: -2px;
  left: 50%;
  translate: -50% -100%;
  padding: 0 4px;
  border-radius: var(--radius-chip);
  background: var(--chart-1);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- lower rows ---------- */
.lower,
.money {
  margin-top: var(--gap);
}
.bookings,
.revenue {
  grid-column: span 8;
}
.bookings {
  display: flex;
  flex-direction: column;
}
.bookings .table-wrap {
  flex: 1 1 0;
  min-height: 420px;
  max-height: none;
}
.lower.is-short {
  align-items: start;
}
.lower.is-short .bookings .table-wrap {
  flex: none;
  min-height: 0;
}
.stack,
.noshows {
  grid-column: span 4;
}
.stack {
  display: grid;
  gap: var(--gap);
  align-content: start;
}

/* segmented filter */
.seg {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  background: #eef1ec;
}
.seg button {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-sub);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}
.seg button:hover {
  color: var(--text);
}
.seg button[aria-selected="true"] {
  background: var(--sheet);
  color: var(--text);
  outline: 1px solid var(--border);
  outline-offset: -1px;
}

/* bookings table */
.table-wrap {
  max-height: 548px;
  overflow: auto;
  margin: 0 calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad));
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 36px;
  padding: 0 12px;
  background: var(--sheet);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-small);
  font-weight: 400;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
}
.table th:first-child,
.table td:first-child {
  padding-left: var(--card-pad);
}
.table th:last-child,
.table td:last-child {
  padding-right: var(--card-pad);
}
.table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
.table tbody tr {
  cursor: pointer;
}
.table tbody tr:hover td {
  background: var(--raised);
}
.table tbody tr:focus-visible {
  outline: 2px solid var(--chart-1);
  outline-offset: -2px;
}
.table .num {
  text-align: right;
}
.nowrap {
  white-space: nowrap;
}
.bk {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.bk .tdot {
  margin-top: 5px;
}
.bk div {
  display: grid;
  min-width: 0;
}
.bk strong {
  font-weight: 600;
}
.bk span {
  font-size: var(--fs-sub);
  line-height: 18px;
  color: var(--muted);
}
.warn-text {
  color: var(--pill-warning-ink);
  font-weight: 600;
}
td.empty {
  padding: 28px 20px;
  color: var(--muted);
  text-align: center;
}

.pay,
.status {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--radius-chip);
  font-size: var(--fs-small);
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pay.paid,
.pay.pass,
.pay.refunded,
.pay.none,
.status.s-upcoming,
.status.s-done {
  padding: 0;
  color: var(--muted);
  font-weight: 400;
}
.pay.due,
.status.s-noshow {
  background: var(--pill-warning-bg);
  color: var(--pill-warning-ink);
}
.pay.sent,
.status.s-pending {
  background: var(--pill-neutral-bg);
  color: var(--pill-neutral-ink);
}
.status.s-live {
  background: var(--pill-positive-bg);
  color: var(--pill-positive-ink);
}
.status.s-conflict,
.status.s-nocoach {
  background: var(--pill-negative-bg);
  color: var(--pill-negative-ink);
}
.status.s-cancelled {
  padding: 0;
  color: var(--muted);
  text-decoration: line-through;
}

/* check-ins */
.sub-title {
  margin: 4px 0 4px;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--muted);
}
.sub-title + ul {
  margin-bottom: 12px;
}
.arrival {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
}
.arrival + .arrival {
  border-top: 1px solid var(--rule);
}
.arr-time {
  display: grid;
  line-height: 17px;
}
.arr-time strong {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.arr-time span {
  font-size: var(--fs-small);
  color: var(--muted);
}
.arr-who {
  font-weight: 600;
}
.late {
  margin-left: 4px;
  font-size: var(--fs-small);
  font-style: normal;
  font-weight: 500;
  color: var(--pill-warning-ink);
}
.faces {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.face {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px dashed #aab3ad;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.face.in {
  border: 0;
  background: var(--pill-positive-bg);
  color: var(--pill-positive-ink);
}
.recent li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
}
.recent li + li {
  border-top: 1px solid var(--rule);
}
.recent li div {
  flex: 1;
  min-width: 0;
  display: grid;
  line-height: 17px;
}
.recent strong {
  font-weight: 600;
}
.recent div span {
  font-size: var(--fs-small);
  color: var(--muted);
}
.recent time {
  font-size: var(--fs-sub);
  color: var(--muted);
}
.recent li.fresh time {
  color: var(--positive);
  font-weight: 600;
}
.arrivals .empty {
  padding: 10px 0;
  color: var(--muted);
}

/* on duty */
.staff-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}
.staff-list li + li {
  border-top: 1px solid var(--rule);
}
.staff-list li div {
  flex: 1;
  min-width: 0;
  display: grid;
  line-height: 18px;
}
.staff-list strong {
  font-weight: 600;
}
.staff-list div span {
  font-size: var(--fs-small);
  color: var(--muted);
}
.staff-st {
  flex: none;
  font-size: var(--fs-small);
  font-style: normal;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.staff-st.st-green {
  color: var(--positive);
}
.staff-st.st-red {
  height: 20px;
  padding: 0 7px;
  border-radius: var(--radius-chip);
  background: var(--pill-negative-bg);
  color: var(--pill-negative-ink);
  line-height: 20px;
}

/* revenue */
.rev-total {
  display: grid;
  justify-items: end;
  text-align: right;
}
.rev-total strong {
  font-size: 24px;
  font-weight: 600;
  line-height: 28px;
}
.rev-total span {
  font-size: var(--fs-sub);
  color: var(--muted);
}
.rev-total span strong {
  font-size: inherit;
  color: var(--text);
}
.rev-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.rev-key {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-bottom: 12px;
  font-size: var(--fs-small);
  color: var(--muted);
}
.rev-key li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sw {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
.sw-taken {
  background: #8f9a94;
}
.sw-today {
  background: var(--chart-1);
}
.sw-booked {
  background: #fff;
  border: 1.5px solid var(--chart-1);
}
.bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  height: 196px;
}
.bar-col {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
}
.bar-area {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-top: 22px;
  border-bottom: 1px solid #b9c1bb;
}
.bar {
  position: relative;
  background: #8f9a94;
}
.bar-col.today .bar {
  background: var(--chart-1);
}
.bar-col.booked .bar {
  background: #fff;
  border: 1.5px solid var(--chart-1);
  border-bottom: 0;
}
.bar-val {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  translate: -50% 0;
  font-size: var(--fs-small);
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.bar-day {
  padding-top: 6px;
  font-size: var(--fs-small);
  text-align: center;
  color: var(--muted);
}
.bar-col.today .bar-day {
  color: var(--text);
  font-weight: 600;
}
.rev-breakdown {
  display: grid;
}
.rev-breakdown li:not(.stack-bar) {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto 40px;
  gap: 10px;
  align-items: center;
  min-height: 36px;
}
.rev-breakdown li + li:not(.stack-bar) {
  border-top: 1px solid var(--rule);
}
.rev-breakdown .stack-bar {
  display: flex;
  height: 12px;
  margin-bottom: 10px;
  border-radius: 3px;
  overflow: hidden;
}
.stack-bar span + span {
  border-left: 2px solid #fff;
}
.rb-amt,
.rb-pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.rb-amt {
  font-weight: 500;
}
.rb-pct {
  color: var(--muted);
  font-size: var(--fs-sub);
}
/* one hue per kind of session, the same as on the timeline */
.tone-green.sw,
.stack-bar .tone-green {
  background: var(--chart-1);
}
.tone-orange.sw,
.stack-bar .tone-orange {
  background: var(--k-clinic-edge);
}
.tone-ball.sw,
.stack-bar .tone-ball {
  background: #b9d62a;
}
.tone-indigo.sw,
.stack-bar .tone-indigo {
  background: var(--k-league-edge);
}
.tone-gray.sw,
.stack-bar .tone-gray {
  background: #c9cfca;
}

/* no-shows */
.ns-list li {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 52px;
  padding: 8px 0;
}
.ns-list li + li {
  border-top: 1px solid var(--rule);
}
.ns-day {
  font-size: var(--fs-sub);
  color: var(--muted);
}
.ns-main {
  display: grid;
  line-height: 18px;
}
.ns-main strong {
  font-weight: 600;
}
.ns-main span {
  font-size: var(--fs-sub);
  color: var(--muted);
}
.repeat {
  font-size: var(--fs-small);
  font-style: normal;
  font-weight: 500;
  color: var(--pill-warning-ink);
}
.policy {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-size: var(--fs-sub);
  line-height: 19px;
  color: var(--muted);
}

.proto-note {
  margin-top: 24px;
  font-size: var(--fs-small);
  color: var(--faint);
}

/* ---------- floating things: these may cast a shadow ---------- */
.popover {
  position: fixed;
  z-index: 40;
  width: 340px;
  max-width: calc(100vw - 24px);
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--sheet);
  box-shadow: 0 12px 32px rgba(13, 27, 22, 0.16);
}
.pop-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pop-close {
  margin-left: auto;
  width: 28px;
  height: 28px;
}
.popover h3 {
  margin-top: 10px;
  font-size: var(--fs-section);
  font-weight: 600;
  line-height: 22px;
}
.pop-alert {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-control);
  background: var(--pill-negative-bg);
  color: var(--pill-negative-ink);
  font-size: var(--fs-sub);
  line-height: 18px;
}
.popover dl {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 6px 10px;
  margin-top: 12px;
  font-size: var(--fs-sub);
}
.popover dt {
  color: var(--muted);
}
.pop-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: grid;
  gap: 8px;
  justify-items: end;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  padding: 10px 14px;
  border-radius: var(--radius-card);
  background: var(--text);
  color: #fff;
  box-shadow: 0 10px 28px rgba(13, 27, 22, 0.22);
  opacity: 0;
  translate: 0 8px;
  transition: opacity 240ms var(--ease-out), translate 240ms var(--ease-out);
}
.toast.in {
  opacity: 1;
  translate: none;
}
.toast-ico svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--lime);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flash {
  animation: flash 1400ms ease;
}
@keyframes flash {
  0%,
  40% {
    outline: 2px solid var(--chart-1);
    outline-offset: 3px;
  }
  100% {
    outline: 2px solid transparent;
    outline-offset: 3px;
  }
}

/* ---------- tablet: the sidebar folds into the top bar ---------- */
@media (max-width: 1100px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--topbar) minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    inset: 0;
    z-index: 60;
    width: 100%;
    height: 100%;
    padding: 0 16px 20px;
    background: var(--frame);
    visibility: hidden;
    transform: translateX(-100%);
    transition: transform 240ms var(--ease-out), visibility 0s linear 240ms;
  }
  .nav-open .sidebar {
    visibility: visible;
    transform: none;
    transition: transform 240ms var(--ease-out);
  }
  .nav-open .menu-btn {
    position: fixed;
    z-index: 70;
    top: 8px;
    right: 12px;
  }
  .topbar {
    grid-column: 1;
    padding: 0 16px 0 8px;
  }
  .topbar .menu-btn,
  .topbar .tb-logo {
    display: inline-flex;
  }
  .topbar .tb-logo {
    font-size: 20px;
  }
  .search {
    position: static;
    translate: none;
    width: auto;
    flex: 1;
    max-width: 360px;
    margin-left: 8px;
  }
  .clock {
    display: none;
  }
  .sheet {
    grid-column: 1;
    margin: 0 8px 8px;
  }
  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .attn-card,
  .todo-card,
  .bookings,
  .revenue,
  .stack,
  .noshows {
    grid-column: 1 / -1;
  }
  .stack {
    grid-template-columns: 1fr;
  }
}

/* ---------- phone ---------- */
@media (max-width: 640px) {
  :root {
    --pad: 16px;
    --card-pad: 16px;
  }
  .topbar {
    gap: 8px;
  }
  .search,
  .avatar,
  .topbar .icon-btn[data-proto] {
    display: none;
  }
  .sheet {
    margin: 0;
    border-radius: 0;
    border-width: 1px 0 0;
  }
  .page-head h1 {
    font-size: 22px;
  }
  .page-facts {
    flex-direction: column;
    gap: 8px;
  }
  .page-facts div {
    display: flex;
    gap: 8px;
  }
  .page-facts dt {
    width: 64px;
    font-size: var(--fs-sub);
  }
  .kpis {
    grid-template-columns: 1fr 1fr;
  }
  .kpi + .kpi {
    border-left: 0;
  }
  .kpi:nth-child(2n) {
    border-left: 1px solid var(--border);
  }
  .kpi:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }
  .kpi {
    padding: 14px var(--card-pad);
  }
  .kpi-value {
    font-size: 24px;
  }
  .block-head {
    flex-direction: column;
    gap: 2px;
  }
  .clash {
    grid-template-columns: 1fr;
  }
  .clash-vs {
    justify-self: start;
  }
  .wait-item {
    flex-wrap: wrap;
  }
  .wait-actions {
    width: 100%;
    flex-direction: row;
    padding-left: 44px;
  }
  .todo-item {
    flex-wrap: wrap;
  }
  .todo-actions {
    width: 100%;
    padding-left: 20px;
  }
  .stack {
    grid-template-columns: 1fr;
  }
  .seg {
    display: flex;
    width: 100%;
  }
  .seg button {
    flex: 1 1 auto;
    padding: 0 6px;
    white-space: nowrap;
  }
  .card-head > div:first-child {
    width: 100%;
  }
  /* the bookings table becomes two-line rows: who and status, then when, where, players, payment */
  .table thead {
    display: none;
  }
  .table tbody tr {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    grid-template-areas:
      "who who who status"
      "time court players pay";
    gap: 4px 10px;
    align-items: center;
    padding: 10px var(--card-pad);
    border-bottom: 1px solid var(--rule);
  }
  .table td {
    padding: 0 !important;
    border: 0;
    background: transparent !important;
  }
  .table td:nth-child(1) {
    grid-area: time;
    font-size: var(--fs-sub);
  }
  .table td:nth-child(2) {
    grid-area: court;
    font-size: var(--fs-sub);
    color: var(--muted);
  }
  .table td:nth-child(3) {
    grid-area: who;
  }
  .table td:nth-child(4) {
    grid-area: players;
    font-size: var(--fs-sub);
    text-align: right;
  }
  .table td:nth-child(4)::after {
    content: " players";
    color: var(--muted);
  }
  .table td:nth-child(5) {
    grid-area: pay;
    justify-self: end;
  }
  .table td:nth-child(6) {
    grid-area: status;
    justify-self: end;
  }
  .table td.empty {
    grid-column: 1 / -1;
    padding: 20px 0 !important;
  }
  .rev-body {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .rev-total {
    justify-items: start;
    text-align: left;
  }
  .bars {
    gap: 6px;
  }
  .bar-val {
    font-size: 11px;
  }
  .toasts {
    left: 12px;
    right: 12px;
    justify-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
