/*
 * Shared layout for every studio's web pages: the Paper layout.
 * No cards and no shadows; thin rules divide rows. Every colour, radius, type
 * size and weight comes from the studio's generated /studio/theme.css (see
 * Studios/<slug>/design/tokens.json). No colour literal belongs in this file:
 * build_tokens.py --check fails on one.
 * Type: five sizes (--text-xs … --text-xl) and two weights.
 * Breakpoints: phone first; tablet from 48rem; wide staff tables from 64rem.
 * The capacity picker (room map, pooled count) lives in picker.css.
 */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text-m);
  line-height: var(--leading-m);
  font-weight: var(--weight-regular);
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3, p, dl, dd, figure { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
a { color: var(--ink); text-underline-offset: 0.2em; }
strong, b { font-weight: var(--weight-strong); }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.nowrap { white-space: nowrap; }
.line-below { display: block; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Type: five sizes, two weights ---------- */
.page-title { font-size: var(--text-xl); line-height: var(--leading-xl); font-weight: var(--weight-regular); letter-spacing: -0.02em; }
h2, .section-title { font-size: var(--text-m); line-height: var(--leading-m); font-weight: var(--weight-strong); }
h3 { font-size: var(--text-s); line-height: var(--leading-s); font-weight: var(--weight-strong); }
.eyebrow { font-size: var(--text-xs); line-height: var(--leading-xs); font-weight: var(--weight-strong); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.meta, .muted { color: var(--muted); }
.meta, .small { font-size: var(--text-s); line-height: var(--leading-s); }
.lead { font-size: var(--text-l); line-height: var(--leading-l); }

/* ---------- Environment line: the one place test wording appears ---------- */
.env-line {
  font-size: var(--text-xs);
  line-height: var(--leading-xs);
  color: var(--muted);
  text-align: center;
  padding: var(--space-xs) var(--space-l);
  border-bottom: 1px solid var(--line);
}

/* ---------- Member shell: brand row on top, three-item bar at the bottom ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-m);
  max-width: 40rem;
  margin: 0 auto;
  padding: var(--space-m) var(--space-l);
  min-height: 3.5rem;
}
.brand {
  font-size: var(--text-s);
  line-height: var(--leading-s);
  font-weight: var(--weight-strong);
  text-decoration: none;
  color: var(--ink);
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
}
.top-side { display: flex; align-items: center; gap: var(--space-l); font-size: var(--text-s); color: var(--muted); }
.top-side a { color: var(--ink); min-height: 2.75rem; display: inline-flex; align-items: center; }
.top-credits { font-variant-numeric: tabular-nums; }
.top-credits b { color: var(--mine); }
.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--canvas);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tabbar a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.5rem;
  font-size: var(--text-xs);
  line-height: var(--leading-xs);
  color: var(--muted);
  text-decoration: none;
  /* Large text: a label wraps inside its third of the bar instead of spilling. */
  min-width: 0;
  padding: var(--space-xs);
  text-align: center;
  overflow-wrap: anywhere;
}
.tabbar a[aria-current="page"] { color: var(--ink); font-weight: var(--weight-strong); }
/* The current item also carries a bar, so it is marked by shape as well as colour. */
.tabbar a[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 30%;
  right: 30%;
  height: 2px;
  background: var(--ink);
}
main {
  max-width: 40rem;
  margin: 0 auto;
  padding: var(--space-s) var(--space-l) calc(5.5rem + env(safe-area-inset-bottom, 0));
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}
main > * { min-width: 0; }

/* ---------- Staff shell: one bar on top, light theme, wide content ---------- */
.staffbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs) var(--space-xl);
  padding: var(--space-xs) var(--space-l);
  border-bottom: 1px solid var(--line);
}
.staffbar nav { display: flex; gap: var(--space-l); flex: 1 1 auto; }
.staffbar nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--muted);
  text-decoration: none;
  font-size: var(--text-s);
  border-bottom: 2px solid transparent;
}
.staffbar nav a[aria-current="page"] { color: var(--ink); font-weight: var(--weight-strong); border-bottom-color: var(--ink); }
.staffbar .who { display: flex; align-items: center; gap: var(--space-m); font-size: var(--text-s); color: var(--muted); }
html[data-shell="staff"] main { max-width: 52rem; padding-bottom: var(--space-xxl); gap: var(--space-l); }
html[data-shell="staff"] main.wide { max-width: 72rem; }

