/* Classfolio · attendance & admissions demo. Design tokens first, then shell, components, pages. */

/* ---------- tokens ---------- */
:root {
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-school: Georgia, "Times New Roman", serif;
  --bg: #f5f4f9; --surface: #ffffff; --surface-2: #faf9fd; --surface-3: #f1eff7;
  --border: #e4e1ec; --border-strong: #cfcadb;
  --text: #1c1930; --text-2: #48445c; --muted: #69657d;
  --accent: #6a3fc9; --accent-hover: #5a33b0; --accent-soft: #efe9fb; --accent-soft-2: #e0d5f7; --accent-text: #5b34b5; --on-accent: #ffffff; --ring: #7c4ddb;
  --good: #0ca30c; --good-text: #006300; --good-soft: #e5f4e5;
  --warn: #fab219; --warn-text: #7a5200; --warn-soft: #fff3d6;
  --serious: #ec835a; --serious-text: #a3401a; --serious-soft: #fdece4;
  --crit: #d03b3b; --crit-text: #b42828; --crit-soft: #fbe9e9;
  --info-text: #1f5fae; --info-soft: #e6f0fc;
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100; --c5: #e87ba4; --c6: #008300; --c7: #6250d6; --c8: #e34948;
  --ord-1: #9ec5f4; --ord-2: #6da7ec; --ord-3: #3987e5; --ord-4: #256abf; --ord-5: #184f95;
  --seg-a: #256abf; --seg-b: #9ec5f4; --track: #ebe9f1;
  --grid: #ebe9f1; --axis: #cfcadb; --ref: #6f6a86;
  --nodata: #e8e6ee; --off: #f0eef5; --off-stripe: #e1dee9;
  --code-P: #0ca30c; --code-A: #d03b3b; --code-L: #fab219; --code-E: #8a93a8;
  --code-P-bg: #e3f3e3; --code-P-fg: #006300; --code-P-solid: #12801f;
  --code-A-bg: #d03b3b; --code-A-fg: #ffffff;
  --code-L-bg: #fab219; --code-L-fg: #3a2a00;
  --code-E-bg: #dde2ec; --code-E-fg: #3a4357; --code-E-solid: #5b6475;
  --school: #1d6b45; --school-hover: #175838; --on-school: #ffffff; --school-ring: #0f4a2e; --school-soft: #e6f2ec; --school-text: #17603d; --hero-bg: #1d6b45; --hero-fg: #ffffff;
  --toast-bg: #1c1930; --toast-fg: #f4f2fa; --toast-good: #6fd86f; --toast-info: #b7a1f6; --toast-warn: #f5c04a; --toast-err: #ff9a9a;
  --shadow-sm: 0 1px 2px rgba(28, 25, 48, .05);
  --shadow-md: 0 6px 20px rgba(28, 25, 48, .08);
  --shadow-lg: 0 18px 48px rgba(28, 25, 48, .2);
  --scrim: rgba(18, 14, 30, .5);
  --radius: 14px;
  --sb-w: 248px; --rail-w: 72px; --top-h: 60px; --tab-h: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0d16; --surface: #181522; --surface-2: #1d1a28; --surface-3: #25212f;
    --border: #2d2939; --border-strong: #3f3951;
    --text: #eeebf6; --text-2: #c3bdd6; --muted: #9e98b3;
    --accent: #a48af2; --accent-hover: #b7a1f6; --accent-soft: #2a2343; --accent-soft-2: #3a2f5e; --accent-text: #bba7f7; --on-accent: #160f2b; --ring: #b7a1f6;
    --good: #2fbf2f; --good-text: #6fd86f; --good-soft: #15291a;
    --warn: #e5a50f; --warn-text: #f5c04a; --warn-soft: #2d2512;
    --serious: #d95926; --serious-text: #f29c78; --serious-soft: #2e1d17;
    --crit: #c93a3a; --crit-text: #ff8f8f; --crit-soft: #33191b;
    --info-text: #8ab8f2; --info-soft: #17243a;
    --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #008300; --c7: #9085e9; --c8: #e66767;
    --ord-1: #184f95; --ord-2: #256abf; --ord-3: #3987e5; --ord-4: #6da7ec; --ord-5: #9ec5f4;
    --seg-a: #6da7ec; --seg-b: #256abf; --track: #2a2638;
    --grid: #2a2637; --axis: #3f3951; --ref: #9a94b0;
    --nodata: #2a2637; --off: #201d2a; --off-stripe: #2c2838;
    --code-P: #2fbf2f; --code-A: #c93a3a; --code-L: #e5a50f; --code-E: #69738c;
    --code-P-bg: #173a1c; --code-P-fg: #7fe07f; --code-P-solid: #12801f;
    --code-A-bg: #c93a3a; --code-A-fg: #ffffff;
    --code-L-bg: #e5a50f; --code-L-fg: #2a1e00;
    --code-E-bg: #343b4e; --code-E-fg: #d3d9e6; --code-E-solid: #5b6475;
    --school: #4fb282; --school-hover: #62c293; --on-school: #0b2417; --school-ring: #2f8a5c; --school-soft: #1a2e24; --school-text: #8fdcb3; --hero-bg: #173d2b; --hero-fg: #eeebf6;
    --toast-bg: #eeebf6; --toast-fg: #181522; --toast-good: #006300; --toast-info: #5b34b5; --toast-warn: #7a5200; --toast-err: #b42828;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, .35);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, .55);
    --scrim: rgba(4, 3, 8, .62);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0d16; --surface: #181522; --surface-2: #1d1a28; --surface-3: #25212f;
  --border: #2d2939; --border-strong: #3f3951;
  --text: #eeebf6; --text-2: #c3bdd6; --muted: #9e98b3;
  --accent: #a48af2; --accent-hover: #b7a1f6; --accent-soft: #2a2343; --accent-soft-2: #3a2f5e; --accent-text: #bba7f7; --on-accent: #160f2b; --ring: #b7a1f6;
  --good: #2fbf2f; --good-text: #6fd86f; --good-soft: #15291a;
  --warn: #e5a50f; --warn-text: #f5c04a; --warn-soft: #2d2512;
  --serious: #d95926; --serious-text: #f29c78; --serious-soft: #2e1d17;
  --crit: #c93a3a; --crit-text: #ff8f8f; --crit-soft: #33191b;
  --info-text: #8ab8f2; --info-soft: #17243a;
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #008300; --c7: #9085e9; --c8: #e66767;
  --ord-1: #184f95; --ord-2: #256abf; --ord-3: #3987e5; --ord-4: #6da7ec; --ord-5: #9ec5f4;
  --seg-a: #6da7ec; --seg-b: #256abf; --track: #2a2638;
  --grid: #2a2637; --axis: #3f3951; --ref: #9a94b0;
  --nodata: #2a2637; --off: #201d2a; --off-stripe: #2c2838;
  --code-P: #2fbf2f; --code-A: #c93a3a; --code-L: #e5a50f; --code-E: #69738c;
  --code-P-bg: #173a1c; --code-P-fg: #7fe07f; --code-P-solid: #12801f;
  --code-A-bg: #c93a3a; --code-A-fg: #ffffff;
  --code-L-bg: #e5a50f; --code-L-fg: #2a1e00;
  --code-E-bg: #343b4e; --code-E-fg: #d3d9e6; --code-E-solid: #5b6475;
  --school: #4fb282; --school-hover: #62c293; --on-school: #0b2417; --school-ring: #2f8a5c; --school-soft: #1a2e24; --school-text: #8fdcb3; --hero-bg: #173d2b; --hero-fg: #eeebf6;
  --toast-bg: #eeebf6; --toast-fg: #181522; --toast-good: #006300; --toast-info: #5b34b5; --toast-warn: #7a5200; --toast-err: #b42828;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, .55);
  --scrim: rgba(4, 3, 8, .62);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
html.is-locked, html.is-locked body { overflow: hidden; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img, svg, video { max-width: 100%; }
h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
a { color: var(--accent-text); }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 500; background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-md); font-weight: 600; }
.skip-link:focus { top: 8px; }
.num { font-variant-numeric: tabular-nums; }
.i { flex: none; display: inline-block; vertical-align: middle; }
.flip { transform: rotate(180deg); }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .muted-p { color: var(--text-2); }
.strong { font-weight: 600; } .small { font-size: 12.5px; } .nowrap { white-space: nowrap; } .break { overflow-wrap: anywhere; }
.show-phone, .show-narrow { display: none; }

