/* =========================================================================
   gym-book.css — member-facing booking widget.

   Everything is scoped under .gb and driven by --gb-* custom properties, so a
   host page themes it by setting variables on the mount element or :root. The
   widget never styles the host's body, html or any element outside .gb.

   Themes: .gb[data-scheme="light"|"dark"|"auto"]. "auto" follows the host's
   prefers-color-scheme. Any host override set inline on the mount wins.
   ========================================================================= */

.gb {
  /* brand --------------------------------------------------------------
     Set --gb-accent-h / --gb-accent-s from the host or from config.brand.accent.
     Every accent token derives from that hue, so a client's colour keeps working
     in dark mode and the text variants stay above 4.5:1 on their surface. */
  --gb-accent-h: 8;
  --gb-accent-s: 85%;
  --gb-accent: hsl(var(--gb-accent-h) var(--gb-accent-s) 55%);
  --gb-accent-solid: hsl(var(--gb-accent-h) var(--gb-accent-s) 44%);
  --gb-accent-ink: #fff;
  --gb-accent-text: hsl(var(--gb-accent-h) var(--gb-accent-s) 38%);
  --gb-accent-soft: hsl(var(--gb-accent-h) var(--gb-accent-s) 55% / 0.10);
  --gb-accent-line: hsl(var(--gb-accent-h) var(--gb-accent-s) 55% / 0.34);

  /* surfaces ---------------------------------------------------------- */
  --gb-bg: hsl(40 14% 97%);
  --gb-surface: #fff;
  --gb-surface-2: hsl(40 12% 95%);
  --gb-ink: hsl(220 18% 11%);
  --gb-ink-2: hsl(220 10% 30%);
  --gb-ink-mute: hsl(220 8% 44%);
  --gb-line: hsl(220 13% 87%);
  --gb-line-2: hsl(220 13% 92.5%);

  /* status ------------------------------------------------------------ */
  --gb-ok: hsl(152 62% 30%);
  --gb-ok-soft: hsl(152 55% 40% / 0.12);
  --gb-warn: hsl(32 92% 34%);
  --gb-warn-soft: hsl(38 92% 50% / 0.16);
  --gb-bad: hsl(4 70% 42%);
  --gb-bad-soft: hsl(4 70% 50% / 0.12);
  --gb-info: hsl(210 70% 38%);
  --gb-info-soft: hsl(210 70% 48% / 0.12);

  /* shape ------------------------------------------------------------- */
  --gb-radius: 10px;
  --gb-radius-sm: 7px;
  --gb-radius-lg: 16px;
  --gb-font: inherit;
  --gb-font-display: var(--gb-font);
  --gb-mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace;
  --gb-shadow: 0 1px 2px hsl(220 18% 11% / 0.06), 0 1px 1px hsl(220 18% 11% / 0.04);
  --gb-shadow-2: 0 14px 40px hsl(220 18% 11% / 0.14), 0 2px 8px hsl(220 18% 11% / 0.07);
  --gb-ring: 0 0 0 2px var(--gb-bg), 0 0 0 4px var(--gb-accent-solid);
  --gb-speed: 160ms;

  color: var(--gb-ink);
  background: var(--gb-bg);
  font-family: var(--gb-font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-align: left;
  container-type: inline-size;
}

.gb[data-scheme="dark"] { color-scheme: dark; }
.gb[data-scheme="light"] { color-scheme: light; }

.gb[data-scheme="dark"],
.gb[data-scheme="auto"][data-host-dark="1"] {
  --gb-accent-solid: hsl(var(--gb-accent-h) var(--gb-accent-s) 67%);
  --gb-accent-ink: hsl(220 28% 9%);
  --gb-accent-text: hsl(var(--gb-accent-h) var(--gb-accent-s) 72%);
  --gb-accent-soft: hsl(var(--gb-accent-h) var(--gb-accent-s) 60% / 0.16);
  --gb-accent-line: hsl(var(--gb-accent-h) var(--gb-accent-s) 62% / 0.40);
  --gb-bg: hsl(222 18% 9%);
  --gb-surface: hsl(222 16% 12.5%);
  --gb-surface-2: hsl(222 14% 17%);
  --gb-ink: hsl(220 22% 96%);
  --gb-ink-2: hsl(220 12% 80%);
  --gb-ink-mute: hsl(220 10% 66%);
  --gb-line: hsl(220 12% 25%);
  --gb-line-2: hsl(220 12% 19%);
  --gb-ok: hsl(152 55% 62%);
  --gb-ok-soft: hsl(152 55% 45% / 0.20);
  --gb-warn: hsl(38 92% 66%);
  --gb-warn-soft: hsl(38 92% 55% / 0.18);
  --gb-bad: hsl(4 85% 70%);
  --gb-bad-soft: hsl(4 75% 55% / 0.18);
  --gb-info: hsl(206 85% 70%);
  --gb-info-soft: hsl(206 80% 55% / 0.18);
  --gb-shadow: 0 1px 2px hsl(0 0% 0% / 0.4);
  --gb-shadow-2: 0 18px 44px hsl(0 0% 0% / 0.55), 0 2px 8px hsl(0 0% 0% / 0.4);
}

@media (prefers-color-scheme: dark) {
  .gb[data-scheme="auto"] {
    color-scheme: dark;
    --gb-accent-solid: hsl(var(--gb-accent-h) var(--gb-accent-s) 67%);
    --gb-accent-ink: hsl(220 28% 9%);
    --gb-accent-text: hsl(var(--gb-accent-h) var(--gb-accent-s) 72%);
    --gb-accent-soft: hsl(var(--gb-accent-h) var(--gb-accent-s) 60% / 0.16);
    --gb-accent-line: hsl(var(--gb-accent-h) var(--gb-accent-s) 62% / 0.40);
    --gb-bg: hsl(222 18% 9%);
    --gb-surface: hsl(222 16% 12.5%);
    --gb-surface-2: hsl(222 14% 17%);
    --gb-ink: hsl(220 22% 96%);
    --gb-ink-2: hsl(220 12% 80%);
    --gb-ink-mute: hsl(220 10% 66%);
    --gb-line: hsl(220 12% 25%);
    --gb-line-2: hsl(220 12% 19%);
    --gb-ok: hsl(152 55% 62%);
    --gb-ok-soft: hsl(152 55% 45% / 0.20);
    --gb-warn: hsl(38 92% 66%);
    --gb-warn-soft: hsl(38 92% 55% / 0.18);
    --gb-bad: hsl(4 85% 70%);
    --gb-bad-soft: hsl(4 75% 55% / 0.18);
    --gb-info: hsl(206 85% 70%);
    --gb-info-soft: hsl(206 80% 55% / 0.18);
    --gb-shadow: 0 1px 2px hsl(0 0% 0% / 0.4);
    --gb-shadow-2: 0 18px 44px hsl(0 0% 0% / 0.55), 0 2px 8px hsl(0 0% 0% / 0.4);
  }
}

.gb *, .gb *::before, .gb *::after { box-sizing: border-box; }
.gb p, .gb h1, .gb h2, .gb h3, .gb h4, .gb ul, .gb ol, .gb figure { margin: 0; }
.gb ul, .gb ol { padding: 0; list-style: none; }
.gb button, .gb input, .gb select, .gb textarea { font: inherit; color: inherit; }
.gb a { color: var(--gb-accent-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.gb :focus-visible { outline: 2px solid var(--gb-accent-solid); outline-offset: 2px; border-radius: 4px; }
.gb-icon { flex: none; display: block; }

.gb [hidden] { display: none !important; }

.gb-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------- shell --- */

.gb-shell {
  border: 1px solid var(--gb-line);
  border-radius: var(--gb-radius-lg);
  background: var(--gb-bg);
  overflow: clip;
  position: relative;
}

.gb-topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  background: var(--gb-surface);
  border-bottom: 1px solid var(--gb-line);
  flex-wrap: wrap;
}

.gb-brand { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; }
.gb-brand__mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--gb-accent-soft); color: var(--gb-accent-text);
  border: 1px solid var(--gb-accent-line);
}
.gb-brand__mark svg { width: 19px; height: 19px; }
.gb-brand__text { min-width: 0; }
.gb-brand__name {
  display: block;
  font-family: var(--gb-font-display); font-weight: 700; font-size: 15px;
  letter-spacing: -0.012em; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gb-brand__sub { display: block; font-size: 11.5px; color: var(--gb-ink-mute); line-height: 1.3; }

.gb-nav { display: flex; gap: 2px; padding: 3px; background: var(--gb-surface-2); border-radius: 999px; }
.gb-nav__btn {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: 7px 13px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: var(--gb-ink-2);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background var(--gb-speed) ease-out, color var(--gb-speed) ease-out;
}
.gb-nav__btn:hover { color: var(--gb-ink); }
.gb-nav__btn[aria-current="page"] {
  background: var(--gb-surface); color: var(--gb-ink); box-shadow: var(--gb-shadow);
}
.gb-nav__btn svg { width: 16px; height: 16px; }

.gb-who { display: flex; align-items: center; gap: 8px; }
.gb-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em;
  background: hsl(var(--gb-hue, 8) 45% 92%); color: hsl(var(--gb-hue, 8) 55% 26%);
}
.gb[data-scheme="dark"] .gb-avatar,
.gb[data-scheme="auto"][data-host-dark="1"] .gb-avatar { background: hsl(var(--gb-hue, 8) 30% 26%); color: hsl(var(--gb-hue, 8) 70% 86%); }
@media (prefers-color-scheme: dark) {
  .gb[data-scheme="auto"] .gb-avatar { background: hsl(var(--gb-hue, 8) 30% 26%); color: hsl(var(--gb-hue, 8) 70% 86%); }
}