/* ---------- Buttons: one filled style in the action colour ---------- */
button, .button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-s);
  min-height: 3rem;
  padding: var(--space-m) var(--space-xl);
  border: 1.5px solid var(--action);
  border-radius: var(--radius-control);
  background: var(--action);
  color: var(--on-action);
  font: inherit;
  font-size: var(--text-m);
  line-height: var(--leading-m);
  font-weight: var(--weight-strong);
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: transform 120ms cubic-bezier(0.23, 1, 0.32, 1), opacity 120ms ease-out;
}
button:active:not(:disabled), .button:active { transform: scale(0.97); }
button.secondary, .button.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--muted);
}
button.quiet, .button.quiet {
  background: transparent;
  color: var(--ink);
  border-color: transparent;
  padding-inline: var(--space-s);
  text-decoration: underline;
  font-weight: var(--weight-regular);
}
button.small, .button.small { min-height: 2.75rem; padding: var(--space-s) var(--space-l); font-size: var(--text-s); line-height: var(--leading-s); }
button.block, .button.block { width: 100%; }
button:disabled { opacity: 0.5; cursor: progress; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
button:focus-visible, .button:focus-visible { outline-offset: 3px; }
.button-row { display: flex; flex-wrap: wrap; gap: var(--space-s); align-items: center; }
.button-row > button, .button-row > .button { flex: 1 1 10rem; }

/* ---------- Forms ---------- */
label { display: block; font-size: var(--text-s); line-height: var(--leading-s); font-weight: var(--weight-strong); margin: 0 0 var(--space-xs); }
input, select {
  width: 100%;
  min-height: 3rem;
  padding: var(--space-s) var(--space-m);
  font: inherit;
  font-size: var(--text-m);
  color: var(--ink);
  background: var(--canvas);
  border: 1.5px solid var(--muted);
  border-radius: var(--radius-control);
}
input::placeholder { color: var(--muted); }
.field { display: flex; flex-direction: column; gap: var(--space-xs); }
.form { display: flex; flex-direction: column; gap: var(--space-l); }

/* ---------- Rows: the list pattern used everywhere instead of cards ---------- */
.rows { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.rows > li, .rows > .row-item { border-top: 1px solid var(--line); padding: var(--space-m) 0; }
.rows > li.empty { color: var(--muted); }
.row-main { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-m); }
.row-main > :last-child { text-align: right; }
section { display: flex; flex-direction: column; gap: var(--space-m); }

/* ---------- Notices: one component; state by a glyph and a rule as well as colour ---------- */
.notice {
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  gap: var(--space-xs) var(--space-m);
  align-items: start;
  padding: var(--space-m) var(--space-l) var(--space-m) var(--space-m);
  background: var(--surface);
  color: var(--ink);
  border-left: 3px solid var(--notice-colour, var(--muted));
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  font-size: var(--text-s);
  line-height: var(--leading-s);
}
.notice::before {
  content: var(--notice-glyph, "i");
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 1.5px solid var(--notice-colour, var(--muted));
  color: var(--notice-colour, var(--muted));
  font-weight: var(--weight-strong);
  font-size: var(--text-xs);
  line-height: 1;
}
.notice > * { grid-column: 2; }
.notice > :first-child { grid-column: 2; }
.notice .notice-title { font-weight: var(--weight-strong); }
.notice .button-row { margin-top: var(--space-s); }
.notice.ok { --notice-colour: var(--success); --notice-glyph: "✓"; }
.notice.warn { --notice-colour: var(--warning); --notice-glyph: "!"; }
.notice.error { --notice-colour: var(--danger); --notice-glyph: "×"; }
.notice.fixture { --notice-colour: var(--muted); --notice-glyph: "i"; border: 1.5px dashed var(--muted); border-radius: var(--radius-control); }
#message:empty { display: none; }
/* A short notice inside a block of actions, for example the late-cancel warning. */
.consequence { color: var(--warning); font-weight: var(--weight-strong); }
.consequence::before { content: "! "; }

/* ---------- Status words: a glyph before the word, a colour from tokens ---------- */
.status { font-size: var(--text-s); line-height: var(--leading-s); font-weight: var(--weight-strong); color: var(--muted); white-space: nowrap; }
.status.active, .status.reconciled, .status.checked_in { color: var(--success); }
.status.active::before, .status.reconciled::before, .status.checked_in::before { content: "✓ "; }
.status.past_due, .status.incomplete { color: var(--warning); }
.status.past_due::before, .status.incomplete::before { content: "! "; }
.status.unreconciled { color: var(--danger); }
.status.unreconciled::before { content: "× "; }
.status.canceled { color: var(--muted); }

/* ---------- Balance ---------- */
.balance-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--space-xs) var(--space-s); }
.balance { font-size: var(--text-xl); line-height: var(--leading-xl); font-weight: var(--weight-strong); color: var(--mine); font-variant-numeric: tabular-nums; }
.balance-line .button, .balance-line a { margin-left: auto; }

