:root {
  /* ── Palette: every color in the app comes from here ── */
  /* Neutrals */
  --bg: #f6f5fb;            /* page background */
  --surface: #ffffff;       /* cards, modals */
  --surface-2: #faf9fd;     /* table headers, subtle fills */
  --surface-3: #f0eff4;     /* muted fills: closed days, neutral badges */
  --line: #e8e6f0;          /* borders, dividers */
  --line-strong: #d8d4ee;   /* stronger dividers, totals */
  --ink: #1d1b2e;           /* main text, dark UI */
  --ink-2: #3b3850;         /* labels */
  --ink-3: #4a4760;         /* secondary text, sidebar links */
  --muted: #6b6880;         /* hints, captions */
  --disabled: #c9c6d6;      /* empty / not-applicable marks */
  --on-dark: #e6e3f5;       /* text on dark bars */
  --on-dark-muted: #cfcde0;
  --scrim: rgba(29, 27, 46, .45);       /* modal backdrop */
  --scrim-light: rgba(29, 27, 46, .35); /* phone menu backdrop */

  /* Brand (logo gradient) */
  --brand: #7c3aed;
  --brand-ink: #5b21b6;
  --brand-2: #db2777;
  --brand-light: #c4b5fd;
  --brand-line: #ddd0fb;
  --brand-soft: #f3edff;
  --brand-softer: #fbf9ff;

  /* Status: good / attention / problem — each with fill, border and text shade */
  --ok: #047857;      --ok-soft: #e3f7ee;     --ok-line: #b8ecd0;
  --warn: #b45309;    --warn-soft: #fff4e0;   --warn-line: #f6dcae;   --warn-ink: #6b3d05;   --warn-softer: #fffaf0;
  --danger: #c81e1e;  --danger-soft: #fdecec; --danger-line: #f5c9c9; --danger-ink: #7f1414;

  /* WhatsApp brand (buttons only) */
  --wa: #128c4b;
  --wa-dot: #25d366;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 27, 46, .04), 0 4px 16px rgba(29, 27, 46, .05);
  --grad: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 .75em; }
