/* ==========================================================================
   Design tokens — warm neutrals with a wine/rose accent. Light + dark.
   Spacing follows a 4px scale; all colors come from these variables.
   ========================================================================== */
:root {
  color-scheme: light dark;

  --bg: #f6f2ef;
  --surface: #ffffff;
  --surface-2: #faf7f5;
  --surface-hover: #f3ece8;
  --border: #e6dcd6;
  --border-strong: #cfc2ba;

  --text: #221b20;
  --text-2: #4f4549;
  --muted: #6e6268;

  --primary: #9b2c5c;
  --primary-hover: #82224c;
  --primary-soft: #f7e7ee;
  --primary-soft-2: #efd2df;
  --on-primary: #ffffff;

  --ok: #1d7044;
  --ok-soft: #e4f3ea;
  --warn: #8a5300;
  --warn-soft: #fdf1dc;
  --warn-border: #f1d29b;
  --danger: #b42318;
  --danger-soft: #fdecea;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(34, 27, 32, 0.05), 0 8px 24px rgba(34, 27, 32, 0.06);
  --shadow-bar: 0 -6px 20px rgba(34, 27, 32, 0.1);
  --focus: 0 0 0 3px rgba(155, 44, 92, 0.35);

  --header-h: 60px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141114;
    --surface: #1c181c;
    --surface-2: #221d22;
    --surface-hover: #2a242a;
    --border: #352d34;
    --border-strong: #4a4049;

    --text: #ede6ea;
    --text-2: #cfc4ca;
    --muted: #a99ca4;

    --primary: #e683ad;
    --primary-hover: #f09cc0;
    --primary-soft: rgba(230, 131, 173, 0.14);
    --primary-soft-2: rgba(230, 131, 173, 0.26);
    --on-primary: #2a0f1c;

    --ok: #7bd3a0;
    --ok-soft: rgba(123, 211, 160, 0.14);
    --warn: #f0c070;
    --warn-soft: rgba(240, 192, 112, 0.12);
    --warn-border: rgba(240, 192, 112, 0.35);
    --danger: #ff8a80;
    --danger-soft: rgba(255, 138, 128, 0.12);

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-bar: 0 -6px 20px rgba(0, 0, 0, 0.5);
    --focus: 0 0 0 3px rgba(230, 131, 173, 0.45);
  }
}

/* ==========================================================================
   Base
   ========================================================================== */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 12px; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }

.error, .flash {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}
.error { color: var(--danger); background: var(--danger-soft); }
.flash { color: var(--ok); background: var(--ok-soft); }

.alert {
  display: grid;
  gap: 8px;
  justify-items: start;
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  padding: 12px;
  border-radius: var(--radius-sm);
}
.alert p { margin: 0; }
.alert ul { margin: 0; padding-left: 20px; }

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 999px;
  white-space: nowrap;
  vertical-align: middle;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.muted { background: var(--surface-hover); color: var(--muted); }