/* ---------- Schedule: date strip and class list ---------- */
.day-head { display: flex; flex-direction: column; gap: var(--space-xs); }
.days {
  display: flex;
  gap: var(--space-xs);
  overflow-x: auto;
  scrollbar-width: none;
  margin-inline: calc(-1 * var(--space-s));
  padding: var(--space-xs) var(--space-s);
}
.days::-webkit-scrollbar { display: none; }
.day {
  flex: 0 0 2.75rem;
  min-height: 3.75rem;
  padding: var(--space-xs) 0;
  flex-direction: column;
  gap: 2px;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: var(--leading-xs);
  font-weight: var(--weight-regular);
}
.day .day-number {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  font-size: var(--text-s);
  font-weight: var(--weight-strong);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.day.empty .day-number { color: var(--muted); font-weight: var(--weight-regular); }
.day[aria-pressed="true"] .day-number { background: var(--action); color: var(--on-action); }
.day .day-dot { width: 4px; height: 4px; border-radius: 50%; background: transparent; }
.day.has-mine .day-dot { background: var(--mine); }

.class-list { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.class-row {
  display: grid;
  grid-template-columns: 3.75rem minmax(0, 1fr) auto;
  gap: var(--space-m);
  align-items: center;
  min-height: 4rem;
  padding: var(--space-m) 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.class-row .when { font-variant-numeric: tabular-nums; font-weight: var(--weight-strong); line-height: 1.1; }
.class-row .when small { display: block; font-size: var(--text-xs); line-height: var(--leading-xs); color: var(--muted); font-weight: var(--weight-regular); }
.class-row .what { min-width: 0; }
.class-row .what b, .class-row .what span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.class-row .what span { font-size: var(--text-s); line-height: var(--leading-s); color: var(--muted); }
.class-row .places { font-size: var(--text-s); line-height: var(--leading-s); color: var(--muted); text-align: right; white-space: nowrap; }
.class-row.few .places { color: var(--ink); font-weight: var(--weight-strong); }
.class-row.full .when, .class-row.full .what b { color: var(--muted); }
.class-row.mine .places { color: var(--mine); font-weight: var(--weight-strong); }
.class-row.mine .places::before { content: "● "; }
.class-row:hover .what b { text-decoration: underline; }

.my-bookings-strip .rows > li { padding: 0; }
.my-bookings-strip a { display: flex; justify-content: space-between; gap: var(--space-m); align-items: center; min-height: 3rem; padding: var(--space-s) 0; text-decoration: none; color: var(--ink); }
.my-bookings-strip a .spot-name { color: var(--mine); font-weight: var(--weight-strong); white-space: nowrap; }

/* ---------- Class page ---------- */
.class-page { display: flex; flex-direction: column; gap: var(--space-xl); }
.back { align-self: flex-start; display: inline-flex; align-items: center; min-height: 2.75rem; color: var(--muted); text-decoration: none; font-size: var(--text-s); }
.back::before { content: "‹"; margin-right: var(--space-s); font-size: var(--text-l); line-height: 1; }
.class-head { display: flex; flex-direction: column; gap: var(--space-xs); }
.class-head .class-when { font-size: var(--text-s); line-height: var(--leading-s); color: var(--muted); font-variant-numeric: tabular-nums; }
.booking { color: var(--mine); font-weight: var(--weight-strong); }
.facts { display: flex; flex-direction: column; border-bottom: 1px solid var(--line); }
.facts > div { display: grid; grid-template-columns: 5.5rem 1fr; gap: var(--space-m); padding: var(--space-m) 0; border-top: 1px solid var(--line); font-size: var(--text-s); line-height: var(--leading-s); }
.facts dt { color: var(--muted); }
.actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
  padding: var(--space-l);
  background: var(--surface);
  border-radius: var(--radius-sheet);
}
.actions p { font-size: var(--text-s); line-height: var(--leading-s); }
.actions .cost { color: var(--muted); }
.actions .question { font-size: var(--text-m); line-height: var(--leading-m); font-weight: var(--weight-strong); }
.other-booking { color: var(--muted); }

/* ---------- My bookings and Account ---------- */
.bookings-page, .account-page, .buy-page { display: flex; flex-direction: column; gap: var(--space-xl); }
.empty-state { align-items: flex-start; }
.next-booking { display: flex; flex-direction: column; gap: var(--space-m); padding-top: var(--space-m); border-top: 1px solid var(--line); }
.next-booking .next-title { font-size: var(--text-l); line-height: var(--leading-l); }
.next-booking .spot-name, .rows .spot-name { color: var(--mine); font-weight: var(--weight-strong); white-space: nowrap; }
.class-list:empty, .rows:empty { border-bottom: 0; }
.links { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-l); }
.links a { display: inline-flex; align-items: center; min-height: 2.75rem; }
details.history { border-top: 1px solid var(--line); }
details.history > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.5rem;
  cursor: pointer;
  list-style: none;
  font-weight: var(--weight-strong);
}
details.history > summary::-webkit-details-marker { display: none; }
details.history > summary::after { content: "+"; font-size: var(--text-l); color: var(--muted); }
details.history[open] > summary::after { content: "–"; }
details.history > div { display: flex; flex-direction: column; gap: var(--space-xl); padding-bottom: var(--space-l); }
.history .rows > li { font-size: var(--text-s); line-height: var(--leading-s); }
.history .delta { font-variant-numeric: tabular-nums; font-weight: var(--weight-strong); }
.refund { color: var(--muted); font-size: var(--text-s); }
.plan-block { display: flex; flex-direction: column; gap: var(--space-m); }
.price { font-variant-numeric: tabular-nums; font-weight: var(--weight-strong); }
.offer { display: flex; flex-direction: column; gap: var(--space-m); padding: var(--space-l) 0; border-top: 1px solid var(--line); }
.offer:last-child { border-bottom: 1px solid var(--line); }

