@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=Inter:wght@400;500;600&display=swap');

:root {
  --plum: #431739;
  --plum-2: #5c2350;
  --plum-soft: #f4ecf2;
  --lime: #e9ff91;
  --lime-2: #d6f05a;
  --ink: #23131f;
  --muted: #6e5f6a;
  --line: #e6dde3;
  --bg: #faf7f9;
  --card: #ffffff;
  --ok: #1f7a4d;
  --ok-bg: #e4f5ec;
  --warn: #8a5a00;
  --warn-bg: #fff3d6;
  --bad: #a3243b;
  --bad-bg: #fde7ea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(67, 23, 57, .06), 0 6px 18px rgba(67, 23, 57, .06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.serif { font-family: Fraunces, Georgia, serif; font-weight: 600; letter-spacing: -.01em; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
a { color: var(--plum); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid transparent;
  background: var(--plum); color: #fff; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--plum-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.lime { background: var(--lime); color: var(--plum); }
.btn.lime:hover { background: var(--lime-2); }
.btn.ghost { background: transparent; color: var(--plum); border-color: var(--line); }
.btn.ghost:hover { background: var(--plum-soft); }
.btn.danger { background: transparent; color: var(--bad); border-color: #f0c9d0; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 13.5px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--plum); text-decoration: underline; cursor: pointer; font-weight: 500; }

label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.in {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 400;
}
textarea.in { min-height: 80px; resize: vertical; }
.in:focus, .btn:focus-visible, .chip:focus-visible, .linkbtn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--plum) 25%, transparent); outline-offset: 1px; border-color: var(--plum);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

.alert { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--bad-bg); color: var(--bad); font-size: 14px; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; background: var(--plum-soft); color: var(--plum); white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.lime { background: var(--lime); color: var(--plum); }
.badge.muted { background: #efeaee; color: var(--muted); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; color: var(--muted);
}
.chip b { font-weight: 600; font-size: 12.5px; padding: 0 7px; border-radius: 999px; background: #efeaee; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--plum); border-color: var(--plum); color: #fff; }
.chip[aria-pressed="true"] b { background: var(--lime); color: var(--plum); }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, #5c2350 0%, var(--plum) 55%, #2c0f26 100%); }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 20px; padding: 32px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
  display: flex; flex-direction: column; gap: 16px; }
.login-card .brand { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; margin-bottom: 4px; }
.login-card .brand p { margin: 0; color: var(--muted); font-size: 14px; }
.keys { width: 54px; height: 54px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--muted); }
.check input { width: 18px; height: 18px; accent-color: var(--plum); }