/* ---------- app shell ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sb-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 40; overflow-y: auto; overscroll-behavior: contain; }
.sb-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 18px 16px 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); border-radius: 10px; }
.brand-word { font-weight: 700; font-size: 19px; letter-spacing: -.015em; }
.logo-mark { flex: none; display: block; }
.pill-demo { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); white-space: nowrap; border: 1px solid var(--accent-soft-2); line-height: 1.6; }
.sb-pill { margin-left: 42px; }
.sb-close { margin-left: auto; display: none !important; }
.sb-tenant { margin: 6px 12px 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-3); display: flex; gap: 10px; align-items: center; }
.tenant-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--school); color: var(--on-school); font-size: 11px; font-weight: 700; display: grid; place-items: center; flex: none; letter-spacing: .03em; }
.tenant-text { min-width: 0; line-height: 1.25; }
.tenant-text strong { display: block; font-size: 13px; }
.tenant-text small { color: var(--muted); font-size: 12px; }
.sb-nav { padding: 6px 10px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; padding: 16px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--text-2); text-decoration: none; font-weight: 500; position: relative; min-height: 42px; }
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-link[aria-current="page"]::before { content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-ext { color: var(--muted); }
.nav-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; line-height: 1; }
.nav-badge-warn { background: var(--warn); color: #3a2a00; }
.sb-foot { padding: 14px 18px 18px; border-top: 1px solid var(--border); display: grid; gap: 4px; }
.sb-back { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; text-decoration: none; color: var(--accent-text); font-size: 14px; min-height: 32px; }
.sb-back:hover { text-decoration: underline; }
.sb-credit { font-size: 12px; color: var(--muted); }
.nav-scrim { display: none; }

.main-col { margin-left: var(--sb-w); min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 24px 0 32px; background: color-mix(in srgb, var(--surface) 90%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.menu-btn, .tb-brand, .tb-pill { display: none !important; }
.tb-context { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.tb-school { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-date { font-size: 12.5px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.tb-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; flex: none; padding: 0; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; min-height: 44px; color: var(--text-2); }
.user-btn:hover { border-color: var(--border-strong); }
.user-meta { display: flex; flex-direction: column; text-align: left; line-height: 1.25; }
.user-meta strong { font-size: 13.5px; color: var(--text); }
.user-meta small { font-size: 11.5px; color: var(--muted); }
.main { padding: 28px 32px 56px; max-width: 1400px; outline: none; }
.tabbar { display: none; }

/* ---------- buttons, links, pills ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: 14.5px; line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-soft { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-soft-2); }
.btn-soft:hover { background: var(--accent-soft-2); }
.btn-danger { background: var(--crit); color: #fff; }
.btn-danger:hover { filter: brightness(.94); }
.btn-danger-ghost { background: transparent; color: var(--crit-text); border-color: color-mix(in srgb, var(--crit) 45%, transparent); }
.btn-danger-ghost:hover { background: var(--crit-soft); }
.btn-school { background: var(--school); color: var(--on-school); }
.btn-school:hover { background: var(--school-hover); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; gap: 6px; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 16px; border-radius: 12px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 4px 2px; color: var(--accent-text); font-weight: 600; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; min-height: 32px; font-size: 14px; }
.link-btn:hover { text-decoration: underline; }
.txt-link { color: var(--accent-text); font-weight: 600; text-decoration: none; display: inline-flex; gap: 4px; align-items: center; }
.txt-link:hover { text-decoration: underline; }
.warn-link { color: var(--warn-text); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; border: 1px solid transparent; }
.badge-info { background: var(--info-soft); color: var(--info-text); }
.badge-neutral { background: var(--surface-3); color: var(--text-2); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-good { background: var(--good-soft); color: var(--good-text); }
.badge-warn { background: var(--warn-soft); color: var(--warn-text); }
.badge-muted { background: transparent; color: var(--muted); border-color: var(--border-strong); }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; padding: 1px 9px 1px 6px; border-radius: 999px; white-space: nowrap; line-height: 1.7; }
.status-good { color: var(--good-text); background: var(--good-soft); }
.status-watch { color: var(--warn-text); background: var(--warn-soft); }
.status-risk { color: var(--crit-text); background: var(--crit-soft); }
.status-none { color: var(--muted); background: var(--surface-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent-text); }
.chip.is-current { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* ---------- layout primitives ---------- */
.page { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.page-titles { min-width: 0; max-width: 780px; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--accent-text); margin-bottom: 4px; }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.02em; font-weight: 700; }
.lede { color: var(--text-2); margin-top: 6px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; min-width: 0; box-shadow: var(--shadow-sm); }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-titles { min-width: 0; }
.card-title { font-size: 16px; font-weight: 700; letter-spacing: -.005em; }
.card-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card-tools { flex: none; }
.card-foot { margin-top: 10px; display: flex; justify-content: center; }
.select-sm { min-height: 36px !important; font-size: 13.5px !important; padding-top: 6px !important; padding-bottom: 6px !important; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; min-width: 0; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow-sm); }
.kpi-label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.kpi-num { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-top: 2px; }
.kpi-note { font-size: 13px; color: var(--muted); display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.kpi-hero { grid-column: span 2; background: linear-gradient(135deg, var(--accent-soft), var(--surface) 72%); border-color: var(--accent-soft-2); }
.hero-num { font-size: 54px; font-weight: 700; letter-spacing: -.035em; line-height: 1.04; margin: 6px 0 4px; }
.kpi-foot { margin-top: 8px; }
.kpi-alert { border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); background: linear-gradient(180deg, var(--warn-soft), var(--surface) 75%); }
@media (min-width: 1200px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* lists & feed */
.list { list-style: none; margin: 0 -8px; padding: 0; display: flex; flex-direction: column; }
.list > li + li { border-top: 1px solid var(--border); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 10px; text-decoration: none; color: inherit; min-width: 0; }
.list-row:hover { background: var(--surface-2); }
.lr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lr-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-end { display: flex; align-items: center; gap: 10px; flex: none; }
.lr-num { font-weight: 700; font-variant-numeric: tabular-nums; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
.feed-item { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); min-width: 0; }
.feed-ic { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-3); color: var(--text-2); display: grid; place-items: center; flex: none; }
.feed-main { min-width: 0; display: flex; flex-direction: column; }
.feed-text { color: var(--text); text-decoration: none; font-weight: 500; font-size: 14px; }
a.feed-text:hover { color: var(--accent-text); text-decoration: underline; }
.feed-when { font-size: 12.5px; color: var(--muted); }

