/* "Calm Ledger" — school-first, powered by AI Ninjas.
   Paper #F4F9F5 · Ink #10201A · Green #0E7A5F (primary) · Gold #C47A08 (attention) · Panel #0C1512
   Programs: Technology #2563EB · AI #7C3AED · Type: Figtree */
:root {
  --paper: #F4F9F5; --surface: #FFFFFF; --surface-2: #F2F7F4; --line: #E3EAE4; --line-2: #CBD8CF;
  --ink: #10201A; --ink-2: #3C4E45; --muted: #5C6D63; --faint: #8A988F;
  --green: #0E7A5F; --green-dark: #0A5F4B; --green-soft: #E2F3EC; --green-tint: #EFF9F4;
  --gold: #C47A08; --gold-ink: #8A5505; --gold-soft: #FCF0DC;
  --red: #C43A3A; --red-soft: #FCEBEB;
  --panel: #0C1512; --panel-2: #16211D; --on-dark: #E9F2ED; --on-dark-2: #A9BAB0; --mint: #2FB389;
  --radius: 1.0667em; --radius-sm: .8em; --shadow: 0 .0667em .1333em rgba(16, 32, 26, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0B1210; --surface: #121B18; --surface-2: #172320; --line: #22302B; --line-2: #2E3E38;
    --ink: #E9F2ED; --ink-2: #C3D1C9; --muted: #9DB0A6; --faint: #74867C;
    --green: #2FB389; --green-dark: #5FD0A9; --green-soft: #12332A; --green-tint: #0F2721;
    --gold: #E0A13A; --gold-ink: #F0BE6A; --gold-soft: #33260F; --red: #F07F7F; --red-soft: #3A1B1F;
    --shadow: none; color-scheme: dark;
  }
  :root:not([data-theme="light"]) .btn.primary { color: #0C1512; }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left); font: .9375em/1.5 Figtree, "Helvetica Neue", Arial, sans-serif; background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--green); }
a:hover { color: var(--green-dark); }
h1 { font-size: 2em; line-height: 1.15; font-weight: 800; letter-spacing: -.01em; margin: 0; }
h2 { font-size: 1.2667em; font-weight: 800; margin: 0; }
h3 { font-size: 1em; font-weight: 800; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .8667em; }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: .0667em; height: .0667em; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 1.0667em; }
.row { display: flex; flex-wrap: wrap; gap: .6667em; align-items: center; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 17.0667em; flex: none; background: var(--surface); border-right: thin solid var(--line); padding: 1.3333em 1.0667em; display: flex; flex-direction: column; gap: 1.3333em; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main { min-width: 0; padding: 1.8667em 2.6667em 3.7333em; display: flex; flex-direction: column; gap: 1.6em; max-width: 93.3333em; width: 100%; }
#crumbs:not(:empty) + .main { padding-top: 1.0667em; }

/* Navigation bar: light back pill + breadcrumbs */
.crumbbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6667em 1.0667em; padding: 1.2em 2.6667em 0; max-width: 93.3333em; }
.back-btn { display: inline-flex; align-items: center; gap: .5714em; min-height: 2.8571em; padding: 0 1em 0 .3571em; border-radius: 71.3571em; border: thin solid var(--line); background: var(--surface); color: var(--ink-2); font: inherit; font-size: .9333em; font-weight: 700; cursor: pointer; box-shadow: var(--shadow); transition: background .15s, border-color .15s, color .15s; }
.back-btn .back-ico { width: 2.1429em; height: 2.1429em; border-radius: 50%; background: var(--green-soft); color: var(--green-dark); display: inline-flex; align-items: center; justify-content: center; transition: transform .15s; }
.back-btn:hover { background: var(--green-tint); border-color: var(--green); color: var(--green-dark); }
.back-btn:hover .back-ico { transform: translateX(-.1333em); background: var(--green); color: #fff; }
.back-btn .back-to { font-weight: 600; color: var(--muted); }
.back-btn:hover .back-to { color: var(--green-dark); }
.crumbs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .3077em; font-size: .8667em; }
.crumbs li { display: inline-flex; align-items: center; gap: .3333em; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; font-weight: 600; padding: .3333em .5em; border-radius: .5em; }
.crumbs a:hover { color: var(--green-dark); background: var(--green-tint); }
.crumbs svg { color: var(--line-2); }
.crumbs li[aria-current] span { color: var(--ink); font-weight: 700; padding: .3333em .5em; }
.topbar { display: none; }
.school-switch { display: flex; align-items: center; gap: .8em; width: 100%; padding: .6667em; border: thin solid var(--line); border-radius: .9333em; background: var(--surface); cursor: pointer; font: inherit; color: inherit; text-align: left; }
.school-switch:hover { background: var(--surface-2); }
.monogram { width: 2.6667em; height: 2.6667em; border-radius: .6667em; background: var(--gold); color: #fff; font-weight: 800; font-size: 1em; display: flex; align-items: center; justify-content: center; flex: none; letter-spacing: .02em; }
.monogram.all { background: var(--ink); color: var(--paper); font-size: .8667em; }
.monogram.lg { width: 2.8235em; height: 2.8235em; font-size: 1.1333em; border-radius: .7059em; }
.nav { display: flex; flex-direction: column; gap: .1333em; }
.nav a { display: flex; align-items: center; gap: .8em; padding: .6667em .8em; min-height: 2.9333em; border-radius: .6667em; color: var(--ink-2); font-weight: 600; text-decoration: none; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--green-soft); color: var(--green-dark); font-weight: 700; }
.nav svg { width: 1.3333em; height: 1.3333em; flex: none; }
.nav .count { margin-left: auto; min-width: 1.8333em; height: 1.8333em; padding: 0 .5em; border-radius: 8.25em; background: var(--gold-soft); color: var(--gold-ink); font-size: .8em; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: .8em; }
.me-card { display: flex; align-items: center; gap: .6667em; padding: .6667em; border-radius: .8em; background: var(--surface-2); }
.avatar { width: 2.7692em; height: 2.7692em; border-radius: 50%; background: var(--panel); color: #fff; font-weight: 800; font-size: .8667em; display: flex; align-items: center; justify-content: center; flex: none; }
.powered { font-size: .8em; color: var(--muted); padding: 0 .3333em; }
.powered strong { color: var(--ink-2); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.0667em; }
.eyebrow { font-size: .9333em; color: var(--muted); font-weight: 600; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: thin solid var(--line); border-radius: var(--radius); padding: 1.4667em; box-shadow: var(--shadow); }
.card.tight { padding: 1.0667em; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .8em; flex-wrap: wrap; margin-bottom: .9333em; }
.grid-2 { display: grid; gap: 1.3333em; grid-template-columns: repeat(auto-fit, minmax(22.6667em, 1fr)); }
.grid-3 { display: grid; gap: 1.6em; grid-template-columns: minmax(0, 2fr) minmax(20em, 1fr); }
@media (max-width: 68.75em) { .grid-3 { grid-template-columns: 1fr; } }
.stats { display: grid; gap: 1.0667em; grid-template-columns: repeat(auto-fit, minmax(12em, 1fr)); }
.stat { background: var(--surface); border: thin solid var(--line); border-radius: var(--radius); padding: 1.2em; display: flex; flex-direction: column; gap: .2667em; }
.stat .label { font-size: .8667em; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 1.8667em; font-weight: 800; line-height: 1.1; }
.stat .value .small { font-size: .4643em; }
.stat .sub { font-size: .8667em; color: var(--muted); }
.stat.soft { background: var(--surface-2); border-color: transparent; }
.meter { height: .4em; border-radius: 6.6em; background: var(--line); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 6.6em; background: var(--green); }
.meter.lg { height: .5333em; }
.meter.warn > span { background: var(--gold); }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5714em; min-height: 3.1429em; padding: 0 1.1429em; border-radius: var(--radius-sm); border: thin solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; font-size: .9333em; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; font-size: 1em; min-height: 2.9333em; padding: 0 1.0667em; }
.btn.primary:hover { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.btn.danger { color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { min-height: 2.7692em; padding: 0 .9231em; font-size: .8667em; border-radius: .7692em; }
.btn.icon { width: 2.9333em; padding: 0; }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 1.2857em; height: 1.2857em; }
.btn.dashed { border: .1333em dashed var(--green); background: var(--green-tint); color: var(--green-dark); }
.icon-btn { background: none; border: 0; color: var(--ink); cursor: pointer; width: 2em; height: 2em; display: inline-flex; align-items: center; justify-content: center; border-radius: .4545em; font-size: 1.4667em; }
.icon-btn:hover { background: var(--surface-2); }
.link { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--green); cursor: pointer; text-decoration: underline; text-underline-offset: .1333em; }
label.field { display: flex; flex-direction: column; gap: .4615em; font-size: .8667em; font-weight: 700; color: var(--ink-2); }
label.field .hint { font-weight: 500; color: var(--muted); }
input, select, textarea { font: inherit; font-size: 1em; color: var(--ink); background: var(--surface); border: thin solid var(--line-2); border-radius: .6667em; padding: 0 .8em; height: 2.9333em; width: 100%; min-width: 0; }
label.field input, label.field select, label.field textarea { font-size: 1.1538em; }
textarea { height: auto; padding: .6667em .8em; }
input[type=checkbox] { width: 1.3333em; height: 1.3333em; accent-color: var(--green); }
:focus-visible { outline: .2em solid var(--green); outline-offset: .1333em; }
input:focus, select:focus, textarea:focus { outline: .1333em solid var(--green); outline-offset: 0; border-color: var(--green); }
.form-grid { display: grid; gap: .9333em; grid-template-columns: repeat(auto-fit, minmax(14.6667em, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.filters { display: flex; flex-wrap: wrap; gap: .8em; align-items: flex-end; }
.filters label.field { min-width: 12em; }
.chips { display: flex; flex-wrap: wrap; gap: .5333em; }
.chip { display: inline-flex; align-items: center; gap: .6667em; min-height: 2.9333em; padding: 0 1.0667em; border-radius: .8em; border: thin solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: 1em; cursor: pointer; }
.chip:hover { border-color: var(--green); }
.chip[aria-pressed="true"] { border: .1333em solid var(--green); background: var(--green-soft); color: var(--green-dark); font-weight: 700; padding: 0 1em; }
.chip.solid[aria-pressed="true"] { background: var(--green); color: #fff; }
.chip.day { width: 4.2667em; justify-content: center; padding: 0; }
.chip.period { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; min-height: 3.7333em; padding: .4em .8em; min-width: 8.2667em; }
.chip.period small { font-size: .8em; color: var(--muted); font-weight: 500; }
.chip.period[aria-pressed="true"] { padding: .3333em .7333em; }
.chip .sw { width: .9333em; height: .9333em; border-radius: .2667em; flex: none; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: .2667em; padding: .2667em; border-radius: .8em; background: var(--line); }
.segmented a { display: inline-flex; align-items: center; text-decoration: none; }
.segmented button, .segmented a { min-height: 2.5714em; padding: 0 1.1429em; border: 0; border-radius: .6429em; background: transparent; font: inherit; font-weight: 600; font-size: .9333em; color: var(--ink-2); cursor: pointer; }
.segmented button[aria-selected="true"], .segmented a[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 .0667em .1333em rgba(16,32,26,.12); }
.step-num { width: 2.1538em; height: 2.1538em; border-radius: 50%; background: var(--green); color: #fff; font-weight: 800; font-size: .8667em; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.step-num.todo { background: transparent; border: .1333em solid var(--line-2); color: var(--muted); }
.step-num.now { background: var(--surface); border: .1333em solid var(--green); color: var(--green-dark); }
.step-num svg { width: 1.1538em; height: 1.1538em; }
fieldset.qa { margin: 0; border: thin solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 1.4667em; display: flex; flex-direction: column; gap: .9333em; min-width: 0; }
.qa-title { display: flex; align-items: center; gap: .5882em; font-size: 1.1333em; font-weight: 800; padding: 0; float: left; width: 100%; }
.qa-title + * { clear: both; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9333em; }
.table th { text-align: left; font-size: .8571em; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: .8333em 1em; border-bottom: thin solid var(--line); white-space: nowrap; }
.table td { padding: .8571em; border-bottom: thin solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--green-tint); }
/* tables run at 14/15: keep nested small text at its usual size */
.table .small, .table td.small, .table .btn.sm, .table .avatar { font-size: .9286em; }
.table .badge { font-size: .8571em; }
.table td.small { padding: .9231em; }
.table input, .table select { font-size: 1.0714em; }
.table .type-toggle { font-size: .9286em; }
.table .icon-btn { font-size: 1.5714em; }
.qa-title .step-num, .qa-title .small { font-size: .7647em; }
.summary .btn.mint { padding: 0 1.0667em; }
.tt-grid .tt-band td { padding: .4545em; }
.type-toggle input[type=checkbox] { width: 1.5385em; height: 1.5385em; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .5em; padding: .25em .8333em; border-radius: 83.25em; font-size: .8em; font-weight: 700; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge svg { width: 1.0833em; height: 1.0833em; }
.badge.delivered, .badge.sent, .badge.ok { background: var(--green-soft); color: var(--green-dark); }
.badge.missed, .badge.failed { background: var(--red-soft); color: var(--red); }
.badge.cancelled { text-decoration: line-through; }
.badge.closed, .badge.quota, .badge.warn, .badge.soon { background: var(--gold-soft); color: var(--gold-ink); }
.badge.program { color: #fff; }
.dot { width: .6667em; height: .6667em; border-radius: .2em; display: inline-block; flex: none; }

/* ---------- checklist & lists ---------- */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: .8em; grid-template-columns: repeat(auto-fit, minmax(11.3333em, 1fr)); }
.checklist li { padding: .9333em; border-radius: .8em; background: var(--surface-2); display: flex; flex-direction: column; gap: .5333em; }
.checklist li.now { background: var(--surface); border: .1333em solid var(--green); }
.checklist li.todo { background: var(--surface); border: thin dashed var(--line-2); }
.checklist strong { font-size: .9333em; }
.checklist span.s { font-size: .8667em; color: var(--muted); }
.checklist a { font-size: .8667em; font-weight: 700; }
.agenda { list-style: none; margin: 0; padding: 0; }
.agenda li { display: grid; grid-template-columns: 6.4em minmax(0, 1fr) auto; gap: 1.0667em; align-items: center; padding: .9333em 0; border-bottom: thin solid var(--line); }
.agenda li:last-child { border-bottom: 0; }
.agenda .t strong { display: block; font-size: 1.0667em; }
.agenda .t span { font-size: .8667em; color: var(--muted); }
.agenda .what { display: flex; gap: .8em; min-width: 0; align-items: stretch; text-align: left; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.agenda .bar { width: .2667em; border-radius: .2667em; flex: none; }
.agenda .what strong { display: block; font-size: 1em; }
.agenda .what > span > span { font-size: .8667em; color: var(--muted); }
.agenda .day-label { display: block; grid-column: 1 / -1; padding: 0; border: 0; font-size: .8667em; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: .6154em; }
@media (max-width: 37.5em) { .agenda li { grid-template-columns: 4.8em minmax(0, 1fr); } .agenda li > .st { grid-column: 2; justify-self: start; } }
.notice { padding: .9333em; border-radius: .8em; background: var(--surface-2); display: flex; flex-direction: column; gap: .4em; }
.notice.warn { background: var(--gold-soft); }
.notice.warn a, .notice.warn .link { color: var(--gold-ink); }
.notice strong { font-size: .9333em; }
.notice span { font-size: .8667em; color: var(--ink-2); }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: .6667em; padding: .6667em 0; border-bottom: thin solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.empty { text-align: center; padding: 2.6667em 1.3333em; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: .8em; }
.empty strong { color: var(--ink); font-size: 1.1333em; }

/* ---------- school timetable grid ---------- */
.tt-layout { display: flex; flex-wrap: wrap; gap: 1.3333em; align-items: flex-start; }
.tt-board { flex: 999 1 42.6667em; min-width: 0; overflow-x: auto; background: var(--surface); border: thin solid var(--line); border-radius: var(--radius); }
.tt-g { display: grid; grid-template-columns: 8.2667em repeat(var(--days, 5), minmax(8.8em, 1fr)); min-width: calc(8.2667em + var(--days, 5) * 8.8em); }
.tt-g > .h { padding: .8em; border-bottom: thin solid var(--line); background: var(--surface-2); display: flex; align-items: baseline; justify-content: space-between; gap: .4em; }
.tt-g > .h + .h { border-left: thin solid var(--line); }
.tt-g > .h strong { font-size: .8667em; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }
.tt-g > .h span { font-size: .8em; color: var(--muted); }
.tt-g > .h.today { background: var(--green-soft); }
.tt-g > .h.today strong { color: var(--green-dark); }
.tt-g > .p { padding: .6667em .8em; border-bottom: thin solid var(--line); background: var(--surface-2); display: flex; flex-direction: column; justify-content: center; min-height: 4.5333em; }
.tt-g > .p strong { font-size: .9333em; }
.tt-g > .p span { font-size: .8em; color: var(--muted); }
.tt-g > .band { border-bottom: thin solid var(--line); border-left: thin solid var(--line); background: var(--paper); display: flex; align-items: center; justify-content: center; font-size: .8em; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.tt-g > .c { border-bottom: thin solid var(--line); border-left: thin solid var(--line); padding: .4em; min-height: 4.5333em; display: flex; flex-direction: column; gap: .4em; }
.tt-add { flex: 1; min-height: 4.3333em; border: .1667em dashed transparent; border-radius: .8333em; background: transparent; font: inherit; font-size: .8em; color: var(--faint); cursor: pointer; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.tt-add .on-hover { display: none; font-weight: 700; color: var(--green-dark); font-size: 1.0833em; }
.tt-add:hover, .tt-add:focus-visible { border-color: var(--green); background: var(--green-tint); }
.tt-add:hover .off-hover, .tt-add:focus-visible .off-hover { display: none; }
.tt-add:hover .on-hover, .tt-add:focus-visible .on-hover { display: inline; }
.tt-quiet { flex: 1; display: flex; align-items: center; justify-content: center; font-size: .8em; color: var(--faint); }
.tt-slot { text-align: left; font: inherit; cursor: pointer; border-radius: .6667em; padding: .5333em .6667em; display: flex; flex-direction: column; gap: .1333em; border: thin solid var(--cb); background: var(--cs); color: var(--ink); width: 100%; }
.tt-slot:hover { filter: brightness(.98); }
.tt-slot.sel { box-shadow: 0 0 0 .2em var(--cl); }
.tt-slot .top { display: flex; justify-content: space-between; gap: .4em; align-items: baseline; }
.tt-slot .top strong { font-size: .9333em; color: var(--ci); }
.tt-slot .room { font-size: .7333em; font-weight: 700; color: var(--ink-2); }
.tt-slot .ppl { font-size: .8em; color: var(--ink-2); }
.crew { display: flex; flex-direction: column; gap: .1667em; margin-top: .1667em; font-size: .8em; min-width: 0; }
.crew .who { display: flex; align-items: flex-start; gap: .4167em; min-width: 0; }
.crew .rl { flex: none; margin-top: .1em; font-size: .8333em; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; line-height: 1.5; padding: 0 .5em; border-radius: .4em; border: thin solid var(--ci); background: var(--ci); color: #fff; }
.crew .rl.ta { background: transparent; color: var(--ci); }
.crew .nm { min-width: 0; overflow-wrap: anywhere; line-height: 1.35; font-weight: 600; color: var(--ink); }
.crew .nm.none { font-weight: 500; color: var(--muted); }
.crew .nm.need { font-weight: 700; color: var(--gold-ink); }
.tt-slot .flag { align-self: flex-start; margin-top: .1818em; font-size: .7333em; font-weight: 800; color: var(--gold-ink); background: var(--gold-soft); border-radius: .5455em; padding: .0909em .5455em; }
.tt-slot .flag.ok { color: var(--green-dark); background: var(--green-soft); }
.tt-slot.cancelled, .tt-slot.closed { opacity: .55; }
.tt-slot.cancelled .top strong { text-decoration: line-through; }
.legend { display: flex; flex-wrap: wrap; gap: 1.2308em; font-size: .8667em; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: .4615em; }
.legend i { width: .9231em; height: .9231em; border-radius: .2308em; display: inline-block; }
.legend i.school { border: thin solid var(--line-2); background: var(--surface); }
.detail { flex: 1 1 21.3333em; position: sticky; top: 1.3333em; display: flex; flex-direction: column; gap: 1.0667em; }
.detail dl, .modal dl { margin: 0; display: grid; grid-template-columns: 7.1429em minmax(0, 1fr); gap: .7143em .8571em; font-size: .9333em; }
.detail dt, .modal dt { color: var(--muted); }
.detail dd, .modal dd { margin: 0; font-weight: 600; }
.rem-row { display: flex; align-items: center; gap: .7143em; font-size: .9333em; line-height: 1.35; }
.rem-row .dot { border-radius: 50%; }
.rem-row .st { margin-left: auto; font-weight: 700; font-size: .9286em; color: var(--green-dark); white-space: nowrap; }

.week { display: grid; gap: .8em; grid-template-columns: repeat(var(--days, 5), minmax(11.3333em, 1fr)); overflow-x: auto; padding-bottom: .2667em; }
.day { background: var(--surface); border: thin solid var(--line); border-radius: var(--radius); min-height: 10.6667em; display: flex; flex-direction: column; }
.day-head { padding: .8em .9333em; border-bottom: thin solid var(--line); display: flex; justify-content: space-between; align-items: baseline; }
.day.today { border-color: var(--green); }
.day.today .day-head { background: var(--green-soft); border-radius: var(--radius) var(--radius) 0 0; }
.day.picked { border: .1333em solid var(--gold); box-shadow: 0 0 0 .2667em var(--gold-soft); }
.day.picked .day-head { background: var(--gold-soft); border-radius: var(--radius) var(--radius) 0 0; }
.tt-g > .h.picked { background: var(--gold-soft); box-shadow: inset 0 -.2em 0 var(--gold); }
.tt-g > .h.picked strong { color: var(--gold-ink); }
.day-body { padding: .5333em; display: flex; flex-direction: column; gap: .5333em; }
@media (max-width: 56.25em) { .week { grid-template-columns: 1fr; } }

.next-card { background: var(--panel); color: var(--on-dark); border-radius: 1.2em; padding: 1.4667em; display: flex; flex-direction: column; gap: .8em; }
.next-card h2 { color: #fff; font-size: 1.7333em; }
.next-card .kicker { font-size: .8em; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--mint); }
.next-card strong { color: #fff; }
.next-card .btn { background: transparent; color: #fff; border-color: #3C4E45; }
.next-card .btn.mint { background: var(--mint); border-color: var(--mint); color: var(--panel); font-weight: 800; }
.week-strip { display: grid; grid-template-columns: repeat(var(--days, 5), minmax(0, 1fr)); gap: .5333em; }
.week-strip a { min-height: 4em; border: thin solid var(--line); border-radius: .8em; background: var(--surface); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; }
.week-strip a span { font-size: .8em; font-weight: 700; color: var(--muted); }
.week-strip a strong { font-size: 1.1333em; }
.week-strip a.on { background: var(--green); border-color: var(--green); color: #fff; }
.week-strip a.on span { color: #fff; }
.week-strip a.has::after { content: ""; width: .3333em; height: .3333em; border-radius: 50%; background: var(--gold); margin-top: .2em; }

.summary { flex: 1 1 21.3333em; position: sticky; top: 1.3333em; background: var(--panel); color: var(--on-dark); border-radius: var(--radius); padding: 1.4667em; display: flex; flex-direction: column; gap: .9333em; }
.summary h2 { color: #fff; font-size: 1.2em; }
.summary .big { font-size: 2.1333em; font-weight: 800; color: #fff; line-height: 1.1; }
.summary ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5333em; }
.summary li { display: flex; align-items: center; gap: .7143em; padding: .7143em .8571em; border-radius: .7143em; background: var(--panel-2); font-size: .9333em; }
.summary li strong { color: #fff; }
.summary .meta { border-top: thin solid var(--panel-2); padding-top: 1em; display: flex; flex-direction: column; gap: .4286em; font-size: .9333em; color: var(--on-dark-2); }
.summary .meta strong { color: var(--on-dark); }
.summary .btn.mint { background: var(--mint); border-color: var(--mint); color: var(--panel); font-weight: 800; min-height: 3.2em; font-size: 1em; }
.summary .btn.mint:disabled { opacity: .45; }
.summary .link { color: var(--on-dark); text-align: center; }
.clash { display: flex; gap: .8571em; align-items: flex-start; padding: .8571em 1em; border-radius: .8571em; background: var(--gold-soft); font-size: .9333em; line-height: 1.45; color: var(--ink); }
.clash svg { flex: none; margin-top: .0714em; color: var(--gold-ink); }

.wizard { display: flex; flex-wrap: wrap; gap: 1.6em; align-items: flex-start; }
.stepper { flex: 1 1 16.6667em; max-width: 21.3333em; }
.stepper ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .2667em; }
.stepper a { display: flex; gap: .8em; align-items: center; padding: .6667em; border-radius: .6667em; text-decoration: none; color: var(--ink); }
.stepper a:hover { background: var(--surface-2); }
.stepper a.now { background: var(--green-soft); }
.stepper a.now strong { color: var(--green-dark); }
.stepper strong { display: block; font-size: .9333em; }
.stepper span.s { display: block; font-size: .8em; color: var(--muted); }
.wizard > .card { flex: 999 1 37.3333em; min-width: 0; }
.daybar { display: flex; height: 2.9333em; border-radius: .6667em; overflow: hidden; gap: .1333em; }
.daybar div { background: var(--green); color: #fff; font-size: .7333em; font-weight: 700; display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap; min-width: .3636em; }
.daybar div.brk { background: var(--line-2); }
.ptable input { height: 2.6667em; }
.type-toggle { display: inline-flex; align-items: center; gap: .6154em; font-size: .8667em; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; }

.bars { display: flex; align-items: flex-end; gap: .9333em; height: 14.6667em; padding: 0 .2667em; border-bottom: thin solid var(--line-2); }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .4em; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .b > span { font-size: .8em; font-weight: 700; color: var(--ink-2); }
.bars .stack-bar { width: 100%; max-width: 3.7333em; display: flex; flex-direction: column-reverse; border-radius: .4em .4em 0 0; overflow: hidden; }
.bars-x { display: flex; gap: .9333em; padding: 0 .2667em; }
.bars-x span { flex: 1; text-align: center; font-size: .8em; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-del { background: var(--green); } .c-mis { background: var(--gold); } .c-un { background: #A9C7B8; } .c-can { background: var(--line-2); }
.hbar { display: flex; flex-direction: column; gap: .4em; }
.hbar .track { height: .6667em; border-radius: 6.6em; background: var(--line); overflow: hidden; }
.hbar .track span { display: block; height: 100%; background: var(--green); border-radius: 6.6em; }
.headline { font-size: 1.3333em; line-height: 1.4; font-weight: 600; max-width: 43em; }
.headline strong.g { color: var(--green-dark); }
.headline strong.o { color: var(--gold-ink); }

/* ---------- modal, palette, toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(8, 14, 12, .5); display: grid; place-items: center; padding: 1.0667em; z-index: 50; }
.modal { background: var(--surface); border-radius: 1.2em; width: min(37.3333em, 100%); max-height: calc(100vh - 2.1333em); overflow: auto; box-shadow: 0 1.6em 4.6667em rgba(0,0,0,.25); }
.modal:focus { outline: none; }
body.modal-open { overflow: hidden; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1.2em 1.4667em; border-bottom: thin solid var(--line); }
.modal-body { padding: 1.4667em; }
.modal-foot { padding: .9333em 1.4667em; border-top: thin solid var(--line); display: flex; justify-content: flex-end; gap: .5333em; flex-wrap: wrap; }
.modal-backdrop.top { place-items: start center; padding-top: 10vh; }
.palette { width: min(41.3333em, 100%); }
.palette input { height: 3.4118em; border: 0; border-bottom: thin solid var(--line); border-radius: 0; font-size: 1.1333em; padding: 0 1.1765em; }
.palette input:focus { outline: none; }
.palette ul { list-style: none; margin: 0; padding: .5333em; max-height: 50vh; overflow: auto; }
.palette li a { display: flex; align-items: center; gap: .8em; padding: .6667em .8em; border-radius: .6667em; color: var(--ink); text-decoration: none; }
.palette li a:hover, .palette li a.sel { background: var(--green-soft); }
.palette li small { color: var(--muted); margin-left: auto; font-size: .8em; }
.alert { padding: .8571em 1em; border-radius: .8571em; font-size: .9333em; }
.alert.error { background: var(--red-soft); color: var(--red); }
.alert.info { background: var(--green-soft); color: var(--green-dark); }
.alert.warn { background: var(--gold-soft); color: var(--gold-ink); }
#toast { position: fixed; bottom: 1.6em; left: 50%; transform: translateX(-50%); background: var(--panel); color: #fff; padding: .8em 1.2em; border-radius: .8em; font-weight: 600; z-index: 60; box-shadow: 0 .6667em 2em rgba(0,0,0,.25); max-width: calc(100vw - 2.1333em); }
kbd { font: inherit; font-size: .8em; color: var(--muted); border: thin solid var(--line); border-radius: .5em; padding: .0833em .5em; }
.search-btn { display: flex; align-items: center; gap: .5714em; min-height: 3.1429em; padding: 0 1em; border: thin solid var(--line); border-radius: .8571em; background: var(--surface); min-width: 18.5714em; font: inherit; font-size: .9333em; color: var(--muted); cursor: pointer; }
.search-btn svg { width: 1.2857em; height: 1.2857em; flex: none; }
.search-btn kbd { margin-left: auto; font-size: .8571em; }
@media (max-width: 43.75em) { .search-btn { min-width: 0; } .search-btn .lbl, .search-btn kbd { display: none; } }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.0667em; background: var(--paper); }
.auth .card { width: min(28em, 100%); padding: 2.1333em; }
.auth form { display: flex; flex-direction: column; gap: .9333em; margin-top: 1.3333em; }
.brandline { display: flex; align-items: center; gap: .8em; }

/* ---------- activity feed ---------- */
.acts { display: flex; flex-direction: column; }
.act { display: flex; align-items: flex-start; gap: .8em; padding: .6667em 0; border-top: thin solid var(--line); }
.act:first-child { border-top: 0; padding-top: 0; }
.act-ico { flex: none; width: 2.1333em; height: 2.1333em; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--green-soft); color: var(--green-dark); }
.act .grow { display: flex; flex-direction: column; gap: .1333em; }
.act-text { overflow-wrap: anywhere; }
.act-go { flex: none; align-self: center; display: inline-flex; align-items: center; justify-content: center; width: 2.4em; height: 2.4em; border-radius: .6667em; color: var(--muted); }
.act-go:hover { background: var(--surface-2); color: var(--green-dark); }
.act-more { margin-top: .6667em; }

/* ---------- people filters, insights overview ---------- */
.people-filters { margin-top: -.4em; }
.people-filters .grow-2 { flex: 2 1 15em; }
/* Phone: the extra filters fold under a "Filters" toggle (desktop renders them inline). */
@media (max-width: 56.25em) {
  .more-filters { display: block; flex: 1 1 100%; }
  .more-filters > summary { display: flex; align-items: center; min-height: 2.9333em; padding: 0 .8em; border: thin solid var(--line-2); border-radius: .6667em; background: var(--surface); font-weight: 700; cursor: pointer; list-style: none; }
  .more-filters > summary::-webkit-details-marker { display: none; }
  .more-filters > summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
  .more-filters[open] > summary::after { content: "▴"; }
  .more-filters-in { display: flex; flex-wrap: wrap; gap: .6667em; margin-top: .6667em; }
}
#pf-count { margin-top: -.8em; }
.section-h { margin-top: .4em; }
.stat.warn { background: var(--gold-soft); }
.stat.warn .value { color: var(--gold-ink); }

/* ---------- schools grouped with their branches; roles ---------- */
.org { display: flex; flex-direction: column; gap: .8em; }
.org + .org { margin-top: .8em; }
.org-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .6667em; }
.badge.role { background: var(--panel); color: #fff; }
.role-system_admin, .role-admin { color: var(--green-dark); }
.role-school_admin, .role-school_manager { color: var(--gold-ink); }

/* ---------- person page ---------- */
.person-link { color: inherit; text-decoration: none; white-space: nowrap; }
.person-link:hover strong { color: var(--green-dark); text-decoration: underline; text-underline-offset: .15em; }
.person-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 1.0667em 1.3333em; }
.avatar.xl { width: 4.2667em; height: 4.2667em; font-size: 1.2em; }
.who-main { flex: 1 1 18em; min-width: 0; display: flex; flex-direction: column; gap: .5333em; }
.who-main h1 { font-size: 1.8667em; }
.contact { display: flex; flex-wrap: wrap; gap: .4em 1.2em; font-size: .9333em; color: var(--ink-2); }
.contact a, .contact span { display: inline-flex; align-items: center; gap: .4286em; color: inherit; text-decoration: none; min-height: 2em; overflow-wrap: anywhere; }
.contact a:hover { color: var(--green-dark); }
.contact svg { color: var(--muted); flex: none; }
.hero-actions { align-self: flex-start; }
.rtag { display: inline-block; flex: none; font-size: .7333em; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; line-height: 1.6; padding: 0 .5455em; border-radius: .4545em; background: var(--green); border: thin solid var(--green); color: #fff; }
.rtag.ta { background: transparent; color: var(--green-dark); }
i.cov { font-style: normal; font-size: .7333em; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 0 .5455em; border-radius: .4545em; background: var(--gold-soft); color: var(--gold-ink); line-height: 1.6; }
i.cov.leave { background: var(--red-soft); color: var(--red); }
i.cov.closed { background: var(--surface-2); color: var(--muted); }

.reg-week { display: grid; gap: .6667em; grid-template-columns: repeat(var(--days, 5), minmax(0, 1fr)); }
.reg-day { display: flex; flex-direction: column; gap: .5333em; min-width: 0; padding: .6667em; border-radius: .8em; background: var(--surface-2); }
.reg-day > strong { font-size: .8667em; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }
.reg-day.free { opacity: .75; }
.reg-item { display: flex; flex-direction: column; gap: .1333em; padding: .5333em .6667em; border-radius: .6667em; background: var(--surface); border-left: .2667em solid var(--c); font-size: .9333em; min-width: 0; }
.reg-item .t { font-weight: 800; font-size: .9286em; }
.reg-item .w { font-weight: 700; }
.reg-item .s { font-size: .8571em; color: var(--muted); }
.reg-item .r { display: flex; flex-wrap: wrap; align-items: center; gap: .2857em .4286em; font-size: .8571em; color: var(--ink-2); margin-top: .1429em; }
.reg-item .r .rtag { font-size: .8333em; }

.sch-nav { margin-bottom: .8em; flex-wrap: nowrap; }
.sch-label { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.sday { border-top: thin solid var(--line); padding: .6667em 0; }
.sday:first-child { border-top: 0; padding-top: 0; }
.sday.today .sday-h strong { color: var(--green-dark); }
.sday-h { display: flex; justify-content: space-between; align-items: baseline; gap: .6667em; margin-bottom: .4em; }
.srow { display: grid; grid-template-columns: 4.6667em minmax(0, 1fr) auto; gap: .8em; align-items: center; width: 100%; padding: .5333em .6667em; margin-top: .4em; border: thin solid var(--line); border-left: .2667em solid var(--c); border-radius: .6667em; background: var(--surface); font: inherit; color: inherit; text-align: left; cursor: pointer; }
.srow:hover { background: var(--green-tint); }
.srow.cancelled, .srow.closed { opacity: .6; }
.srow.cancelled .w strong { text-decoration: line-through; }
.srow .t strong { display: block; }
.srow .t span, .srow .w span { display: block; font-size: .8667em; color: var(--muted); }
.srow .w { min-width: 0; }
.srow .w strong { display: block; overflow-wrap: anywhere; }
.srow .r { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .2667em; }

.cal-h, .cal-g { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .2667em; }
.cal-h span { text-align: center; font-size: .7333em; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-bottom: .3636em; }
.cal-day { position: relative; display: flex; flex-direction: column; gap: .2em; min-height: 5.8667em; padding: .4em; border: thin solid var(--line); border-radius: .6667em; background: var(--surface); color: var(--ink); text-decoration: none; overflow: hidden; }
.cal-day:hover { border-color: var(--green); }
.cal-day.wkend { background: var(--surface-2); }
.cal-day .n { font-weight: 800; font-size: .9333em; }
.cal-day .dots { display: none; gap: .2em; }
.cal-day .dots i { width: .4667em; height: .4667em; border-radius: 50%; }
.cal-day .dots i.cancelled, .cal-day .dots i.closed { opacity: .35; }
.cal-day .cnt { display: none; }
.cal-day .peek { display: flex; flex-direction: column; gap: .1333em; }
.cal-day .peek span { font-size: .7333em; font-weight: 700; padding: .0909em .3636em; border-radius: .3636em; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-day.today { border: .1333em solid var(--green); }
.cal-day.on { box-shadow: 0 0 0 .2em var(--gold-soft); border-color: var(--gold); }
.cal-day.leave::after, .cal-day.covering::after { content: ""; position: absolute; top: .4em; right: .4em; width: .5333em; height: .5333em; border-radius: 50%; background: var(--red); }
.cal-day.covering::after { background: var(--gold); }
.cal-key { display: flex; flex-wrap: wrap; gap: .4em 1.0667em; margin-top: .6667em; }
.cal-key span { display: inline-flex; align-items: center; gap: .4em; }
.cal-key .k { width: .6154em; height: .6154em; border-radius: 50%; display: inline-block; }
.cal-key .k.leave { background: var(--red); } .cal-key .k.covering { background: var(--gold); } .cal-key .k.today { border: .1538em solid var(--green); }

.term-sum { margin-bottom: .6667em; }
.term-m { margin: 1.0667em 0 .4em; font-size: .8667em; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.term-w { border: thin solid var(--line); border-radius: .8em; margin-top: .4em; background: var(--surface); }
.term-w summary { display: flex; flex-wrap: wrap; align-items: center; gap: .4em .8em; padding: .6667em .8em; cursor: pointer; list-style: none; min-height: 2.9333em; }
.term-w summary::-webkit-details-marker { display: none; }
.term-w summary::before { content: "›"; font-weight: 800; color: var(--muted); transition: transform .15s; }
.term-w[open] summary::before { transform: rotate(90deg); }
.term-w .wk { font-weight: 700; min-width: 7.3333em; }
.term-w .bar { flex: 1 1 4em; height: .4em; border-radius: 99em; background: var(--line); overflow: hidden; min-width: 2.6667em; }
.term-w .bar span { display: block; height: 100%; background: var(--green); border-radius: 99em; }
.term-w .n { font-size: .8667em; color: var(--ink-2); }
.term-days { padding: 0 .8em .6667em; }

ul.plain { list-style: none; margin: 0; padding: 0; }
.leave-row { display: grid; grid-template-columns: 5.3333em minmax(0, 1fr); gap: .3em .8em; padding: .6667em 0; border-top: thin solid var(--line); }
.leave-row:first-child { border-top: 0; }
.leave-row .d strong, .leave-row .w strong { display: block; }
.leave-row .d span, .leave-row .w span { display: block; font-size: .8667em; color: var(--muted); }
.leave-row .a { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: .4em .8em; }
.leave-row .a .link { font-size: .8667em; min-height: 2.1538em; }
.pick { display: flex; align-items: center; gap: .8em; padding: .6667em .8em; border: thin solid var(--line); border-radius: .8em; cursor: pointer; min-height: 3.2em; }
.pick:has(input:checked) { border-color: var(--green); background: var(--green-tint); }
.pick.dim { opacity: .7; }
.pick input { flex: none; width: 1.3333em; height: 1.3333em; accent-color: var(--green); margin: 0; }
.person-grid { align-items: start; }

/* ---------- shared bits for the phone layout (hidden on desktop) ---------- */
.tabbar, .tt-phone { display: none; }
.monogram.sm { width: 2.1333em; height: 2.1333em; border-radius: .5333em; font-size: .8em; }
.setup-meter { width: 14.6667em; }
.sheet-link { display: flex; align-items: center; gap: .8em; min-height: 3.2em; padding: 0 .8em; border-radius: .8em; color: var(--ink); text-decoration: none; font-weight: 600; }
.sheet-link:hover, .sheet-link.on { background: var(--green-soft); color: var(--green-dark); }
.sheet-link svg:last-child { color: var(--faint); }
button.sheet-link { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
button.sheet-link svg:last-child { color: inherit; }

/* Install app: shown only where it's possible (html.can-install is set by app.js) */
html:not(.can-install) [data-install] { display: none !important; }
.install-auth { display: flex; margin: 1.0667em auto 0; }
.install-card { display: flex; align-items: center; gap: 1.0667em; flex-wrap: wrap; border-color: var(--green); background: var(--green-tint); padding: 1.0667em 1.3333em; }
.install-card .monogram { background: var(--green); }
.install-card .grow { min-width: 12em; display: flex; flex-direction: column; gap: .2em; }
.install-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .8em; }
.install-step { display: flex; align-items: center; gap: .8em; }
.install-step svg { vertical-align: -.2em; color: var(--green); }
.install-n { width: 1.8667em; height: 1.8667em; flex: none; border-radius: 50%; background: var(--green-soft); color: var(--green-dark); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }

/* ================= PHONE (up to 56.25em) =================
   One column, a bottom tab bar within thumb reach, bottom sheets instead of centred dialogs,
   touch targets of 2.75em+ and form text at 1em of the browser default (stops iOS zooming into fields). */
@media (max-width: 56.25em) {
  html { -webkit-text-size-adjust: 100%; }
  body { -webkit-tap-highlight-color: transparent; }
  .shell { display: block; }
  .sidebar, .crumbbar { display: none; }

  /* top bar: back · school (tap to switch) · search */
  .topbar { display: flex; align-items: center; gap: .25em; min-height: 3.6em; padding: env(safe-area-inset-top) .5em 0; background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(.8em); backdrop-filter: saturate(1.4) blur(.8em); border-bottom: thin solid var(--line); position: sticky; top: 0; z-index: 30; }
  .topbar .icon-btn { width: 2.9333em; height: 2.9333em; }
  .top-school { flex: 1; min-width: 0; display: flex; align-items: center; gap: .6em; min-height: 2.9333em; padding: 0 .5em; border: 0; border-radius: .8em; background: none; font: inherit; font-weight: 700; color: var(--ink); text-align: left; cursor: pointer; }
  .top-school .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-school:active { background: var(--surface-2); }
  .top-school > svg { color: var(--muted); flex: none; }
  .top-title { padding-left: .5em; font-size: 1.0667em; }

  /* bottom tab bar */
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; padding: .25em calc(.25em + env(safe-area-inset-right)) env(safe-area-inset-bottom) calc(.25em + env(safe-area-inset-left)); background: color-mix(in srgb, var(--surface) 94%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(.8em); backdrop-filter: saturate(1.4) blur(.8em); border-top: thin solid var(--line); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2em; min-height: 3.7333em; padding: .3em 0; border: 0; background: none; font: inherit; color: var(--muted); text-decoration: none; cursor: pointer; }
  .tabbar span { font-size: .7333em; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
  .tabbar svg { width: 1.6em; height: 1.6em; padding: .1333em .8em; box-sizing: content-box; border-radius: 99em; transition: background .15s; }
  .tabbar .on { color: var(--green-dark); }
  .tabbar .on svg { background: var(--green-soft); }

  /* page */
  .main { padding: 1.2em 1.0667em calc(6.6667em + env(safe-area-inset-bottom)); gap: 1.2em; }
  h1 { font-size: 1.6em; }
  h2 { font-size: 1.1333em; }
  .page-head { flex-direction: column; align-items: stretch; gap: .8em; }
  .page-head > .row { flex-wrap: nowrap; overflow-x: auto; margin: 0 -1.0667em; padding: .1333em 1.0667em; scrollbar-width: none; }
  .page-head > .row::-webkit-scrollbar { display: none; }
  .page-head > .row > * { flex: none; }
  .page-head .search-btn { display: none; }
  .eyebrow { font-size: .8667em; }

  /* floating "Add slot" button above the tab bar */
  .btn.fab { position: fixed; right: 1.0667em; bottom: calc(5.0667em + env(safe-area-inset-bottom)); z-index: 36; width: 3.7333em; height: 3.7333em; min-height: 0; padding: 0; border-radius: 50%; box-shadow: 0 .4em 1.2em rgba(14, 122, 95, .35), 0 .1333em .2667em rgba(0, 0, 0, .12); }
  .btn.fab span { position: absolute; width: .0667em; height: .0667em; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .btn.fab svg { width: 1.6em; height: 1.6em; }

  /* cards, grids, stats */
  .card { padding: 1.0667em; border-radius: 1.0667em; }
  .card-head { margin-bottom: .8em; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); gap: 1.0667em; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6667em; }
  .stat { padding: .8em .9333em; border-radius: .9333em; }
  .stat .value { font-size: 1.4667em; }
  .headline { font-size: 1.0667em; }

  /* setup checklist: only the steps left, as compact rows */
  .setup-meter { width: 100%; }
  .checklist { grid-template-columns: minmax(0, 1fr); gap: .5333em; }
  .checklist li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "n t a" "n s a"; align-items: center; column-gap: .8em; row-gap: .1333em; padding: .8em; }
  .checklist li:not(.now):not(.todo) { display: none; }
  .checklist li > .step-num { grid-area: n; }
  .checklist li > strong { grid-area: t; }
  .checklist li > .s { grid-area: s; }
  .checklist li > a { grid-area: a; min-height: 2.9333em; display: inline-flex; align-items: center; white-space: nowrap; }

  /* agenda rows */
  .agenda li { grid-template-columns: 4.5333em minmax(0, 1fr); gap: .4em .8em; padding: .8em 0; }
  .agenda li > .st { grid-column: 2; justify-self: start; }
  .agenda .what { min-height: 2.9333em; }

  /* buttons, chips and forms: thumb-sized */
  .btn.sm { min-height: 2.9333em; }
  .btn { min-height: 2.9333em; }
  .chip.day { width: auto; flex: 1 1 0; min-width: 3.2em; }
  .chip.period { min-width: 0; flex: 1 1 8em; }
  input, select, textarea { font-size: 1.0667em; height: 3.0667em; }
  textarea { height: auto; }
  label.field input, label.field select, label.field textarea { font-size: 1.2308em; }
  .filters { gap: .6667em; }
  .filters label.field { min-width: 0; flex: 1 1 9.3333em; }
  .filters > .btn { flex: 1 1 100%; }
  fieldset.qa { padding: 1.0667em; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .summary, .detail { position: static; }
  .segmented { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .segmented::-webkit-scrollbar { display: none; }
  .segmented button { flex: none; min-height: 2.6667em; }

  /* tables become stacked cards; labels come from the header (data-label set in app.js) */
  .table-wrap.card { background: none; border: 0; box-shadow: none; padding: 0 !important; }
  table.table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tr { background: var(--surface); border: thin solid var(--line); border-radius: .8571em; padding: .7143em .9286em; margin-bottom: .5714em; }
  .table td { display: flex; justify-content: space-between; align-items: center; gap: 1.1429em; padding: .2857em 0; border: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }
  .table td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: .8571em; font-weight: 700; text-align: left; }
  .table td:first-child { display: block; text-align: left; padding-bottom: .4286em; font-size: 1.0714em; }
  .table td:first-child::before, .table td:last-child::before { content: none; }
  .table td:last-child { justify-content: flex-start; padding-top: .5714em; }
  .table td:last-child .row { width: 100%; }
  .table td:last-child .btn { flex: 1 1 0; }
  .table tbody tr:hover td { background: none; }
  /* bell schedule: name on top, start/end side by side, type and remove below */
  .ptable tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4286em .8571em; }
  .ptable td { flex-direction: column; align-items: stretch; gap: .2857em; text-align: left; padding: 0; }
  .ptable td:first-child { grid-column: 1 / -1; padding: 0; }
  .ptable td:nth-child(4) { justify-content: center; }
  .ptable td:last-child { align-items: flex-end; justify-content: center; padding: 0; }
  .table td.small { padding: .3077em 0; }
  .table tr:last-child td { border-bottom: 0; }

  /* school timetable: one day at a time */
  .tt-desktop, .legend { display: none; }
  .tt-phone { display: flex; flex-direction: column; gap: .8em; }
  .day-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: .4em; position: sticky; top: calc(3.6em + env(safe-area-inset-top)); z-index: 5; padding: .4em 0; background: var(--paper); }
  .day-tabs a { display: flex; flex-direction: column; align-items: center; gap: .0667em; min-height: 4.2667em; padding: .4em 0; border: thin solid var(--line); border-radius: .8em; background: var(--surface); color: var(--ink); text-decoration: none; }
  .day-tabs span { font-size: .8em; font-weight: 700; color: var(--muted); }
  .day-tabs strong { font-size: 1.1333em; line-height: 1.2; }
  .day-tabs i { font-style: normal; font-size: .6667em; color: var(--muted); white-space: nowrap; }
  .day-tabs a.today { border-color: var(--green); }
  .day-tabs a.on { background: var(--green); border-color: var(--green); color: #fff; }
  .day-tabs a.on span, .day-tabs a.on i { color: #fff; opacity: .9; }
  .pday { list-style: none; margin: 0; padding: .2667em .9333em; background: var(--surface); border: thin solid var(--line); border-radius: 1.0667em; }
  .pday li + li { border-top: thin solid var(--line); }
  .prow { display: grid; grid-template-columns: 5.0667em minmax(0, 1fr); gap: .8em; align-items: center; padding: .6667em 0; }
  .pt strong { display: block; font-size: .9333em; }
  .pt span { font-size: .8em; color: var(--muted); }
  .pc { display: flex; flex-direction: column; gap: .5333em; min-width: 0; }
  .prow:not(.has) .pc { flex-direction: row; align-items: center; justify-content: space-between; }
  .prow:not(.has) .pt strong { color: var(--ink-2); font-weight: 600; }
  .padd { display: inline-flex; align-items: center; justify-content: center; width: 2.6667em; height: 2.6667em; flex: none; border-radius: .8em; border: .1333em dashed var(--line-2); color: var(--green-dark); }
  .padd:active { background: var(--green-tint); border-color: var(--green); }
  .pband { display: flex; justify-content: space-between; gap: .8em; padding: .5333em .2667em; font-size: .7333em; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
  .tt-slot { padding: .6667em .8em; min-height: 2.9333em; }

  /* person page */
  .person-hero { gap: .8em; }
  .avatar.xl { width: 3.7333em; height: 3.7333em; }
  .who-main h1 { font-size: 1.4667em; }
  .hero-actions { width: 100%; }
  .hero-actions > * { flex: 1 1 0; }
  .reg-week { grid-template-columns: minmax(0, 1fr); gap: .5333em; }
  .reg-day { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .reg-day > strong { flex: 0 0 100%; }
  .reg-day.free { flex-direction: row; justify-content: space-between; align-items: center; padding: .5333em .6667em; }
  .reg-day.free > strong { flex: none; }
  .reg-item { flex: 1 1 14em; }
  .card-head .segmented { width: 100%; }
  .card-head .segmented a { flex: 1 1 0; justify-content: center; }
  .srow { grid-template-columns: 4em minmax(0, 1fr); }
  .srow .r { grid-column: 2; justify-content: flex-start; }
  .cal-day { min-height: 3.4667em; padding: .3333em; align-items: center; }
  .cal-day .peek { display: none; }
  .cal-day .dots { display: flex; flex-wrap: wrap; justify-content: center; }
  .cal-day.leave::after, .cal-day.covering::after { top: .2667em; right: .2667em; }
  .term-w .wk { min-width: 0; }

  /* a person's week */
  .week { grid-template-columns: minmax(0, 1fr); overflow: visible; }
  .day { min-height: 0; }
  .day.empty { flex-direction: row; align-items: center; justify-content: space-between; }
  .day.empty .day-head { border: 0; flex: 1; gap: .8em; justify-content: flex-start; }
  .day.empty .day-body { padding: 0 .9333em; }
  .day.empty .day-body > span { padding: 0 !important; }
  .day.empty .day-head { padding: .8em .9333em; }
  .week-strip a { min-height: 3.7333em; }
  .next-card { padding: 1.2em; border-radius: 1.0667em; }
  .next-card h2 { font-size: 1.4667em; }
  .next-card .row .btn { flex: 1 1 0; }

  /* school setup wizard: steps become a scrollable strip */
  .wizard { gap: 1.0667em; }
  .stepper { flex: 1 1 100%; max-width: none; }
  .stepper ol { flex-direction: row; overflow-x: auto; gap: .4em; scrollbar-width: none; }
  .stepper ol::-webkit-scrollbar { display: none; }
  .stepper a { flex: none; padding: .5333em .8em .5333em .5333em; border: thin solid var(--line); background: var(--surface); }
  .stepper span.s { display: none; }
  .daybar { height: 2.4em; }

  /* insights bars */
  .bars { gap: .4em; height: 10.6667em; }
  .bars-x { gap: .4em; }

  /* dialogs become bottom sheets */
  .modal-backdrop { place-items: end stretch; padding: 0; }
  .modal-backdrop.top { place-items: start stretch; padding: calc(.8em + env(safe-area-inset-top)) .8em 0; }
  .modal { width: 100% !important; max-height: 92%; border-radius: 1.3333em 1.3333em 0 0; animation: sheet-up .22s ease-out; }
  .modal-backdrop.top .modal { border-radius: 1.0667em; animation: none; }
  .modal-head { position: sticky; top: 0; z-index: 2; background: var(--surface); padding: 1.0667em 1.0667em .8em; }
  .modal-head::before { content: ""; position: absolute; top: .4em; left: 50%; width: 2.4em; height: .2667em; margin-left: -1.2em; border-radius: 99em; background: var(--line-2); }
  .modal-body { padding: 1.0667em; }
  .modal-foot { position: sticky; bottom: 0; background: var(--surface); padding: .8em 1.0667em calc(.8em + env(safe-area-inset-bottom)); }
  .modal-foot > * { flex: 1 1 auto; margin: 0 !important; }
  .detail dl, .modal dl { grid-template-columns: 5.3333em minmax(0, 1fr); }
  .palette input { font-size: 1.0667em; }

  #toast { bottom: calc(5.3333em + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 2.1333em); text-align: center; }
  .auth { align-items: start; padding-top: 10%; }
  .auth .card { padding: 1.6em 1.3333em; }
  .empty { padding: 1.6em .8em; }
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .modal { animation: none !important; } }

/* ---------- printable sheets (always light, like paper) ---------- */
.tt-sheets { display: flex; flex-direction: column; gap: 1.6em; }
.tt-sheet { --ink: #10201A; --soft: #5C6D63; --line: #E3EAE4; --wash: #F2F7F4; background: #fff; color: var(--ink); border-radius: 1.0667em; overflow: hidden; border: thin solid var(--line); box-shadow: 0 .1333em .4em rgba(16,32,26,.06), 0 .8em 2.1333em rgba(16,32,26,.06); }
.tt-head { display: flex; justify-content: space-between; gap: 1.3333em; padding: 1.4667em 1.7333em; color: #fff; background: #0C1512; position: relative; }
.tt-head::after { content: ""; position: absolute; inset: auto 0 0 0; height: .3333em; background: linear-gradient(90deg, #2563EB, #7C3AED, #C47A08); }
.tt-eyebrow { font-size: .7333em; letter-spacing: .14em; text-transform: uppercase; color: #A9BAB0; font-weight: 700; }
.tt-title { font-size: 1.7333em; margin: .1538em 0 .3077em; color: #fff; line-height: 1.15; }
.tt-lines { display: flex; flex-wrap: wrap; gap: .3077em 1.2308em; font-size: .8667em; color: #E9F2ED; }
.tt-head-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: .6667em; }
.tt-big { font-size: 2.9333em; font-weight: 800; line-height: 1; letter-spacing: -.02em; color: #fff; }
.tt-big small { font-size: .3182em; font-weight: 600; color: #A9BAB0; letter-spacing: 0; }
.tt-chips { display: flex; flex-wrap: wrap; gap: .4em; justify-content: flex-end; }
.tt-chips span { background: rgba(255,255,255,.1); border: thin solid rgba(255,255,255,.22); padding: .25em .8333em; border-radius: 83.25em; font-size: .8em; font-weight: 600; white-space: nowrap; }
.tt-grid { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: .8333em; }
.tt-grid thead th { background: var(--wash); color: var(--soft); text-transform: uppercase; letter-spacing: .08em; font-size: .88em; padding: .9091em .7273em; border-bottom: thin solid var(--line); }
.tt-grid thead th:first-child { width: 9.44em; }
.tt-grid tbody th { text-align: left; padding: .64em .96em; background: var(--wash); border-right: thin solid var(--line); border-bottom: thin solid var(--line); vertical-align: middle; }
.tt-grid tbody th b { display: block; font-size: 1.04em; color: var(--ink); }
.tt-grid tbody th small { color: var(--soft); font-size: .84em; display: block; line-height: 1.35; }
.tt-grid td { padding: .4em; border-bottom: thin solid var(--line); border-right: thin solid var(--line); vertical-align: top; height: 4.64em; }
.tt-grid td:last-child { border-right: 0; }
.tt-grid tbody tr:last-child > * { border-bottom: 0; }
.tt-school { display: block; color: #B9C4BD; font-size: .88em; text-align: center; padding-top: 1.6364em; }
.tt-band th, .tt-band td { background: #F4F9F5 !important; height: auto !important; }
.tt-band td { text-align: center; color: var(--soft); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: .88em; vertical-align: middle !important; }
.tt-sheet .tt-slot { cursor: default; background: var(--t); border: 0; border-left: .32em solid var(--c); border-radius: .64em; padding: .48em .64em; }
.tt-sheet .tt-slot + .tt-slot { margin-top: .32em; }
.tt-slot-top { display: flex; justify-content: space-between; gap: .48em; align-items: baseline; }
.tt-slot-top strong { color: var(--c); font-size: 1.04em; filter: brightness(.8); }
.tt-room { font-size: .84em; font-weight: 700; background: #fff; color: var(--ink); border-radius: .381em; padding: 0 .4762em; border: thin solid var(--line); white-space: nowrap; }
.tt-sub, .tt-people { color: var(--ink); font-size: .92em; }
.tt-ta { color: var(--soft); }
.tt-people + .tt-people { margin-top: .0833em; }
.tt-role.ta { background: transparent; color: var(--c); border: thin solid var(--c); }
.tt-mine { font-weight: 700; }
.tt-time { color: var(--soft); font-size: .84em; }
.tt-role { display: inline-block; font-size: .76em; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; background: var(--c); color: #fff; border-radius: .4211em; padding: 0 .5263em; margin-right: .5263em; }
.tt-empty { text-align: center; color: var(--soft); padding: 2.4em !important; }
.tt-schools { display: grid; grid-template-columns: repeat(auto-fit, minmax(14.6667em, 1fr)); gap: .6667em; padding: .9333em 1.3333em 0; }
.tt-schools div { display: flex; flex-direction: column; font-size: .8em; color: var(--soft); border: thin solid var(--line); border-radius: .8333em; padding: .6667em 1em; }
.tt-schools strong { color: var(--ink); font-size: 1.0833em; }
.tt-foot { display: flex; justify-content: space-between; align-items: center; gap: 1.0435em; flex-wrap: wrap; padding: 1.0435em 1.7391em 1.2174em; font-size: .7667em; color: var(--soft); }
.tt-legend { display: flex; gap: .8em; flex-wrap: wrap; }
.tt-legend span { display: inline-flex; align-items: center; gap: .4em; font-weight: 600; color: var(--ink); }
.tt-legend i { width: .8em; height: .8em; border-radius: .2em; display: inline-block; }
@media (max-width: 56.25em) { .tt-sheet { overflow-x: auto; } .tt-grid { min-width: 48em; } .tt-head { flex-direction: column; } .tt-head-side { align-items: flex-start; text-align: left; } .tt-chips { justify-content: flex-start; } }
@media print {
  @page { size: A4 landscape; margin: 8mm; }
  body { background: #fff !important; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  .sidebar, .topbar, .crumbbar, .no-print, #toast, #modal-root { display: none !important; }
  .shell { display: block; }
  .main { padding: 0 !important; max-width: none; }
  .tt-sheets { gap: 0; }
  .tt-sheet { box-shadow: none; border-radius: .6667em; break-after: page; page-break-after: always; break-inside: avoid; }
  .tt-sheet:last-child { break-after: auto; page-break-after: auto; }
  .tt-grid td { height: 3.84em; }
}
.plain-fs { border: 0; margin: 0; padding: 0; min-width: 0; }

/* ================= MOTION =================
   Short, quiet and functional: 150–240ms, ease-out (cubic-bezier(.2,.8,.2,1)). Pages: View Transitions on <main> only
   (the frame stays still). Everything here is skipped when the device asks for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  #main { view-transition-name: page; }
  /* The frame doesn't move: no whole-page cross-fade, only the nav highlight changes. */
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  ::view-transition-group(page) { animation-duration: .24s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
  ::view-transition-old(page) { animation: vt-out .14s ease-in both; }
  ::view-transition-new(page) { animation: vt-in-up .24s cubic-bezier(.2, .8, .2, 1) both; }
  html[data-nav="back"]::view-transition-new(page) { animation-name: vt-in-back; }
  html[data-nav="section"]::view-transition-old(page) { animation: vt-fade-out .12s ease-in both; }
  html[data-nav="section"]::view-transition-new(page) { animation: vt-fade-in .2s ease-out both; }

  /* Controls respond smoothly. */
  .btn, .chip, .icon-btn, .link, .nav a, .tabbar a, .tabbar button, .segmented button, .segmented a, .day-tabs a, .week-strip a,
  .tt-slot, .tt-add, .srow, .pick, .cal-day, .sheet-link, .school-switch, .back-btn, .act-go, .stepper a, .term-w summary,
  input, select, textarea {
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, opacity .15s ease, transform .15s ease;
  }
  .tt-slot:hover, .srow:hover { transform: translateY(-.0667em); }
  .btn:active, .chip:active, .tabbar a:active, .tabbar button:active { transform: scale(.98); }
  .term-w[open] .term-days { animation: vt-fade-in .2s ease-out both; }

  /* Notifications slide up; dialogs pop in on desktop (phones keep their bottom-sheet slide). */
  #toast:not(.hidden) { animation: toast-in .22s cubic-bezier(.2, .8, .2, 1) both; }
  .modal-backdrop { animation: vt-fade-in .16s ease-out both; }
}
@media (prefers-reduced-motion: no-preference) and (min-width: 56.3125em) {
  .modal { animation: modal-pop .2s cubic-bezier(.2, .8, .2, 1) both; }
}
@keyframes vt-out { to { opacity: 0; transform: translateY(-.25em); } }
@keyframes vt-in-up { from { opacity: 0; transform: translateY(.6em); } }
@keyframes vt-in-back { from { opacity: 0; transform: translateX(-1.2em); } }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; } }
@keyframes modal-pop { from { opacity: 0; transform: translateY(.5em) scale(.98); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, .8em); } }
@media (prefers-reduced-motion: reduce) {
  *, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; transition: none !important; }
}