/* ---------- app shell ---------- */
.top { position: sticky; top: 0; z-index: 20; background: var(--plum); color: #fff; }
.top-in { max-width: 1180px; margin: 0 auto; padding: 0 20px; height: 64px; display: flex; align-items: center; gap: 20px; }
.top .logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.top .logo .keys { width: 34px; height: 34px; }
.top .logo span { font-size: 18px; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav button { background: none; border: 0; color: #e8d9e4; padding: 8px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; }
.nav button[aria-current="page"] { background: rgba(255,255,255,.12); color: #fff; }
.nav button:hover { color: #fff; }
.top .spacer { flex: 1; }
.top .who { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #e8d9e4; }
.top .who .btn { min-height: 34px; }
@media (max-width: 760px) {
  .top-in { height: auto; padding: 10px 16px; flex-wrap: wrap; gap: 8px 12px; }
  .nav { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .top .who .name { display: none; }
}

main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 80px; }
@media (max-width: 640px) { main { padding: 18px 16px 80px; } }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.pagehead h1 { font-size: 28px; color: var(--plum); }
.pagehead p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { max-width: 300px; }
@media (max-width: 640px) { .toolbar .search { max-width: none; } }

.banner { margin-bottom: 16px; }

/* ---------- client list ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) minmax(0, 1.3fr) auto; gap: 16px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.row .who h2 { font-size: 16px; }
.row .who h2 button { all: unset; cursor: pointer; color: var(--ink); }
.row .who h2 button:hover { color: var(--plum); text-decoration: underline; }
.row .sub { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.row .kids { font-size: 14px; }
.row .kids span { color: var(--muted); }
.row .meta { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.row .act { display: flex; gap: 8px; justify-content: flex-end; }
@media (max-width: 860px) {
  .row { grid-template-columns: 1fr 1fr; }
  .row .act { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 520px) { .row { grid-template-columns: 1fr; } }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty h2 { font-size: 20px; color: var(--plum); margin-bottom: 6px; }

/* ---------- cards / tables ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.table td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .off td { color: var(--muted); }
.tablewrap { overflow-x: auto; }
@media (max-width: 700px) {
  .table.stack thead { display: none; }
  .table.stack tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .table.stack td { padding: 0; border: 0; }
  .table.stack td:first-child { grid-column: 1 / -1; }
}

/* ---------- dialogs ---------- */
dialog {
  width: min(680px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 18px;
  box-shadow: 0 24px 80px rgba(35, 19, 31, .35); color: var(--ink);
}
dialog::backdrop { background: rgba(35, 19, 31, .45); }
dialog.wide { width: min(860px, calc(100vw - 24px)); }
.dlg { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 12px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font-size: 22px; color: var(--plum); }
.dlg-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.dlg-body { padding: 18px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.dlg-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; background: #fcfafb; border-radius: 0 0 18px 18px; }
.x { background: none; border: 0; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 8px; }
.x:hover { background: var(--plum-soft); color: var(--plum); }
@media (max-width: 640px) {
  dialog, dialog.wide { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; margin: 0; }
  .dlg { max-height: 100vh; height: 100%; }
  .dlg-body { flex: 1; }
  .dlg-foot { border-radius: 0; }
}

.section { display: flex; flex-direction: column; gap: 12px; }
.section > h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.students { display: flex; flex-direction: column; gap: 8px; }
.student { display: grid; grid-template-columns: 1fr 160px auto; gap: 8px; align-items: center; }
@media (max-width: 520px) { .student { grid-template-columns: 1fr 110px auto; } }

/* billing builder */
.svc-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.svc { display: grid; grid-template-columns: auto 1fr auto 78px; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.svc:last-child { border-bottom: 0; }
.svc input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--plum); }
.svc .nm { font-weight: 600; }
.svc .ds { color: var(--muted); font-size: 13px; }
.svc .pr { font-variant-numeric: tabular-nums; white-space: nowrap; }
.svc .qty { min-height: 34px; padding: 4px 8px; }
.svc.on { background: #fbf8fa; }
.svc-group { padding: 8px 14px; background: #f6f1f5; font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--line); }

.choice { display: grid; gap: 8px; }
.choice label { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; }
.choice label:has(input:checked) { border-color: var(--plum); background: var(--plum-soft); }
.choice input { grid-row: span 2; margin-top: 3px; width: 18px; height: 18px; accent-color: var(--plum); }
.choice b { font-weight: 600; }
.choice small { grid-column: 2; color: var(--muted); font-size: 13px; }

.totals { border-radius: 12px; background: var(--plum); color: #fff; padding: 14px 16px; display: grid; gap: 4px; }
.totals .ln { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: #e8d9e4; font-variant-numeric: tabular-nums; }
.totals .big { font-size: 18px; color: #fff; font-weight: 600; }
.totals .big span:last-child { color: var(--lime); }

.linkbox { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 12px; background: #fff7cc; border: 1px solid #f1e39a; }
.linkbox input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 13.5px; }

.subs { display: flex; flex-direction: column; gap: 10px; }
.subcard { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.subcard .hd { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.subcard ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13.5px; }
.subcard .btns { display: flex; gap: 8px; flex-wrap: wrap; }

.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.log li { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.log li b { color: var(--ink); font-weight: 500; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow);
  max-width: calc(100vw - 32px);
}
.toast.bad { background: var(--bad); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt0 { margin-top: 0; }
.row-gap { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spin { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: s .7s linear infinite; }
@keyframes s { to { transform: rotate(360deg); } }
.dlg-foot .spacer { flex: 1; }
.top .btn.ghost { color: #fff; border-color: rgba(255,255,255,.35); }
.top .btn.ghost:hover { background: rgba(255,255,255,.12); }
@media (max-width: 640px) {
  .svc { grid-template-columns: auto 1fr 62px; gap: 4px 12px; }
  .svc .pr { grid-column: 2; grid-row: 2; font-size: 13.5px; color: var(--muted); }
  .svc .qty { grid-column: 3; grid-row: 1 / span 2; }
  .svc input[type=checkbox] { grid-row: 1 / span 2; }
}

.foot { max-width: 1180px; margin: -56px auto 0; padding: 0 20px 24px; text-align: center; font-size: 12.5px; color: var(--muted); }
.login-card .foot { margin: 0; padding: 0; }

/* ================= v1.2: sidebar app + dashboard ================= */
.login-card .logo { width: 180px; height: 180px; object-fit: contain; margin: -8px auto -4px; }

body.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; background: var(--plum); color: #fff;
  display: flex; flex-direction: column; gap: 22px; padding: 22px 16px;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; padding: 0 6px; }
.brand img { width: 40px; height: 40px; border-radius: 10px; box-shadow: 0 0 0 1px rgba(233,255,145,.35); }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand b { font-size: 18px; }
.brand small { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--lime); }
.side .nav { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.side .nav button {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px;
  background: none; border: 0; color: #e8d9e4; font-weight: 600; cursor: pointer;
}
.side .nav svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side .nav button:hover { background: rgba(255,255,255,.07); color: #fff; }
.side .nav button[aria-current="page"] { background: var(--lime); color: var(--plum); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 0 6px; }
.side-foot .who { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #f3e9f0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--lime); color: var(--plum); font-weight: 700; font-size: 13px; }
.side .btn.ghost { color: #fff; border-color: rgba(255,255,255,.3); }
.side .btn.ghost:hover { background: rgba(255,255,255,.1); }
.ver { font-size: 11.5px; color: #b9a4b4; }
body.app main { max-width: 1240px; width: 100%; margin: 0; padding: 28px 32px 64px; }
.foot { display: none; }

@media (max-width: 900px) {
  body.app { grid-template-columns: 1fr; }
  .side { position: sticky; z-index: 30; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; }
  .brand img { width: 34px; height: 34px; }
  .brand small { display: none; }
  .side .nav { order: 3; width: 100%; flex-direction: row; overflow-x: auto; gap: 2px; }
  .side .nav button { width: auto; padding: 8px 12px; white-space: nowrap; font-size: 14px; }
  .side .nav svg { display: none; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; padding: 0; }
  .side-foot .who span:last-child, .ver, #testmode { display: none; }
  body.app main { padding: 20px 16px 64px; }
}

.eyebrow { margin: 0 0 4px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.panel { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.panel > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel > header h2 { font-size: 20px; color: var(--plum); }

/* KPI cards */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi .lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi .val { font-family: Fraunces, Georgia, serif; font-size: 30px; font-weight: 600; color: var(--plum); line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 13px; color: var(--muted); }
.kpi .up { color: var(--ok); font-weight: 600; }
.kpi .down { color: var(--bad); font-weight: 600; }
.kpi.feature { background: var(--plum); border-color: var(--plum); }
.kpi.feature .lbl, .kpi.feature .sub { color: #e8d9e4; }
.kpi.feature .val { color: var(--lime); }
.kpi.feature .up { color: var(--lime); }
.meter { height: 6px; border-radius: 99px; background: #efe7ed; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--plum); border-radius: 99px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .kpis { grid-template-columns: 1fr 1fr; gap: 10px; } .kpi { padding: 12px 14px; } .kpi .val { font-size: 23px; } }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; }
.dash-grid .panel { margin-bottom: 18px; }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: 1fr; } }

/* Sales chart */
.chart { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; align-items: end; height: 230px; padding-top: 8px; }
.bar { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar .amt { font-size: 12.5px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar .stack { width: 100%; max-width: 58px; display: flex; flex-direction: column-reverse; border-radius: 8px 8px 3px 3px; overflow: hidden; background: #f3edf1; }
.bar .stack i { display: block; width: 100%; }
.bar .stack i.tuition { background: var(--plum); }
.bar .stack i.fees { background: var(--lime-2); }
.bar .mo { font-size: 12.5px; color: var(--muted); }
.bar.now .mo { color: var(--plum); font-weight: 700; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.sw.tuition { background: var(--plum); } .sw.fees { background: var(--lime-2); }

/* Upcoming payments */
.due-list { display: flex; flex-direction: column; max-height: 330px; overflow-y: auto; margin: 0 -8px; }
.due-group { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 8px 4px; }
.due-group.bad { color: var(--bad); }
.due { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; }
.due:hover { background: #faf6f9; }
.due .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due .nm small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.due .amt { font-variant-numeric: tabular-nums; font-weight: 600; }
.due-empty { padding: 24px 8px; text-align: center; color: var(--muted); }

/* Week schedule */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.day { background: #fbf8fa; border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.day.today { border-color: var(--plum); box-shadow: inset 0 3px 0 var(--plum); }
.day h3 { font-size: 13px; margin: 0 0 2px; color: var(--plum); display: flex; justify-content: space-between; gap: 6px; }
.day h3 span { color: var(--muted); font-weight: 500; }
.lesson { background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--plum); border-radius: 8px; padding: 6px 8px; font-size: 12.5px; cursor: pointer; text-align: left; width: 100%; font: inherit; font-size: 12.5px; color: inherit; }
.lesson:hover { border-color: var(--plum); }
.lesson b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson span { color: var(--muted); }
.lesson.group { border-left-color: var(--lime-2); }
.day .none { font-size: 12.5px; color: var(--muted); padding: 4px 2px; }
@media (max-width: 1100px) { .week { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 640px) { .week { grid-template-columns: 1fr; } .day .none { display: none; } }

/* Students roster */
.roster { display: flex; flex-direction: column; gap: 18px; }
.roster h2.dayhead { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 -8px; font-family: Inter, system-ui, sans-serif; }
.rtable { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.rtable th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fcfafb; }
.rtable td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rtable tr:last-child td { border-bottom: 0; }
.rtable tbody tr { cursor: pointer; }
.rtable tbody tr:hover td { background: #fcf9fb; }
.rtable .who b { display: block; }
.rtable .who small { color: var(--muted); }
.rtable .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rtable .acts { text-align: right; white-space: nowrap; }
.rtable .time { white-space: nowrap; }
@media (max-width: 800px) {
  .rtable thead { display: none; }
  .rtable tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .rtable td { padding: 0; border: 0; }
  .rtable td.who { grid-column: 1 / -1; }
  .rtable td.acts { grid-column: 1 / -1; text-align: left; }
  .rtable td[data-l]::before { content: attr(data-l) " "; color: var(--muted); font-size: 12px; }
}

/* Student dialog */
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 720px) { .grid3, .grid4 { grid-template-columns: 1fr 1fr; } }
.pay-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pay-summary > div { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.pay-summary small { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.pay-summary b { font-size: 17px; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .pay-summary { grid-template-columns: 1fr; } }
.table.compact td { padding: 8px 10px; font-size: 14px; }
.between { justify-content: space-between; }
.student { grid-template-columns: 1fr 140px auto; }

/* Settings */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.settings-grid .panel { margin-bottom: 18px; }
@media (max-width: 860px) { .settings-grid { grid-template-columns: 1fr; } }
.inline-form { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.inline-form h3 { margin: 0; font-size: 15px; }
.import-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.import-row:first-of-type { border-top: 0; padding-top: 0; }
@media (max-width: 560px) { .import-row { flex-direction: column; align-items: flex-start; } }
@media (max-width: 900px) {
  body.app { grid-template-columns: minmax(0, 1fr); }
  .side, .side .nav, body.app main { min-width: 0; }
  .side-foot .btn { white-space: nowrap; }
}
@media (max-width: 800px) {
  .rtable, .rtable tbody { display: block; width: 100%; }
  .rtable td.who b { white-space: normal; }
}
@media (min-width: 801px) {
  .rtable { table-layout: fixed; }
  .rtable th:nth-child(1) { width: 27%; } .rtable th:nth-child(2) { width: 24%; } .rtable th:nth-child(3) { width: 17%; }
  .rtable th:nth-child(4) { width: 11%; } .rtable th:nth-child(5) { width: 11%; } .rtable th:nth-child(6) { width: 150px; }
}

/* v1.2.1: studio logo in the sidebar */
.brand { display: block; background: #fffdf8; border-radius: 16px; padding: 10px; margin: 0 2px; box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.brand img { display: block; width: 100%; max-width: 168px; height: auto; margin: 0 auto; border-radius: 0; box-shadow: none; }
@media (max-width: 900px) {
  .brand { padding: 3px; border-radius: 50%; width: 52px; height: 52px; margin: 0; }
  .brand img { width: 46px; height: 46px; max-width: none; }
}

/* v1.3: one students table with sort + column filters */
.searchbox { position: relative; flex: 1 1 280px; max-width: 380px; }
.searchbox svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.searchbox .in { padding-left: 38px; }
@media (max-width: 640px) { .searchbox { max-width: none; flex-basis: 100%; } }

.tsummary { display: flex; justify-content: space-between; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.tsummary b { color: var(--ink); }
.bad-text { color: var(--bad); font-weight: 600; }
.fchips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.fchip { border: 1px solid var(--plum); background: var(--plum-soft); color: var(--plum); border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 600; cursor: pointer; }
.fchip:hover { background: #ead9e5; }
.fchip span { margin-left: 2px; }

.ftable-wrap { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.ftable { width: 100%; min-width: 900px; border-collapse: separate; border-spacing: 0; }
.ftable th { position: sticky; top: 0; z-index: 2; background: #fcfafb; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ftable th.num .th { justify-content: flex-end; }
.ftable td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ftable tbody tr { cursor: pointer; }
.ftable tbody tr:hover td { background: #fcf9fb; }
.ftable tbody tr:last-child td { border-bottom: 0; }
.ftable tr.none td { text-align: center; color: var(--muted); padding: 32px; cursor: default; }
.ftable td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ftable td.time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ftable td.who b { display: block; }
.ftable td.who small { color: var(--muted); font-size: 12.5px; }
.ftable td.acts { text-align: right; white-space: nowrap; }
.th { display: flex; align-items: center; gap: 2px; }
.th-sort { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 6px; border-radius: 8px; font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); cursor: pointer; }
.th-sort:hover { background: #f1e9ef; color: var(--plum); }
.th-sort.on { color: var(--plum); }
.th-sort .arrow { font-size: 10px; opacity: .55; }
.th-sort.on .arrow { opacity: 1; }
.th-filter { position: relative; display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; background: none; border-radius: 8px; color: #a8969f; cursor: pointer; }
.th-filter svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.th-filter:hover { background: #f1e9ef; color: var(--plum); }
.th-filter.on { background: var(--plum); color: var(--lime); }
.th-filter.on svg { fill: currentColor; }
.th-filter b { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--lime); color: var(--plum); font-size: 10.5px; line-height: 16px; }
.th-sort:focus-visible, .th-filter:focus-visible, .fchip:focus-visible { outline: 3px solid color-mix(in srgb, var(--plum) 30%, transparent); outline-offset: 1px; }

.fpop { position: absolute; z-index: 10; min-width: 230px; max-width: 300px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(35,19,31,.18); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.fpop-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 14px; }
.fpop .check { color: var(--ink); padding: 3px 0; cursor: pointer; }
.fpop .check .muted { margin-left: auto; }
.fpop-sort { display: flex; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.fpop-sort .btn { flex: 1; }

/* v1.4: family reply page */
.spot-card { max-width: 460px; gap: 14px; }
.spot-card h1 { font-size: 24px; color: var(--plum); text-align: center; }
.spot-card p { margin: 0; }
.spot-card .brand-mini { text-align: center; }
.spot-card .logo { width: 130px; height: 130px; object-fit: contain; }
.spot-opening { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--plum-soft); }
.spot-opening small { color: var(--muted); font-weight: 600; }
.spot-choices { display: flex; flex-direction: column; gap: 10px; }
.spot-btn { width: 100%; white-space: normal; text-align: center; min-height: 48px; padding: 10px 16px; }
.spot-btn.picked { box-shadow: 0 0 0 3px var(--lime-2); }
.spot-foot { text-align: center; border-top: 1px solid var(--line); padding-top: 12px; }

/* v1.4: waiting list */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--lime); color: var(--plum); font-size: 12px; line-height: 20px; text-align: center; }
.side .nav button[aria-current="page"] .nav-badge { background: var(--plum); color: var(--lime); }
.attn { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.attn-item { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--line); border-left: 4px solid var(--warn); background: #fff; box-shadow: var(--shadow); }
.attn-item.ok { border-left-color: var(--ok); }
.attn-item.bad { border-left-color: var(--bad); }
.attn-item .msg { flex: 1 1 320px; min-width: 0; }
.attn-item .msg b { display: block; }
.attn-item .msg span { color: var(--muted); font-size: 13.5px; }
.attn-item .btns { display: flex; gap: 8px; flex-wrap: wrap; }
.wl-table td.pos { width: 44px; font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 18px; color: var(--plum); text-align: center; }
.wl-table .contact { font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; }
.wl-table .st small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.wl-table td.acts { display: table-cell; }
.wl-table td.acts .btn { margin-left: 6px; }
.ftable.wl-table { min-width: 980px; }
.offer-preview { border: 1px solid var(--line); border-radius: 12px; background: #fcfafb; overflow: hidden; }
.pv-head { display: flex; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: 14px; align-items: baseline; }
.pv-head small { width: 56px; flex: none; color: var(--muted); font-weight: 600; }
.offer-preview pre { margin: 0; padding: 12px 14px; max-height: 260px; overflow: auto; white-space: pre-wrap; font: 13.5px/1.5 Inter, system-ui, sans-serif; color: var(--ink); }
.dash-attn { margin-bottom: 16px; }
.email-status dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.email-status dt { color: var(--muted); font-weight: 600; }
.email-status dd { margin: 0; overflow-wrap: anywhere; }

/* v1.5: settings tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tabs button:hover { color: var(--plum); }
.tabs button[aria-selected="true"] { color: var(--plum); border-bottom-color: var(--plum); }
.tabs button:focus-visible { outline: 3px solid color-mix(in srgb, var(--plum) 30%, transparent); outline-offset: -3px; }
.panel.narrow { max-width: 520px; }
.grid5 { grid-template-columns: 1.6fr repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .grid5 { grid-template-columns: 1fr 1fr; } .grid5 > :first-child { grid-column: 1 / -1; } }
.email-choice { grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .email-choice { grid-template-columns: 1fr; } }
code { font-size: 12.5px; background: #f3edf1; padding: 1px 5px; border-radius: 5px; }

/* hours editor */
.hours-rows { display: flex; flex-direction: column; gap: 8px; }
.hrow { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr auto; gap: 8px; align-items: end; }
.hrow .f { font-size: 12.5px; }
@media (max-width: 640px) { .hrow { grid-template-columns: 1fr 1fr; } .hrow .x { justify-self: start; } }
.hours-empty { padding: 14px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); text-align: center; }

/* lesson calendar */
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }
.lg.taken { background: var(--plum); } .lg.future { background: #8c5a80; } .lg.held { background: var(--lime-2); } .lg.open { background: #fff; border: 1.5px dashed #b9a4b4; }
.calwrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px 4px; }
.cal { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 1fr); gap: 10px; }
.cal-day { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cal-day h3 { margin: 0 0 2px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--plum); display: flex; justify-content: space-between; }
.cal-day h3 span { color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; }
.slot { display: block; width: 100%; text-align: left; font: inherit; font-size: 13px; border-radius: 10px; padding: 7px 10px; cursor: pointer; border: 1px solid transparent; min-height: 52px; }
.slot .tm { display: block; font-size: 12px; font-variant-numeric: tabular-nums; opacity: .85; }
.slot b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot small { display: block; font-size: 11.5px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot.taken { background: var(--plum); color: #fff; }
.slot.taken.future { background: #8c5a80; }
.slot.held { background: var(--lime); color: var(--plum); border-color: var(--lime-2); }
.slot.open { background: #fff; color: var(--muted); border: 1.5px dashed #cdbcc8; }
.slot.open b { color: var(--plum); }
.slot.open:hover { border-color: var(--plum); background: var(--plum-soft); }
.slot:focus-visible { outline: 3px solid color-mix(in srgb, var(--plum) 30%, transparent); outline-offset: 1px; }
.cal-empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; }
.cal-outside { margin-top: 10px; font-size: 13px; color: var(--muted); }

/* open spots on the waiting list */
.open-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; padding: 12px 14px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.open-strip > b { margin-right: 4px; color: var(--plum); }
.open-chip { border: 1.5px dashed #b9a4b4; background: #fff; color: var(--plum); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.open-chip:hover { background: var(--plum-soft); border-color: var(--plum); }
.ok-text { color: var(--ok); font-weight: 600; }
@media (min-width: 641px) { .hrow + .hrow .hl { display: none; } .hrow + .hrow { align-items: center; } }

/* v1.6: offer steps, every-other-week slots, Apps Script setup */
.offer-pick { display: grid; grid-template-columns: 1fr 1.3fr 1.6fr; gap: 12px; }
@media (max-width: 720px) { .offer-pick { grid-template-columns: 1fr; } }
.stepn { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px; border-radius: 50%; background: var(--plum); color: var(--lime); font-size: 11.5px; }
.offer-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--plum-soft); }
.offer-sum span { display: flex; flex-direction: column; gap: 2px; font-weight: 600; color: var(--plum); }
.offer-sum small { font-weight: 600; color: var(--muted); font-size: 12px; }
.slot.partial { background: #fff; border-left: 6px solid var(--plum); }
.slot.partial b { color: var(--plum); }
.cal-note { margin: -2px 0 2px; font-size: 11.5px; color: var(--muted); }
.open-chip small { font-weight: 500; color: var(--muted); }
.steps { margin: 0 0 6px; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 14.5px; }
.codebox { position: relative; margin-top: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fbf8fa; }
.codebox pre { margin: 0; padding: 12px 14px; max-height: 220px; overflow: auto; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; }
.codebox .btn { position: absolute; top: 8px; right: 8px; }
.script-setup { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }

/* v1.6: readability */
body { font-size: 16px; line-height: 1.55; }
.pagehead { margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.pagehead h1 { font-size: 32px; }
.pagehead p { font-size: 15px; max-width: 680px; }
.panel { padding: 22px 24px; gap: 16px; margin-bottom: 22px; }
.panel > header h2 { font-size: 21px; }
.kpi .lbl { font-size: 13.5px; text-transform: uppercase; letter-spacing: .04em; }
.kpi .sub { font-size: 13.5px; }
.ftable td { padding: 13px 16px; font-size: 15px; }
.ftable td.who b { font-size: 15.5px; }
.ftable tbody tr:nth-child(even) td { background: #fdfbfc; }
.ftable tbody tr:hover td { background: #f8f1f6; }
.th-sort { font-size: 12.5px; }
.badge { font-size: 13px; padding: 3px 10px; }
.btn.sm { min-height: 34px; font-size: 14px; }
.toolbar { margin-bottom: 18px; }
.due .nm { font-size: 15px; }
label.f { font-size: 14px; }
.in { font-size: 15px; }
.dlg-body { gap: 18px; padding: 20px 24px; }
.side .nav button { font-size: 15.5px; padding: 11px 12px; }
.wl-table td.acts { white-space: nowrap; }
.wl-table .linkbtn { margin-left: 10px; font-size: 14px; }
#wl-email-note { margin-bottom: 14px; }