a { color: var(--brand-ink); }
code { background: var(--brand-soft); padding: 1px 6px; border-radius: 6px; font-size: 13px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.block { display: block; }
.center { text-align: center; justify-self: center; }
.mt { margin-top: 24px; }
.mr-auto { margin-right: auto; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.gap-sm { gap: 10px; }
.stack { display: grid; gap: 14px; }
.alert-text { color: var(--danger); margin: 4px 0 0; }
.boot, .loading { display: grid; place-items: center; min-height: 40vh; color: var(--muted); }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 16px;
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none;
  transition: background .15s, box-shadow .15s, transform .05s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(124, 58, 237, .25); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 20px rgba(124, 58, 237, .35); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--brand-soft); border-color: var(--brand-line); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: var(--danger-line); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-wa:hover { filter: brightness(1.08); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.link { background: none; border: 0; color: var(--brand-ink); font: inherit; font-weight: 600; cursor: pointer; padding: 0; font-size: 13px; }
.link:hover { text-decoration: underline; }
.icon-btn { background: none; border: 0; font-size: 16px; cursor: pointer; color: var(--muted); padding: 6px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--bg); }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px;
  font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; color: var(--ink);
}
.chip em { font-style: normal; color: var(--muted); margin-left: 4px; }
.chip.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.is-active em { color: var(--on-dark-muted); }
.spinner {
  width: 16px; height: 16px; border-radius: 50%; display: inline-block;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Forms ───────────────────────────────────────────── */
.field { display: grid; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.req { color: var(--brand-2); font-style: normal; }
.hint { color: var(--muted); font-size: 12px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(124, 58, 237, .12); }
input:disabled { background: var(--bg); color: var(--muted); }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; padding: 6px 0; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.check.inline { padding: 0; align-items: center; white-space: nowrap; }
.check.inline input { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2.tight { gap: 10px; }
.span-2 { grid-column: span 2; }
details.sub { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 14px; }
details.sub summary { cursor: pointer; font-weight: 600; color: var(--brand-ink); font-size: 14px; margin-bottom: 14px; }
.legal {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  font-size: 13px; color: var(--ink-3); white-space: pre-line; max-height: 180px; overflow: auto; margin-bottom: 8px;
}
.actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ── Auth ────────────────────────────────────────────── */
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-hero { background: var(--grad); color: #fff; display: grid; place-items: center; padding: 48px; position: relative; overflow: hidden; }
.auth-hero::after {
  content: ''; position: absolute; inset: auto -20% -30% auto; width: 520px; height: 520px; border-radius: 50%;
  border: 40px solid rgba(255, 255, 255, .08);
}
.auth-hero-inner { max-width: 420px; position: relative; z-index: 1; }
.auth-logo { width: 64px; height: 64px; background: #fff; border-radius: 18px; padding: 10px; margin-bottom: 20px; }
.auth-hero h1 { font-size: 36px; }
.tagline { font-size: 17px; opacity: .92; }
.portal-tag { display: inline-block; margin: -4px 0 12px; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .2); font-weight: 700; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
.hero-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.hero-points li { padding-left: 30px; position: relative; opacity: .95; }
.hero-points li::before {
  content: '✓'; position: absolute; left: 0; top: 1px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255, 255, 255, .22); display: grid; place-items: center; font-size: 12px;
}
.auth-panel { display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 24px; }
.tabs { display: flex; background: var(--surface-3); border-radius: 12px; padding: 4px; margin-bottom: 28px; }
.tab { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 9px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab.is-active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.demo-accounts { margin-top: 28px; padding: 14px; border: 1px dashed var(--brand-line); border-radius: 12px; background: var(--brand-softer); }
.big-icon { font-size: 44px; }

/* ── Shell ───────────────────────────────────────────── */
.demo-bar { background: var(--ink); color: var(--on-dark); font-size: 13px; text-align: center; padding: 7px 16px; }
.demo-bar .link { color: var(--brand-light); }
.topbar { background: rgba(255, 255, 255, .85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 17px; }
.brand img { width: 30px; height: 30px; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-link { padding: 8px 12px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 550; font-size: 14px; white-space: nowrap; }
.nav-link:hover { color: var(--ink); background: var(--bg); }
.nav-link.is-active { color: var(--brand-ink); background: var(--brand-soft); }
.nav-link.is-soon { opacity: .55; cursor: default; }
.nav-link.is-soon:hover { background: none; color: var(--muted); }
.nav-link em { font-style: normal; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; margin-left: 5px; background: var(--line); padding: 1px 5px; border-radius: 5px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-meta { display: grid; line-height: 1.2; }
.user-meta b { font-size: 13px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { color: var(--muted); font-size: 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none;
}
.avatar-lg { width: 46px; height: 46px; font-size: 16px; }
.container { max-width: 1180px; margin: 0 auto; padding: 28px 20px 64px; }

/* ── Office sidebar layout ───────────────────────────── */
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px 12px; overflow-y: auto;
}
.sidebar .brand { padding: 0 8px 14px; }
.side-nav { display: grid; gap: 1px; flex: 1; align-content: start; }
.side-section {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: none; border: 0; border-radius: 8px; cursor: pointer; font-family: inherit;
  font-size: 12.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); padding: 14px 10px 5px; margin-top: 2px;
}
.side-section:hover { color: var(--brand-2); }
.side-section .chev { font-size: 11px; transition: transform .15s ease; }
.side-group.is-collapsed .chev { transform: rotate(-90deg); }
.side-items { display: grid; gap: 1px; }
.side-group.is-collapsed .side-items { display: none; }
.side-link { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; border-radius: 9px; text-decoration: none; color: var(--ink-3); font-weight: 550; font-size: 14px; }
.side-link:hover { background: var(--bg); color: var(--ink); }
.side-link.is-active { background: var(--brand-soft); color: var(--brand-ink); }
.side-link.is-soon { opacity: .5; cursor: default; }
.side-link.is-soon:hover { background: none; color: var(--ink-3); }
.side-link em { font-style: normal; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; background: var(--line); padding: 1px 6px; border-radius: 5px; }
.side-foot { border-top: 1px solid var(--line); padding: 12px 6px 0; margin-top: 12px; }
.side-foot .user-chip { flex-wrap: wrap; }
.side-foot .user-meta { display: grid; flex: 1; min-width: 0; }
.main-col { min-width: 0; }
.mobile-bar { display: none; }
.side-backdrop { display: none; }
.app-shell .fd-summary { top: 20px; }

/* ── Layout pieces ───────────────────────────────────── */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 2px; }
.page-head .muted { margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.section { margin-bottom: 30px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.section-head h2, .section-head h3 { margin: 0; }
.two-col { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
.banner { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 24px; }
.banner-warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink); }

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--brand-soft); color: var(--brand-ink); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: var(--surface-3); color: var(--muted); }
.wa-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--wa-dot); margin-left: 4px; vertical-align: middle; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 2px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s; }
.stat:hover { transform: translateY(-2px); }
.stat small { color: var(--muted); font-weight: 600; font-size: 13px; }
.stat b { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.stat-warn { border-color: var(--warn-line); background: linear-gradient(180deg, var(--warn-softer), #fff); }

.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li > div { display: grid; min-width: 0; }

.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 1fr) 2fr 28px; gap: 10px; align-items: center; font-size: 13px; }
.bar { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--grad); border-radius: 99px; }

.tile-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 4px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
a.tile:hover { border-color: var(--brand-line); }
.tile small { color: var(--muted); }
.tile.is-soon { opacity: .6; }
.tile-icon { font-size: 22px; margin-bottom: 6px; }
.tile-icon.wa { color: var(--wa); }
.tile-icon.wa svg { width: 24px; height: 24px; }

/* Gymnast & coach cards */
.gym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.gym-card { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.gym-card.is-inactive { opacity: .55; }
.gym-avatar { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; display: grid; place-items: center; flex: none; }
.gym-info { flex: 1; min-width: 0; }
.gym-info h4 { margin: 0 0 2px; font-size: 15px; }
.gym-info p { margin: 0; }
.add-tile { width: 100%; margin-top: 12px; padding: 16px; border: 2px dashed var(--brand-line); border-radius: 12px; background: var(--brand-softer); color: var(--brand-ink); font: inherit; font-weight: 600; cursor: pointer; }
.add-tile:hover { background: var(--brand-soft); }
.coach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.coach-card { display: grid; gap: 14px; align-content: start; }
.coach-card h3 { margin: 0; }
.coach-card p { margin: 0; }
.coach-card.is-inactive { opacity: .6; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 550; }

.info { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.info dt { color: var(--muted); }
.info dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Tables */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { max-width: 320px; }
.toolbar select { width: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--brand-softer); }
.table .empty { text-align: center; color: var(--muted); padding: 32px; }

/* Wizard */
.wizard { max-width: 760px; margin: 0 auto; }
.stepper { list-style: none; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stepper li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); padding-top: 10px; border-top: 3px solid var(--line); }
.stepper li span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--line); font-weight: 700; font-size: 12px; flex: none; }
.stepper li.current { color: var(--ink); border-color: var(--brand); }
.stepper li.current span { background: var(--grad); color: #fff; }
.stepper li.done { border-color: var(--brand-light); }
.stepper li.done span { background: var(--brand-soft); color: var(--brand-ink); }
.review { display: grid; gap: 22px; }
.review h3 { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 6px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 18px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(29, 27, 46, .25); animation: pop .18s ease-out; }
.modal-wide { max-width: 820px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 22px; overflow-y: auto; display: grid; gap: 20px; }
.modal-body section h3 { margin-bottom: 10px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

/* Toasts */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); animation: pop .2s; transition: opacity .3s, transform .3s; }
.toast-error { background: var(--danger); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ── Billing & reports ───────────────────────────────── */
[hidden] { display: none !important; }
.mb { margin-bottom: 20px; }
.text-danger { color: var(--danger); }
.num, .table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.num-w { text-align: right; font-variant-numeric: tabular-nums; }
.table.compact td, .table.compact th { padding: 8px 10px; }
.table tfoot td { border-top: 1px solid var(--line); border-bottom: 0; padding-top: 8px; padding-bottom: 8px; }
.table tr.is-inactive td { opacity: .55; }
.amount-input { width: 110px; text-align: right; padding: 6px 8px; }
.actions.tight { margin-top: 10px; padding-top: 10px; }
.stats-3 { grid-template-columns: repeat(3, 1fr); }
.bar-row { grid-template-columns: minmax(110px, 1fr) 2fr minmax(70px, auto); }

.grid-line { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid-line .span-2 { grid-column: span 2; }
.grid-line .span-3 { grid-column: span 3; }
.line-form.card { padding: 14px; margin-top: 12px; box-shadow: none; }

.level-group { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 12px; margin-top: 8px; }

.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tab-link { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab-link:hover { color: var(--ink); }
.tab-link.is-active { color: var(--brand-ink); border-bottom-color: var(--brand); }

/* Status grid (replaces the spreadsheet tuition tabs) */
.table.grid td, .table.grid th { padding: 8px 10px; text-align: center; white-space: nowrap; }
.table.grid td.sticky, .table.grid th.sticky { position: sticky; left: 0; background: var(--surface); text-align: left; z-index: 1; box-shadow: 1px 0 0 var(--line); }
.table.grid thead th.sticky { background: var(--surface-2); }
.table.grid td.cell { cursor: pointer; font-weight: 600; font-size: 13px; }
.c-paid { background: var(--ok-soft); color: var(--ok); }
.c-partial { background: var(--warn-soft); color: var(--warn); }
.c-due { background: var(--surface-3); color: var(--ink-2); }
.c-overdue { background: var(--danger-soft); color: var(--danger); }
.c-none { color: var(--disabled); }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; font-size: 12px; font-weight: 600; }
.legend span { padding: 3px 10px; border-radius: 999px; }
.legend .c-none { background: var(--bg); color: var(--muted); }

/* Daily register (like the spreadsheet's CashRegister_DailyReport) */
.table.register td { padding: 7px 12px; }
.table.register tr.grp-date td { background: var(--ink); color: #fff; font-weight: 700; }
.table.register tr.grp-method td { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.table.register tr.grp-who td { font-weight: 650; padding-top: 10px; border-bottom: 0; }
.table.register tr.subtotal td { font-weight: 650; background: var(--surface-2); }
.table.register tr.subtotal-method td { background: var(--brand-soft); }
.table.register tr.subtotal-day td, .table.register tr.grand td { background: var(--line-strong); font-weight: 700; }
.print-only { display: none; }

@media print {
  .demo-bar, .topbar, .sidebar, .mobile-bar, .tabs-line, .page-head, .no-print, #toasts { display: none !important; }
  .app-shell { display: block; }
  .print-only { display: block; }
  body { background: #fff; font-size: 12px; }
  .container { padding: 0; max-width: none; }
  .card, .stat { box-shadow: none; }
  .stats { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .stat b { font-size: 18px; }
  .table-wrap { overflow: visible; }
  .table.register tr { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Credits report */
.text-ok { color: var(--ok); }
.note-input { width: 240px; padding: 6px 10px; font-size: 13px; }
.table.credits tr.credit-row td { border-top: 2px solid var(--line); background: var(--brand-softer); }
.table.credits tr.draw-row td { border-bottom: 0; padding-top: 5px; padding-bottom: 5px; }

/* Private scheduling board */
.banner-danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-ink); }
.day-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 12px; }
.day-chip { position: relative; display: grid; gap: 1px; padding: 8px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font: inherit; cursor: pointer; text-align: center; color: var(--ink); }
.day-chip small { color: var(--muted); font-size: 11px; }
.day-chip em { position: absolute; top: 4px; right: 6px; font-style: normal; font-size: 11px; font-weight: 700; color: var(--brand-ink); }
.day-chip.is-today { border-color: var(--brand-light); }
.day-chip.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.day-chip.is-active small, .day-chip.is-active em { color: var(--on-dark-muted); }
.pv-board { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12px; }
.pv-board th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); padding: 8px 6px; border-bottom: 1px solid var(--line); font-weight: 650; font-size: 12px; min-width: 96px; }
.pv-board th small { display: block; color: var(--muted); font-weight: 500; }
.pv-board .pv-time { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 70px; width: 70px; white-space: nowrap; text-align: right; padding: 0 8px; color: var(--muted); font-weight: 500; vertical-align: top; font-size: 11px; border-bottom: 0; }
.pv-board td { height: 22px; border-bottom: 1px solid #fff; border-right: 1px solid #fff; }
.pv-avail { background: var(--ok-soft); cursor: pointer; }
.pv-avail:hover { background: var(--ok-line); }
.pv-unavail { background: var(--danger-soft); cursor: pointer; }
.pv-unavail:hover { background: var(--danger-line); }
.pv-closed, .pv-closed-chip {
  background: repeating-linear-gradient(135deg, var(--line) 0 6px, var(--surface-3) 6px 12px);
}
.day-chip.is-closed:not(.is-active) { background: var(--surface-3); color: var(--muted); }
.pv-edit td.pv-offhours { opacity: .45; }
.reminder-row > div:first-child { display: grid; justify-items: start; gap: 2px; }
.row.end { justify-content: flex-end; }
.pv-special { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; padding: 10px 14px; margin-bottom: 12px; }
.special-form { display: grid; gap: 10px; padding: 14px; margin-top: 10px; box-shadow: none; }
.special-form select, .special-form input[type="date"] { width: auto; padding: 6px 8px; }
.special-form .chip { cursor: pointer; }
.hours-table td { vertical-align: middle; }
.hours-table select { width: auto; padding: 6px 8px; }
.pv-board td.pv-lesson { background: var(--brand-soft); border-left: 3px solid var(--brand); padding: 3px 6px; vertical-align: top; cursor: pointer; }
.pv-lesson b { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.pv-lesson small { color: var(--muted); font-size: 11px; }
/* Lesson colors match the status badges: hold = grey, booked = amber, confirmed = brand, completed = green, no show = red */
.pv-board td.pv-tentative { background: var(--surface-3); border-left-color: var(--muted); }
.pv-board td.pv-booked { background: var(--warn-soft); border-left-color: var(--warn); }
.pv-board td.pv-completed { background: var(--ok-soft); border-left-color: var(--ok); }
.pv-board td.pv-no_show { background: var(--danger-soft); border-left-color: var(--danger); }
.pv-legend span { background: var(--bg); }
.pv-legend .pv-avail { background: var(--ok-soft); }
.pv-legend .pv-unavail { background: var(--danger-soft); }
.pv-legend .pv-closed { border: 1px solid var(--line); }
.pv-edit td { cursor: pointer; user-select: none; }
.pv-chip { padding: 1px 6px; border-radius: 5px; }

/* ADAPT report */
.stats-5 { grid-template-columns: repeat(5, 1fr); }
.table.adapt-report tr.subtotal td { background: var(--surface-2); font-weight: 600; }
.table.adapt-report tr.grand td { background: var(--line-strong); font-weight: 700; }

/* Announcements & events */
.news { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 26px; }
.news-card h2 { font-size: 16px; margin-bottom: 10px; }
.news-list, .event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.news-list li { padding-left: 12px; border-left: 3px solid var(--line); }
.news-list li.is-pinned { border-left-color: var(--brand); }
.news-list p { margin: 3px 0; font-size: 14px; color: var(--ink-3); }
.event-list li { display: flex; gap: 12px; align-items: flex-start; }
.cal { flex: none; width: 46px; display: grid; justify-items: center; padding: 5px 0; border-radius: 10px; background: var(--brand-soft); color: var(--brand-ink); line-height: 1.1; }
.cal b { font-size: 18px; }
.cal small { font-size: 11px; text-transform: uppercase; font-weight: 700; }
/* Event type tags (palette colors): competitions stand out in brand purple */
.badge.kind-show { background: var(--warn-soft); color: var(--warn-ink); }
.badge.kind-camp { background: var(--ok-soft); color: var(--ok); }
.badge.kind-clinic, .badge.kind-meeting, .badge.kind-other { background: var(--surface-3); color: var(--ink-3); }
.auth-panel { align-content: center; gap: 22px; }
.auth-news { width: 100%; max-width: 400px; }
.news-compact { grid-template-columns: 1fr; gap: 12px; margin: 0; }
.news-compact .card { padding: 16px; }

/* Attendance */
.att-table td { vertical-align: middle; }
.att-table input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--ok); }
.att-table select { width: auto; padding: 6px 8px; }
.att-table input:not([type]) { padding: 6px 8px; min-width: 160px; }
.att-table tr.att-absent td { background: var(--danger-soft); }
.att-table tr.att-sick td { background: var(--warn-soft); }
.att-dash { display: grid; grid-template-columns: minmax(180px, .8fr) 1fr 1fr; gap: 22px; }
.att-dash h3 { font-size: 14px; }
.att-kpis { display: grid; gap: 12px; align-content: start; }
.att-kpis > div { display: grid; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.att-kpis b { font-size: 26px; letter-spacing: -.02em; }
@media (max-width: 960px) { .att-dash { grid-template-columns: 1fr; } }

/* Front desk sale */
.mt-sm { margin-top: 10px; }
.mt-xs { margin-top: 4px; }
.fd { grid-template-columns: 1.6fr 1fr; align-items: start; }
.fd-summary { position: sticky; top: 84px; }
.fd-items input { padding: 6px 8px; }
.fd-items td:first-child { width: 100%; min-width: 200px; }
.fd-items .amount-input { width: 88px; }
.fd-items .qty-input { width: 58px; }
.qty-input { width: 70px; text-align: right; }
.fd-total { font-size: 20px; border-top: 2px solid var(--ink); padding-top: 10px; margin-top: 6px; }
.fd .list li { padding: 8px 0; }

/* Family invoices */
.inv-card { padding: 0; margin-bottom: 10px; overflow: hidden; }
.inv-head { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: none; border: 0; padding: 14px 18px; font: inherit; text-align: left; cursor: pointer; color: var(--ink); }
.inv-amt { display: grid; justify-items: end; gap: 4px; }
.inv-body { display: none; padding: 0 18px 14px; }
.inv-card.is-open .inv-body { display: block; }
.pay-box p:last-child { margin-bottom: 0; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 960px) {
  .stats, .tile-grid, .stats-5 { grid-template-columns: repeat(2, 1fr); }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 10px 40px rgba(29, 27, 46, .2); }
  .menu-open .sidebar { transform: none; }
  .menu-open .side-backdrop { display: block; position: fixed; inset: 0; z-index: 39; background: var(--scrim-light); }
  .mobile-bar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; height: 56px; padding: 0 12px; background: rgba(255, 255, 255, .9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .mobile-bar .brand span { display: none; }
  .mobile-title { font-weight: 650; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .menu-btn { font-size: 20px; }
  .side-foot .user-meta { display: grid; }
  .two-col, .detail-grid, .fd { grid-template-columns: 1fr; }
  .fd-summary { position: static; }
  .user-meta { display: none; }
}
@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 32px 20px; }
  .auth-hero h1 { font-size: 28px; }
  .hero-points { display: none; }
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 16px 0; gap: 8px 12px; }
  .topbar .brand { flex: 1; }
  .nav { order: 3; flex: 1 0 100%; padding-bottom: 8px; }
  .container { padding: 20px 16px 48px; }
  .grid-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .grid-2.tight { grid-template-columns: 1fr 1fr; }
  .stepper b { display: none; }
  .grid-line { grid-template-columns: 1fr 1fr; }
  .grid-line .span-2, .grid-line .span-3 { grid-column: span 2; }
  .stats-3 { grid-template-columns: 1fr; }
  .toolbar .search { max-width: none; }
  h1 { font-size: 22px; }
  .card { padding: 18px; }
}
@media (max-width: 420px) {
  .stats, .tile-grid { grid-template-columns: 1fr; }
}

.nowrap { white-space: nowrap; }

/* ── Phones: tables that become cards (web layout unchanged) ── */
@media (max-width: 640px) {
  .lesson-table, .lesson-table tbody, .pay-table, .pay-table tbody { display: block; }
  .lesson-table tr {
    display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: start;
    padding: 14px 16px; border-bottom: 1px solid var(--line);
  }
  .lesson-table td { display: block; padding: 0; border: 0; text-align: left; }
  .lesson-table .l-when { grid-column: 1; }
  .lesson-table .l-status { grid-column: 2; grid-row: 1; justify-self: end; }
  .lesson-table .l-who, .lesson-table .l-pay, .lesson-table .l-act { grid-column: 1 / -1; }
  .lesson-table .l-pay:empty, .lesson-table .l-act:empty { display: none; }
  .lesson-table .l-act .row { justify-content: stretch; }
  .lesson-table .l-act .btn { flex: 1 1 140px; justify-content: center; min-height: 42px; }
  .lesson-table .l-act > .btn { width: 100%; }

  .pay-table thead { display: none; }
  .pay-table tr {
    display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
    padding: 12px 16px; border-bottom: 1px solid var(--line);
  }
  .pay-table td { display: block; padding: 0; border: 0; }
  .pay-table .p-date { grid-column: 1; }
  .pay-table .p-amt { grid-column: 2; grid-row: 1; font-weight: 700; }
  .pay-table .p-method { grid-column: 1; color: var(--ink-3); font-size: 14px; }
  .pay-table .p-status { grid-column: 2; grid-row: 2; justify-self: end; }
  .pay-table .p-ref { grid-column: 1 / -1; color: var(--ink-3); }
  .pay-table .p-ref:empty { display: none; }

  .att-history, .att-history tbody { display: block; }
  .att-history thead { display: none; }
  .att-history tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
  .att-history td { display: block; padding: 0; border: 0; }
  .att-history .a-date { grid-column: 1; font-weight: 650; }
  .att-history .a-class { grid-column: 1; color: var(--ink-3); font-size: 14px; }
  .att-history .a-status { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .att-history .a-note { grid-column: 1 / -1; }
  .att-history .a-note:empty { display: none; }

  /* Coach: taking attendance — checkbox, name, status on one line; note below */
  .att-table, .att-table tbody { display: block; }
  .att-table thead { display: none; }
  .att-table tr { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .att-table tr.att-absent { background: var(--danger-soft); }
  .att-table tr.att-sick { background: var(--warn-soft); }
  .att-table td { display: block; padding: 0; border: 0; background: none !important; }
  .att-table input[type="checkbox"] { width: 26px; height: 26px; }
  .att-table .t-status select { padding: 8px; }
  .att-table .t-note { grid-column: 1 / -1; }
  .att-table .t-note input { width: 100%; min-width: 0; }

  /* Coach: roster cards */
  .roster-table, .roster-table tbody { display: block; }
  .roster-table thead { display: none; }
  .roster-table tr { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .roster-table td { display: block; padding: 0; border: 0; }
  .roster-table .r-age { grid-column: 2; grid-row: 1; color: var(--ink-3); }
  .roster-table .r-prog, .roster-table .r-health, .roster-table .r-parent { grid-column: 1 / -1; }
  .roster-table .r-health:has(.muted) { display: none; }
  .sm-only { display: inline; }
}
@media (min-width: 641px) { .sm-only { display: none; } }

/* ── Owner portal (phone-first) ─────────────────────── */
.exec-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 2px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.kpi small { color: var(--ink-3); font-size: 13px; font-weight: 600; }
.kpi b { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.kpi span { color: var(--ink-3); font-size: 12.5px; }
.kpi-hero { grid-column: 1 / -1; background: var(--brand-soft); border-color: var(--brand-line); }
.kpi-hero b { font-size: 32px; color: var(--brand-ink); }
.kpi-alert b { color: var(--danger); }
.exec-banner { display: block; text-decoration: none; margin-bottom: 18px; }
.exec-card { margin-bottom: 18px; }
.exec-card h2 { font-size: 16px; }
.exec-list { list-style: none; margin: 0; padding: 0; }
.exec-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.exec-list li:first-child { border-top: 0; }
.exec-tags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.exec-h { font-size: 16px; margin: 20px 0 8px; display: flex; justify-content: space-between; }
.reg-pay { padding: 12px 16px; border-top: 1px solid var(--line); }
.reg-pay:first-child { border-top: 0; }
.reg-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.reg-amt { font-size: 17px; white-space: nowrap; }
.reg-items { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.reg-items li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; }
.stock-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line); }
.stock-row:first-child { border-top: 0; }
.stock-qty { display: grid; justify-items: end; gap: 2px; }
.stock-qty b { font-size: 18px; }
.pad { padding: 16px; }
@media (max-width: 640px) {
  .exec-kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi b { font-size: 19px; }
  .kpi-hero b { font-size: 28px; }
  .reg-items li { grid-template-columns: 1fr auto; }
  .reg-items li span:nth-child(2) { grid-column: 1; grid-row: 2; font-size: 12px; }
  .reg-items li span:nth-child(3) { grid-row: 1 / span 2; align-self: start; }
  .exec-list li { align-items: flex-start; }
}
/* Coach home on phones: next privates first, then news, then the profile card */
@media (max-width: 640px) {
  .coach-home { display: flex; flex-direction: column; gap: 16px; }
  .coach-home .two-col, .coach-home .news { display: contents; }
  .coach-home .coach-next { order: -1; }
  .coach-home .coach-profile { order: 1; }
}
