/* School attendance & admissions. Mobile first.
   Palette and type follow baobabwestcoast.com: warm neutrals, ink buttons, one accent. */

@font-face {
    font-family: "Inter";
    src: url("../fonts/inter-latin-wght.260c81a4759b.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --bg: #f6f3ee;
    --surface: #ffffff;
    --surface-2: #ece7df;
    --text: #161816;
    --muted: #5f625d;
    --border: #e0dbd3;
    --brand: #c4621d;      /* overridden per school */
    --brand-ink: #ffffff;
    --link: #a8521a;
    --focus: #2f7dd1;

    --p: #3f7a3a;  --p-bg: #e3eedf;
    --a: #c2352b;  --a-bg: #fbe1de;
    --l: #6b6e69;  --l-bg: #ece9e3;
    --m: #a15c00;  --m-bg: #fbe9cc;  /* village: came in the morning */
    --e: #3b56b8;  --e-bg: #e1e6f8;  /* village: came in the evening */
    --info-bg: #f3e6da;
    --warn-bg: #fdefd2;
    --holiday-bg: repeating-linear-gradient(135deg, #ece7df 0 6px, #f6f3ee 6px 12px);
    --boys: #2a78d6;  --girls: #eb6834;  /* chart series, validated for colour-blind separation */

    --radius: 14px;
    --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 2px 8px rgb(0 0 0 / .04);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1110;
        --surface: #1b1e1c;
        --surface-2: #232724;
        --text: #f1eee8;
        --muted: #a3a59f;
        --border: #2f332f;
        --brand: #e8843a;
        --brand-ink: #160c04;
        --link: #e8843a;
        --p: #6aa556;  --p-bg: #1d2e19;
        --a: #f07b71;  --a-bg: #45201d;
        --l: #a3a59f;  --l-bg: #2a2d2a;
        --m: #e8a64a;  --m-bg: #3b2a10;
        --e: #8ea4f0;  --e-bg: #1f2747;
        --info-bg: #2e2117;
        --warn-bg: #40300f;
        --holiday-bg: repeating-linear-gradient(135deg, #1b1e1c 0 6px, #232724 6px 12px);
        --boys: #3987e5;  --girls: #d95926;
        --shadow: none;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 16px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-feature-settings: "ss01", "cv11";
    -webkit-font-smoothing: antialiased;
}
a { color: var(--link); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem;
    min-height: 60px; padding: .55rem 16px;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--border); color: var(--text);
}
.brand { color: inherit; text-decoration: none; font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; margin-right: auto;
    display: inline-flex; align-items: center; gap: .55rem; min-width: 0; }
.brand::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); flex: none;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); }
.brand:has(.brand-logo)::before { display: none; }
.brand-logo { height: 34px; width: auto; max-width: 64px; object-fit: contain; border-radius: 8px; }
.brand-short { display: none; }
@media (max-width: 520px) { .brand-full { display: none; } .brand-short { display: inline; } }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem; }
.nav a, .nav .linklike {
    color: inherit; text-decoration: none; padding: .4rem .65rem; border-radius: 8px; font-size: .95rem;
    opacity: .9;
}
.nav a[aria-current="page"] { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--text); opacity: 1; font-weight: 600;
    box-shadow: inset 0 -2px 0 var(--brand); }
.nav a:hover, .nav .linklike:hover { background: color-mix(in srgb, var(--text) 6%, transparent); opacity: 1; }
.nav form { margin: 0; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; }
@media (max-width: 520px) {
    .nav { width: 100%; }
    .nav-secondary { margin-left: auto; }
    .nav-secondary + .nav-secondary { margin-left: 0; }
}

