/* ESDS — one stylesheet, no build step. Layout is fluid with a fixed maximum width,
   so pages look the same in a maximized or a smaller window; below 900px the side menu
   folds into a top bar. */
:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --ink: #1d2a26;
  --ink-2: #55635e;
  --line: #dfe5e2;
  --brand-ink: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: var(--brand);
  --ok-soft: var(--brand-soft);
  --warn: #8a5a00;
  --warn-soft: #fff4dc;
  --radius: 10px;
  --side: 248px;
  --font: "Segoe UI", system-ui, -apple-system, "Noto Sans", "Noto Sans Tamil", "Nirmala UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: 22px; margin: 0; line-height: 1.3; }
h2 { font-size: 17px; margin: 0 0 12px; }
p { margin: 0 0 10px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: var(--side); flex: 0 0 var(--side); background: var(--side-bg); color: var(--side-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 14px; letter-spacing: .5px; }
.brand-name { font-weight: 700; font-size: 16px; line-height: 1.2; }
.brand-sub { font-size: 11.5px; color: var(--side-muted); }
.nav { padding: 6px 10px 16px; flex: 1; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--side-label); padding: 14px 10px 6px; }
.nav a, .nav span.soon {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border-radius: 8px; color: var(--side-text); text-decoration: none; font-size: 14.5px;
}
.nav a:hover { background: var(--side-hover); }
.nav a.active { background: var(--brand); color: #fff; }
.nav span.soon { color: var(--side-label); cursor: default; }
.tag-soon { font-size: 10.5px; border: 1px solid var(--side-line); border-radius: 999px; padding: 0 7px; }
.side-foot { padding: 14px 18px; border-top: 1px solid var(--side-line); font-size: 13px; }
.side-foot .who { color: #fff; font-weight: 600; }
.side-foot .roles { color: var(--side-muted); font-size: 12px; margin-bottom: 8px; }
.side-foot a, .side-foot button { color: var(--side-text); font-size: 13px; }
.linkbtn { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; font: inherit; }

.main { flex: 1; min-width: 0; }
.topbar { display: none; }
.content { max-width: 1180px; margin: 0 auto; padding: 28px 32px 48px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

/* ---------- Pieces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--brand-ring); border-radius: var(--radius); padding: 16px; text-decoration: none; color: inherit; display: block; }
.stat .n { font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat .l { color: var(--ink-2); font-size: 13.5px; }
a.stat:hover { border-color: var(--brand); }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink);
  padding: 8px 14px; border-radius: 8px; font: inherit; font-size: 14.5px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--surface); color: var(--brand); border-color: var(--brand-ring); }
.btn.ghost:hover { background: var(--brand-soft); filter: none; }
.btn.sm { padding: 4px 10px; font-size: 13px; font-weight: 600; }

.alert { border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 14.5px; }
.alert.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok-line); }
.alert.err { background: var(--danger-soft); color: var(--danger); border: 1px solid #f5c2bd; }
.alert ul { margin: 4px 0 0 18px; padding: 0; }

.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); margin: 1px 2px 1px 0; white-space: nowrap; }
.badge.grey { background: #eef1f0; color: var(--ink-2); }
.badge.off { background: var(--danger-soft); color: var(--danger); }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-2); background: var(--brand-faint); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.actions { text-align: right; white-space: nowrap; }
tr.is-off td { color: var(--ink-2); }
.empty { padding: 28px; text-align: center; color: var(--ink-2); }

/* ---------- Forms ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .field { margin: 0; }
.form { max-width: 720px; }
.field { margin-bottom: 16px; }
.field label, .field .label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.field .hint { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.field .error { font-size: 13px; color: var(--danger); margin-top: 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], select, textarea {
  width: 100%; font: inherit; font-size: 15px; padding: 8px 10px; border: 1px solid #c9d2ce; border-radius: 8px; background: #fff; color: var(--ink);
}
.filters input, .filters select { width: auto; min-width: 160px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-ring); border-color: var(--brand); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; cursor: pointer; background: #fff; }
.check input { margin-top: 4px; }
.check strong { display: block; font-size: 14px; }
.check span { font-size: 12.5px; color: var(--ink-2); }
.check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.switch { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; cursor: pointer; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; }
.login-card .brand { color: var(--ink); padding: 0 0 18px; justify-content: center; }
.login-card .brand-mark { color: #fff; }
.login-card .brand-sub { color: var(--ink-2); }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 14px; }
.pagination a, .pagination span { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; font-size: 13.5px; background: #fff; }
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Narrow windows and phones ---------- */
@media (max-width: 900px) {
  .shell { display: block; }
  .side { position: fixed; z-index: 30; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 0 100vmax rgba(0,0,0,0); }
  #nav-toggle:checked ~ .shell .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20; background: var(--side-bg); color: #fff; padding: 10px 16px; }
  .topbar label { cursor: pointer; font-size: 22px; line-height: 1; padding: 2px 6px; }
  .topbar .brand-name { font-size: 15px; }
  .content { padding: 20px 16px 40px; }
  .row2 { grid-template-columns: 1fr; }
  .filters input, .filters select { min-width: 0; flex: 1 1 140px; }
}
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.scrim { display: none; }
@media (max-width: 900px) {
  .side { box-shadow: none !important; }
  #nav-toggle:checked ~ .shell .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.35); }
}
/* labels inside a .field must keep their own layout */
.field label.check { display: flex; margin-bottom: 0; font-weight: 400; }
.field label.switch { display: inline-flex; margin-bottom: 0; }
@media (min-width: 901px) {
  .shell { background: linear-gradient(to right, var(--side-bg) var(--side), var(--bg) var(--side)); }
}
/* attendance grid */
.att th.att-col, .att td.att-col { text-align: center; padding-left: 6px; padding-right: 6px; width: 1%; white-space: nowrap; }
.att th.att-col a { color: var(--ink-2); text-decoration: none; }
.mk { font-weight: 700; }
.mk.ok { color: var(--ok); }
.mk.no { color: var(--danger); }
.pct { font-weight: 700; }
.pct.low { color: var(--danger); }
details.card > summary { cursor: pointer; }
/* attendance taking */
.roll { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.roll .check { align-items: center; }
.roll .check input { width: 20px; height: 20px; margin: 0; flex: 0 0 auto; }
.roll .check:not(:has(input:checked)) { border-color: #f5c2bd; background: var(--danger-soft); }
.roll-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.roll-count { font-weight: 600; margin-left: auto; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; }
@media (max-width: 900px) { .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; } }
.status-pending { background: var(--warn-soft); color: var(--warn); }
.status-rejected { background: var(--danger-soft); color: var(--danger); }
.row3 { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 0 16px; max-width: 720px; }
input[type=date], input[type=time] { width: 100%; font: inherit; font-size: 15px; padding: 7px 10px; border: 1px solid #c9d2ce; border-radius: 8px; background: #fff; color: var(--ink); }
.filters input[type=date] { width: auto; }
@media (max-width: 900px) { .row3 { grid-template-columns: 1fr 1fr; } .row3 .field:first-child { grid-column: 1 / -1; } }
.att td:first-child { min-width: 170px; }
tr.row-bad td { background: #fff7f6; }
code { font-family: Consolas, "Courier New", monospace; font-size: 14px; background: #eef1f0; padding: 1px 6px; border-radius: 5px; }
input[type=file] { font: inherit; font-size: 14.5px; max-width: 100%; }
.tag-count { font-size: 11px; font-weight: 700; background: #f5b83d; color: #10261f; border-radius: 999px; padding: 0 7px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: middle; position: relative; top: -1px; }
.stat .dot { width: 12px; height: 12px; top: -4px; }
.dot.online { background: #12a150; box-shadow: 0 0 0 3px #d6f3e2; }
.dot.away { background: #e0a100; }
.dot.offline { background: #b8c2be; }
.dot.never { background: transparent; border: 2px solid #b8c2be; }
@media (max-width: 600px) { .hide-sm { display: none; } }
/* WhatsApp */
.wa { width: 16px; height: 16px; flex: 0 0 auto; }
.btn.wa-btn { background: var(--brand); border-color: var(--brand); }
.wa-sent { display: inline-flex; align-items: center; gap: 5px; color: var(--brand); font-weight: 700; font-size: 14px; }
.wa-sent .wa { width: 18px; height: 18px; }
.n.money { font-size: 20px; white-space: nowrap; }
.n.warn { color: var(--warn); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.two-col > .card { margin-bottom: 18px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; gap: 0; } }
.bar-row { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; margin: 8px 0; font-size: 14px; }
.bar { background: #eef1f0; border-radius: 6px; height: 14px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.bar-val { font-weight: 600; white-space: nowrap; }
.n.ok { color: var(--ok); }
td.warn-t { color: var(--warn); font-weight: 600; }
/* One-click class start / end */
.btn.big { font-size: 17px; padding: 12px 22px; }
.btn.stop { background: var(--danger); border-color: var(--danger); }
.start-box, .running-box { display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--brand-soft); margin: 6px 0 4px; }
.running-box { background: var(--warn-soft); border-color: #f0dcae; margin-bottom: 16px; }
.running-banner { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 16px; border-radius: 10px; background: var(--warn-soft); border: 1px solid #f0dcae; }
.running-banner form { margin-left: auto; }
details.manual { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
details.manual summary { cursor: pointer; color: var(--brand); font-weight: 600; margin-bottom: 12px; }
.status-running { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.live { font-variant-numeric: tabular-nums; }
/* Approve classes */
.approve-card { padding-bottom: 12px; }
.approve-head { display: flex; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 12px; }
.approve-body { display: flex; gap: 14px 24px; flex-wrap: wrap; align-items: stretch; }
.approve-form { display: flex; gap: 10px; align-items: flex-end; flex: 1 1 260px; }
.approve-form .field { flex: 1 1 auto; max-width: 220px; }
.ref-box { flex: 1 1 240px; border: 1px dashed var(--line); border-radius: 10px; padding: 10px 14px; background: #fbfcfb; }
.ref-box .btn { margin-top: 6px; }
details.reject { margin-top: 12px; }
details.reject summary { cursor: pointer; color: var(--ink-2); font-size: 14px; margin-bottom: 8px; }
.status-approved { background: var(--brand-soft); color: var(--brand); }
.status-paid { background: #e7f0ff; color: #1d4f9c; }
/* Cash book */
.book td, .book th { white-space: nowrap; }
.book td.desc { white-space: normal; min-width: 160px; }
.book tr.in td { background: var(--brand-faint); }
.book td.neg { color: var(--danger); }
.book tfoot td { font-weight: 700; border-top: 2px solid var(--line); background: #f7f9f8; }
.split-row { display: flex; gap: 10px; flex-wrap: wrap; }
.split-row .field { flex: 1 1 150px; max-width: 220px; }
.pay-group { margin-bottom: 16px; }
.pay-group h2 { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
/* Late comers */
.badge.late, .mk.late { background: var(--warn-soft); color: var(--warn); }
.mk.late { font-weight: 700; padding: 0 6px; border-radius: 6px; }
.late-form { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.late-form input[type=time] { width: 120px; padding: 4px 8px; font-size: 14px; }
.absent-list { border-top: 1px solid var(--line); }
.absent-row { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.absent-row:last-child { border-bottom: 0; }
.absent-row .who { flex: 1 1 200px; min-width: 0; }
.absent-row .wa-cell { margin-left: auto; }
/* ---------- Progress: tabs, charts, grades, tips ---------- */
.ctabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -6px 0 18px; overflow-x: auto; }
.ctabs a { padding: 9px 14px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 14.5px; border-bottom: 3px solid transparent; white-space: nowrap; }
.ctabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.ctabs a:hover { color: var(--ink); }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #e7ecea; stroke-width: 1; }
.chart .ax { font-size: 12px; fill: #6b7773; font-family: var(--font); }
.chart .band { font-weight: 700; fill: #9aa5a1; }
.chart .lbl { font-size: 12px; fill: var(--ink-2); font-weight: 600; font-family: var(--font); }
.legend { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin: 4px 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 18px; height: 3px; border-radius: 2px; }
.grade { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 9px; font-weight: 800; font-size: 17px; background: #eef1f0; color: var(--ink); }
.grade.sm { min-width: 26px; height: 26px; font-size: 14px; border-radius: 7px; }
.grade.g-A { background: #dff3e8; color: #0b6b3f; }
.grade.g-B { background: #e3eefc; color: #1f57a8; }
.grade.g-C { background: #fff2d6; color: #8a5a00; }
.grade.g-S { background: #fde7dc; color: #a2441b; }
.grade.g-F { background: var(--danger-soft); color: var(--danger); }
.st { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.st.good { background: #dff3e8; color: #0b6b3f; }
.st.warn { background: var(--warn-soft); color: var(--warn); }
.st.bad { background: var(--danger-soft); color: var(--danger); }
.st.none { background: #eef1f0; color: var(--ink-2); }
.tips { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tips li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: #f7f9f8; border: 1px solid var(--line); font-size: 14.5px; }
.tips li .ic { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; margin-top: 1px; }
.tips li.good .ic { background: #12a150; }
.tips li.warn .ic { background: #d48a00; }
.tips li.bad .ic { background: var(--danger); }
.tips li.info .ic { background: #2a78d6; }
.tips li strong { font-weight: 700; }
.subj-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-bottom: 18px; }
.subj { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; color: inherit; text-decoration: none; }
a.subj:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(15,107,79,.08); }
.subj-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.subj-head h3 { margin: 0; font-size: 17px; }
.subj-head .small { margin-top: 2px; }
.pred { display: flex; align-items: center; gap: 10px; }
.pred .arrow { color: var(--ink-2); font-size: 13px; }
.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.meter .k { font-size: 12.5px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 6px; }
.meter .k b { color: var(--ink); }
.meter .bar { height: 8px; margin-top: 4px; }
.bar span.plan { background: transparent; border-right: 2px solid #8a918e; border-radius: 0; height: 100%; position: relative; top: -8px; }
.bar.two { position: relative; }
.bar.two .mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #55635e; }
.bar span.warn { background: #d48a00; }
.bar span.bad { background: var(--danger); }
.next-pill { display: flex; align-items: center; gap: 8px; font-size: 13.5px; background: var(--brand-soft); color: var(--brand); border-radius: 8px; padding: 6px 10px; }
.hero { background: linear-gradient(120deg, var(--brand), var(--brand-2) 60%, var(--brand-3)); color: #fff; border-radius: 14px; padding: 20px 22px; margin-bottom: 18px; display: flex; gap: 14px 24px; justify-content: space-between; flex-wrap: wrap; align-items: center; }
.hero h1 { color: #fff; font-size: 23px; }
.hero p { margin: 4px 0 0; color: rgba(255,255,255,.85); }
.hero-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-stat { background: rgba(255,255,255,.13); border-radius: 10px; padding: 8px 14px; min-width: 96px; }
.hero-stat .n { font-size: 22px; font-weight: 800; line-height: 1.15; }
.hero-stat .l { font-size: 12px; color: rgba(255,255,255,.85); }
.units { list-style: none; margin: 0; padding: 0; }
.units li { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.units li:last-child { border-bottom: 0; }
.units .u-dot { width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; font-size: 12px; font-weight: 800; border: 2px solid #c9d2ce; color: #fff; }
.units .done .u-dot { background: #12a150; border-color: #12a150; }
.units .started .u-dot { border-color: #2a78d6; background: #fff; color: #2a78d6; }
.units .overdue .u-dot { border-color: var(--danger); background: #fff; color: var(--danger); }
.units .u-name { flex: 1; min-width: 0; }
.units .u-when { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.dist { display: flex; gap: 2px; height: 22px; border-radius: 6px; overflow: hidden; margin: 6px 0; }
.dist span { display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: #fff; min-width: 0; }
.dist .g-A { background: #12a150; } .dist .g-B { background: #2a78d6; } .dist .g-C { background: #d48a00; } .dist .g-S { background: #e06b33; } .dist .g-F { background: var(--danger); }
.mini-form { display: inline-flex; gap: 6px; align-items: center; }
.mini-form select { width: auto; padding: 3px 8px; font-size: 14px; }
.marks-table input[type=number] { width: 96px; padding: 5px 8px; }
.marks-table td.abs label { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; cursor: pointer; }
.marks-table tr.is-abs td { background: #fff7f6; }
.unit-table td.u-actions { white-space: nowrap; text-align: right; }
.unit-table td.u-actions form { display: inline; }
.unit-table input[type=month] { width: 150px; font: inherit; font-size: 14px; padding: 4px 8px; border: 1px solid #c9d2ce; border-radius: 8px; }
tr.u-overdue td { background: #fff7f6; }
tr.u-done td { color: var(--ink-2); }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { display: inline-flex; gap: 5px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; cursor: pointer; font-weight: 600; font-size: 14px; }
.days label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.countdown { font-variant-numeric: tabular-nums; }
/* Student pages: top bar instead of the side menu */
.s-top { background: var(--side-bg); color: #fff; }
.s-top-in { max-width: 1100px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; }
.s-top .brand { padding: 0; }
.s-nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.s-nav a { color: var(--side-text); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 14.5px; }
.s-nav a.active, .s-nav a:hover { background: var(--side-hover); color: #fff; }
.s-who { font-size: 13px; color: var(--side-muted); display: flex; gap: 10px; align-items: center; }
.s-who button, .s-who a { color: var(--side-text); }
.s-main { max-width: 1100px; margin: 0 auto; padding: 24px 24px 48px; }
@media (max-width: 700px) {
  .s-top-in { padding: 10px 16px; }
  .s-main { padding: 16px 16px 40px; }
  .meters { grid-template-columns: 1fr; }
  .subj-grid { grid-template-columns: 1fr; }
  .hero { padding: 16px; }
}
.chart.narrow { display: none; }
@media (max-width: 600px) { .chart.wide { display: none; } .chart.narrow { display: block; } }
.two-col > * { min-width: 0; }
.next-pill { display: block; }
.units .u-name { overflow-wrap: anywhere; }
.units .u-when { white-space: normal; text-align: right; max-width: 40%; }
.stat .mini-form, .stat .mini-form select { max-width: 100%; }
.term-row { display: flex; gap: 8px 18px; flex-wrap: wrap; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.term-row:last-child { border-bottom: 0; }
.term-row .who { flex: 0 1 190px; min-width: 150px; }
.term-subjects { list-style: none; margin: 0; padding: 0; flex: 1 1 280px; display: grid; gap: 4px; font-size: 14px; }
.term-subjects li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.term-subjects .sub { min-width: 150px; color: var(--ink-2); }
.term-row .act { margin-left: auto; display: flex; gap: 8px; align-items: center; }
@media (max-width: 600px) { .term-row .act { margin-left: 0; } .term-subjects .sub { min-width: 120px; } }
.chart { max-width: 820px; }
.show-sm { display: none; }
@media (max-width: 600px) {
  .show-sm { display: block; }
  td.actions.stack-sm { white-space: normal; }
  td.actions.stack-sm .btn { margin: 2px 0; }
}
/* Outstanding by member */
.out-head { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.out-head > div:first-child { flex: 1 1 220px; }
.out-total { text-align: right; }
.out-total .n { font-size: 20px; font-weight: 700; }
.out-group tfoot td { background: #f7f9f8; border-top: 2px solid var(--line); }
.phone-form { display: inline-flex; gap: 6px; align-items: center; }
.phone-form input[type=text] { width: 190px; padding: 4px 8px; font-size: 14px; }
@media (max-width: 600px) { .phone-form input[type=text] { width: 150px; } }
/* Buttons keep readable text wherever they are placed */
a.btn, button.btn { color: var(--brand-ink); }
a.btn.ghost, button.btn.ghost { color: var(--brand); }
.year-pick { display: flex; gap: 10px; flex-wrap: wrap; }
.btn.danger { background: #fff; color: var(--danger); border-color: #f0c4bf; }
.btn.danger:hover { background: var(--danger-soft); filter: none; }
.danger-zone { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
/* Timetable */
.day-card { margin-bottom: 14px; }
.day-head { padding: 10px 20px; background: #f7f9f8; border-bottom: 1px solid var(--line); font-size: 15px; }
.sc-row { display: flex; gap: 10px 18px; padding: 12px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; align-items: flex-start; }
.sc-row:last-child { border-bottom: 0; }
.sc-row.is-off { background: #fafafa; color: var(--ink-2); }
.sc-time { flex: 0 0 90px; font-weight: 700; }
.sc-main { flex: 1 1 320px; min-width: 0; }
.sc-actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.sc-actions details > summary { list-style: none; }
.sc-actions details > summary::-webkit-details-marker { display: none; }
.lesson-form { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.lesson-form select { width: auto; max-width: 260px; padding: 4px 8px; font-size: 14px; }
.lesson-form input[type=text] { flex: 1 1 180px; width: auto; padding: 4px 8px; font-size: 14px; }
.move-form { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-top: 6px; min-width: 230px; }
.move-form label { display: grid; gap: 2px; font-size: 13px; font-weight: 600; }
.move-form input, .move-form select { padding: 4px 8px; font-size: 14px; }
details.slot { border-bottom: 1px solid var(--line); padding: 8px 0; }
details.slot summary { cursor: pointer; }
/* Notifications */
.bell { display: inline-flex; align-items: center; gap: 6px; }
.bell .tag-count { background: #e5484d; color: #fff; }
.push-row { display: flex; gap: 12px 20px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.push-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.note-row { display: flex; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; align-items: flex-start; }
.note-row:hover { background: #f7f9f8; }
.note-row .note-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex: 0 0 auto; background: transparent; }
.note-row.unread .note-dot { background: #2a78d6; }
.note-row.unread strong { color: var(--ink); }
.note-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.note-body { font-size: 14px; color: var(--ink-2); }
.note-when { white-space: nowrap; }
.install-step { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-top: 10px; }
.install-step summary { cursor: pointer; }
.install-step ol { margin: 8px 0 0 18px; padding: 0; font-size: 14.5px; }
.s-top .bell { color: #fff; text-decoration: none; padding: 6px 10px; border-radius: 8px; }
.s-top .bell:hover { background: var(--side-hover); }
.topbar .bell { color: #fff; text-decoration: none; margin-left: auto; font-size: 18px; }
@media (max-width: 600px) { .sc-time { flex-basis: 100%; } }
[hidden] { display: none !important; }
/* Timetable: repeat + per-day time */
.repeat-line { color: var(--brand); font-weight: 400; margin-top: 2px; }
.repeat-tick { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 4px 0 10px; }
.time-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.time-form input[type=time] { width: auto; padding: 4px 6px; font-size: 14px; }
.time-form select { width: auto; padding: 4px 6px; font-size: 13.5px; }
.sc-actions { max-width: 100%; }
.badge.you { background: var(--brand); color: #fff; }
.sc-row.week-row { padding-top: 8px; padding-bottom: 8px; }
.sc-row.mine { background: var(--brand-soft); }
.move-form select { max-width: 100%; }
/* Hide / show the left menu (computers) */
.side-hide, .side-show { display: none; }
@media (min-width: 901px) {
  .side-hide { display: grid; place-items: center; position: absolute; top: 20px; right: 10px; width: 30px; height: 30px; border-radius: 8px;
    border: 1px solid var(--side-line); background: var(--side-hover); color: var(--side-text); font-size: 18px; line-height: 1; cursor: pointer; z-index: 2; }
  .side-hide:hover { background: var(--side-line); }
  .side .brand { padding-right: 46px; }
  html.side-closed .side { display: none; }
  html.side-closed .shell { background: var(--bg); }
  html.side-closed .side-show { display: inline-flex; align-items: center; gap: 6px; position: fixed; top: 14px; left: 14px; z-index: 40;
    background: var(--side-bg); color: #fff; border: 0; border-radius: 9px; padding: 8px 12px; font-size: 15px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
  html.side-closed .side-show span { font-size: 13.5px; }
  html.side-closed .content { padding-top: 64px; max-width: 1400px; }
}
/* Cash book: the top stays in place, only the lines scroll (heading row and totals stay visible) */
.book thead th { position: sticky; top: 0; z-index: 2; background: var(--brand-faint); box-shadow: inset 0 -1px 0 var(--line); }
.book tfoot td { position: sticky; bottom: 0; z-index: 2; background: var(--brand-soft); box-shadow: inset 0 1px 0 var(--line); }
.book-card .table-wrap { max-height: 75vh; overflow: auto; }
@media (min-width: 901px) and (min-height: 560px) {
  .content.fill-page { height: 100vh; display: flex; flex-direction: column; padding-bottom: 16px; }
  .content.fill-page > * { flex: 0 0 auto; }
  .content.fill-page > .book-card { flex: 1 1 auto; min-height: 220px; display: flex; flex-direction: column; overflow: hidden; margin-bottom: 0; }
  .content.fill-page .book-card .table-wrap { flex: 1 1 auto; max-height: none; min-height: 0; }
}
/* Feedback */
.fb-item { padding: 14px 18px; }
.fb-item.fb-new { border-left: 4px solid #d69e2e; }
.fb-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fb-stars { color: #d69e2e; letter-spacing: 1px; }
.fb-stars .fb-off { color: #d9dedc; }
.fb-reply { margin-top: 10px; padding: 8px 12px; background: var(--brand-soft); border-radius: 8px; font-size: 14.5px; }
.rating-pick { display: flex; gap: 4px; flex-wrap: wrap; }
.rating-pick label { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 400; color: #d69e2e; margin: 0; }
.rating-pick input { margin: 0; }
/* Cash book: expenses by kind */
.exp-split { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin: -4px 0 14px; }
.exp-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); text-decoration: none; }
.exp-chip:hover { border-color: var(--brand); }
.exp-chip.on { background: var(--brand-soft); border-color: var(--brand); }

/* ---------- Colour themes: one per role (soft, easy on the eyes) ---------- */
:root {
  --side-bg: #10261f;
  --side-hover: #1b3a30;
  --side-line: #23423a;
  --side-text: #dbe7e2;
  --side-muted: #9fb7ae;
  --side-label: #7f9a90;
  --brand: #0f6b4f;
  --brand-2: #16815f;
  --brand-3: #1f9a72;
  --brand-soft: #e3f1ec;
  --brand-faint: #f3faf5;
  --brand-ring: #9fd3c0;
  --ok-line: #bfe0d4;
}
html[data-theme="teacher"] { /* Subject Teacher – green */
  --side-bg: #10261f;
  --side-hover: #1b3a30;
  --side-line: #23423a;
  --side-text: #dbe7e2;
  --side-muted: #9fb7ae;
  --side-label: #7f9a90;
  --brand: #0f6b4f;
  --brand-2: #16815f;
  --brand-3: #1f9a72;
  --brand-soft: #e3f1ec;
  --brand-faint: #f3faf5;
  --brand-ring: #9fd3c0;
}
html[data-theme="supervisor"] { /* Supervisor – royal blue */
  --side-bg: #131d2f;
  --side-hover: #1e2c48;
  --side-line: #2a3955;
  --side-text: #dadee7;
  --side-muted: #a0a9ba;
  --side-label: #818a9c;
  --brand: #203e79;
  --brand-2: #25488d;
  --brand-3: #32569f;
  --brand-soft: #e3eaf8;
  --brand-faint: #f4f6fb;
  --brand-ring: #90abdf;
  --bg: #f3f5f7;
  --line: #dbdfe6;
}
html[data-theme="admin"] { /* Admin – slate grey */
  --side-bg: #1b2027;
  --side-hover: #2a313c;
  --side-line: #373e49;
  --side-text: #dadfe7;
  --side-muted: #a0abba;
  --side-label: #818d9c;
  --brand: #3c4a5d;
  --brand-2: #46566d;
  --brand-3: #54657d;
  --brand-soft: #e9ecf1;
  --brand-faint: #f6f7f9;
  --brand-ring: #a8b5c7;
  --bg: #f4f5f6;
  --line: #dee0e3;
}
html[data-theme="principal"] { /* Principal – purple */
  --side-bg: #20172b;
  --side-hover: #322442;
  --side-line: #3f304f;
  --side-text: #e0dae7;
  --side-muted: #ada0ba;
  --side-label: #8e819c;
  --brand: #4b2f6a;
  --brand-2: #57377b;
  --brand-3: #66458c;
  --brand-soft: #ede6f4;
  --brand-faint: #f7f4fa;
  --brand-ring: #b69cd3;
  --bg: #f5f4f7;
  --line: #e0dce4;
}
html[data-theme="accountant"] { /* Accountant – amber brown */
  --side-bg: #2f2013;
  --side-hover: #48321e;
  --side-line: #553e2a;
  --side-text: #e7e0da;
  --side-muted: #baada0;
  --side-label: #9c8e81;
  --brand: #7c491d;
  --brand-2: #915622;
  --brand-3: #a3652e;
  --brand-soft: #f8ece2;
  --brand-faint: #fbf7f4;
  --brand-ring: #dfb590;
  --bg: #f7f5f3;
  --line: #e6e0db;
}
html[data-theme="treasurer"] { /* Donors Treasurer – rose */
  --side-bg: #2d161b;
  --side-hover: #45212a;
  --side-line: #522e37;
  --side-text: #e7dadd;
  --side-muted: #baa0a7;
  --side-label: #9c8188;
  --brand: #6f2a3b;
  --brand-2: #813145;
  --brand-3: #933e53;
  --brand-soft: #f5e5e9;
  --brand-faint: #fbf4f6;
  --brand-ring: #d897a8;
  --bg: #f7f4f4;
  --line: #e5dcde;
}
html[data-theme="secretary"] { /* Secretary – indigo */
  --side-bg: #18182a;
  --side-hover: #252541;
  --side-line: #31314e;
  --side-text: #dadae7;
  --side-muted: #a0a0ba;
  --side-label: #81819c;
  --brand: #2f2f6a;
  --brand-2: #37377b;
  --brand-3: #45458c;
  --brand-soft: #e6e6f4;
  --brand-faint: #f4f4fa;
  --brand-ring: #9c9cd3;
  --bg: #f4f4f7;
  --line: #dcdce4;
}
html[data-theme="president"] { /* President – gold */
  --side-bg: #2e2814;
  --side-hover: #473e1f;
  --side-line: #544b2b;
  --side-text: #e7e4da;
  --side-muted: #bab4a0;
  --side-label: #9c9681;
  --brand: #7c661d;
  --brand-2: #917722;
  --brand-3: #a3882e;
  --brand-soft: #f8f3e2;
  --brand-faint: #fbf9f4;
  --brand-ring: #dfcd90;
  --bg: #f7f6f3;
  --line: #e6e3db;
}
html[data-theme="donor"] { /* Donor – olive */
  --side-bg: #232c17;
  --side-hover: #364323;
  --side-line: #42502f;
  --side-text: #e2e7da;
  --side-muted: #b0baa0;
  --side-label: #919c81;
  --brand: #537128;
  --brand-2: #60842e;
  --brand-3: #70963b;
  --brand-soft: #eff6e5;
  --brand-faint: #f8fbf4;
  --brand-ring: #bdda95;
  --bg: #f6f7f4;
  --line: #e1e5dc;
}
html[data-theme="student"] { /* Student – ocean teal */
  --side-bg: #112b32;
  --side-hover: #19424d;
  --side-line: #264f59;
  --side-text: #dae4e7;
  --side-muted: #a0b5ba;
  --side-label: #81979c;
  --brand: #176d82;
  --brand-2: #1b7f98;
  --brand-3: #2790aa;
  --brand-soft: #e2f4f8;
  --brand-faint: #f4fafb;
  --brand-ring: #90cfdf;
  --bg: #f3f7f7;
  --line: #dbe4e6;
}
.theme-legend summary { cursor: pointer; }
.theme-swatches { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; }
.swatch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.swatch .sw { width: 34px; height: 18px; border-radius: 5px; display: inline-block; border: 1px solid var(--line); }

.tag-count.theme { background: var(--brand-ring); color: var(--side-bg); }
.tag-count.quiet { background: var(--side-line); color: var(--side-text); }
.day-head { background: var(--brand-faint); }
input[type=checkbox], input[type=radio], progress { accent-color: var(--brand); }
::selection { background: var(--brand-soft); }