/* avatars */
.av { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; letter-spacing: .02em; }
.av-sm { width: 30px; height: 30px; font-size: 11.5px; }
.av-xs { width: 24px; height: 24px; font-size: 10px; }
.av-lg { width: 48px; height: 48px; font-size: 16px; }
.av-0 { background: #ece5fb; color: #4d2ea0; } .av-1 { background: #e1edfb; color: #1d5296; } .av-2 { background: #dcf2ea; color: #0f5c45; } .av-3 { background: #fcefd2; color: #6e4a00; }
.av-4 { background: #fbe3ed; color: #922654; } .av-5 { background: #e3f0dd; color: #2a5f15; } .av-6 { background: #fde7dd; color: #8f3d19; } .av-7 { background: #e6e8ee; color: #394155; }
:root[data-theme="dark"] .av-0 { background: #30285a; color: #d3c6fb; } :root[data-theme="dark"] .av-1 { background: #1d3150; color: #b7d4f8; } :root[data-theme="dark"] .av-2 { background: #173a30; color: #a6e3cd; } :root[data-theme="dark"] .av-3 { background: #3a2e12; color: #f4d48a; }
:root[data-theme="dark"] .av-4 { background: #43202f; color: #f6bdd3; } :root[data-theme="dark"] .av-5 { background: #213a1a; color: #bfe4ae; } :root[data-theme="dark"] .av-6 { background: #43261a; color: #f8c5ad; } :root[data-theme="dark"] .av-7 { background: #2e3240; color: #cdd2de; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .av-0 { background: #30285a; color: #d3c6fb; } :root:not([data-theme="light"]) .av-1 { background: #1d3150; color: #b7d4f8; } :root:not([data-theme="light"]) .av-2 { background: #173a30; color: #a6e3cd; } :root:not([data-theme="light"]) .av-3 { background: #3a2e12; color: #f4d48a; }
  :root:not([data-theme="light"]) .av-4 { background: #43202f; color: #f6bdd3; } :root:not([data-theme="light"]) .av-5 { background: #213a1a; color: #bfe4ae; } :root:not([data-theme="light"]) .av-6 { background: #43261a; color: #f8c5ad; } :root:not([data-theme="light"]) .av-7 { background: #2e3240; color: #cdd2de; }
}

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; background: var(--surface-2); white-space: nowrap; }
.tbl .r { text-align: right; }
.tbl tbody tr:last-child td, .tbl tbody tr:last-child th { border-bottom: 0; }
.tbl-hover tbody tr.row-click { cursor: pointer; }
.tbl-hover tbody tr.row-click:hover td, .tbl tbody tr.row-click:hover td { background: var(--surface-2); }
.tbl-compact th, .tbl-compact td { padding: 7px 10px; font-size: 13px; }
.tbl-compact tbody th { font-weight: 600; }
.tbl tr.row-click { cursor: pointer; }
.tbl tr.is-overdue td:first-child { box-shadow: inset 3px 0 0 var(--crit); }
.tbl tr.is-fresh td { background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface)); }
.tbl-note { font-size: 12.5px; color: var(--muted); padding: 10px 14px; border-top: 1px solid var(--border); }
.cell-btn { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: inherit; min-height: 36px; font-weight: 500; }
.cell-btn:hover .strong, .cell-btn:hover > span:last-child { color: var(--accent-text); text-decoration: underline; }
.cell-two { display: flex; flex-direction: column; line-height: 1.3; }
.owner-n { margin-left: 8px; font-size: 13.5px; }

/* phone cards for list-like tables */
.m-cards { list-style: none; margin: 0; padding: 0; flex-direction: column; }
.m-card { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: none; border: 0; border-bottom: 1px solid var(--border); text-align: left; cursor: pointer; color: inherit; min-height: 60px; }
.m-cards > li:last-child > .m-card { border-bottom: 0; }
.m-card:active { background: var(--surface-2); }
.card:not(.card-flush) .m-card { padding-left: 0; padding-right: 0; }
.m-card-col { flex-direction: column; align-items: stretch; gap: 8px; }
.mc-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mc-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-meta { flex-wrap: wrap; gap: 6px 10px; padding-left: 46px; }
.mc-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.mc-owner { font-size: 12.5px; color: var(--muted); margin-left: auto; }
.m-card.is-overdue { box-shadow: inset 3px 0 0 var(--crit); }
.m-card-wrap { position: relative; border-bottom: 1px solid var(--border); }
.m-card-wrap .m-card { border-bottom: 0; padding-right: 120px; }
.m-card-wrap .mc-move { position: absolute; right: 12px; top: 12px; }
.m-cards > li.m-card-wrap:last-child { border-bottom: 0; }

/* forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.one { grid-template-columns: minmax(0, 1fr); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-grid .full, .field.full { grid-column: 1 / -1; }
.field > label, .lbl, .fieldset > legend { font-size: 13.5px; font-weight: 600; color: var(--text); }
.req { color: var(--crit-text); }
.opt { font-weight: 400; color: var(--muted); font-size: 12.5px; }
input[type="text"], input:not([type]), input[type="tel"], input[type="email"], input[type="date"], input[type="search"], input[type="number"], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 15px; line-height: 1.3;
}
select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a86a0' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent); }
input[disabled], select[disabled], textarea[disabled] { opacity: .55; cursor: not-allowed; }
[aria-invalid="true"] { border-color: var(--crit) !important; }
fieldset[aria-invalid="true"] .radio-card span { border-color: var(--crit); }
.field-err { font-size: 13px; color: var(--crit-text); font-weight: 500; }
.help { font-size: 12.5px; color: var(--muted); }
.hint { font-size: 13px; color: var(--text-2); display: flex; gap: 6px; align-items: flex-start; }
.hint .i { margin-top: 2px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; min-height: 40px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: 0; cursor: pointer; }
.check-lg { min-height: 44px; }
.fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.fieldset > legend { padding: 0; margin-bottom: 6px; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-card { position: relative; display: inline-flex; }
.radio-card input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.radio-card span { display: inline-flex; align-items: center; min-height: 42px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); font-weight: 500; }
.radio-card input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--accent); }
.radio-card input:focus-visible + span { outline: 2px solid var(--ring); outline-offset: 2px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }

.seg { display: inline-flex; background: var(--surface-3); border-radius: 11px; padding: 3px; gap: 3px; border: 1px solid var(--border); }
.seg-opt { position: relative; display: inline-flex; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.seg-opt span { display: grid; place-items: center; min-width: 44px; min-height: 34px; padding: 0 12px; border-radius: 8px; font-weight: 600; color: var(--text-2); }
.seg-opt input:checked + span { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--accent-soft-2); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--ring); }
.seg-view button { display: inline-flex; gap: 6px; align-items: center; min-height: 34px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; font-weight: 600; color: var(--text-2); cursor: pointer; font-size: 14px; }
.seg-view button[aria-pressed="true"] { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--accent-soft-2); }

/* banners, empty states, summary strips */
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; font-size: 14px; border: 1px solid transparent; flex-wrap: wrap; }
.banner > span { flex: 1; min-width: 180px; }
.banner-ok { background: var(--good-soft); color: var(--good-text); border-color: color-mix(in srgb, var(--good) 28%, transparent); }
.banner-warn { background: var(--warn-soft); color: var(--warn-text); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.banner-info { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-soft-2); }
.banner-muted { background: var(--surface-3); color: var(--text-2); border-color: var(--border); }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 36px 16px; }
.empty-ic { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; margin-bottom: 4px; }
.empty h3 { font-size: 17px; }
.empty p { color: var(--text-2); max-width: 440px; }
.empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.empty > .btn { margin-top: 8px; }
.summary-strip { display: flex; flex-wrap: wrap; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.ss { flex: 1 1 150px; background: var(--surface); padding: 12px 16px; display: flex; flex-direction: column; min-width: 0; }
.ss-l { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-v { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.ss-v small { font-size: 13px; color: var(--muted); font-weight: 500; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 20px; top: calc(var(--top-h) + 12px); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; max-width: min(440px, calc(100vw - 32px)); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: var(--toast-bg); color: var(--toast-fg); padding: 8px 6px 8px 14px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; animation: toast-in .2s ease; transition: opacity .2s, transform .2s; }
.toast.out { opacity: 0; transform: translateY(-6px); }
.toast-ic { display: grid; place-items: center; flex: none; }
.toast-good .toast-ic { color: var(--toast-good); } .toast-info .toast-ic { color: var(--toast-info); } .toast-warn .toast-ic { color: var(--toast-warn); } .toast-error .toast-ic { color: var(--toast-err); }
.toast-msg { flex: 1; min-width: 0; }
.toast-act { background: transparent; border: 1px solid color-mix(in srgb, var(--toast-fg) 35%, transparent); color: inherit; border-radius: 8px; padding: 0 10px; font-weight: 600; cursor: pointer; min-height: 32px; white-space: nowrap; font-size: 13.5px; }
.toast-act:hover { background: color-mix(in srgb, var(--toast-fg) 12%, transparent); }
.toast-x { background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; flex: none; }
.toast-x:hover { opacity: 1; }
body.is-public .toasts { top: 16px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- dialogs & drawers ---------- */
.dlg-layer { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.dlg-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity .2s; }
.dlg-layer.open .dlg-scrim { opacity: 1; }
.dlg { position: relative; background: var(--surface); color: var(--text); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); display: flex; flex-direction: column; outline: none; opacity: 0; transform: translateY(12px) scale(.985); transition: opacity .2s, transform .2s; border: 1px solid var(--border); }
.dlg-layer.open .dlg { opacity: 1; transform: none; }
.dlg-sm { max-width: 460px; } .dlg-md { max-width: 640px; } .dlg-lg { max-width: 900px; }
.dlg-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); flex: none; }
.dlg-head-main { flex: 1; min-width: 0; }
.dlg-title { font-size: 18px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.dlg-sub { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.dlg-x { margin: -6px -8px 0 0; }
.dlg-body { padding: 18px 20px 22px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 16px; overscroll-behavior: contain; min-height: 0; }
.dlg-body > * { flex-shrink: 0; }
.dlg-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 16px 16px; flex: none; }
.dlg-foot:empty { display: none; }
.dlg-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dlg-person > div { min-width: 0; }
.foot-gap { flex: 1; }
.dlg-drawer { justify-content: flex-end; padding: 0; }
.dlg-drawer .dlg { max-width: 580px; height: 100%; max-height: none; border-radius: 0; border-width: 0 0 0 1px; transform: translateX(28px); }
.dlg-drawer.open .dlg { transform: none; }
.dlg-drawer .dlg-foot { border-radius: 0; }
.dlg .card { box-shadow: none; }
.dlg-student .card { padding: 16px; }

.mini-stats { display: flex; flex-wrap: wrap; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.ms { flex: 1 1 120px; background: var(--surface); padding: 10px 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.ms-l { font-size: 12px; color: var(--muted); font-weight: 600; }
.ms-v { font-size: 22px; font-weight: 700; }
.ms-s { font-size: 12px; color: var(--muted); }
.contact-line { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--text-2); margin-top: 6px; overflow-wrap: anywhere; }
.sub-h { font-size: 14px; font-weight: 700; margin: 14px 0 6px; }
.abs-list { font-size: 13px; color: var(--text-2); line-height: 1.7; }

/* popover menu */
.menu-pop { position: fixed; z-index: 150; min-width: 230px; max-width: 320px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px; border: 0; background: none; border-radius: 8px; text-align: left; cursor: pointer; color: var(--text); text-decoration: none; font-size: 14px; font-weight: 500; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); outline: none; }
.menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--ring); }
.menu-item > span { flex: 1; }
.menu-item small { color: var(--muted); }
.menu-item[aria-disabled="true"] { color: var(--muted); cursor: default; }
.menu-item[aria-disabled="true"]:hover { background: none; }
.menu-check { color: var(--accent-text); }
.menu-item.danger { color: var(--crit-text); }
.menu-heading { padding: 8px 10px 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 2px; }
.menu-gap { width: 18px; flex: none; }
.menu-pop.is-sheet { left: 0; right: 0; bottom: 0; top: auto; max-width: none; border-radius: 18px 18px 0 0; padding: 10px 10px calc(14px + env(safe-area-inset-bottom)); max-height: 82vh; overflow-y: auto; animation: sheet-in .2s ease; }
.menu-pop.is-sheet .menu-item { min-height: 50px; font-size: 15.5px; }
.menu-scrim { position: fixed; inset: 0; z-index: 149; background: var(--scrim); }
@keyframes sheet-in { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

/* ---------- charts ---------- */
.chart-host { position: relative; width: 100%; min-height: 40px; }
.chart-svg { display: block; overflow: visible; }
.ax-grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.ax-base { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.ax-ref { stroke: var(--ref); stroke-width: 1; shape-rendering: crispEdges; }
.ax-t { fill: var(--muted); font-size: 11.5px; font-family: var(--font); }
.ax-t.num { font-variant-numeric: tabular-nums; }
.ax-ref-t { fill: var(--text-2); font-weight: 600; }
.val-t { fill: var(--text); font-size: 12px; font-weight: 700; font-family: var(--font); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.bar { fill: var(--c1); transition: opacity .15s, transform .15s; transform-box: fill-box; }
.mark { outline: none; }
.hit { fill: transparent; }
.mark.is-hot .bar { filter: brightness(1.12) saturate(1.1); }
.chart-svg:hover .mark:not(.is-hot) .bar { opacity: .6; }
.mark:focus-visible .hit, .chart-svg .hit:focus-visible { stroke: var(--ring); stroke-width: 2; }
.chart-svg .hit:focus { outline: none; }
.series-line { fill: none; stroke: var(--c1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.series-dot { fill: var(--c1); stroke: var(--surface); stroke-width: 2; }
.cross-line { stroke: var(--axis); stroke-width: 1; }
.chart-tip { position: fixed; z-index: 400; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow-md); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; min-width: 150px; max-width: 260px; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; top: 0; left: 0; }
.chart-tip.show { opacity: 1; transform: none; }
.tip-title { font-weight: 700; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.tip-sw.is-line { height: 3px; width: 12px; border-radius: 2px; }
.tip-l { color: var(--text-2); flex: 1; }
.tip-v { font-weight: 700; font-variant-numeric: tabular-nums; }
.funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.fn-row { outline: none; border-radius: 8px; }
.fn-row:focus-visible { outline: 2px solid var(--ring); outline-offset: 4px; }
.fn-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; margin-bottom: 4px; }
.fn-label { font-weight: 600; }
.fn-val { font-weight: 700; }
.fn-track { height: 20px; }
.fn-bar { display: block; height: 20px; border-radius: 0 4px 4px 0; transition: filter .15s; }
.fn-bar.is-hot { filter: brightness(1.1) saturate(1.1); }
.fn-conv { font-size: 12px; color: var(--muted); margin-top: 3px; }
.meters { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mt-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) 62px; align-items: center; gap: 12px; outline: none; border-radius: 6px; }
.mt-row:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }
.mt-label { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.mt-track { display: flex; height: 16px; background: var(--track); border-radius: 0 4px 4px 0; overflow: hidden; }
.mt-track.is-hot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--axis); }
.mt-seg { height: 100%; flex: none; }
.seg-a { background: var(--seg-a); } .seg-b { background: var(--seg-b); }
.mt-seg + .mt-seg { border-left: 2px solid var(--surface); }
.mt-val { font-size: 13px; text-align: right; color: var(--text-2); }
.legend, .code-legend { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-2); }
.legend li, .code-legend li { display: inline-flex; align-items: center; gap: 6px; }
.lg-sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.lg-line { width: 18px; height: 0; border-top: 2px solid var(--ref); display: inline-block; }
.lg-track { background: var(--track); box-shadow: inset 0 0 0 1px var(--border-strong); }
.chart-table .table-wrap { border: 1px solid var(--border); border-radius: 10px; }