.badge.info { background: color-mix(in srgb, #2b6cb0 14%, transparent); color: color-mix(in srgb, #2b6cb0 80%, var(--text)); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

/* ==========================================================================
   Dialog
   ========================================================================== */
.confirm-dialog {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  width: min(400px, calc(100vw - 32px));
}
.confirm-dialog::backdrop { background: rgba(20, 14, 18, 0.45); backdrop-filter: blur(2px); }
.confirm-dialog[open] { animation: dialog-in 0.15s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.dialog-body { padding: 24px; }
.dialog-body h2 { margin-bottom: 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
@media (max-width: 420px) {
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .confirm-dialog[open] { animation: none; } }

/* ==========================================================================
   Header
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  min-height: var(--header-h);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
}
.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex: none;
}
.brand:hover { text-decoration: none; }
.topbar nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.topbar nav a, .topbar nav .link {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 500;
}
.topbar nav a:hover, .topbar nav .link:hover { background: var(--surface-hover); text-decoration: none; }
.topbar nav a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }
.user-email { font-size: 0.85rem; padding: 0 8px; }

.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }
.page { display: grid; gap: 16px; }

/* ==========================================================================
   Buttons & inputs
   ========================================================================== */
button {
  font: inherit;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: 10px 16px;
  min-height: 44px;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
button:hover:not(:disabled) { background: var(--surface-hover); }
button:disabled { cursor: not-allowed; opacity: 0.5; }
button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}
button.primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
button.secondary { border-color: var(--primary); color: var(--primary); background: transparent; }
button.secondary:hover:not(:disabled) { background: var(--primary-soft); }
button.danger { border-color: var(--danger); color: var(--danger); background: transparent; }
button.danger:hover:not(:disabled) { background: var(--danger-soft); }
button.small { padding: 6px 12px; min-height: 36px; font-size: 0.875rem; }
button.block { width: 100%; }
button.link {
  border: none;
  background: none;
  color: var(--primary);
  padding: 0;
  min-height: 0;
  font-weight: 500;
}
button.link:hover:not(:disabled) { background: none; text-decoration: underline; }
button.icon {
  border: none;
  background: none;
  font-size: 1.4rem;
  line-height: 1;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
}
button:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

input {
  font: inherit;
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
input:focus { border-color: var(--primary); outline: none; box-shadow: var(--focus); }
input:disabled { background: var(--surface-2); color: var(--muted); }
input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 0;
  margin: 0;
  flex: none;
  accent-color: var(--primary);
}

.form { display: grid; gap: 16px; }
.form label, label.inline { display: grid; gap: 6px; font-weight: 600; font-size: 0.925rem; color: var(--text-2); }
.form label small { font-weight: 400; }
label.checkbox, .form label.checkbox {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.weekdays { display: flex; flex-wrap: wrap; gap: 8px; }
.weekdays label.checkbox {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  min-height: 40px;
}
.weekdays label.checkbox:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card.narrow { max-width: 560px; margin: 0 auto 16px; }
.list-item { display: grid; gap: 8px; }

details.collapsible { padding: 0; }
details.collapsible > summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius-lg);
}
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary h3 { margin: 0; }
details.collapsible > summary::after {
  content: "";
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s;
  margin-top: -4px;
}
details.collapsible[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
details.collapsible > .form { padding: 0 24px 24px; }

/* ==========================================================================
   Booking page
   ========================================================================== */
.booking-card {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.25fr) minmax(240px, 0.9fr);
  grid-template-rows: 1fr auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.booking-card > section, .booking-card > aside { padding: 28px; min-width: 0; }
.info-panel { grid-row: 1 / span 2; border-right: 1px solid var(--border); }
.calendar-panel { border-right: 1px solid var(--border); }
.booking-card.details-step { grid-template-columns: minmax(280px, 1fr) minmax(320px, 2.15fr); grid-template-rows: auto; }
.details-panel { max-width: 640px; display: grid; gap: 20px; align-content: start; }
.panel-title { font-size: 1.15rem; margin-bottom: 16px; }

.instructor { color: var(--muted); font-weight: 700; margin: 0 0 4px; }
.info-panel h1 { font-size: 1.6rem; }
.class-meta { list-style: none; padding: 0; margin: 16px 0 20px; display: grid; gap: 10px; }
.class-meta li { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); font-weight: 600; }
.class-meta a { color: inherit; }
.class-meta a:hover { color: var(--primary); }
.class-meta svg {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  fill: none;
  stroke: var(--primary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.description { color: var(--text-2); }
.description p { margin: 0 0 14px; }
.description strong { color: var(--text); }
.more-toggle { display: none; }
.info-panel > .badge { display: flex; width: fit-content; margin-top: 12px; }

/* Calendar */
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-title { font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px 4px; }
.cal-dow { text-align: center; font-size: 0.72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; padding: 4px 0; }
.day {
  aspect-ratio: 1;
  width: 100%;
  max-width: 48px;
  min-height: 0;
  justify-self: center;
  border-radius: 50%;
  border: none;
  background: none;
  padding: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.day.available { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.day.available:hover:not(:disabled) { background: var(--primary-soft-2); }
.day.picked { box-shadow: inset 0 0 0 2px var(--primary); }
.day.selected, .day.selected:hover:not(:disabled) { background: var(--primary); color: var(--on-primary); }
.day:disabled { opacity: 0.55; cursor: default; }
.tz { margin: 16px 0 0; font-size: 0.85rem; }

/* Times */
.first-time {
  align-items: flex-start !important;
  padding: 12px 14px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.first-time:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.first-time input { margin-top: 2px; }
.first-time small { font-weight: 400; }
.day-title { margin: 0 0 2px; }
.hint { margin: 0 0 12px; font-size: 0.875rem; }
.time-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.time-list.horizontal { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); margin: 12px 0; }
.time {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 8px;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  background: transparent;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.time small { font-weight: 500; font-size: 0.75rem; opacity: 0.85; }
.time:hover:not(:disabled) { background: var(--primary-soft); }
.time.picked, .time.picked:hover:not(:disabled) { background: var(--primary); color: var(--on-primary); }

/* Selection: action bar while picking, recap on the details step */
.summary {
  display: grid;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.summary.bar {
  grid-column: 2 / -1;
  grid-template-columns: 1fr auto;
  align-items: center;
  border-width: 1px 0 0;
  border-radius: 0 0 var(--radius-lg) 0;
  padding: 16px 28px;
}
.summary-title { display: block; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 8px; }
.picked-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.picked-list li {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--primary-soft);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 4px 4px 12px;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}
.summary:not(.bar) .picked-list li { padding-right: 12px; }
.chip-remove {
  border: none;
  background: none;
  min-height: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
}
.chip-remove:hover:not(:disabled) { background: var(--primary-soft-2); color: var(--text); }
.summary-total { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }
.summary:not(.bar) .summary-total { justify-content: space-between; }
.price-line { display: grid; justify-items: end; line-height: 1.2; }
.summary:not(.bar) .price-line { justify-items: start; }
.price { display: inline-flex; gap: 8px; align-items: baseline; font-size: 1.25rem; }
.price s { font-size: 0.95rem; font-weight: 400; }
.continue { min-width: 160px; }

.details-form h2 { margin-bottom: 12px; }
.back { justify-self: start; }

/* Booking status pages */
.booking-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.slot-lines { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 6px; }
.slot-lines li { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.total { display: flex; justify-content: space-between; align-items: baseline; margin: 12px 0; }
.offer { border-color: var(--primary); }
.fake-card {
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
  margin: 16px 0;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-family: ui-monospace, monospace;
}

/* My bookings */
.my-bookings { max-width: 720px; margin: 0 auto; width: 100%; }
.booking-item.awaiting { border-color: var(--warn-border); }
.booking-item .slot-lines { margin: 4px 0; }
.item-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
@media (max-width: 520px) {
  .item-actions { flex-direction: column-reverse; align-items: stretch; text-align: center; }
}

.slot-line { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.slot-line.past { color: var(--muted); }
.calendar-link {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 6px 12px;
  border: 1px solid var(--primary); border-radius: var(--radius-sm);
  color: var(--primary); font-size: 0.875rem; font-weight: 600; white-space: nowrap;
}
.calendar-link:hover { background: var(--primary-soft); text-decoration: none; }
.calendar-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* My bookings: filter, sort, pager */
.list-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.segmented button {
  border: none; border-radius: 999px; background: none; min-height: 38px; padding: 6px 18px;
  color: var(--muted); font-weight: 600;
}
.segmented button:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.segmented button.active, .segmented button.active:hover:not(:disabled) { background: var(--primary); color: var(--on-primary); }
.sort-select { display: inline-flex; align-items: center; gap: 8px; }
select {
  font: inherit; min-height: 40px; padding: 6px 32px 6px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}
select:focus { border-color: var(--primary); outline: none; box-shadow: var(--focus); }
.list-count { margin: 0; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
.pager-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); font-weight: 600;
}
.pager-link:hover { text-decoration: none; background: var(--surface-hover); }
.pager-link.disabled { color: var(--muted); opacity: 0.5; }

/* Account */
.account-page { display: grid; gap: 16px; max-width: 560px; margin: 0 auto; }
.details-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 24px; margin: 0; }
.details-list dt { color: var(--muted); font-weight: 600; }
.details-list dd { margin: 0; word-break: break-word; }
.field-error { color: var(--danger); font-weight: 500; }
input[aria-invalid="true"] { border-color: var(--danger); }

/* ==========================================================================
   Admin
   ========================================================================== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button {
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 14px;
  white-space: nowrap;
}
.tabs button:hover:not(:disabled) { background: none; color: var(--text); }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.toolbar { display: flex; justify-content: flex-end; }
.add-booking, .move-dialog { border-color: var(--primary); }
.link-share { display: grid; gap: 6px; font-weight: 600; }
.link-share input { font-family: ui-monospace, monospace; font-size: 0.85rem; }

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card .table-wrap { border: none; box-shadow: none; border-radius: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 0.925rem; }
.table th, .table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-2); }
.table tbody tr:hover { background: var(--surface-2); }
.table tr:last-child td { border-bottom: none; }
tr.muted td { color: var(--muted); }
.cell-customer > strong, .cell-customer .email { display: block; }
.cell-customer .email { font-size: 0.875rem; word-break: break-all; margin-top: 2px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cell-actions { text-align: right; }
.slot-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 3px 0; }
.slot-row .badge { margin-left: 6px; }
.seat-editor { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; white-space: nowrap; }
.slot-attendees { scroll-margin-top: calc(var(--header-h) + 12px); }
.seat-editor input { width: 72px; min-height: 36px; padding: 6px 8px; }

.admin-slots { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(360px, 1.5fr); gap: 16px; align-items: start; }
.admin-slots .slot-column { grid-column: 2; grid-row: 1 / span 2; display: grid; gap: 16px; align-content: start; min-width: 0; }
.hidden { display: none !important; }
.table tr.selectable { cursor: pointer; }
.table tr.selectable:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--primary); }
.table tr.selected, .table tr.selected:hover { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.list-hint { margin: 10px 0 0; }
.slot-attendees { display: grid; gap: 12px; border-color: var(--primary); }
.attendees-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.attendees-head h3 { margin: 0 0 2px; }
.attendees-head p { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.attendees-summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.attendees-summary .small-link { margin-left: auto; font-size: 0.9rem; }
.attendee-list { list-style: none; margin: 0; padding: 0; display: grid; }
.attendee { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 4px 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.attendee:first-child { border-top: none; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); font-size: 0.8rem; font-weight: 700;
}
.attendee-main { display: grid; min-width: 0; }
.attendee-name { font-weight: 600; }
.attendee-email { word-break: break-all; }
.attendee .tags { justify-content: flex-end; margin: 0; }
.attendee.inactive .attendee-name, .attendee.inactive .attendee-price { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.slot-list .cal-header { margin-bottom: 12px; }

/* Class outcomes */
.slot-line.inactive .slot-date { text-decoration: line-through; text-decoration-color: var(--border-strong); color: var(--muted); }
.slot-text { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.slot-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.stat-info .stat-value { color: color-mix(in srgb, #2b6cb0 80%, var(--text)); }
.stat-danger .stat-value { color: var(--danger); }
button.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }
button.danger-fill:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 85%, #000); border-color: transparent; }

/* Slot cancellation */
.confirm-dialog.wide { width: min(520px, calc(100vw - 32px)); }
.confirm-dialog .form { gap: 14px; }
.confirm-dialog p { margin: 4px 0 0; }
textarea {
  font: inherit; width: 100%; padding: 10px 12px; resize: vertical; min-height: 96px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
textarea:focus { border-color: var(--primary); outline: none; box-shadow: var(--focus); }
.cell-when .badge { margin-left: 8px; }
.cancelled-row .slot-date { text-decoration: line-through; text-decoration-color: var(--border-strong); color: var(--muted); }
.cancel-reason { margin-top: 4px; font-weight: 400; white-space: pre-line; }
.cell-actions { white-space: nowrap; }
.cell-actions button + button { margin-left: 6px; }

/* Refunds */
.tab-count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px;
  border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: 0.75rem; font-weight: 700;
}
.refunds-tab { display: grid; gap: 12px; max-width: 860px; }
.refund-summary { font-size: 1.1rem; }
.refund-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.refund-item { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 20px; }
.refund-main { display: grid; gap: 2px; min-width: 0; }
.refund-name { font-weight: 700; }
.refund-class { font-weight: 600; margin-top: 4px; }
.refund-note { white-space: pre-line; }
.refund-side { display: grid; justify-items: end; gap: 8px; flex: none; }
.refund-amount { font-size: 1.2rem; }
.empty-state { text-align: center; color: var(--muted); }
@media (max-width: 520px) {
  .refund-item { flex-direction: column; align-items: stretch; }
  .refund-side { grid-template-columns: 1fr auto; align-items: center; justify-items: start; }
}

/* Users */
.users-tab { display: grid; gap: 12px; }
.users-toolbar { justify-content: space-between; align-items: center; gap: 12px; }
.users-toolbar input { max-width: 360px; }
.table th.num, .table td.num { text-align: right; white-space: nowrap; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover { background: var(--primary-soft); }
.cell-name a { font-weight: 600; }
.cell-email span:first-child { word-break: break-all; }
.cell-email .tags { display: inline-flex; margin: 0 0 0 6px; vertical-align: middle; }

.user-page { max-width: 820px; margin: 0 auto; width: 100%; }
.back-link { font-weight: 500; }
.user-header { display: grid; gap: 4px; }
.user-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-title h2 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-top: 16px; }
.stat { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.stat-value { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.section-title { margin: 8px 0 0; }
.booking-meta { margin: 0; }

/* ==========================================================================
   Tablet & phone
   ========================================================================== */
@media (max-width: 1024px) {
  .booking-card { grid-template-columns: minmax(260px, 1fr) minmax(300px, 1.3fr); }
  .info-panel { grid-row: 1 / span 3; }
  .times-panel { grid-column: 2; border-top: 1px solid var(--border); }
  .calendar-panel { border-right: none; }
  .summary.bar { grid-column: 2; border-radius: 0 0 var(--radius-lg) 0; }
}

@media (max-width: 860px) {
  .container { padding: 16px 12px 24px; }
  .card { padding: 16px; }
  details.collapsible > summary { padding: 16px; }
  details.collapsible > .form { padding: 0 16px 16px; }
  h1, .info-panel h1 { font-size: 1.4rem; }

  .booking-card, .booking-card.details-step { grid-template-columns: 1fr; grid-template-rows: auto; }
  .booking-card > section, .booking-card > aside { padding: 20px 16px; }
  .info-panel { grid-row: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .times-panel { grid-column: auto; }
  .calendar-panel { border-bottom: 1px solid var(--border); }
  .day { max-width: 44px; }

  /* Keep the calendar close to the top: clamp the description. */
  .description:not(.expanded) {
    max-height: 7.5em;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
    mask-image: linear-gradient(to bottom, #000 55%, transparent);
  }
  .more-toggle { display: block; margin-top: 4px; }

  /* Selection bar sticks to the bottom of the screen while picking. */
  .summary.bar {
    grid-column: auto;
    position: sticky;
    bottom: 0;
    z-index: 10;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-bar);
  }
  .summary.bar .summary-title { display: none; }
  .summary.bar .picked-list { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .summary.bar .summary-total { justify-content: space-between; flex-wrap: nowrap; }
  .summary.bar .price-line { justify-items: start; }
  .continue { flex: 1; max-width: 220px; }

  .admin-slots { grid-template-columns: 1fr; }
  .admin-slots .slot-column { grid-column: auto; grid-row: auto; }
  .attendee { grid-template-columns: auto 1fr auto; align-items: start; }
  .attendee .avatar { grid-row: 1 / span 2; }
  .attendee .attendee-price { grid-column: 3; grid-row: 1; }
  .attendee .tags { grid-column: 2 / -1; grid-row: 2; justify-content: flex-start; }
  .user-email { display: none; }

  /* Tables become stacked cards. */
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; }
  .table.responsive tr { padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .table.responsive tr:last-child { border-bottom: none; }
  .table.responsive td { padding: 4px 0; border: none; }
  .table.responsive td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin: 6px 0 2px;
  }
  /* User rows: name on top, then the rest. */
  .users-table td.num { text-align: left; }
  .users-toolbar { flex-direction: column; align-items: stretch; }
  .users-toolbar input { max-width: none; }
  .users-table .cell-name { font-size: 1.05rem; }
  .cell-email .tags { display: flex; margin: 4px 0 0; }

  /* Slot rows: when on top, then seats | price | delete. */
  .slot-list .table.responsive tr { display: grid; grid-template-columns: auto 1fr auto; column-gap: 16px; align-items: end; }
  .slot-list .table.responsive .cell-when { grid-column: 1 / -1; }
  .slot-list .table.responsive td[data-label]::before { margin-top: 2px; }
}

@media (max-width: 520px) {
  .topbar-inner { flex-wrap: nowrap; gap: 8px; padding: 8px 12px; }
  .topbar nav { flex-wrap: nowrap; gap: 0; }
  .topbar nav a, .topbar nav .link { padding: 8px 10px; white-space: nowrap; }
  /* Keep one header row on phones: logo mark only. */
  .brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

@media (max-width: 420px) {
  .cal-grid { gap: 4px 2px; }
}
