:root {
  --ink: #12263F; --bg: #F3F8FA; --accent: #A31511; --gold: #C99A2E; --coral: #C0524A;
  --card: #fff; --muted: #5B6B7D; --line: #E1EAEE; --green: #2F7D4F;
  --shadow: 0 1px 2px rgba(18,38,63,.06), 0 6px 18px rgba(18,38,63,.07);
  --head: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--body); }
h1, h2, h3 { font-family: var(--head); font-weight: 700; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 22px; } h3 { font-size: 16px; margin-bottom: 12px; }
p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); font-size: 14px; } .note { color: var(--muted); font-size: 14px; margin-top: 8px; }
.note.ok, .ok { color: var(--green); } .note.err, .err { color: var(--coral); }
.center { text-align: center; } .nowrap { white-space: nowrap; } .num { text-align: right; font-variant-numeric: tabular-nums; }

input, select, textarea { width: 100%; min-height: 44px; padding: 8px 12px; font: 500 15px var(--body); color: var(--ink);
  background: #fff; border: 1px solid #C9D8DF; border-radius: 10px; }
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid rgba(163,21,17,.35); outline-offset: 2px; }
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }

.btn { min-height: 44px; padding: 0 18px; border: 0; border-radius: 10px; font: 600 15px var(--body); cursor: pointer; }
.btn.primary { background: var(--accent); color: #fff; } .btn.coral { background: var(--coral); color: #fff; } .btn.ink { background: var(--ink); color: #fff; }
.btn.ghost { background: #E3EEF2; color: var(--ink); } .btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn:disabled { opacity: .6; cursor: default; }
.link { background: none; border: 0; padding: 4px 0; color: var(--accent); font: 500 13px var(--body); cursor: pointer; text-decoration: underline; }
.link.danger { color: var(--coral); } .link.light { color: #E8EEF3; } .center-link { display: block; margin: 8px auto; }

.card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head { margin-bottom: 14px; } .page-title { margin-bottom: 14px; } .page-head .page-title { margin: 0; }
.actions { display: flex; gap: 8px; align-items: center; } .actions select, .actions input { width: auto; min-height: 38px; }

.badge { display: inline-block; color: #fff; font: 600 12px var(--head); padding: 2px 10px; border-radius: 999px; margin-left: 6px; white-space: nowrap; }
.pill { display: inline-block; font: 600 12px var(--body); padding: 3px 10px; border-radius: 999px; }
.pill.paid { background: #DDF1E4; color: #1F6B3F; } .pill.pending { background: #FBEFC8; color: #7A5410; } .pill.overdue { background: #F8DEDB; color: #9C3A33; }
.chip { display: inline-block; background: #E3EEF2; border-radius: 999px; padding: 2px 10px; font: 600 12px var(--body); }

/* login */
.login { max-width: 380px; margin: 0 auto; padding: 8vh 16px 32px; }
.login-brand { text-align: center; margin-bottom: 20px; }
.login-brand img { width: 96px; height: 96px; border-radius: 50%; display: block; margin: 0 auto 8px; }
.brand img, .side-brand img { width: 44px; height: 44px; border-radius: 50%; flex: none; display: block; }
.login-brand p { color: var(--muted); font-size: 14px; }
.login .btn { width: 100%; margin-top: 16px; } .login .link { display: block; margin: 12px auto 0; }

/* admin shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #fff; padding: 18px 12px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 14px; font-size: 26px; }
.side-brand strong { display: block; font: 700 18px var(--head); } .side-brand small { display: block; font-size: 12px; color: #9FB6C8; margin-top: -2px; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; color: #D5E2EC; text-decoration: none; font-weight: 500; }
.side nav a:hover { background: rgba(255,255,255,.07); }
.side nav a.active { background: var(--accent); color: #fff; }
.ico { width: 22px; text-align: center; font-size: 14px; }
.side-foot { padding: 8px; font-size: 12px; color: #9FB6C8; word-break: break-all; }
.main { padding: 24px; min-width: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 16px 18px; }
.stat-card span { color: var(--muted); font-size: 13px; display: block; } .stat-card strong { font: 700 30px var(--head); }
.stat-card small { display: block; color: var(--muted); font-size: 12px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; padding-top: 0; }

.tbl { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
tr.bad td { background: #FBECEA; } tfoot th { font-size: 14px; color: var(--ink); }
td select, td input { min-height: 38px; min-width: 90px; }
td input[type=number] { width: 84px; min-width: 0; }
.status-sel.paid { border-color: #7DC298; } .status-sel.overdue { border-color: var(--coral); } .status-sel.pending { border-color: var(--gold); }
.saved { color: var(--green); font-size: 12px; }

table.grid { table-layout: fixed; min-width: 900px; } table.grid th:first-child { width: 80px; }
table.grid td { vertical-align: top; padding: 6px; border-left: 1px solid var(--line); height: 60px; }
.slot { background: #F8E9E8; border-left: 4px solid var(--accent); border-radius: 8px; padding: 8px; margin-bottom: 6px; display: flex; flex-direction: column; gap: 1px; }
.slot small { color: var(--muted); font-size: 12px; } .slot .chip { align-self: flex-start; margin-top: 4px; }
.slot-actions { display: flex; gap: 12px; }
.private-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.venue-row { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.venue-row:first-child { border-top: 0; } .venue-row.new { border-top: 1px dashed var(--line); padding-top: 14px; }
.venue-row input[type=text] { flex: 1; min-height: 40px; } .venue-row .link { flex: none; white-space: nowrap; }
.slot.private { background: #EDEBF7; border-left-color: #7030A0; margin-bottom: 0; }
.slot.one-off { background: #FBF2DE; border-left-color: var(--gold); margin-bottom: 0; }
.link.warn { color: var(--gold); }
.grp-only[hidden] { display: none; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; } .span2 { grid-column: 1 / -1; }
.form-grid .btn { margin-top: 16px; } #reg-msg { margin-left: 12px; }
fieldset.newg { border: 1px dashed #B5C9D2; border-radius: 12px; padding: 4px 14px 12px; margin: 12px 0 0; } legend { font-weight: 600; padding: 0 6px; }
.seg { display: flex; gap: 8px; } .seg label { margin: 0; } .seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 10px 14px; border: 1px solid #C9D8DF; border-radius: 10px; font-weight: 500; cursor: pointer; }
.seg input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.seg input:focus-visible + span { outline: 3px solid rgba(163,21,17,.35); }

.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
.kcol { background: #E7F0F3; border-radius: 16px; padding: 12px; min-height: 160px; }
.kcol h3 { display: flex; justify-content: space-between; align-items: center; }
.kcol.renewing { border-top: 4px solid var(--green); } .kcol.reminderdue { border-top: 4px solid var(--gold); } .kcol.atrisk { border-top: 4px solid var(--coral); }
.kdrop { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kcard { background: #fff; border-radius: 12px; padding: 10px; box-shadow: var(--shadow); cursor: grab; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.kcard .badge { margin-left: 0; } .kcard select { min-height: 36px; font-size: 13px; }
.pay-Approved { border-color: var(--gold); } .pay-Paid { border-color: #7DC298; }

.hist { list-style: none; padding: 0; margin: 0; } .hist li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); } .hist li:first-child { border-top: 0; }
.hist img, .thumb.ph { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex: none; background: #E6EEF1; }
.hist > li > div { flex: 1; min-width: 0; } .hist p { margin-top: 4px; overflow-wrap: anywhere; }
.stars { color: var(--gold); letter-spacing: 2px; } .stars .dim { color: #C9D5DB; }

/* modal + toast */
.modal-backdrop { position: fixed; inset: 0; background: rgba(18,38,63,.5); display: grid; place-items: center; padding: 12px; z-index: 20; overflow-y: auto; }
.modal { background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 420px; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow); } .modal.wide { max-width: 620px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; } .form-err { color: var(--coral); font-size: 14px; margin-top: 10px; min-height: 0; }
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 30; width: max-content; max-width: 92vw; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; } .toast.err { background: var(--coral); }

/* staff (phone first) */
.staff-wrap { max-width: 520px; margin: 0 auto; padding: 12px 14px 40px; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 6px 0 10px; }
.brand { display: flex; gap: 10px; align-items: center; font-size: 26px; } .brand h1 { font-size: 19px; } .brand p { font-size: 12px; color: var(--muted); margin-top: -2px; }
.banner { background: #FFF6DC; border: 1px solid #EBD79B; color: #5F4A10; border-radius: 12px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 16px; }
.class-card .clock { margin: 12px 0; } .class-card .clock .btn { width: 100%; }
.class-card.private { border-left: 4px solid #7030A0; }
.class-card.one-off { border-left: 4px solid var(--gold); }
.kids { list-style: none; margin: 0; padding: 0; } .kids li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.mini-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font: 700 14px var(--head); flex: none; }
.kid-name { flex: 1; min-width: 0; } .kid-name strong { display: block; overflow-wrap: anywhere; } .kid-name .badge { margin: 2px 0 0; } .tick { display: block; font-size: 12px; color: var(--green); }
.starpick { display: flex; gap: 6px; } .starbtn { width: 48px; height: 48px; border: 1px solid #C9D8DF; background: #fff; border-radius: 12px; cursor: pointer; padding: 8px; }
.starbtn svg { width: 100%; height: 100%; fill: none; stroke: #B9C6CE; stroke-width: 1.6; stroke-linejoin: round; }
.starbtn.on svg { fill: var(--gold); stroke: var(--gold); }

.comp-chip { display: inline-block; margin-top: 3px; background: #FFF1CC; color: #7A5410; border-radius: 999px; font: 600 11px var(--body); padding: 2px 8px; }
.mk-chip, .abs-chip { display: inline-block; margin: 3px 4px 0 0; border-radius: 999px; font: 600 11px var(--body); padding: 2px 8px; }
.mk-chip { background: #E3EEF2; color: var(--ink); } .abs-chip { background: #F8DEDB; color: #9C3A33; }
.kid-name .link { display: block; padding: 2px 0; font-size: 12px; }
.comp-chip.int { background: var(--ink); color: #fff; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input { flex: 1; min-width: 180px; } .toolbar select { width: auto; max-width: 100%; }
.bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: #F8E9E8; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.bulk[hidden] { display: none; } .bulk select { width: auto; min-height: 38px; max-width: 260px; }
.mini-photo { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; display: block; }
tr.dim td { opacity: .6; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.cs-col { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; } .cs-col .btn { width: 100%; }
.top-links { display: flex; gap: 14px; align-items: center; }
.cal-links { margin-top: 6px; font-size: 13px; } .cal-links a { color: var(--accent); }
.kid-actions { display: flex; gap: 6px; flex: none; }
.banner.ok { background: #E4F4EA; border-color: #A8D5B8; color: #1F5A38; margin: 10px 0; }
.lvtabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.lvtab { flex: none; min-width: 54px; min-height: 46px; border: 2px solid transparent; border-radius: 12px; background: #EAF1F4; color: var(--ink);
  font: 700 14px var(--head); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lvtab small { font: 500 11px var(--body); color: var(--muted); }
.lvtab.on { background: var(--c); color: #fff; } .lvtab.on small { color: rgba(255,255,255,.85); }
.lv-title { margin: 10px 0 4px; display: flex; align-items: center; gap: 8px; } .lv-title .badge { margin-left: 0; }
.sk-list { list-style: none; margin: 8px 0 0; padding: 0; }
.sk-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.sk-name { min-width: 0; } .sk-name strong { display: block; font-size: 14.5px; overflow-wrap: anywhere; }
.sk-name small { font-size: 12px; color: var(--muted); } .sk-name small.passed { color: var(--green); } .sk-name small.learning { color: var(--gold); }
.seg3 { display: flex; flex: none; border: 1px solid #C9D8DF; border-radius: 10px; overflow: hidden; }
.seg3 button { min-height: 40px; padding: 0 10px; border: 0; border-right: 1px solid #C9D8DF; background: #fff; color: var(--muted); font: 600 12.5px var(--body); cursor: pointer; }
.seg3 button:last-child { border-right: 0; }
.seg3 button.on.none { background: #E3EEF2; color: var(--ink); } .seg3 button.on.learning { background: var(--gold); color: #12263F; } .seg3 button.on.passed { background: var(--green); color: #fff; }
.seg3 button:disabled { opacity: .6; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .side { position: static; height: auto; flex-direction: column; padding: 10px; min-width: 0; }
  .side-brand { padding-bottom: 4px; } .side-foot { display: flex; justify-content: space-between; align-items: center; }
  .side nav { flex: none; flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; } .side nav a { white-space: nowrap; padding: 8px 12px; }
  .main { padding: 14px; } .board { grid-template-columns: 1fr; } .form-grid { grid-template-columns: 1fr; }
}