.gb-body { padding: 16px; }
/* ------------------------------------------------------------ buttons --- */

.gb-btn {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; min-height: 40px;
  border-radius: var(--gb-radius); border: 1px solid var(--gb-line);
  background: var(--gb-surface); color: var(--gb-ink);
  font-size: 14px; font-weight: 600; letter-spacing: -0.005em;
  white-space: nowrap; text-decoration: none;
  transition: background var(--gb-speed) ease-out, border-color var(--gb-speed) ease-out,
              transform var(--gb-speed) ease-out, opacity var(--gb-speed) ease-out;
}
.gb-btn:hover:not(:disabled) { background: var(--gb-surface-2); }
.gb-btn:active:not(:disabled) { transform: translateY(1px); }
.gb-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.gb-btn svg { width: 17px; height: 17px; }

.gb-btn--primary {
  background: var(--gb-accent-solid); color: var(--gb-accent-ink);
  border-color: transparent;
}
.gb-btn--primary:hover:not(:disabled) { background: color-mix(in srgb, var(--gb-accent-solid) 88%, #000); }
.gb[data-scheme="dark"] .gb-btn--primary:hover:not(:disabled),
.gb[data-scheme="auto"][data-host-dark="1"] .gb-btn--primary:hover:not(:disabled) { background: color-mix(in srgb, var(--gb-accent-solid) 86%, #fff); }

.gb-btn--ghost { background: transparent; border-color: transparent; color: var(--gb-ink-2); }
.gb-btn--ghost:hover:not(:disabled) { background: var(--gb-surface-2); color: var(--gb-ink); }
.gb-btn--soft { background: var(--gb-accent-soft); border-color: var(--gb-accent-line); color: var(--gb-accent-text); }
.gb-btn--soft:hover:not(:disabled) { background: color-mix(in srgb, var(--gb-accent-soft) 60%, var(--gb-surface)); }
.gb-btn--danger { color: var(--gb-bad); border-color: color-mix(in srgb, var(--gb-bad) 34%, transparent); background: transparent; }
.gb-btn--danger:hover:not(:disabled) { background: var(--gb-bad-soft); }
.gb-btn--sm { min-height: 32px; padding: 5px 11px; font-size: 13px; border-radius: var(--gb-radius-sm); }
.gb-btn--block { width: 100%; }
.gb-btn--icon { padding: 0; width: 36px; min-height: 36px; }

.gb-btn[data-pending="1"] { pointer-events: none; opacity: 0.75; }
.gb-btn[data-pending="1"] .gb-btn__label { opacity: 0.55; }
.gb-spin { width: 15px; height: 15px; animation: gb-spin 900ms linear infinite; }
@keyframes gb-spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------- chips --- */

.gb-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.015em;
  background: var(--gb-surface-2); color: var(--gb-ink-2);
  border: 1px solid transparent; white-space: nowrap;
}
.gb-pill--ok { background: var(--gb-ok-soft); color: var(--gb-ok); }
.gb-pill--warn { background: var(--gb-warn-soft); color: var(--gb-warn); }
.gb-pill--bad { background: var(--gb-bad-soft); color: var(--gb-bad); }
.gb-pill--info { background: var(--gb-info-soft); color: var(--gb-info); }
.gb-pill--accent { background: var(--gb-accent-soft); color: var(--gb-accent-text); }
.gb-pill--line { background: transparent; border-color: var(--gb-line); color: var(--gb-ink-mute); }
.gb-pill svg { width: 13px; height: 13px; }

/* --------------------------------------------------------- day strip --- */

.gb-weekbar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.gb-weekbar__label {
  font-family: var(--gb-font-display); font-weight: 700; font-size: 17px;
  letter-spacing: -0.015em; margin-right: auto;
}
.gb-iconbtn {
  appearance: none; cursor: pointer; display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: var(--gb-radius-sm);
  border: 1px solid var(--gb-line); background: var(--gb-surface); color: var(--gb-ink-2);
  transition: background var(--gb-speed) ease-out;
}
.gb-iconbtn:hover:not(:disabled) { background: var(--gb-surface-2); color: var(--gb-ink); }
.gb-iconbtn:disabled { opacity: 0.4; cursor: not-allowed; }

.gb-days {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(58px, 1fr);
  gap: 6px; margin-bottom: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; padding-bottom: 2px;
}
.gb-days::-webkit-scrollbar { display: none; }
.gb-day {
  appearance: none; cursor: pointer; scroll-snap-align: center;
  display: grid; gap: 1px; justify-items: center;
  padding: 9px 4px 8px; border-radius: var(--gb-radius);
  border: 1px solid var(--gb-line); background: var(--gb-surface); color: var(--gb-ink-2);
  transition: border-color var(--gb-speed) ease-out, background var(--gb-speed) ease-out;
}
.gb-day:hover { border-color: var(--gb-ink-mute); }
.gb-day__dow { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gb-ink-mute); }
.gb-day__num { font-family: var(--gb-font-display); font-size: 18px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.gb-day__dot { width: 4px; height: 4px; border-radius: 50%; background: var(--gb-ink-mute); opacity: 0.45; margin-top: 3px; }
.gb-day[aria-pressed="true"] {
  background: var(--gb-accent-solid); border-color: var(--gb-accent-solid); color: var(--gb-accent-ink);
}
.gb-day[aria-pressed="true"] .gb-day__dow { color: var(--gb-accent-ink); opacity: 0.85; }
.gb-day[aria-pressed="true"] .gb-day__dot { background: var(--gb-accent-ink); opacity: 0.8; }
.gb-day--today .gb-day__num { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: var(--gb-accent); }
.gb-day--empty { opacity: 0.55; }

/* ------------------------------------------------------------ filters --- */

.gb-filters {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-bottom: 14px;
}
.gb-select {
  appearance: none; cursor: pointer;
  padding: 7px 30px 7px 11px; min-height: 36px;
  border: 1px solid var(--gb-line); border-radius: var(--gb-radius-sm);
  background-color: var(--gb-surface); color: var(--gb-ink);
  font-size: 13.5px; font-weight: 600;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 13px center, right 8px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.gb-select:hover { border-color: var(--gb-ink-mute); }
.gb-filters__spacer { margin-left: auto; }
.gb-toggle { display: inline-flex; padding: 3px; gap: 2px; background: var(--gb-surface-2); border-radius: 999px; }
.gb-toggle button {
  appearance: none; border: 0; cursor: pointer; background: transparent;
  padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--gb-ink-2);
}
.gb-toggle button[aria-pressed="true"] { background: var(--gb-surface); color: var(--gb-ink); box-shadow: var(--gb-shadow); }

/* -------------------------------------------------------------- week --- */

.gb-week { display: grid; gap: 10px; }
.gb-weekgroup__head {
  display: flex; align-items: baseline; gap: 8px;
  position: sticky; top: 0; z-index: 2;
  padding: 8px 2px 7px; margin-bottom: 2px;
  background: linear-gradient(var(--gb-bg) 76%, transparent);
}
.gb-weekgroup__day { font-family: var(--gb-font-display); font-weight: 700; font-size: 14px; letter-spacing: -0.01em; }
.gb-weekgroup__meta { font-size: 12px; color: var(--gb-ink-mute); margin-left: auto; }
.gb-weekgroup__list { display: grid; gap: 8px; }

@container (min-width: 900px) {
  .gb-week--grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: start; }
  .gb-week--grid .gb-weekgroup { min-width: 0; }
  .gb-week--grid .gb-weekgroup__head {
    background: var(--gb-surface-2); border-radius: var(--gb-radius-sm);
    padding: 7px 9px; position: static; margin-bottom: 6px;
    display: grid; gap: 0;
  }
  .gb-week--grid .gb-weekgroup__meta { margin-left: 0; font-size: 11px; }
  .gb-week--grid .gb-weekgroup__list { gap: 6px; }

  /* Seven columns is not much room, so the card restacks: time and status on
     one line, the class name wrapping underneath, the room dropped. */
  .gb-week--grid .gb-class {
    grid-template-columns: auto 1fr; gap: 1px 8px;
    padding: 8px 9px 9px 12px;
  }
  .gb-week--grid .gb-class::before { inset: 6px auto 6px 0; width: 2.5px; }
  .gb-week--grid .gb-class__time { grid-row: 1; grid-column: 1; font-size: 12.5px; }
  .gb-week--grid .gb-class__dur { display: none; }
  .gb-week--grid .gb-class__main { grid-row: 2; grid-column: 1 / -1; }
  .gb-week--grid .gb-class__name { font-size: 13px; white-space: normal; line-height: 1.25; }
  .gb-week--grid .gb-class__meta { font-size: 11px; }
  .gb-week--grid .gb-class__room { display: none; }
  .gb-week--grid .gb-class__side { grid-row: 1; grid-column: 2; justify-items: end; }
  .gb-week--grid .gb-class__cta { display: none; }
  .gb-week--grid .gb-pill--done { display: none; }
  .gb-week--grid .gb-class--past { opacity: 0.42; }
}

/* -------------------------------------------------------- class card --- */

.gb-class {
  position: relative; width: 100%; text-align: left;
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center;
  padding: 12px 13px 12px 15px;
  border: 1px solid var(--gb-line); border-radius: var(--gb-radius);
  background: var(--gb-surface); color: inherit; cursor: pointer;
  transition: border-color var(--gb-speed) ease-out, box-shadow var(--gb-speed) ease-out, transform var(--gb-speed) ease-out;
}
.gb-class::before {
  content: ""; position: absolute; inset: 8px auto 8px 0; width: 3px; border-radius: 3px;
  background: var(--gb-ct, var(--gb-accent));
}
.gb-class:hover { border-color: color-mix(in srgb, var(--gb-ink-mute) 55%, transparent); box-shadow: var(--gb-shadow); }
.gb-class:active { transform: translateY(1px); }

.gb-class__name, .gb-class__meta, .gb-class__time, .gb-class__dur { display: block; }
.gb-class__time {
  font-family: var(--gb-font-display); font-weight: 700; font-size: 14.5px;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap;
  grid-row: 1; align-self: end;
}
.gb-class__main { grid-row: 1 / span 2; grid-column: 2; min-width: 0; }
.gb-class__name {
  font-family: var(--gb-font-display); font-weight: 700; font-size: 14.5px; letter-spacing: -0.012em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gb-class__meta {
  font-size: 12.5px; color: var(--gb-ink-mute); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gb-class__dur { grid-row: 2; grid-column: 1; font-size: 11.5px; color: var(--gb-ink-mute); font-variant-numeric: tabular-nums; }
.gb-class__side { grid-row: 1 / span 2; grid-column: 3; display: grid; gap: 6px; justify-items: end; }
.gb-class__cta { pointer-events: none; }

.gb-class--booked { border-color: var(--gb-accent-line); background: color-mix(in srgb, var(--gb-accent-soft) 55%, var(--gb-surface)); }
.gb-class--full { background: var(--gb-surface); }
.gb-class--full .gb-class__name, .gb-class--cancelled .gb-class__name { color: var(--gb-ink-2); }
.gb-class--cancelled { opacity: 0.62; }
.gb-class--cancelled .gb-class__name { text-decoration: line-through; text-decoration-thickness: 1px; }
.gb-class--past { opacity: 0.5; }

.gb-spots { font-size: 11.5px; font-weight: 700; color: var(--gb-ink-mute); font-variant-numeric: tabular-nums; }
.gb-spots--low { color: var(--gb-warn); }

/* -------------------------------------------------------------- cards --- */

.gb-card {
  background: var(--gb-surface); border: 1px solid var(--gb-line);
  border-radius: var(--gb-radius); padding: 16px;
}
.gb-card--pad0 { padding: 0; overflow: clip; }
.gb-cardhead { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.gb-cardhead h3 {
  font-family: var(--gb-font-display); font-size: 15px; font-weight: 700; letter-spacing: -0.014em;
  margin-right: auto;
}
.gb-grid { display: grid; gap: 12px; }
@container (min-width: 700px) { .gb-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (min-width: 860px) { .gb-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.gb-section { margin-bottom: 22px; }
.gb-section:last-child { margin-bottom: 0; }
.gb-h2 {
  font-family: var(--gb-font-display); font-size: 18px; font-weight: 700;
  letter-spacing: -0.018em; margin-bottom: 3px;
}
.gb-lede { color: var(--gb-ink-mute); font-size: 13.5px; margin-bottom: 14px; max-width: 62ch; }

/* ------------------------------------------------------------- sheets --- */

/* Sheets and toasts are portalled to <body>: .gb sets container-type, which
   would otherwise make it the containing block for position:fixed children. */
.gb-portal {
  position: fixed; inset: 0; z-index: 2147483000;
  background: transparent; container-type: normal;
  pointer-events: none;
}
.gb-portal > * { pointer-events: auto; }
.gb-portal:empty { display: none; }

.gb-scrim {
  position: absolute; inset: 0;
  background: hsl(220 25% 8% / 0.46);
  display: flex; justify-content: flex-end;
  animation: gb-fade var(--gb-speed) ease-out;
  backdrop-filter: blur(1.5px);
}
@keyframes gb-fade { from { opacity: 0; } }

.gb-sheet {
  background: var(--gb-bg); color: var(--gb-ink);
  width: min(460px, 100%); height: 100%;
  display: flex; flex-direction: column;
  box-shadow: var(--gb-shadow-2);
  animation: gb-slide var(--gb-speed) cubic-bezier(0.22, 0.8, 0.3, 1);
  font-family: var(--gb-font);
}
@keyframes gb-slide { from { transform: translateX(24px); opacity: 0.4; } }

.gb-sheet__head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 16px 12px; border-bottom: 1px solid var(--gb-line);
  background: var(--gb-surface);
}
.gb-sheet__title { font-family: var(--gb-font-display); font-size: 17px; font-weight: 700; letter-spacing: -0.018em; }
.gb-sheet__sub { font-size: 13px; color: var(--gb-ink-mute); margin-top: 2px; }
.gb-sheet__body { padding: 16px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.gb-sheet__foot {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--gb-line); background: var(--gb-surface);
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.gb-sheet__foot .gb-btn--primary { flex: 1; }

@media (max-width: 640px) {
  .gb-scrim { align-items: flex-end; }
  .gb-sheet {
    width: 100%; height: auto; max-height: 92vh;
    border-radius: 18px 18px 0 0;
    animation: gb-up var(--gb-speed) cubic-bezier(0.22, 0.8, 0.3, 1);
  }
  @keyframes gb-up { from { transform: translateY(28px); opacity: 0.5; } }
}

.gb-kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; font-size: 13.5px; }
.gb-kv dt { color: var(--gb-ink-mute); }
.gb-kv dd { margin: 0; font-weight: 600; }

/* -------------------------------------------------------------- forms --- */

.gb-field { display: grid; gap: 5px; margin-bottom: 12px; }
.gb-label { font-size: 12.5px; font-weight: 700; color: var(--gb-ink-2); letter-spacing: 0.005em; }
.gb-input {
  width: 100%; padding: 10px 12px; min-height: 42px;
  border: 1px solid var(--gb-line); border-radius: var(--gb-radius-sm);
  background: var(--gb-surface); color: var(--gb-ink); font-size: 15px;
}
.gb-input::placeholder { color: var(--gb-ink-mute); opacity: 0.75; }
.gb-input:focus { border-color: var(--gb-accent-solid); }
.gb-hint { font-size: 12px; color: var(--gb-ink-mute); }

/* ------------------------------------------------------------- states --- */

.gb-empty {
  display: grid; justify-items: center; text-align: center; gap: 8px;
  padding: 34px 20px; border: 1px dashed var(--gb-line); border-radius: var(--gb-radius);
  background: var(--gb-surface);
}
.gb-empty__icon {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--gb-surface-2); color: var(--gb-ink-mute);
}
.gb-empty__icon svg { width: 21px; height: 21px; }
.gb-empty__title { font-family: var(--gb-font-display); font-weight: 700; font-size: 15px; letter-spacing: -0.012em; }
.gb-empty__body { font-size: 13.5px; color: var(--gb-ink-mute); max-width: 42ch; }

.gb-note {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 10px 12px; border-radius: var(--gb-radius-sm);
  font-size: 13px; line-height: 1.45;
  background: var(--gb-surface-2); color: var(--gb-ink-2);
  border: 1px solid var(--gb-line-2);
}
.gb-note svg { width: 16px; height: 16px; margin-top: 1px; }
.gb-note--bad { background: var(--gb-bad-soft); color: var(--gb-bad); border-color: color-mix(in srgb, var(--gb-bad) 26%, transparent); }
.gb-note--ok { background: var(--gb-ok-soft); color: var(--gb-ok); border-color: color-mix(in srgb, var(--gb-ok) 26%, transparent); }
.gb-note--warn { background: var(--gb-warn-soft); color: var(--gb-warn); border-color: color-mix(in srgb, var(--gb-warn) 30%, transparent); }
.gb-note--accent { background: var(--gb-accent-soft); color: var(--gb-accent-text); border-color: var(--gb-accent-line); }

.gb-skel { display: grid; gap: 8px; }
.gb-skel__row {
  height: 62px; border-radius: var(--gb-radius);
  background: linear-gradient(90deg, var(--gb-surface-2) 25%, var(--gb-line-2) 37%, var(--gb-surface-2) 63%);
  background-size: 400% 100%; animation: gb-shim 1.3s ease-in-out infinite;
}
@keyframes gb-shim { from { background-position: 100% 0; } to { background-position: 0 0; } }

.gb-toast {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 2147483001; max-width: min(440px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px; border-radius: 999px;
  background: hsl(220 22% 12%); color: hsl(0 0% 100%);
  font-size: 13.5px; font-weight: 600; box-shadow: var(--gb-shadow-2);
  animation: gb-toast-in var(--gb-speed) cubic-bezier(0.22, 0.8, 0.3, 1);
}
.gb-toast--bad { background: hsl(4 62% 32%); }
.gb-toast--ok { background: hsl(158 55% 20%); }
.gb-toast svg { width: 17px; height: 17px; }
@keyframes gb-toast-in { from { transform: translate(-50%, 12px); opacity: 0; } }

/* --------------------------------------------------------------- PT --- */

.gb-trainers { display: grid; gap: 10px; }
@container (min-width: 700px) { .gb-trainers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.gb-trainer {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 13px; text-align: left; cursor: pointer;
  border: 1px solid var(--gb-line); border-radius: var(--gb-radius); background: var(--gb-surface);
  transition: border-color var(--gb-speed) ease-out, box-shadow var(--gb-speed) ease-out;
}
.gb-trainer:hover { border-color: color-mix(in srgb, var(--gb-ink-mute) 55%, transparent); box-shadow: var(--gb-shadow); }
.gb-trainer[aria-pressed="true"] { border-color: var(--gb-accent-solid); box-shadow: 0 0 0 1px var(--gb-accent-solid) inset; }
.gb-trainer .gb-avatar { width: 42px; height: 42px; font-size: 14px; }
.gb-trainer__name { font-family: var(--gb-font-display); font-weight: 700; font-size: 14.5px; letter-spacing: -0.012em; }
.gb-trainer__spec { font-size: 12.5px; color: var(--gb-ink-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gb-trainer__price { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.gb-trainer__price small { display: block; font-size: 11px; font-weight: 500; color: var(--gb-ink-mute); }

.gb-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.gb-slot {
  appearance: none; cursor: pointer; padding: 11px 6px;
  border: 1px solid var(--gb-line); border-radius: var(--gb-radius-sm);
  background: var(--gb-surface); color: var(--gb-ink);
  font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
  transition: border-color var(--gb-speed) ease-out, background var(--gb-speed) ease-out;
}
.gb-slot:hover { border-color: var(--gb-accent-solid); background: var(--gb-accent-soft); }
.gb-slot[aria-pressed="true"] { background: var(--gb-accent-solid); border-color: var(--gb-accent-solid); color: var(--gb-accent-ink); }

/* --------------------------------------------------------- memberships --- */

.gb-plans { display: grid; gap: 12px; }
@container (min-width: 720px) { .gb-plans { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); } }
.gb-plan {
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px; border: 1px solid var(--gb-line); border-radius: var(--gb-radius);
  background: var(--gb-surface); position: relative;
}
.gb-plan--featured { border-color: var(--gb-accent-solid); box-shadow: 0 0 0 1px var(--gb-accent-solid) inset; }
.gb-plan__tag {
  position: absolute; top: -9px; left: 16px;
  background: var(--gb-accent-solid); color: var(--gb-accent-ink);
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px;
}
.gb-plan__name { font-family: var(--gb-font-display); font-weight: 700; font-size: 16px; letter-spacing: -0.015em; }
.gb-plan__price { font-family: var(--gb-font-display); font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.gb-plan__price small { font-size: 13px; font-weight: 600; color: var(--gb-ink-mute); letter-spacing: 0; }
.gb-plan__features { display: grid; gap: 7px; font-size: 13.5px; color: var(--gb-ink-2); margin-top: -2px; }
.gb-plan__features li { display: grid; grid-template-columns: 17px 1fr; gap: 8px; align-items: start; }
.gb-plan__features svg { width: 15px; height: 15px; margin-top: 3px; color: var(--gb-accent-text); }
.gb-plan__cta { margin-top: auto; }

/* ------------------------------------------------------------ account --- */

.gb-rows { display: grid; gap: 8px; }
.gb-row {
  display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; align-items: center;
  padding: 12px 13px; border: 1px solid var(--gb-line); border-radius: var(--gb-radius);
  background: var(--gb-surface);
}
.gb-row__main { min-width: 0; }
.gb-row__title { font-weight: 700; font-size: 14px; letter-spacing: -0.008em; }
.gb-row__meta { font-size: 12.5px; color: var(--gb-ink-mute); margin-top: 1px; }
.gb-row__side { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.gb-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.gb-stat { padding: 13px 14px; border: 1px solid var(--gb-line); border-radius: var(--gb-radius); background: var(--gb-surface); }
.gb-stat__label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--gb-ink-mute); }
.gb-stat__value { font-family: var(--gb-font-display); font-size: 24px; font-weight: 800; letter-spacing: -0.028em; line-height: 1.15; margin-top: 3px; font-variant-numeric: tabular-nums; }
.gb-stat__sub { font-size: 12px; color: var(--gb-ink-mute); margin-top: 1px; }

.gb-signin { max-width: 420px; margin: 0 auto; }
.gb-demoids { display: grid; gap: 5px; margin-top: 10px; }
.gb-demoid {
  appearance: none; cursor: pointer; text-align: left;
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  padding: 8px 11px; border: 1px solid var(--gb-line); border-radius: var(--gb-radius-sm);
  background: var(--gb-surface); font-size: 13px;
}
.gb-demoid:hover { border-color: var(--gb-accent-solid); background: var(--gb-accent-soft); }
.gb-demoid code { font-family: var(--gb-mono); font-size: 12px; color: var(--gb-ink-mute); }

.gb-foot {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 11px 16px; border-top: 1px solid var(--gb-line);
  background: var(--gb-surface); font-size: 12px; color: var(--gb-ink-mute);
}
.gb-foot__sep { opacity: 0.4; }

.gb-fatal {
  padding: 18px; border: 1px solid color-mix(in srgb, var(--gb-bad) 40%, transparent);
  border-radius: var(--gb-radius); background: var(--gb-bad-soft); color: var(--gb-bad);
  font-size: 14px; line-height: 1.5;
}
.gb-fatal strong { display: block; margin-bottom: 4px; }

/* Phones. The timetable is the screen members actually use, so the widget
   restacks rather than shrinking: brand and identity on one row, the sections
   as a scrollable segmented control under it, filters two up, and class cards
   with the time and the spots on the first line. */
@container (max-width: 560px) {
  .gb-body { padding: 12px; }
  .gb-topbar { padding: 10px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .gb-brand { margin-right: 0; grid-row: 1; grid-column: 1; }
  .gb-who { grid-row: 1; grid-column: 2; }
  .gb-nav {
    grid-row: 2; grid-column: 1 / -1; overflow-x: auto; scrollbar-width: none;
    justify-content: flex-start; -webkit-overflow-scrolling: touch;
  }
  .gb-nav::-webkit-scrollbar { display: none; }
  .gb-nav__btn { flex: none; padding: 7px 11px; font-size: 13px; }
  .gb-days { grid-auto-columns: minmax(44px, 1fr); gap: 5px; }
  .gb-day { padding: 7px 2px 6px; }
  .gb-day__num { font-size: 16px; }
  .gb-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
  .gb-filters .gb-select { width: 100%; min-width: 0; }
  .gb-filters__spacer { display: none; }
  .gb-toggle { grid-column: 2; justify-self: end; }
  .gb-weekbar__label { font-size: 15.5px; }

  .gb-class { grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; padding: 11px 12px 12px 14px; }
  .gb-class__time { grid-row: 1; grid-column: 1; }
  .gb-class__dur { display: none; }
  .gb-class__side { grid-row: 1; grid-column: 2; display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
  .gb-class__main { grid-row: 2; grid-column: 1 / -1; margin-top: 1px; }
  .gb-class__name { white-space: normal; line-height: 1.25; }
  .gb-class__meta { white-space: normal; }
  .gb-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gb-foot { padding: 10px 12px; }
}

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