/* status codes P / A / L / E */
.code-chip { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; font-size: 12px; font-weight: 700; flex: none; }
.code-chip.code-P { background: var(--code-P-bg); color: var(--code-P-fg); }
.code-chip.code-A { background: var(--code-A-bg); color: var(--code-A-fg); }
.code-chip.code-L { background: var(--code-L-bg); color: var(--code-L-fg); }
.code-chip.code-E { background: var(--code-E-bg); color: var(--code-E-fg); }
.code-chip.is-off { background: repeating-linear-gradient(135deg, var(--off-stripe) 0 3px, var(--off) 3px 6px); box-shadow: inset 0 0 0 1px var(--border); }

/* calendar heatmap */
.cal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 18px 16px; }
.cal-mtitle { font-weight: 700; font-size: 13.5px; margin-bottom: 6px; }
.cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-dow { font-size: 10.5px; color: var(--muted); text-align: center; font-weight: 600; }
.cal-cell { aspect-ratio: 1; border-radius: 5px; display: grid; place-items: center; font-size: 11px; min-width: 0; outline: none; }
.cal-cell b { font-weight: 700; }
.cal-cell i { font-style: normal; color: var(--muted); font-size: 10px; }
.cal-cell.code-P { background: var(--code-P-bg); color: var(--code-P-fg); }
.cal-cell.code-A { background: var(--code-A-bg); color: var(--code-A-fg); }
.cal-cell.code-L { background: var(--code-L-bg); color: var(--code-L-fg); }
.cal-cell.code-E { background: var(--code-E-bg); color: var(--code-E-fg); }
.cal-cell.is-off, .cal-cell.is-hol { background: repeating-linear-gradient(135deg, var(--off-stripe) 0 3px, var(--off) 3px 6px); }
.cal-cell.is-none { background: var(--nodata); }
.cal-cell.is-pad { visibility: hidden; }
.cal-cell:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.cal-cell.is-hot { box-shadow: 0 0 0 2px var(--text); }