/* ---------- page ---------- */
.page { max-width: 1100px; margin: 0 auto; padding: 1rem 16px 6rem; }
.page-narrow { max-width: 720px; }
.page-wide { max-width: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.page-head .spacer { flex: 1; }

.messages { margin-bottom: 1rem; }
.msg { padding: .7rem 1rem; border-radius: var(--radius); background: var(--surface); border-left: 4px solid var(--p); box-shadow: var(--shadow); }
.msg-success { border-color: var(--p); }
.msg-error, .msg-warning { border-color: var(--a); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.banner { padding: .65rem .9rem; border-radius: var(--radius); margin-bottom: 1rem; background: var(--surface-2); }
.banner-warn { background: var(--warn-bg); }
.banner-info { background: var(--info-bg); }
.banner-ok { background: var(--p-bg); }

/* ---------- buttons & forms ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    min-height: 44px; padding: .5rem 1rem;
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface); color: var(--text);
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
    transition: background .2s, color .2s, border-color .2s, transform .25s cubic-bezier(.2, .7, .2, 1);
}
.btn:hover { border-color: var(--text); }
/* Ink pill that turns the school's colour on hover, as on baobabwestcoast.com. */
.btn-primary { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn-primary:hover { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-small { min-height: 34px; padding: .25rem .85rem; font-size: .9rem; }
.btn-icon { border-radius: 50%; }
.btn-icon { min-width: 44px; padding: .5rem; font-size: 1.2rem; line-height: 1; }

.form-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } .span-2 { grid-column: span 2; } }
.field label, .field legend { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .95rem; }
.field fieldset { border: 0; padding: 0; margin: 0; }
.field input[type=text], .field input[type=tel], .field input[type=date], .field input[type=search], .field input[type=number],
.field input[type=password], .field select, .field textarea, .input {
    width: 100%; min-height: 44px; padding: .55rem .7rem;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); color: var(--text); font: inherit;
}
.field textarea { min-height: 6rem; resize: vertical; }
.field .help { color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.field .errorlist { color: var(--a); margin: .25rem 0 0; padding: 0; list-style: none; font-size: .9rem; }
.field input[type=checkbox] { width: 1.2rem; height: 1.2rem; vertical-align: middle; }
.choices { display: flex; gap: .5rem; flex-wrap: wrap; }
.choices label { font-weight: 400; display: inline-flex; align-items: center; gap: .35rem; padding: .5rem .8rem;
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; margin: 0; }
.choices label:has(input:checked) { border-color: var(--brand); background: var(--surface-2); font-weight: 600; }
.form-section { margin: 1.5rem 0 .75rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.5rem; }

/* ---------- avatar ---------- */
.avatar {
    flex: none; width: 40px; height: 40px; border-radius: 50%;
    display: inline-grid; place-items: center; overflow: hidden;
    background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: .85rem;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 96px; height: 96px; font-size: 1.8rem; }

/* ---------- status colours ---------- */
.st-P { --c: var(--p); --cbg: var(--p-bg); }
.st-A { --c: var(--a); --cbg: var(--a-bg); }
.st-L { --c: var(--l); --cbg: var(--l-bg); }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border-radius: 99px;
    background: var(--cbg, var(--surface-2)); color: var(--c, var(--muted)); font-weight: 600; font-size: .85rem; white-space: nowrap; }

/* ---------- dashboard ---------- */
.datebar { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.datebar .date-label { font-weight: 700; font-size: 1.1rem; min-width: 9.5rem; text-align: center; }
.datebar input[type=date] { min-height: 44px; padding: .3rem .5rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.session { margin-bottom: 1.75rem; }
.session-head { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; margin-bottom: .6rem; }
.class-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.class-card { display: flex; flex-direction: column; gap: .6rem; }
.class-card .title { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.class-card .title a { font-weight: 700; font-size: 1.1rem; text-decoration: none; color: var(--text); }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; display: flex; }
.progress span { display: block; height: 100%; }
.progress .p { background: var(--p); } .progress .l { background: var(--l); }
.progress .a { background: var(--a); }
.class-card .links { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: auto; }
.class-card.todo { border-color: #d99a2b; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }

/* ---------- class tabs ---------- */
.class-head { margin-bottom: .75rem; }
.class-head .crumb { font-size: .9rem; color: var(--muted); }
.tabs { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.tabs a { padding: .4rem .9rem; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .95rem; }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- daily roster ---------- */
.tally { position: sticky; top: 0; z-index: 5; display: flex; gap: .4rem; flex-wrap: wrap; align-items: center;
    padding: .55rem 0; background: var(--bg); border-bottom: 1px solid var(--border); margin-bottom: .5rem; }
.tally .pill { font-size: .95rem; padding: .2rem .7rem; }
.tally .spacer { flex: 1; }
.roster { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.roster-row { background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--c, var(--border));
    border-radius: var(--radius); padding: .5rem .6rem; display: grid; gap: .5rem;
    grid-template-columns: auto 1fr; align-items: center; transition: background-color .15s; }
.roster-row.st-A { background: var(--a-bg); }
.roster-row.st-L { background: var(--l-bg); }
.roster-row .who { min-width: 0; }
.roster-row .who .name { font-weight: 600; overflow-wrap: anywhere; }
.roster-row .who .sub { font-size: .82rem; color: var(--muted); }
.roster-row .controls { grid-column: 1 / -1; display: flex; gap: .4rem; align-items: center; }
@media (min-width: 640px) {
    .roster-row { grid-template-columns: auto 1fr auto; }
    .roster-row .controls { grid-column: auto; }
}
.seg { display: inline-flex; flex: 1; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { flex: 1; min-width: 48px; min-height: 44px; display: grid; place-items: center; cursor: pointer; font-weight: 700;
    color: var(--muted); border-left: 1px solid var(--border); user-select: none; -webkit-tap-highlight-color: transparent; }
.seg label:first-of-type { border-left: 0; }
.seg label .sym { font-size: 1.35rem; line-height: 1; }
.seg label.st-L .sym { font-size: 2rem; line-height: .6; }
.seg label .full { font-weight: 600; font-size: .9rem; margin-left: .35rem; }
.seg label { display: flex; align-items: center; justify-content: center; }
@media (max-width: 420px) { .seg label .full { display: none; } }
.seg input:checked + label { background: var(--c); color: #fff; }
.seg input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: -3px; }
.note-toggle { min-height: 44px; min-width: 44px; }
.note-toggle.has-note { color: var(--link); border-color: var(--link); }
.note { grid-column: 1 / -1; }
.note[hidden] { display: none; }
.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: .6rem 16px calc(.6rem + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -2px 12px rgb(0 0 0 / .08); }
.savebar .inner { max-width: 1100px; margin: 0 auto; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.savebar .state { flex: 1; min-width: 8rem; font-size: .9rem; color: var(--muted); }
.savebar .state.dirty { color: #b26b00; font-weight: 600; }

/* ---------- week / month grid ---------- */
.legend { display: flex; flex-wrap: wrap; gap: .35rem .8rem; align-items: center; font-size: .875rem; color: var(--muted); margin-bottom: .6rem; }
.grid-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
.grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .9rem; }
.grid th, .grid td { padding: 0; border-bottom: 1px solid var(--border); text-align: center; }
.grid thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; font-weight: 600; padding: .4rem .2rem; font-size: .8rem; color: var(--muted); }
.grid thead th a { color: inherit; text-decoration: none; display: block; }
.grid thead th .dnum { display: block; font-size: 1rem; color: var(--text); }
.grid th.is-today .dnum { color: var(--link); }
.grid th.is-today { box-shadow: inset 0 -3px 0 var(--brand); }
.grid .name-col { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; padding: .35rem .6rem; min-width: 9rem; max-width: 14rem; border-right: 1px solid var(--border); }
.grid thead .name-col { z-index: 3; }
.grid .name-col a { color: var(--text); text-decoration: none; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid .name-col .sub { font-size: .75rem; color: var(--muted); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid td.cell { min-width: 2.4rem; }
@media (max-width: 520px) { .grid .name-col { min-width: 7rem; max-width: 9rem; } }
.grid .holiday { background: var(--holiday-bg); }
.grid .sum { padding: .3rem .4rem; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.grid .sum.rate { font-weight: 700; color: var(--text); }
.grid .sum-first { border-left: 1px solid var(--border); }
.grid tfoot td, .grid tfoot th { background: var(--surface-2); font-size: .8rem; color: var(--muted); padding: .35rem .2rem; border-bottom: 0; }
.mark-btn { width: 100%; min-height: 40px; border: 0; background: transparent; cursor: pointer; font: inherit; font-weight: 700;
    color: var(--c, var(--border)); -webkit-tap-highlight-color: transparent; }
.mark-btn:not([data-status=""]) { background: var(--cbg); }
.mark-btn:hover { box-shadow: inset 0 0 0 2px var(--border); }
.mark-btn.saving { opacity: .5; }
.mark-btn.error { box-shadow: inset 0 0 0 2px var(--a); }
.mark-btn { font-size: 1.05rem; }
.mark-btn.st-L { font-size: 1.6rem; line-height: 1; }
.grid-month .mark-btn { min-height: 34px; font-size: .95rem; }
.grid-month .mark-btn.st-L { font-size: 1.5rem; }
.grid-month td.cell { min-width: 1.9rem; }
.grid-week td.cell { min-width: 3.2rem; }
.rate-low { color: var(--a) !important; }

/* ---------- students ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filters .input { flex: 1 1 12rem; width: auto; }
.filters select.input { flex: 0 1 14rem; }
.student-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.student-item a { display: flex; gap: .75rem; align-items: center; padding: .6rem .75rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.student-item a:hover { border-color: var(--brand); }
.student-item .who { flex: 1; min-width: 0; }
.student-item .name { font-weight: 600; }
.student-item .sub { font-size: .85rem; color: var(--muted); }
.student-item .tags { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.tag { font-size: .78rem; padding: .1rem .5rem; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.profile { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.profile .who { flex: 1; min-width: 12rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin: 1rem 0; }
.big-rate { font-size: 2rem; font-weight: 800; line-height: 1; }
.history { list-style: none; padding: 0; margin: 0; }
.history li { display: flex; gap: .6rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.notes-text { white-space: pre-wrap; }

/* ---------- login ---------- */
.login { max-width: 380px; margin: 3rem auto; }
.login-school { text-align: center; margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.login-logo { max-height: 96px; max-width: 160px; object-fit: contain; margin-bottom: .5rem; }
.login h2 { font-size: 1rem; color: var(--muted); }
.print-header { display: none; }

/* ---------- print ---------- */
@media print {
    .topbar, .savebar, .no-print, .tabs, .messages { display: none !important; }
    .print-header { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; font-size: 10pt; }
    .print-header img { max-height: 48px; }
    .page { padding: 0; max-width: none; }
    .grid-wrap { overflow: visible; border: 0; }
    .grid { font-size: 8pt; }
    .grid thead th, .grid .name-col { position: static; }
    .mark-btn { min-height: 0; padding: 2px 0; }
    body { background: #fff; }
}

/* ---------- saving loader ---------- */
form.is-saving .roster, form.is-saving .bulk-card { opacity: .55; pointer-events: none; }
form.is-saving button { pointer-events: none; opacity: .6; }
form.is-saving button.is-loading { opacity: 1; }
.btn.is-loading::before { content: ""; width: 1em; height: 1em; border: 2px solid currentColor;
    border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.is-loading::before { animation-duration: 2s; } }

/* ---------- admin dashboard ---------- */
.week-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; margin-bottom: 1rem; }
.week-head .datebar { flex-wrap: nowrap; min-width: 0; }
.week-head .date-label { min-width: 0; }
.week-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1rem; }
.week-total strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.week-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin-bottom: 1rem; }
.day-card { min-width: 0; }
.day-name { font-size: 1.05rem; margin: 0 0 .6rem; display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap; }
.day-today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.day-off { background: var(--holiday-bg); }
.day-off-label { margin: 0; color: var(--muted); font-weight: 600; }
.day-donuts { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .3rem; vertical-align: baseline; }
.dot.donut-boys { background: var(--boys); }
.dot.donut-girls { background: var(--girls); }
.dot.donut-unset { background: var(--l); }

/* donut: a 100-unit ring; segments are stroke dashes with a 2px surface gap */
.donut { margin: 0; display: flex; flex-direction: column; align-items: center; gap: .3rem; min-width: 0; }
.donut-label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.donut-ring { position: relative; width: 100%; max-width: 104px; aspect-ratio: 1; }
.donut-ring svg { display: block; width: 100%; height: 100%; }
.donut-track, .donut-seg { fill: none; stroke-width: 5.5; }
.donut-track { stroke: var(--surface-2); }
.donut-seg { stroke-linecap: butt; }
.donut-seg.donut-boys { stroke: var(--boys); }
.donut-seg.donut-girls { stroke: var(--girls); }
.donut-seg.donut-unset { stroke: var(--l); }
.donut-seg:hover { stroke-width: 7; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; text-align: center; }
.donut-total { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.donut-word { font-size: .75rem; color: var(--muted); }
.donut-untaken .donut-word { color: #b26b00; font-weight: 600; }
.donut-off .donut-track { stroke-dasharray: 2 2; }
.donut-legend { display: flex; flex-direction: column; align-items: flex-start; font-size: .8rem; font-variant-numeric: tabular-nums; }
.donut-link { text-decoration: none; color: inherit; border-radius: var(--radius); }
.donut-link:hover .donut-track { stroke: var(--border); }
@media (prefers-color-scheme: dark) { .donut-untaken .donut-word { color: #f0b453; } }
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; padding: .4rem .5rem; border-bottom: 1px solid var(--border); }
.data-table td { padding: .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }

/* ---------- bulk add / edit students ---------- */
.bulk-form { padding-bottom: 5rem; }
.bulk-date { max-width: 16rem; margin-bottom: 1rem; }
.bulk-card { padding: 0; }
.bulk-table td { padding: .3rem; vertical-align: middle; }
.bulk-table td.center { text-align: center; }
.bulk-table input[type=text], .bulk-table input[type=tel], .bulk-table input[type=date], .bulk-table select {
    width: 100%; min-width: 8rem; min-height: 40px; padding: .35rem .5rem; font: inherit;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.bulk-table td:nth-child(2) input { min-width: 12rem; }
.bulk-table input[type=checkbox] { width: 1.3rem; height: 1.3rem; }
.bulk-table .errorlist { color: var(--a); margin: .2rem 0 0; padding: 0; list-style: none; font-size: .8rem; }
.bulk-table .row-error td { background: color-mix(in srgb, var(--a) 8%, transparent); }

/* ---------- school page editor ---------- */
.editor-section { margin-bottom: 1rem; }
.editor-section h2 { margin-bottom: .75rem; }
.map-tools { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .75rem 0; }
.gallery-admin { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.gallery-admin li { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.gallery-admin img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.gallery-admin .meta { padding: .4rem .5rem; display: flex; justify-content: space-between; gap: .4rem; align-items: center; font-size: .85rem; }
.current-image { display: flex; gap: .75rem; align-items: center; margin-bottom: .4rem; }
.current-image img { max-height: 64px; max-width: 120px; border-radius: 6px; border: 1px solid var(--border); object-fit: cover; }
.tally-mini { display: inline-flex; gap: .9rem; font-variant-numeric: tabular-nums; }
.field input[type=color] { width: 64px; height: 44px; padding: 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; }
.mark-btn.locked { cursor: not-allowed; opacity: .55; }
.mark-btn.locked:hover { box-shadow: none; }
#roster-form.is-locked .seg label { cursor: default; }
#roster-form.is-locked .seg input:not(:checked) + label { opacity: .5; }

/* ---------- village: family compounds; / morning, \ evening, ✗ both ---------- */
.came-M { --c: var(--m); --cbg: var(--m-bg); }
.came-E { --c: var(--e); --cbg: var(--e-bg); }
.came-B { --c: var(--p); --cbg: var(--p-bg); }
.came-none { --c: var(--l); --cbg: var(--surface); }
.came-sym { font-weight: 800; font-size: 1.25rem; line-height: 1; }
.pill.came-M, .pill.came-E, .pill.came-B { background: var(--cbg); color: var(--c); }
.compound-pick select.input { min-height: 44px; }
.compound-head { font-size: 1.05rem; margin: 1.1rem 0 .45rem; display: flex; gap: .5rem; align-items: baseline; }
.village-row.came-none { border-left-color: var(--border); }
.village-row.came-M, .village-row.came-E, .village-row.came-B { background: var(--cbg); }
.village-row .who .name a { color: inherit; text-decoration: none; }
.village-row.saving { opacity: .7; }
.village-row.error { box-shadow: 0 0 0 2px var(--a); }
.came-seg label { min-width: 52px; }
.came-seg label.came-none .came-sym { color: var(--muted); font-weight: 400; }
.came-seg input:checked + label.came-none { background: var(--surface-2); color: var(--text); }
.mark-btn.came-btn { font-size: 1.3rem; font-weight: 800; color: var(--c, var(--text)); }
.mark-btn.came-M, .mark-btn.came-E, .mark-btn.came-B { background: var(--cbg); }
.village-grid .group-row th, .village-grid .group-row td { background: var(--surface-2); font-weight: 700; padding: .4rem .6rem; text-align: left; }
.village-grid .group-row .muted { font-weight: 400; }
.compound-table td.num, .compound-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