/* ---------- Staff: front desk ---------- */
.chips { display: flex; gap: var(--space-s); overflow-x: auto; padding: 2px; scrollbar-width: thin; }
.chips button {
  flex: 0 0 auto;
  min-height: 2.75rem;
  padding: var(--space-xs) var(--space-l);
  font-size: var(--text-s);
  line-height: var(--leading-s);
  font-weight: var(--weight-regular);
  background: transparent;
  color: var(--ink);
  border-color: var(--muted);
}
.chips button[aria-pressed="true"] { background: var(--action); color: var(--on-action); border-color: var(--action); font-weight: var(--weight-strong); }
.desk-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-xs) var(--space-l); }
.desk-head h1 { font-size: var(--text-l); line-height: var(--leading-l); font-weight: var(--weight-regular); }
.counts { color: var(--muted); font-variant-numeric: tabular-nums; font-size: var(--text-s); }
.counts b { color: var(--ink); }
.roster-list { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.roster-row {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto;
  gap: var(--space-m);
  align-items: center;
  min-height: 3.25rem;
  padding: var(--space-xs) 0;
  border-top: 1px solid var(--line);
}
.roster-row.pooled { grid-template-columns: minmax(0, 1fr) auto; }
.roster-list > [hidden] { display: none; }
.roster-row .seat-no { font-weight: var(--weight-strong); color: var(--muted); font-variant-numeric: tabular-nums; }
.roster-row .who-line { min-width: 0; display: flex; flex-direction: column; }
.roster-row .member { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roster-row .credits { font-size: var(--text-xs); line-height: var(--leading-xs); color: var(--muted); }
.roster-row .row-actions { display: flex; align-items: center; gap: var(--space-m); justify-content: flex-end; }
.roster-row .row-actions button { min-height: 2.75rem; padding: var(--space-xs) var(--space-l); font-size: var(--text-s); line-height: var(--leading-s); }
.roster-row.open { min-height: 2.75rem; color: var(--muted); }
.roster-row.open .who-line { font-size: var(--text-s); }
.roster-row.checked-in .member { color: var(--muted); }
.search input { max-width: 28rem; }

/* ---------- Staff: office ---------- */
.table-wrap { overflow-x: auto; }
/* On a narrow screen a money table scrolls sideways instead of squeezing its columns. */
.table-wrap > table { min-width: 40rem; }
#report { display: flex; flex-direction: column; gap: var(--space-l); }
table { width: 100%; border-collapse: collapse; font-size: var(--text-s); line-height: var(--leading-s); }
th, td { text-align: left; padding: var(--space-s) var(--space-s) var(--space-s) 0; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: var(--text-xs); line-height: var(--leading-xs); font-weight: var(--weight-strong); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: var(--weight-strong); border-top: 1.5px solid var(--ink); }
.report-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--space-s) var(--space-l); }
.report-head .ref { display: block; font-size: var(--text-xs); line-height: var(--leading-xs); color: var(--muted); font-weight: var(--weight-regular); }
.plain-list { margin: 0; padding-left: var(--space-xl); font-size: var(--text-s); line-height: var(--leading-s); }
.duplicate { color: var(--muted); font-size: var(--text-xs); line-height: var(--leading-xs); }
.refunded { color: var(--muted); }