/* ---------- attendance ---------- */
.pickers { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: flex-end; padding: 16px 20px; }
.pk { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pk > label, .pk-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.date-step { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.date-step input { width: auto; min-width: 156px; }
.pk-grade select { min-width: 150px; }
.pickers-3 .pk { flex: 1 1 170px; }
.todo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.todo-l { display: inline-flex; gap: 6px; align-items: center; color: var(--warn-text); font-weight: 600; }
.todo-done { color: var(--good-text); display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.page-att { max-width: 940px; }
#att-body { display: flex; flex-direction: column; gap: 12px; }
.class-line { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.class-title { font-size: 20px; font-weight: 700; }
.class-date { color: var(--muted); font-weight: 500; font-size: 16px; }
.class-meta { color: var(--text-2); font-size: 14px; }
.roster-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.roster { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.r-row { display: grid; grid-template-columns: 24px auto minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 8px 14px; border-top: 1px solid var(--border); min-height: 62px; transition: background .2s; }
.r-row:first-child { border-top: 0; }
.r-roll { color: var(--muted); font-size: 13px; font-weight: 600; text-align: right; }
.r-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.r-first { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-last { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg-att { display: flex; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.att-opt { position: relative; display: inline-flex; }
.att-opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.att-opt span[aria-hidden] { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; border: 1.5px solid var(--border-strong); background: var(--surface); font-weight: 700; font-size: 15px; color: var(--text-2); transition: background .12s, color .12s, border-color .12s; }
.att-opt:hover span[aria-hidden] { border-color: var(--muted); }
.att-opt input:focus-visible + span { outline: 2px solid var(--ring); outline-offset: 2px; }
.opt-P input:checked + span { background: var(--code-P-solid); border-color: var(--code-P-solid); color: #fff; }
.opt-A input:checked + span { background: var(--code-A-bg); border-color: var(--code-A-bg); color: var(--code-A-fg); }
.opt-L input:checked + span { background: var(--code-L-bg); border-color: var(--code-L-bg); color: var(--code-L-fg); }
.opt-E input:checked + span { background: var(--code-E-solid); border-color: var(--code-E-solid); color: #fff; }
.r-reason { grid-column: 3 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 2px 0 6px; }
.r-reason-l { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.r-reason-l small { font-weight: 400; color: var(--muted); }
.why { display: flex; flex-wrap: wrap; gap: 6px; }
.why-opt { position: relative; display: inline-flex; }
.why-opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.why-opt span { display: inline-flex; align-items: center; min-height: 32px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--border-strong); font-size: 13px; background: var(--surface); }
.why-opt input:checked + span { background: var(--text); color: var(--surface); border-color: var(--text); }
.why-opt input:focus-visible + span { outline: 2px solid var(--ring); outline-offset: 2px; }
.r-row.code-row-A { background: color-mix(in srgb, var(--crit) 6%, var(--surface)); }
.r-row.code-row-E { background: color-mix(in srgb, var(--code-E-solid) 7%, var(--surface)); }
.r-row.code-row-L { background: color-mix(in srgb, var(--warn) 8%, var(--surface)); }
.r-row.flash { animation: flash 1.3s ease; }
.r-result { display: flex; align-items: center; gap: 10px; }
.r-res-t { display: flex; flex-direction: column; font-size: 14px; font-weight: 600; line-height: 1.2; min-width: 84px; }
.r-res-t small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.att-bar { position: sticky; bottom: 12px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding: 10px 12px 10px 16px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg); }
.att-counts { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13.5px; color: var(--text-2); }
.cnt { white-space: nowrap; display: inline-flex; align-items: center; }
.cnt b { font-size: 16px; color: var(--text); margin-right: 4px; font-variant-numeric: tabular-nums; }
.cnt::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }
.cnt-P::before { background: var(--code-P-solid); } .cnt-A::before { background: var(--code-A-bg); } .cnt-L::before { background: var(--code-L-bg); } .cnt-E::before { background: var(--code-E-solid); } .cnt-U::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.cnt-U.has b { color: var(--warn-text); }
.att-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.show-phone-i { display: none; }
.saved-note { display: inline-flex; gap: 6px; align-items: center; color: var(--good-text); font-weight: 600; font-size: 14px; }
.no-school .empty-ic { background: var(--warn-soft); color: var(--warn-text); }
@keyframes flash { 0% { box-shadow: inset 0 0 0 2px var(--accent); } 70% { box-shadow: inset 0 0 0 2px var(--accent); } 100% { box-shadow: inset 0 0 0 2px transparent; } }

/* ---------- reports: monthly register ---------- */
.register-wrap { overflow: auto; max-height: min(68vh, 680px); border: 1px solid var(--border); border-radius: 12px; position: relative; overscroll-behavior: contain; outline: none; }
.register-wrap:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.register { border-collapse: separate; border-spacing: 0; font-size: 12.5px; min-width: 100%; }
.register th, .register td { border-bottom: 1px solid var(--border); padding: 0; text-align: center; background: var(--surface); }
.register thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); font-weight: 600; color: var(--text-2); padding: 6px 0; border-bottom: 1px solid var(--border-strong); }
.register .rg-stu { position: sticky; left: 0; z-index: 1; text-align: left; min-width: 196px; max-width: 196px; width: 196px; border-right: 1px solid var(--border-strong); padding: 0; }
.register thead .rg-stu { z-index: 4; padding: 8px 12px; background: var(--surface-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.rg-name { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 0 12px; background: none; border: 0; text-align: left; cursor: pointer; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.rg-name .num { color: var(--muted); font-size: 11.5px; width: 18px; flex: none; }
.rg-name:hover { color: var(--accent-text); text-decoration: underline; }
.rg-day { min-width: 30px; width: 30px; }
.rg-d { display: block; font-size: 12px; color: var(--text); line-height: 1.2; }
.rg-w { display: block; font-size: 10px; color: var(--muted); font-weight: 500; }
.register thead .rg-day.is-today { box-shadow: inset 0 -3px 0 var(--accent); }
.register .rg-c { height: 36px; min-width: 30px; }
.register .is-off { background-color: var(--off); background-image: repeating-linear-gradient(135deg, var(--off-stripe) 0 2px, transparent 2px 6px); }
.register thead .is-off .rg-d { color: var(--muted); }
.register .rg-c.is-future { background: var(--surface-2); }
.rc { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; font-weight: 700; font-size: 11.5px; }
.rc-P { color: var(--code-P-fg); }
.rc-A { background: var(--code-A-bg); color: var(--code-A-fg); }
.rc-L { background: var(--code-L-bg); color: var(--code-L-fg); }
.rc-E { background: var(--code-E-bg); color: var(--code-E-fg); }
.rc-none { color: var(--muted); }
.register .rg-tot { min-width: 60px; padding: 0 8px; font-weight: 600; color: var(--text); background: var(--surface-2); }
.register thead .rg-tot { font-size: 11.5px; color: var(--text-2); }
.register thead .rg-tot:first-of-type { border-left: 1px solid var(--border-strong); }
.register td.rg-tot:nth-last-child(4) { border-left: 1px solid var(--border-strong); }
.rg-pct { font-weight: 700; }
.register tfoot th, .register tfoot td { background: var(--surface-2); border-bottom: 0; border-top: 1px solid var(--border-strong); position: sticky; bottom: 0; z-index: 1; height: 34px; }
.register tfoot .rg-stu { z-index: 3; }
.rg-foot-l { padding: 0 12px !important; font-size: 12px; font-weight: 600; color: var(--text-2); }
.rg-daypct { font-size: 11px; color: var(--text-2); }

/* ---------- enquiries ---------- */
.quick { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; margin: -2px; }
.quick::-webkit-scrollbar { display: none; }
.qf { display: flex; flex-direction: column; align-items: flex-start; min-width: 118px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-align: left; color: var(--text); flex: none; box-shadow: var(--shadow-sm); }
.qf:hover { border-color: var(--border-strong); }
.qf-n { font-size: 20px; font-weight: 700; line-height: 1.2; }
.qf-l { font-size: 12.5px; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.qf.is-on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.qf-warn .qf-n { color: var(--warn-text); }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 14px 16px; }
.search { position: relative; flex: 1 1 240px; min-width: 0; }
.search > .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 38px; }
.flt { display: flex; flex-direction: column; gap: 4px; flex: 0 1 170px; min-width: 130px; }
.flt > label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.flt-check { flex: none; }
.flt-more { display: contents; }
.show-phone-f { display: none; }
.ft-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11.5px; display: inline-grid; place-items: center; }
.touch-hint { display: none; }
@media (hover: none), (pointer: coarse) { .drag-hint { display: none; } .touch-hint { display: inline; } }
.results-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13.5px; color: var(--text-2); min-height: 34px; margin: -6px 0; }
.due { display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; white-space: nowrap; }
.due-over { color: var(--crit-text); font-weight: 600; }
.due-today { color: var(--warn-text); font-weight: 600; }

/* drawer content */
.dr-status { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.dr-sec { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border); }
.dr-h { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.dr-h label { font: inherit; }
.dr-h .count { font-weight: 600; color: var(--text-2); font-size: 12px; background: var(--surface-3); border-radius: 999px; padding: 1px 8px; }
.dr-h-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.dl-grid > div { min-width: 0; }
.dl-grid .full { grid-column: 1 / -1; }
.dl-grid dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.dl-grid dd { margin: 2px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { display: flex; gap: 12px; padding-bottom: 14px; position: relative; }
.tl-item::before { content: ""; position: absolute; left: 5px; top: 16px; bottom: -2px; width: 2px; background: var(--border); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent); background: var(--surface); margin-top: 5px; flex: none; position: relative; z-index: 1; }
.tl-main { min-width: 0; }
.tl-text { font-size: 14px; }
.tl-meta { font-size: 12.5px; color: var(--muted); }
.stepper-mini { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; }
.sm-step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; position: relative; min-width: 0; }
.sm-step::before { content: ""; position: absolute; top: 10px; right: 50%; width: 100%; height: 2px; background: var(--border-strong); }
.sm-step:first-child::before { display: none; }
.sm-step.done::before, .sm-step.current::before { background: var(--accent); }
.sm-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); display: grid; place-items: center; position: relative; z-index: 1; color: var(--on-accent); }
.sm-step.done .sm-dot { background: var(--accent); border-color: var(--accent); }
.sm-step.current .sm-dot { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.sm-l { font-size: 11.5px; color: var(--muted); font-weight: 600; line-height: 1.2; }
.sm-step.current .sm-l { color: var(--accent-text); }
.pcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.drawer-app .pcards { grid-template-columns: minmax(0, 1fr); }
.pcard { border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pc-name { display: flex; gap: 10px; align-items: center; min-width: 0; }
.pc-name > span:last-child { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.pc-name small { color: var(--muted); font-size: 12.5px; }
.pc-line { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--text-2); min-width: 0; }
.docs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.doc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.docs > li + li { border-top: 1px solid var(--border); }
.doc-l { display: flex; align-items: center; gap: 10px; font-size: 14px; min-width: 0; }
.doc-l small { display: block; color: var(--muted); font-size: 12px; }
.ic-good { color: var(--good); }
.ic-muted { color: var(--border-strong); }
.switch { width: 44px; height: 26px; border-radius: 999px; background: var(--border-strong); border: 0; position: relative; cursor: pointer; flex: none; padding: 0; transition: background .15s; }
.switch::after { content: ""; position: absolute; inset: -9px -4px; }
.sw-knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] .sw-knob { transform: translateX(18px); }
.as-line { display: flex; gap: 8px; align-items: center; font-size: 14px; flex-wrap: wrap; }
.age { display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; font-weight: 600; }
.age-ok { color: var(--good-text); }
.age-bad { color: var(--warn-text); }
.slot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.slot { position: relative; display: flex; }
.slot input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.slot span { flex: 1; display: grid; place-items: center; min-height: 42px; border: 1px solid var(--border-strong); border-radius: 10px; font-weight: 600; font-size: 14px; }
.slot input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent); }
.slot input:focus-visible + span { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---------- admissions board ---------- */
.ad-tools .seg-view { flex: none; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(216px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; align-items: start; overscroll-behavior-x: contain; }
.col { background: var(--surface-3); border: 1px solid var(--border); border-radius: 14px; display: flex; flex-direction: column; min-width: 0; transition: background .15s, border-color .15s; }
.col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 10px; }
.col-title { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.col-count { font-size: 12px; font-weight: 700; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; min-width: 26px; text-align: center; flex: none; }
.col-body { display: flex; flex-direction: column; gap: 8px; padding: 0 8px 10px; min-height: 90px; }
.col.is-over { background: var(--accent-soft); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.col-empty { font-size: 13px; color: var(--muted); text-align: center; padding: 18px 8px; border: 1px dashed var(--border-strong); border-radius: 10px; }
.col-withdrawn .col-title, .col-notadmitted .col-title { color: var(--text-2); }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; min-width: 0; transition: opacity .15s, box-shadow .15s, border-color .15s; }
.kcard:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.kcard[draggable="true"] { cursor: grab; }
.kcard[draggable="true"]:active { cursor: grabbing; }
.kcard.is-dragging { opacity: .4; }
.kcard.is-flash { animation: flash 2s ease; border-color: var(--accent); }
.kc-open { display: flex; flex-direction: column; gap: 1px; text-align: left; background: none; border: 0; padding: 10px 12px 8px; cursor: pointer; color: inherit; border-radius: 12px 12px 0 0; min-width: 0; width: 100%; }
.kc-top { display: flex; align-items: center; gap: 8px; min-width: 0; margin-bottom: 4px; }
.kc-name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.kc-open:hover .kc-name { color: var(--accent-text); }
.kc-meta { font-size: 13px; color: var(--text-2); }
.kc-date { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kc-badges { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 12px 10px; }
.kc-badges .badge { font-size: 11.5px; padding: 0 7px; }
.kc-foot { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 6px 6px 8px 10px; border-top: 1px solid var(--border); min-width: 0; }
.kc-id { font-size: 11px; color: var(--muted); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.kcard .kc-move { padding: 0 8px; gap: 4px; }
.kc-move { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; flex: none; }
.kc-move:hover, .kc-move[aria-expanded="true"] { border-color: var(--accent); color: var(--accent-text); }
.stage-tabs { display: none; }

/* ---------- public application page ---------- */
body.is-public { background: var(--bg); }
.public { min-height: 100vh; }
.pub { min-height: 100vh; display: flex; flex-direction: column; }
.pub-in { max-width: 900px; margin: 0 auto; padding: 0 24px; width: 100%; }
.pub-strip { background: var(--surface-3); border-bottom: 1px solid var(--border); font-size: 13px; }
.pub-strip .pub-in { display: flex; align-items: center; gap: 12px; min-height: 42px; }
.pub-strip-t { color: var(--text-2); }
.pub-back { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--accent-text); text-decoration: none; min-height: 36px; white-space: nowrap; }
.pub-back:hover { text-decoration: underline; }
.pub-head { background: var(--surface); border-bottom: 1px solid var(--border); }
.pub-head .pub-in { display: flex; align-items: center; gap: 14px; min-height: 78px; }
.crest { flex: none; display: block; }
.pub-id { min-width: 0; }
.pub-name { font-family: var(--font-school); font-weight: 700; font-size: 19px; letter-spacing: -.005em; line-height: 1.25; }
.pub-tag { font-size: 13px; color: var(--muted); }
.pub-contact { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; color: var(--text-2); white-space: nowrap; }
.pub-hero { background: var(--hero-bg); color: var(--hero-fg); }
.pub-hero .pub-in { padding-top: 30px; padding-bottom: 70px; }
.pub-hero .eyebrow { color: var(--hero-fg); opacity: .85; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; }
.pub-hero h1 { font-family: var(--font-school); font-size: 36px; font-weight: 700; letter-spacing: -.01em; }
.pub-hero p { max-width: 640px; margin-top: 8px; opacity: .92; }
.pub-main { flex: 1; margin-top: -46px; padding-bottom: 44px; }
.stepper { background: var(--surface); border: 1px solid var(--border); border-bottom: 0; border-radius: 16px 16px 0 0; padding: 14px 16px; }
.stepper ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.st { flex: 1; min-width: 0; }
.st-btn { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; padding: 6px; border-radius: 10px; text-align: left; color: var(--muted); font-weight: 600; font-size: 13.5px; min-height: 40px; }
button.st-btn { cursor: pointer; color: var(--text-2); }
button.st-btn:hover { background: var(--surface-3); }
.st-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); font-size: 12.5px; flex: none; background: var(--surface); }
.st.done .st-num { background: var(--school); border-color: var(--school); color: var(--on-school); }
.st.current .st-num { border-color: var(--school); color: var(--school-text); box-shadow: 0 0 0 4px var(--school-soft); }
.st.current .st-btn { color: var(--text); }
.st-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-short, .st-phone, .st-bar { display: none; }
.pub-card { background: var(--surface); border: 1px solid var(--border); border-radius: 0 0 16px 16px; padding: 26px 28px; box-shadow: var(--shadow-md); }
.step-title { font-size: 21px; font-weight: 700; outline: none; letter-spacing: -.01em; }
.step-lede { color: var(--text-2); margin: 4px 0 20px; }
.pub .sub-h { font-size: 15px; margin: 22px 0 10px; }
.sub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.pub-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); }
.form-alert { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--crit-soft); color: var(--crit-text); font-weight: 600; margin-bottom: 16px; }
.age-live { min-height: 22px; }
.uploads { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.upload { border: 1px dashed var(--border-strong); border-radius: 12px; padding: 12px 14px; }
.upload.has-file { border-style: solid; border-color: color-mix(in srgb, var(--good) 45%, var(--border)); background: color-mix(in srgb, var(--good) 5%, var(--surface)); }
.up-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.up-ic { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-2); flex: none; }
.upload.has-file .up-ic { background: var(--good-soft); color: var(--good-text); }
.up-text { flex: 1; min-width: 150px; }
.up-label { font-weight: 600; }
.up-btn { cursor: pointer; }
.up-main:has(.file-in:focus-visible) .up-btn { outline: 2px solid var(--ring); outline-offset: 2px; }
.up-files { list-style: none; margin: 10px 0 0; padding: 0; }
.up-files li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.up-name { font-weight: 600; min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-files .link-btn { margin-left: auto; }
.up-size { flex: none; }
.up-size { color: var(--muted); }
.upload .field-err { margin-top: 6px; }
.rv-sec { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.rv-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
.rv-head h3 { font-size: 15px; }
.declare { align-items: flex-start; margin-top: 8px; font-size: 14px; line-height: 1.45; }
.declare input { margin-top: 2px; }
.done-card { border-radius: 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 24px; }
.done-card h2 { font-size: 24px; outline: none; }
.done-lede { color: var(--text-2); max-width: 520px; }
.done-ic { width: 68px; height: 68px; border-radius: 50%; background: var(--good-soft); color: var(--good-text); display: grid; place-items: center; }
.app-no { display: flex; flex-direction: column; align-items: center; padding: 12px 28px; border-radius: 12px; background: var(--school-soft); margin: 6px 0; }
.app-no span { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.app-no b { font-size: 26px; letter-spacing: .02em; color: var(--school-text); }
.next-steps { list-style: none; margin: 10px 0; padding: 0; text-align: left; display: grid; gap: 12px; max-width: 520px; counter-reset: ns; }
.next-steps li { display: grid; grid-template-columns: 28px 1fr; column-gap: 12px; counter-increment: ns; }
.next-steps li::before { content: counter(ns); grid-row: span 2; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.next-steps span { color: var(--text-2); font-size: 14px; }
.done-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.pub-foot { border-top: 1px solid var(--border); background: var(--surface); font-size: 13px; color: var(--muted); }
.pub-foot .pub-in { padding-top: 16px; padding-bottom: 18px; display: grid; gap: 4px; }
.pub-foot a { color: var(--school-text); }
.pub input:focus, .pub select:focus, .pub textarea:focus { border-color: var(--school); box-shadow: 0 0 0 3px color-mix(in srgb, var(--school) 24%, transparent); }
.pub .radio-card input:checked + span { border-color: var(--school); background: var(--school-soft); color: var(--school-text); box-shadow: inset 0 0 0 1px var(--school); }
.pub .check input { accent-color: var(--school); }
.pub .btn-soft { background: var(--school-soft); color: var(--school-text); border-color: color-mix(in srgb, var(--school) 30%, transparent); }
.pub .link-btn { color: var(--school-text); }
.pub .pill-demo { flex: none; }

/* ---------- responsive: desktop-only extras ---------- */
@media (max-width: 1199px) {
  .feed { grid-template-columns: minmax(0, 1fr); }
  .tbl-enq .c-src, .tbl-enq .owner-n { display: none; }
  .tbl-enq th, .tbl-enq td { padding-left: 10px; padding-right: 10px; }
}
@media (max-width: 1023px) { .hide-narrow { display: none !important; } .m-cards.show-narrow { display: flex; } }
@media (max-width: 1023px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- tablet: icon rail ---------- */
@media (min-width: 640px) and (max-width: 1023px) {
  :root { --sb-w: var(--rail-w); }
  .sidebar { width: var(--rail-w); overflow: visible; }
  .sb-top { justify-content: center; padding: 14px 0 6px; }
  .brand-word, .sb-pill, .sb-tenant, .sb-foot, .nav-label, .nav-ext { display: none; }
  .nav-group { height: 1px; padding: 0; margin: 10px 14px; background: var(--border); font-size: 0; }
  .sb-nav { align-items: center; padding: 6px 8px; }
  .nav-link { width: 48px; height: 48px; min-height: 48px; justify-content: center; padding: 0; }
  .nav-link .nav-badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; font-size: 10.5px; padding: 0 5px; }
  .nav-link::after { content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%); background: var(--text); color: var(--surface); font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 8px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 60; box-shadow: var(--shadow-md); }
  .nav-link:hover::after, .nav-link:focus-visible::after { opacity: 1; }
  .nav-link[aria-current="page"]::before { left: -8px; }
  .tb-pill { display: inline-block !important; }
  .topbar { padding: 0 16px 0 24px; }
  .main { padding: 24px 24px 48px; }
  .user-meta small { display: none; }
  .board { grid-auto-columns: 272px; scroll-snap-type: x mandatory; scroll-padding-left: 0; }
  .col { scroll-snap-align: start; }
}

/* ---------- phone ---------- */
@media (max-width: 639px) {
  body { font-size: 15px; }
  .sidebar { width: min(308px, 86vw); transform: translateX(-104%); transition: transform .24s ease, visibility .24s; box-shadow: var(--shadow-lg); z-index: 70; visibility: hidden; }
  .shell.nav-open .sidebar { transform: none; visibility: visible; }
  .sb-top { padding: 12px 10px 8px 16px; }
  .sb-close { display: inline-grid !important; }
  .sb-pill { margin-left: 42px; }
  .nav-link { min-height: 46px; }
  .nav-scrim { display: block; position: fixed; inset: 0; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 65; }
  .shell.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  .main-col { margin-left: 0; }
  .topbar { padding: 0 6px 0 4px; gap: 4px; height: 56px; }
  .menu-btn { display: inline-grid !important; }
  .tb-brand { display: inline-flex !important; gap: 8px; margin-left: 2px; }
  .tb-brand .brand-word { font-size: 17px; }
  .tb-pill { display: inline-block !important; margin-left: 4px; }
  .pill-more { display: none; }
  .tb-context { display: none; }
  .tb-actions { gap: 2px; }
  .user-meta, .user-btn > .i { display: none; }
  .user-btn { padding: 2px; border: 0; background: transparent; min-height: 44px; min-width: 44px; justify-content: center; }
  .main { padding: 16px 16px calc(var(--tab-h) + 28px + env(safe-area-inset-bottom)); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; background: var(--surface); border-top: 1px solid var(--border); padding: 0 4px env(safe-area-inset-bottom); height: calc(var(--tab-h) + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(0, 0, 0, .04); }
  .tab-link { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; border-radius: 10px; position: relative; }
  .tab-link > span:not(.nav-badge) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tab-link[aria-current="page"] { color: var(--accent-text); }
  .tab-link[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
  .tab-link .nav-badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 10.5px; padding: 0 5px; }
  h1 { font-size: 23px; }
  .page { gap: 16px; }
  .page-head { align-items: stretch; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1 1 auto; }
  .card:not(.card-flush) { padding: 16px; }
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-num { font-size: 26px; }
  .hero-num { font-size: 46px; }
  .kpi-hero { grid-column: 1 / -1; }
  .hide-phone { display: none !important; }
  .show-phone { display: block; }
  .m-cards.show-phone { display: flex; }
  .form-grid, .sub-grid { grid-template-columns: minmax(0, 1fr); }
  input[type="text"], input:not([type]), input[type="tel"], input[type="email"], input[type="date"], input[type="search"], input[type="number"], select, textarea { font-size: 16px; min-height: 44px; }
  .select-sm { font-size: 16px !important; }
  .filters { padding: 12px; gap: 10px; }
  .flt { flex: 1 1 calc(50% - 5px); min-width: 0; }
  .search { flex: 1 1 0; }
  .flt-check { flex-basis: 100%; }
  .show-phone-f { display: inline-flex; flex: none; min-height: 44px; }
  .flt-more { display: none; }
  .flt-more.open { display: flex; flex-wrap: wrap; gap: 10px; width: 100%; }
  .summary-strip .ss { flex-basis: 30%; padding: 9px 12px; }
  .ss-l { white-space: normal; font-size: 12px; line-height: 1.25; }
  .ss-v { font-size: 19px; }
  .toasts { left: 12px; right: 12px; top: 64px; align-items: stretch; max-width: none; }
  /* dialogs: bottom sheet / full screen */
  .dlg-layer { padding: 0; align-items: flex-end; }
  .dlg { border-radius: 18px 18px 0 0; max-height: 94vh; max-height: 94dvh; transform: translateY(28px); border-width: 1px 0 0; }
  .dlg-lg, .dlg-drawer .dlg { max-width: none; height: 100%; max-height: 100vh; max-height: 100dvh; border-radius: 0; border-width: 0; }
  .dlg-drawer .dlg { transform: translateY(20px); width: 100%; }
  .dlg-head { padding: 12px 12px 12px 16px; }
  .dlg-body { padding: 16px; }
  .dlg-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-radius: 0; }
  .dlg-foot .btn { flex: 1 1 auto; min-height: 46px; }
  .foot-gap { display: none; }
  .dl-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sm-l { font-size: 10.5px; }
  /* attendance */
  .pickers { padding: 14px; gap: 12px; }
  .pk-date { width: 100%; }
  .pickers-3 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pickers-3 .pk:last-child { grid-column: 1 / -1; }
  .date-step { flex-wrap: nowrap; }
  .date-step input { flex: 1; min-width: 0; }
  .pk-grade { flex: 1; }
  .pk-grade select { min-width: 0; }
  .class-title { font-size: 18px; }
  .class-date { font-size: 15px; }
  .r-row { grid-template-columns: auto minmax(0, 1fr) auto; padding: 8px 10px; gap: 4px 8px; min-height: 64px; }
  .r-roll { display: none; }
  .r-row .av { width: 32px; height: 32px; font-size: 12px; }
  .r-last::before { content: attr(data-roll); }
  .seg-att { gap: 5px; }
  .att-opt span[aria-hidden] { width: 41px; height: 46px; font-size: 16px; }
  .r-reason { grid-column: 1 / -1; }
  .roster-tools .btn { flex: 1; min-height: 46px; }
  .att-allp { flex: 1 1 100%; min-height: 48px; font-size: 16px; order: -1; }
  .show-phone-i { display: inline; }
  .att-bar { bottom: calc(var(--tab-h) + 8px + env(safe-area-inset-bottom)); padding: 8px 10px 10px; gap: 8px; border-radius: 16px; }
  .att-counts { width: 100%; justify-content: space-between; gap: 2px 6px; font-size: 11.5px; }
  .cnt { flex-direction: column; align-items: center; }
  .cnt::before { display: none; }
  .cnt b { font-size: 16px; margin: 0; }
  .att-actions { width: 100%; justify-content: space-between; gap: 8px; flex-wrap: nowrap; }
  .att-actions .btn { flex: 0 0 auto; min-width: 118px; min-height: 48px; font-size: 16px; }
  .att-actions .check { font-size: 13px; line-height: 1.25; flex: 1 1 auto; min-height: 44px; min-width: 0; }
  .saved-note { flex: 1 1 auto; font-size: 13px; }
  /* reports */
  .register .rg-stu { min-width: 136px; max-width: 136px; width: 136px; }
  .rg-name { padding: 0 8px; font-size: 12.5px; gap: 6px; }
  .register-wrap { max-height: 62vh; }
  /* admissions */
  .stage-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 12px; scrollbar-width: none; }
  .stage-tabs::-webkit-scrollbar { display: none; }
  .stage-tabs button { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-weight: 600; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
  .stage-tabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
  .tab-n { font-size: 12px; background: color-mix(in srgb, currentColor 16%, transparent); border-radius: 999px; padding: 0 7px; }
  .board { display: block; overflow: visible; padding: 0; }
  .col { display: none; background: transparent; border: 0; }
  .col.is-phone-active { display: flex; }
  .col-head { display: none; }
  .col-body { padding: 0; }
  .kc-move { min-height: 40px; padding: 0 14px; font-size: 13.5px; }
  .ad-tools .seg-view { flex: 1 1 100%; }
  .seg-view button { flex: 1; justify-content: center; min-height: 38px; }
  .mt-row { grid-template-columns: 62px minmax(0, 1fr) 54px; gap: 10px; }
  .feed-text { font-size: 13.5px; }
  /* public form */
  .pub-in { padding: 0 16px; }
  .pub-strip .pub-in { min-height: 40px; }
  .pub-head .pub-in { min-height: 64px; gap: 10px; }
  .pub-head .crest { width: 38px; height: 38px; }
  .pub-name { font-size: 16px; }
  .pub-tag { font-size: 12.5px; }
  .pub-hero .pub-in { padding-top: 20px; padding-bottom: 58px; }
  .pub-hero h1 { font-size: 28px; }
  .pub-hero p { font-size: 14.5px; }
  .stepper { padding: 12px 16px; }
  .stepper ol { display: none; }
  .st-phone { display: block; font-size: 14px; color: var(--text-2); }
  .st-bar { display: block; height: 6px; border-radius: 999px; background: var(--surface-3); margin-top: 8px; overflow: hidden; }
  .st-bar span { display: block; height: 100%; background: var(--school); border-radius: 999px; transition: width .25s; }
  .pub-card { padding: 18px 16px 0; }
  .done-card { padding: 30px 16px; }
  .step-title { font-size: 19px; }
  .pub-actions { position: sticky; bottom: 0; margin: 22px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -8px 20px rgba(0, 0, 0, .06); z-index: 5; border-radius: 0 0 16px 16px; }
  .pub-actions .btn { flex: 1; }
  .pub-actions > span:empty { display: none; }
  .radio-row { flex-direction: column; }
  .radio-card { display: flex; }
  .radio-card span { width: 100%; min-height: 48px; }
  .done-actions .btn { width: 100%; }
  .slot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 640px) and (max-width: 899px) { .st-full { display: none; } .st-short { display: inline; } }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