/* ---------- Dialogs ---------- */
dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius-sheet);
  padding: var(--space-xl);
  max-width: 28rem;
  width: calc(100% - 2rem);
  background: var(--canvas);
  color: var(--ink);
}
dialog::backdrop { background: color-mix(in srgb, var(--ink) 40%, transparent); }
dialog .form { gap: var(--space-m); }

/* ---------- Sign in ---------- */
.signin { max-width: 24rem; width: 100%; }

/* ---------- Tablet and wider ---------- */
@media (min-width: 48rem) {
  .top { max-width: 48rem; padding-inline: var(--space-xl); }
  .tabbar {
    position: static;
    display: flex;
    gap: var(--space-xl);
    border-top: 0;
    background: transparent;
    padding: 0;
    margin-right: auto;
    margin-left: var(--space-xxl);
  }
  .tabbar a { min-height: 2.75rem; font-size: var(--text-s); line-height: var(--leading-s); }
  .tabbar a[aria-current="page"]::before { top: auto; bottom: 0; left: 0; right: 0; }
  main { max-width: 48rem; padding: var(--space-l) var(--space-xl) var(--space-xxl); }
  .class-page { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-xl) var(--space-xxl); align-items: start; }
  .class-page > .back, .class-page > .class-head { grid-column: 1 / -1; }
  .class-page > .picker { grid-column: 1; grid-row: span 3; }
  .class-page > :not(.back):not(.class-head):not(.picker) { grid-column: 2; }
  .staffbar { padding-inline: var(--space-xl); }
}
@media (min-width: 64rem) {
  html[data-shell="staff"] main { padding-inline: var(--space-xl); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  button:active:not(:disabled), .button:active { transform: none; }
}
