/* Chalkline console. Glass on the chrome, solid surfaces under dense data —
   a register with 30 rows is not the place for a blur. */
:root{
  --ground:#EDF0EC; --surface:#FFFFFF; --surface-2:#F5F8F4;
  --ink:#16211C; --ink-2:#46564D; --ink-3:#6E7F76;
  --line:#D6DED8; --line-2:#E5EAE6;
  --accent:#0E7A63; --accent-soft:#DDEEE8; --accent-line:#8CC9B8;
  /* chart + status inks: validated together (lightness band, chroma floor,
     CVD separation, normal-vision floor, contrast) against a white surface */
  --mark:#0B8F70; --amber:#8A6410; --amber-soft:#F7EED9;
  --rose:#9C332B; --rose-soft:#F7E4E1;
  --blue:#0F6BB5; --blue-soft:#DFEAF3;
  --board:#16241F;
  --sans:ui-sans-serif,system-ui,'DejaVu Sans',sans-serif;
  --mono:ui-monospace,'DejaVu Sans Mono',monospace;
  --ar:'FreeSerif','DejaVu Sans',serif;
  --glass-fill:rgba(255,255,255,.16); --glass-line:rgba(255,255,255,.28);
  --glass-shadow:0 14px 34px rgba(8,26,20,.28);
  --page:1120px;
  /* One height for everything that stands on a toolbar line. Left to their own
     devices a text input came out 29px, a native date input 31px and a button
     32px, so a filter bar was three different heights bottom-aligned against
     each other and the labels above them sat on three different baselines. */
  --ctl-h:32px;
}
@media (pointer:coarse){
  /* The fields float to 16px on touch to stop iOS zooming; the row has to grow
     with them, and 40px is a thumb rather than a pencil. */
  :root{ --ctl-h:40px; }
}
*{box-sizing:border-box;-webkit-font-smoothing:antialiased}
html,body{height:100%}
body{margin:0;font-family:var(--sans);color:var(--ink);background:var(--ground);font-size:13.5px}
.ar{font-family:var(--ar);direction:rtl;unicode-bidi:isolate}
.mono{font-family:var(--mono)}
.dim{color:var(--ink-3)}
.grow{flex:1}
.spacer{flex:1}
.hidden{display:none}
button{font:inherit;color:inherit}
a{color:var(--accent)}

.ambient{background:
  radial-gradient(58% 42% at 14% 8%,#3AA98C 0%,transparent 62%),
  radial-gradient(52% 38% at 88% 16%,#2E7BB8 0%,transparent 64%),
  radial-gradient(70% 46% at 62% 96%,#1B4A3D 0%,transparent 66%),
  #10322A}
.glass{backdrop-filter:blur(20px) saturate(1.3);-webkit-backdrop-filter:blur(20px) saturate(1.3);
  background:var(--glass-fill);border:1px solid var(--glass-line);box-shadow:var(--glass-shadow)}

/* ---------------------------------------------------------------- sign in */
/* Its own class, not `.card`: the stat card further down this file paints an
   opaque white background, and reusing the name made the glass panel solid and
   its white text invisible. */
#signin{position:fixed;inset:0;display:grid;place-items:center}
#signin .signin-card{width:380px;border-radius:14px;padding:26px 24px;color:#fff}
#signin h1{margin:0 0 2px;font-size:20px;letter-spacing:-.01em}
#signin .sub{font-size:12px;color:rgba(255,255,255,.72);margin-bottom:20px}
#signin label{display:block;font-size:10.5px;letter-spacing:.09em;text-transform:uppercase;
  color:rgba(255,255,255,.7);margin:14px 0 5px;font-family:var(--mono)}
#signin input{width:100%;padding:9px 11px;border-radius:8px;border:1px solid rgba(255,255,255,.28);
  background:rgba(255,255,255,.12);color:#fff;font-size:13.5px;outline:none}
#signin input:focus{border-color:rgba(255,255,255,.6)}
#signin button:not(.eye){width:100%;margin-top:20px;padding:10px;border-radius:8px;border:0;cursor:pointer;
  background:#fff;color:#10322A;font-weight:600}
/* the reveal eye must not inherit the card's full-width button styling.
   The password input has a pale background, so a light grey reads; white did not. */
#signin .pwfield .eye{color:#9aa1ab}
#signin .pwfield .eye:hover{color:#5b626c}
#signin .err{margin-top:12px;font-size:12px;color:#FFD9D4;min-height:16px}
#signin .legal-links{margin-top:6px;font-size:12px;text-align:center;color:rgba(255,255,255,.7)}
#signin .legal-links a{color:rgba(255,255,255,.85)}
.brandmark{width:26px;height:26px;border-radius:7px;background:linear-gradient(135deg,#3AA98C,#0E7A63);
  display:inline-grid;place-items:center;color:#fff;font-weight:700;font-size:13px;margin-bottom:12px}
.brandmark.small{width:22px;height:22px;font-size:11px;margin:0}

/* ------------------------------------------------------------------ shell */
#app{display:none;grid-template-rows:auto minmax(0,1fr);height:100%}
.topbar{display:flex;align-items:center;gap:12px;padding:0 18px;height:52px;color:#fff;position:relative}
.topbar .name{font-weight:600;letter-spacing:-.01em}
.topbar .ctx{font-family:var(--mono);font-size:11px;color:rgba(255,255,255,.72)}
.chip{display:inline-flex;align-items:center;gap:8px;padding:4px 10px;border-radius:999px;
  border:1px solid rgba(255,255,255,.3);background:rgba(255,255,255,.14);font-size:12px}
.avatar{width:24px;height:24px;border-radius:50%;background:rgba(255,255,255,.25);display:grid;
  place-items:center;font-size:10.5px;font-family:var(--mono)}
/* `.linkbtn` alone is white, for the dark topbar. On a white panel it needs
   `.dark` (muted ink) or `.danger` (for the one action that removes something). */
.linkbtn{background:none;border:0;cursor:pointer;font-size:12px;color:rgba(255,255,255,.8)}
.linkbtn.dark{color:var(--ink-3)}
.linkbtn.danger{color:var(--rose)}
.linkbtn.danger:hover{text-decoration:underline}
/* A person's name in a table that opens their record: reads as the name, in the
   table's own size, and shows itself a link on hover. */
.linkbtn.namelink{color:var(--accent);font-size:inherit;padding:0;text-align:start}
.linkbtn.namelink:hover{text-decoration:underline}

/* Icon-only action buttons: a square hit-area with a soft hover, in place of
   the old text labels (Edit / Deactivate / Remove …). The title/aria-label at
   the call site carries the meaning. */
.iconbtn{display:inline-flex;align-items:center;justify-content:center;padding:3px;border-radius:6px;line-height:0}
.linkbtn.iconbtn:hover{background:rgba(0,0,0,.06);text-decoration:none}
.linkbtn.danger.iconbtn:hover{background:rgba(220,60,90,.12);text-decoration:none}
.btn.iconbtn{padding:6px 8px}
.iconbtn .ico{display:block}

.body{display:grid;grid-template-columns:206px minmax(0,1fr);min-height:0}
.nav{background:#16241F;padding:10px 8px 24px;display:flex;flex-direction:column;gap:1px;overflow:auto}
.nav a{display:flex;align-items:center;gap:9px;padding:7px 10px;border-radius:8px;color:rgba(255,255,255,.72);
  text-decoration:none;font-size:13px;cursor:pointer}
.nav a:hover{background:rgba(255,255,255,.07);color:#fff}
.nav a.on{background:rgba(255,255,255,.13);color:#fff}
.nav .grp{font-family:var(--mono);font-size:10px;letter-spacing:.1em;text-transform:uppercase;
  color:rgba(255,255,255,.4);padding:14px 10px 6px}
.nav .ico{flex:none;opacity:.78}
.nav a.on .ico,.nav a:hover .ico{opacity:1}
/* Future-dated assessments waiting for this person (#3.3). Rides the label on
   desktop; corners the icon on the phone tab bar. */
.nav a{position:relative}
.nav-badge{margin-left:auto;min-width:18px;height:18px;padding:0 5px;border-radius:9px;
  background:var(--accent,#2E9E86);color:#fff;font-family:var(--mono);font-size:10.5px;
  display:inline-flex;align-items:center;justify-content:center;line-height:1}
@media (max-width:743.98px){
  .nav-badge{position:absolute;top:2px;right:calc(50% - 20px);margin:0}
}
/* The Upcoming Tests strip at the top of the Assessments tab. Horizontally
   scrolling cards, so a long list never pushes the marking table down. */
.upcoming-strip{display:flex;gap:10px;overflow-x:auto;padding:2px 0 4px}
.upcoming-card{flex:0 0 auto;display:flex;align-items:flex-start;gap:8px;
  min-width:180px;max-width:260px;padding:9px 12px;border:1px solid var(--line,#e3e3df);
  border-radius:10px;background:var(--card,#fff)}
.upcoming-card .up-dot{flex:none;width:9px;height:9px;border-radius:50%;margin-top:5px}

/* The content is a centred column, not a left-hugging one — on a wide screen a
   full-bleed table is a ruler you have to follow with a finger. */
main{overflow:auto;min-width:0;padding:34px 36px 64px}
.wrap{max-width:var(--page);margin:0 auto}

.pagehead{display:flex;align-items:flex-end;gap:16px;margin-bottom:10px}
.pagehead-actions{display:flex;gap:8px;margin-left:auto}
h2.page{margin:0 0 3px;font-size:20px;letter-spacing:-.015em}
.page-sub{color:var(--ink-3);font-size:12.5px;max-width:70ch}
.hint{color:var(--ink-3);font-size:12px;padding:10px 15px}

.bar{display:flex;gap:10px;align-items:flex-end;flex-wrap:wrap;margin-bottom:14px}
/* Reusable responsive toolbar system (shared, so screens stop reinventing it in
   inline styles). Desktop: search/filters left, actions pushed right. Mobile:
   everything stacks full-width, actions on their own row, buttons content-sized. */
.page-toolbar{display:flex;gap:10px;align-items:flex-end;flex-wrap:wrap;margin-bottom:14px}
.toolbar-primary{flex:1 1 260px;min-width:200px}
.toolbar-primary input,.toolbar-primary .combo{width:100%}
.toolbar-filters{display:flex;gap:8px;flex-wrap:wrap;align-items:flex-end}
.toolbar-actions{margin-left:auto;display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.toolbar-actions .btn{flex:0 0 auto}
.mobile-full{}
/* Overflow menu: inline on desktop, a dropdown behind "More ▾" on mobile. */
.moremenu{position:relative;display:inline-flex}
.moremenu-items{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.moremenu-btn{display:none}
@media (max-width:743.98px){
  .page-toolbar{display:flex;flex-direction:column;align-items:stretch;gap:10px}
  .toolbar-primary,.toolbar-filters,.toolbar-actions{width:100%}
  .toolbar-actions{margin-left:0;justify-content:flex-start}
  .toolbar-filters > *{flex:1 1 44%;min-width:0}
  .mobile-full{flex:1 1 100% !important;width:100%}
  .mobile-auto{flex:0 0 auto !important}
  .moremenu-btn{display:inline-flex}
  .moremenu-items{position:absolute;right:0;top:calc(100% + 6px);flex-direction:column;align-items:stretch;
    min-width:210px;background:var(--surface,#fff);border:1px solid var(--line,#e5e5ee);border-radius:12px;
    box-shadow:0 12px 34px rgba(0,0,0,.2);padding:8px;z-index:60}
  .moremenu:not(.open) .moremenu-items{display:none}
  .moremenu-items > .btn{width:100%;justify-content:flex-start}
}
.inline-field{display:flex;flex-direction:column;gap:4px}
.inline-field > span{font-family:var(--mono);font-size:10px;letter-spacing:.08em;
  text-transform:uppercase;color:var(--ink-3)}
input[type=text],input[type=date],input[type=search],input[type=number],input[type=password]{
  padding:6px 9px;border-radius:8px;border:1px solid var(--line);background:var(--surface);
  font-size:13px;outline:none;color:var(--ink);height:var(--ctl-h)}
input:focus{border-color:var(--accent-line)}
input.file{padding:5px;font-size:12px;max-width:230px}
/* iOS Safari force-zooms the page whenever a focused field is under 16px, and
   does not zoom back when the keyboard closes — which throws off the layout.
   On touch devices only, float the focusable fields up to 16px so focus never
   triggers the zoom; desktop keeps its denser 13px. */
@media (pointer: coarse){
  input[type=text],input[type=date],input[type=search],input[type=number],
  input[type=password],.combo-input,#signin input{font-size:16px}
}
.btn{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border-radius:8px;
  border:1px solid var(--line);background:var(--surface);min-height:var(--ctl-h);
  cursor:pointer;font-size:12.5px;white-space:nowrap}
.btn .ico{flex:0 0 auto}
/* a password input with a reveal eye overlaid on its right edge */
.pwfield{position:relative;display:flex;align-items:center;width:100%}
.pwfield input{flex:1;width:100%;padding-right:34px}
.pwfield .eye{position:absolute;right:6px;top:50%;transform:translateY(-50%);
  border:0;background:none;cursor:pointer;color:#6b7280;padding:4px;line-height:0;
  display:inline-flex;align-items:center;justify-content:center;border-radius:6px}
.pwfield .eye:hover{color:#111}
/* the multi-select roll on Fee setup: filter, tick, assign to many at once */
/* The assign panel holds form controls, not a full-bleed table, so its body is
   inset from the panel walls the way the header is. */
/* Assign: the exceptions, in the drawer the Options link opens. The bar above
   it is the shared `.bar`, so nothing here restates its spacing. */
.assignopts{display:flex;align-items:flex-end;gap:10px;flex-wrap:wrap;
  padding:12px 14px;margin-bottom:14px;border:1px solid var(--line-2);
  border-radius:10px;background:var(--surface-2)}
.assignopts[hidden]{display:none}

/* Assigned: one table, with the fee spanning a row of its own between the
   groups. Tinted rather than grey, because grey is what the column-header band
   is and two grey bands read as two headers. */
.cagroup-row > td{background:var(--accent-soft);border-bottom-color:var(--accent-line)}
.cagroup-row:not(:first-child) > td{border-top:1px solid var(--accent-line)}
.cagroup-name{font-weight:600;color:#0A5A49}
/* The tick column is as wide as a tick and no wider. */
th.ca-tick,td.ca-tick{width:1%;padding-right:0;white-space:nowrap}
td.ca-tick input,th.ca-tick input{margin:0;vertical-align:middle}
@media (max-width:743.98px){
  .assignopts > *{flex:1 1 100%;min-width:0}
  .assignopts input{width:100%!important}
  /* A row a thumb taps needs the height of one. */
  .tablewrap td.ca-tick,.tablewrap td.ca-tick + td{padding-block:12px}
}
.assignhead{display:flex;align-items:center;gap:12px;margin:8px 0 10px}
.assignhead .selall{display:inline-flex;align-items:center;gap:5px;font-size:12.5px;cursor:pointer}
.picklist{border:1px solid var(--line);border-radius:8px;max-height:360px;overflow:auto}
.pickrow{display:flex;align-items:center;gap:10px;padding:7px 12px;border-bottom:1px solid var(--line);
  cursor:pointer;margin:0}
.pickrow:last-child{border-bottom:0}
.pickrow:hover{background:rgba(0,0,0,.03)}
.pickrow input[type=checkbox]{flex:0 0 auto;margin:0}
.assignhead .count{font-size:12px}
.empty.pad{padding:26px 0}
.btn:hover{border-color:var(--accent-line)}
.btn.primary{background:var(--accent);border-color:var(--accent);color:#fff}
.btn.primary:hover{filter:brightness(1.06)}
.btn[disabled]{opacity:.45;cursor:not-allowed}

/* ------------------------------------------------------- searchable dropdown */
.combo{position:relative;display:inline-flex;align-items:center;min-width:150px}
.combo-input{width:100%;padding:6px 24px 6px 9px;border-radius:8px;border:1px solid var(--line);
  height:var(--ctl-h);
  background:var(--surface);font-size:13px;outline:none;color:var(--ink);font-family:inherit}
.combo.open .combo-input{border-color:var(--accent-line)}
.combo-caret{position:absolute;right:8px;font-size:9px;color:var(--ink-3);cursor:pointer;user-select:none}
.combo-list{position:fixed;z-index:90;max-height:260px;overflow:auto;background:var(--surface);
  border:1px solid var(--line);border-radius:10px;box-shadow:0 12px 28px rgba(8,26,20,.16);padding:4px}
.combo-opt > span:first-child{flex:1;min-width:0}
.combo-opt{display:flex;align-items:center;gap:8px;padding:6px 9px;border-radius:7px;cursor:pointer;
  font-size:13px}
.combo-opt.on{background:var(--surface-2)}
.combo-opt.sel{color:var(--accent);font-weight:600}
.combo-hint{margin-left:auto;flex-shrink:0;white-space:nowrap;font-family:var(--mono);font-size:10.5px;color:var(--ink-3)}
.combo-empty{padding:8px 9px;color:var(--ink-3);font-size:12.5px}
/* A vertical tick list inside a sheet — the leave form's "which children". */
.checkset{display:flex;flex-direction:column;gap:4px;border:1px solid var(--line);
  border-radius:9px;padding:6px}
.checkrow{display:flex;align-items:center;gap:10px;padding:8px 9px;border-radius:7px;
  cursor:pointer;font-size:13px}
.checkrow:hover{background:var(--surface-2)}
.checkrow input{flex:none}
.combo.on-dark .combo-input{background:transparent;border:0;color:#fff;padding-left:0}
.combo.on-dark .combo-caret{color:rgba(255,255,255,.75)}
.combo.on-dark .combo-opt{color:var(--ink)}

/* ------------------------------------------------------------------- panels */
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px;margin-bottom:18px}
.card{background:var(--surface);border:1px solid var(--line-2);border-radius:12px;padding:14px 15px}
.card .k{font-family:var(--mono);font-size:10px;letter-spacing:.09em;text-transform:uppercase;color:var(--ink-3)}
.card .v{font-size:26px;letter-spacing:-.02em;margin-top:6px}
.card .n{font-size:11.5px;color:var(--ink-3);margin-top:2px}

.panel{background:var(--surface);border:1px solid var(--line-2);border-radius:12px;overflow:hidden}
/* a second heading inside one panel: the statement's receipts under its fees */
.statement-sub{font-family:var(--mono);font-size:10px;letter-spacing:.09em;text-transform:uppercase;
  color:var(--ink-3);padding:12px 15px 6px;border-top:1px solid var(--line-2);background:var(--surface-2)}
.panel > header{padding:11px 15px;border-bottom:1px solid var(--line-2);display:flex;
  align-items:center;gap:10px;font-weight:600;font-size:13px}
.chips{display:flex;flex-wrap:wrap;gap:6px;padding:13px 15px}

/* Long tables get their own scrollbar rather than pushing the whole page down:
   the sticky header stays put while the body scrolls inside the panel. */
.tablewrap{overflow:auto;max-height:68vh}
/* A table wider than its panel is scrolled sideways, and on a touch screen
   there is no scrollbar to say so — the row simply looks cut off and the
   buttons past the edge look missing. These two shadows are painted on the
   wrapper and pinned to the scroll area (`local`), so each one shows only
   while there is still something to scroll to on that side, and fades out at
   the end. Pure CSS: nothing to keep in step with the scroll position. */
.tablewrap{
  background-image:
    radial-gradient(farthest-side at 0 50%, rgba(8,26,20,.14), rgba(8,26,20,0)),
    radial-gradient(farthest-side at 100% 50%, rgba(8,26,20,.14), rgba(8,26,20,0)),
    linear-gradient(to right, var(--surface), rgba(255,255,255,0)),
    linear-gradient(to left, var(--surface), rgba(255,255,255,0));
  background-position:left center,right center,left center,right center;
  background-repeat:no-repeat;
  background-size:13px 100%,13px 100%,26px 100%,26px 100%;
  background-attachment:scroll,scroll,local,local;
}
table{width:100%;border-collapse:collapse;font-size:12.5px}
th{text-align:left;font-family:var(--mono);font-size:10px;letter-spacing:.08em;text-transform:uppercase;
  color:var(--ink-3);padding:9px 12px;border-bottom:1px solid var(--line-2);background:var(--surface-2);
  position:sticky;top:0;white-space:nowrap}
td{padding:8px 12px;border-bottom:1px solid var(--line-2);vertical-align:middle}
/* Only where there is a pointer to hover with. On a touch screen :hover latches
   on after a tap and leaves a row highlighted that nobody is pointing at — and
   its opaque background hides the scroll shadow the wrapper paints behind. */
@media (hover:hover){ tbody tr:hover{background:var(--surface-2)} }
.num{text-align:right;font-family:var(--mono)}
td:has(.num){text-align:right}
/* A numeric column right-aligns its header too, so label and figures line up. */
th.num{text-align:right}
th.filtered{color:var(--accent)}
/* The funnel that opens a numeric column's range filter, sitting in the header. */
th .colfilter{display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;
  margin-left:5px;padding:1px;border:none;background:none;color:var(--ink-3);cursor:pointer;border-radius:5px}
th .colfilter:hover{background:var(--surface);color:var(--ink)}
th .colfilter.on{color:var(--accent)}
/* A min/max range filter popover (reuses the column-menu chrome). */
.numfilter{min-width:210px;padding:10px}
.numfilter-row{display:flex;align-items:center;gap:8px}
.numfilter-row input{width:80px}
.numfilter-actions{display:flex;justify-content:space-between;align-items:center;margin-top:10px}
/* Shared column funnel menu: sort rows, a separator, then a filter control. */
.thlabel{cursor:pointer;display:inline-flex;align-items:baseline}
.sortarrow{font-size:9px;margin-left:2px}
.colmenu-sep{height:1px;background:var(--line-2);margin:5px 4px}
.colmenu .btnrow{width:100%;text-align:left;background:none;border:none;cursor:pointer;
  font-size:13px;color:var(--ink);font-family:inherit}
.colmenu .btnrow:hover{background:var(--surface-2)}
.colmenu .numfilter{min-width:0}
.colmenu .numfilter > input[type=search]{width:100%;margin-bottom:8px}
/* A centre-aligned column (header and cells together). */
th.ta-c{text-align:center}
.ta-c{text-align:center}
td:has(.ta-c){text-align:center}

@media (max-width:743.98px){
  /* A panel title and the controls on its right share one line until the title
     needs two — then they interleave and the heading reads as part of the
     button beside it. Given a row of their own, each is one thing again. */
  .panel > header{flex-wrap:wrap;row-gap:8px}
  .panel > header > .spacer{display:none}
  /* A table that scrolls up and down inside a page that also scrolls up and
     down traps the thumb: the flick that meant to move the page moves the rows
     instead. On a phone the table is as tall as it needs to be and the page
     does the scrolling — sideways stays with the table, where it belongs. */
  .tablewrap{max-height:none;overflow-y:visible}
  /* Keep the sideways scrollbar drawn rather than fading it out, so the bar is
     a second signal next to the edge shadow. */
  .tablewrap{scrollbar-width:thin}
  .tablewrap::-webkit-scrollbar{height:7px;-webkit-appearance:none}
  .tablewrap::-webkit-scrollbar-thumb{background:var(--line-2);border-radius:999px}
  /* The funnel is the whole of a column's sort and filter menu, and at 16px it
     is a quarter of the 44px a thumb needs. */
  th .colfilter{padding:9px;margin-left:1px}
}

.pill{display:inline-flex;align-items:center;gap:5px;font-family:var(--mono);font-size:10.5px;
  padding:2px 7px;border-radius:999px;border:1px solid var(--line);color:var(--ink-2);background:var(--surface)}
.pill i{font-style:normal;opacity:.75}
.pill.present{background:var(--accent-soft);border-color:var(--accent-line);color:#0A5A49}
.pill.absent{background:var(--rose-soft);border-color:#E1A9A2;color:var(--rose)}
.pill.late{background:var(--amber-soft);border-color:#DCC38A;color:var(--amber)}
.pill.excused{background:var(--blue-soft);border-color:#A9C6DC;color:var(--blue)}
.notice{background:var(--amber-soft);border:1px solid #DCC38A;color:var(--amber);border-radius:10px;
  padding:9px 11px;font-size:12px;margin-bottom:12px}
.empty{padding:34px;text-align:center;color:var(--ink-3);font-size:13px}

/* -------------------------------------------------------------------- chart */
/* One measure, one hue. No legend for a single series; every bar is directly
   labelled, so nothing is carried by colour alone. */
.chart{padding:12px 15px 15px}
.chart-row{display:flex;align-items:center;gap:10px;padding:4px 0}
.chart-label{font-size:11.5px;color:var(--ink-2);min-width:52px}
.chart-track{position:relative;flex:1;height:14px;background:var(--surface-2);border-radius:3px;
  overflow:hidden}
.chart-bar{display:block;height:100%;background:var(--mark);border-radius:0 4px 4px 0}
.chart-bar.under{background:var(--amber)}
.chart-target{position:absolute;top:-2px;bottom:-2px;width:2px;background:var(--ink-3);opacity:.55}
.chart-value{font-size:11.5px;color:var(--ink-2);min-width:52px;text-align:right}

/* --------------------------------------------------------------- register */
.focus{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:16px}
.stage{background:var(--surface);border:1px solid var(--line-2);border-radius:14px;padding:24px;
  display:flex;flex-direction:column;align-items:center;min-height:440px}
.portrait{width:132px;height:132px;border-radius:50%;border:3px solid var(--line-2);
  background:var(--surface-2);display:grid;place-items:center;font-size:38px;color:var(--ink-3);
  font-family:var(--mono)}
.stage .roll{margin-top:14px;font-family:var(--mono);font-size:12px;color:var(--ink-3);letter-spacing:.06em}
.stage .who{font-size:23px;letter-spacing:-.02em;margin-top:3px}
.stage .who-ar{font-size:15px;color:var(--ink-2);margin-top:2px}
.marks{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;width:100%;max-width:520px;margin-top:24px}
.mark{padding:14px 8px;border-radius:12px;border:1px solid var(--line);background:var(--surface-2);
  cursor:pointer;text-align:center}
.mark .lbl{font-size:13px;font-weight:600}
.mark .key{font-family:var(--mono);font-size:10px;color:var(--ink-3);margin-top:3px}
.mark:hover{border-color:var(--accent-line)}
/* Selected reads as a solid fill, not a tint — the chosen status is the one
   thing on the card that must be unmistakable at a glance. */
.mark.sel-present{background:var(--accent);border-color:var(--accent);color:#fff}
.mark.sel-absent{background:var(--rose);border-color:var(--rose);color:#fff}
.mark.sel-late{background:var(--amber);border-color:var(--amber);color:#fff}
.mark.sel-excused{background:var(--blue);border-color:var(--blue);color:#fff}
.mark[class*=sel-] .key{color:inherit;opacity:.8}
/* End of the run: two big actions in the four-button slot. */
.endbtns{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;width:100%;max-width:520px;margin-top:24px}
.btn.big{padding:14px 8px;border-radius:12px;font-size:14px;font-weight:600}
.stepper{display:flex;gap:8px;margin-top:16px}
.progress{width:100%;max-width:520px;margin-top:auto;padding-top:22px}
.track{height:4px;border-radius:2px;background:var(--line-2);overflow:hidden}
.track > i{display:block;height:100%;background:var(--accent)}
.progress .meta{display:flex;justify-content:space-between;font-family:var(--mono);font-size:11px;
  color:var(--ink-3);margin-top:7px}
.queue{font-size:12px;color:var(--ink-2);padding:4px 14px 12px}
.queue .row{display:flex;justify-content:space-between;gap:8px;padding:6px 0;border-bottom:1px solid var(--line-2)}
.markset{display:flex;gap:4px}
.chipbtn{width:26px;height:26px;border-radius:7px;border:1px solid var(--line);background:var(--surface);
  cursor:pointer;font-size:12px;font-family:var(--mono)}
.chipbtn:hover{border-color:var(--accent-line)}
.chipbtn.sel-present{background:var(--accent-soft);border-color:var(--accent);color:#0A5A49}
.chipbtn.sel-absent{background:var(--rose-soft);border-color:var(--rose);color:var(--rose)}
.chipbtn.sel-late{background:var(--amber-soft);border-color:var(--amber);color:var(--amber)}
.chipbtn.sel-excused{background:var(--blue-soft);border-color:var(--blue);color:var(--blue)}
/* Leave (§6): L belongs to Leave, everywhere, always. A violet keeps it clearly
   apart from Late's amber. */
.pill.leave{background:#EAE3F5;border-color:#C6B6E4;color:#5A3E93}
.mark.sel-leave{background:#6D4AA8;border-color:#6D4AA8;color:#fff}
.chipbtn.sel-leave{background:#EAE3F5;border-color:#6D4AA8;color:#5A3E93}
.stage.onleave{border-color:#C6B6E4;box-shadow:0 0 0 3px #EAE3F5}
.leavebanner{margin-top:12px;background:#EAE3F5;border:1px solid #C6B6E4;color:#5A3E93;
  border-radius:10px;padding:9px 12px;font-size:13px}
.leavebanner-sub{color:var(--ink-3);font-size:11.5px;margin-top:3px}
.pill.leave-pending{background:var(--amber-soft);border-color:#DCC38A;color:var(--amber)}
.pill.leave-approved{background:var(--accent-soft);border-color:var(--accent-line);color:#0A5A49}
.pill.leave-rejected{background:var(--rose-soft);border-color:#E1A9A2;color:var(--rose)}
.pill.leave-escalated{background:#EAE3F5;border-color:#C6B6E4;color:#5A3E93}
.clip{display:inline-block;max-width:280px;overflow:hidden;text-overflow:ellipsis;
  white-space:nowrap;vertical-align:bottom}

/* --------------------------------------------------------------- org tree */
.treewrap{overflow:auto;padding:6px 0}
.tnode{padding:5px 12px;border-radius:8px;display:flex;align-items:center;gap:9px}
.tnode:hover{background:var(--surface-2)}
.tnode .code{font-family:var(--mono);font-size:11px;color:var(--ink-3);min-width:74px}
.tnode .caret{width:14px;color:var(--ink-3);cursor:pointer;user-select:none;font-size:10px}
.tnode.lvl-branch{font-weight:600}
.tnode.lvl-standard{padding-left:26px}
.tnode.lvl-section{padding-left:48px}
.tnode.lvl-student{padding-left:70px;color:var(--ink-2)}
/* Fixed column header for the class tree (#3, #9) */
.tnode-head{position:sticky;top:0;background:var(--surface);z-index:1;font-weight:600;
  color:var(--ink-3);border-bottom:1px solid var(--line);border-radius:0}
.tnode-head:hover{background:var(--surface)}
.tnode-head .headlabel{font-family:var(--mono);font-size:10px;text-transform:uppercase;
  letter-spacing:.03em;color:var(--ink-3);margin-left:6px;text-align:right;min-width:70px}
.tnode .teacherpill{background:var(--surface-2);color:var(--ink-2);max-width:150px;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tnode.clickable{cursor:pointer}
.tnode.lvl-student.clickable:hover{background:var(--accent-soft)}

/* Tab strip for screens that merge two views (Subjects: catalogue + class setup) */
.subtabs{display:flex;gap:4px;border-bottom:1px solid var(--line);margin-bottom:4px;overflow-x:auto;-webkit-overflow-scrolling:touch}
.subtab{white-space:nowrap}
.subtab{background:none;border:0;border-bottom:2px solid transparent;cursor:pointer;
  padding:8px 14px;font-size:13px;color:var(--ink-3)}
.subtab:hover{color:var(--ink)}
.subtab.on{color:var(--accent);border-bottom-color:var(--accent);font-weight:600}

/* Role holders (#13): clickable people pills */
.holders{margin:2px 0 12px}
.pill.clickable{cursor:pointer;border:1px solid var(--line);background:var(--surface)}
.pill.clickable:hover{border-color:var(--accent-line);background:var(--accent-soft)}

/* Notes: the teacher's note / a child's remark, shown to guardians; and the
   multiline note field on the assessment editor. */
.notepad{white-space:pre-wrap;font-size:13px;color:var(--ink-2);padding:4px 2px}
.notebox{width:100%;font:inherit;font-size:14px;padding:8px 10px;border:1px solid var(--line);
  border-radius:8px;resize:vertical;background:var(--surface);color:var(--ink)}
/* The Students tab — the org tree (chart) and the class → student → guardian list */
.orgbranch{margin-bottom:16px}
.orgtitle{font-weight:700;font-size:16px;color:var(--ink);padding:6px 2px}
.orgstd{border-left:2px solid var(--accent-line);padding:2px 0 2px 14px;margin:0 0 12px 6px}
.orgstd-h{font-weight:600;color:var(--ink-2);margin-bottom:6px}
.orgsec{border:1px solid var(--line);border-radius:10px;background:var(--surface);
  padding:10px 12px;margin-bottom:10px}
.orgsec-h{display:flex;align-items:center;gap:8px;margin-bottom:8px;font-size:13px;
  cursor:pointer;user-select:none}
.orgsec-h .caret{width:14px;color:var(--ink-3);font-size:10px;flex:none}
.orgsec-h:hover .mono{color:var(--accent)}
.orgsec.collapsed{padding-bottom:12px}
.orgsec.collapsed .orgsec-h{margin-bottom:0}
.orgsec.collapsed .orgsec-body{display:none}
.orgsec-body .tablewrap{margin:0}

/* ------------------------------------------------ collapse carets & tools */
/* One right-aligned, bigger toggle for the roster standards/classes and the
   structure tree. A down-chevron that rotates: pointing down when open, turned
   to the side when collapsed. Shared so both screens read the same. */
.collapsetools{display:inline-flex;gap:6px;align-items:center}
.collapsetools .btn{padding:5px 11px;font-size:12.5px}
.collapsecaret{display:inline-flex;align-items:center;justify-content:center;
  width:34px;height:34px;border-radius:8px;color:var(--ink-3);cursor:pointer;flex:none;
  transition:background .12s,color .12s}
.collapsecaret:hover{background:var(--surface-2);color:var(--ink)}
.collapsecaret .ico{transform:rotate(-90deg);transition:transform .15s}
.collapsecaret.open .ico{transform:rotate(0deg)}
.collapsecaret.empty{cursor:default;background:none;visibility:hidden}
.tnode .collapsecaret{width:30px;height:30px}
/* The standard header is now a clickable collapse row, caret on the right. */
.orgstd-h{display:flex;align-items:center;gap:8px;cursor:pointer;user-select:none;padding:2px 0}
.orgstd-h:hover{color:var(--ink)}
.orgstd.collapsed .orgstd-body{display:none}
.tnode.togglerow{cursor:pointer}
.rostercell{display:inline-flex;align-items:center;gap:9px}
.rostercell .face{width:26px;height:26px;font-size:11px}
.orggrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(96px,1fr));gap:10px}
.orgstudent{border:1px solid var(--line);border-radius:10px;padding:8px 6px;display:flex;
  flex-direction:column;align-items:center;gap:6px;text-align:center;background:var(--surface)}
.orgstudent:hover{border-color:var(--accent-line)}
.orgstudent-open{cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:4px;width:100%}
.orgstudent-open:hover .orgstudent-name{color:var(--accent)}
.orgstudent .face{width:44px;height:44px;font-size:15px}
.orgstudent-name{font-size:12px;color:var(--ink);line-height:1.15}
.orgstudent-acts{display:flex;gap:2px;justify-content:center;border-top:1px solid var(--line);
  padding-top:5px;width:100%}
.rosterlist{display:flex;flex-direction:column;gap:2px}
.rosteritem{border-bottom:1px solid var(--line)}
.rosterrow-h{display:flex;align-items:center;gap:10px;padding:7px 4px;cursor:pointer;list-style:none}
.rosterrow-h::-webkit-details-marker{display:none}
.rosterrow-h .face{width:30px;height:30px;font-size:12px}
.rosternamebtn{color:var(--ink);font-size:13.5px;font-weight:500}
.rosternamebtn:hover{color:var(--accent);text-decoration:underline}
.rosterrow-h .caret{width:14px;color:var(--ink-3);font-size:10px}
.rosteritem[open] .rosterrow-h{background:var(--surface-2)}
.guardianline{padding:4px 4px 10px 44px}
.guardianrow{display:flex;align-items:center;gap:10px;padding:3px 0;font-size:13px}
.assign-head{display:flex;align-items:center}
.selectall{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;font-weight:400;
  text-transform:none;letter-spacing:0;color:var(--ink-3);cursor:pointer}
/* The chart zooms rather than scrolls sideways: the viewport clips, and the +/−/
   Fit toolbar (or Ctrl+wheel) scales the stage with a CSS transform. */
#chart{position:relative;background:var(--surface);border:1px solid var(--line-2);
  border-radius:12px;overflow:hidden}
.chart-viewport{width:100%;overflow:hidden}
.chart-stage{transform-origin:top left;will-change:transform}
.chart-stage > svg{display:block}
.chart-zoom{position:absolute;top:8px;right:10px;z-index:2;display:flex;align-items:center;gap:5px;
  background:var(--surface);border:1px solid var(--line-2);border-radius:9px;padding:4px 6px;
  box-shadow:0 2px 8px rgba(8,26,20,.10)}
.chart-zoom-val{font-size:11px;color:var(--ink-2);min-width:38px;text-align:center}
.chart-zoom .btn.small{min-width:28px;padding:2px 8px}

/* Class-roster popup: pupils as photo cards, code + name under each. */
.rostergrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(118px,1fr));gap:10px;
  margin-bottom:12px}
.rostercard{border:1px solid var(--line);border-radius:10px;padding:10px 8px;display:flex;
  flex-direction:column;align-items:center;gap:5px;text-align:center;background:var(--surface)}
.rostercard:hover{border-color:var(--accent-line)}
.rostercard .face{width:56px;height:56px;font-size:18px}
.rostercard-name{font-size:12.5px;color:var(--ink);font-weight:500;line-height:1.15}
.rostercard-name:hover{color:var(--accent);text-decoration:underline}
.rostercard-code{font-size:11px}
.rostercard-stats{font-size:10.5px}

/* A photographed face is a button: click it to open the picture full size. */
.face-img{cursor:zoom-in}
.lightbox-back{position:fixed;inset:0;background:rgba(6,16,13,.82);display:grid;place-items:center;
  z-index:200;padding:24px;cursor:zoom-out}
.lightbox-img{max-width:96vw;max-height:92vh;object-fit:contain;border-radius:6px;
  box-shadow:0 20px 60px rgba(0,0,0,.5);cursor:default}
.lightbox-x{position:fixed;top:16px;right:20px;width:40px;height:40px;border-radius:50%;border:0;
  background:rgba(255,255,255,.16);color:#fff;font-size:24px;line-height:1;cursor:pointer}
.lightbox-x:hover{background:rgba(255,255,255,.3)}

/* --------------------------------------------------------------- settings */
.setting{display:flex;gap:12px;align-items:center;padding:10px 15px;border-bottom:1px solid var(--line-2)}
.field-help{font-size:11.5px;color:var(--ink-3)}
/* On a phone the four-across row runs off the side of the screen, and the panel
   clips rather than scrolls — so Save became unreachable and a setting could be
   changed but not saved. Stacked, the name reads as a heading and the control
   and its Save sit on one line underneath, both inside the screen. */
@media (max-width:743.98px){
  .setting{display:grid;grid-template-columns:1fr auto;align-items:center;
    gap:6px 10px;padding:12px 14px}
  .setting > .grow{grid-column:1 / -1}
  /* The value type (bool, int, template) is for whoever is reading the API,
     not for the person changing the setting — and it costs a column. */
  .setting > .mono.dim{display:none}
  .setting > input,.setting > .combo{grid-column:1;width:100%!important;min-width:0}
  .setting > .btn{grid-column:2;min-height:38px;padding-inline:16px}
}

/* ------------------------------------------------------------- create sheet */
/* z-index 80 sits ABOVE the fullscreen marking overlay (.sheetful-back, z-index
   70) so a dialog opened from inside it — "Add files" on an assessment — is not
   drawn behind it and left looking dead (#7). */
.sheet-back{position:fixed;inset:0;background:rgba(10,26,21,.4);display:grid;place-items:center;z-index:80;
  padding:20px;backdrop-filter:blur(2px)}
.sheet{width:min(560px,100%);max-height:88vh;display:flex;flex-direction:column;background:var(--surface);
  border-radius:14px;box-shadow:0 24px 60px rgba(8,26,20,.34);overflow:hidden}
.sheet > header{display:flex;align-items:center;gap:10px;padding:13px 16px;font-weight:600;
  border-bottom:1px solid var(--line-2)}
/* A long name stays on one line and trails an ellipsis rather than wrapping and
   shoving the close button around. */
.sheet-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
/* Header actions get their own full-width row under the title, so five buttons
   line up instead of wrapping into the title. */
.sheet-toolbar{display:flex;flex-wrap:wrap;gap:6px;padding:10px 16px;
  border-bottom:1px solid var(--line-2);background:var(--surface-2)}
.sheet-toolbar:empty{display:none}
/* min-height:0 lets the body shrink inside the flex column so its own
   overflow:auto engages and the sheet gets a scrollbar instead of overflowing. */
.sheet-body{padding:14px 16px;overflow:auto;min-height:0;display:grid;
  grid-template-columns:1fr 1fr;gap:12px}
.sheet > footer{display:flex;justify-content:flex-end;gap:8px;padding:12px 16px;
  border-top:1px solid var(--line-2);background:var(--surface-2)}
/* Payment modal: a dedicated grid so it reads top-to-bottom instead of the
   generic two-column zig-zag. Fee list, intro, remark and reference span the
   full width; only Method + Date share a row. One column on mobile. */
.payment-sheet-body{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px 14px}
.payment-sheet-body .payment-intro,
.payment-sheet-body .payment-lines,
.payment-sheet-body .payment-detail-h,
.payment-sheet-body .payment-remark,
.payment-sheet-body .payment-reference{grid-column:1 / -1}
.payment-sheet-body .payment-lines{max-height:300px;overflow:auto}
.payment-sheet-body .payment-detail-h{margin-top:2px;padding-top:8px;border-top:1px solid var(--line-2)}
.payment-sheet-body .payment-lines .pickrow{padding:8px 4px;border-bottom:1px solid var(--line-2)}
@media (max-width:743.98px){
  .payment-sheet-body{grid-template-columns:minmax(0,1fr)}
  .payment-sheet-body > *{grid-column:1}
}
.sheet-err{color:var(--rose);font-size:12.5px;padding:0 16px;min-height:0}
.sheet-err:not(:empty){padding:8px 16px}
.field{display:flex;flex-direction:column;gap:5px}
.field-label{font-family:var(--mono);font-size:10px;letter-spacing:.08em;text-transform:uppercase;
  color:var(--ink-3)}
.field-label i{color:var(--rose);font-style:normal}
.field > input,.field .combo{width:100%}
/* a tick box is not a text field: it must not stretch to the column */
.field input[type=checkbox]{width:auto;flex:none;margin:0}

/* Top-right, stacking downward, and above every sheet/overlay (.sheet-back 80,
   .combo-list 90) so a toast fired from inside a popup renders in front of it. */
.toasts{position:fixed;top:14px;right:14px;z-index:120;display:flex;flex-direction:column;
  gap:10px;align-items:flex-end;pointer-events:none;max-width:min(460px,calc(100vw - 28px))}
/* Green by default = success; red = failure. Bigger than a hint so a save or an
   error reads across the room, not just at the keyboard. */
.toast{width:100%;max-width:460px;min-width:300px;background:#0B8F70;color:#fff;border-radius:12px;
  box-shadow:0 14px 36px rgba(8,26,20,.42);overflow:hidden;pointer-events:auto;opacity:0;
  transform:translateX(12px);transition:opacity .18s,transform .18s}
.toast.on{opacity:1;transform:none}
.toast.off{opacity:0;transform:translateX(12px)}
.toast.good{background:#0B8F70}
.toast.bad{background:var(--rose)}
/* Neither done nor failed: an import that went in with rows left behind. */
.toast.warn{background:var(--amber)}
.toast-row{display:flex;align-items:flex-start;gap:12px;padding:15px 18px 13px;font-size:15px}
.toast-msg{flex:1;min-width:0;line-height:1.4;font-weight:500}
.toast-x{flex:none;background:none;border:0;color:inherit;opacity:.75;cursor:pointer;
  font-size:20px;line-height:1;padding:0 2px;margin:-1px -2px 0 0}
.toast-x:hover{opacity:1}
.toast-bar{height:4px;width:100%;background:rgba(255,255,255,.6)}

/* ------------------------------------------------------------------ phone
   The register is the one screen a teacher uses standing up, so the phone
   layout is not a courtesy — it is the primary case. */
@media (max-width:743.98px){
  body{font-size:14px}
  .topbar{height:48px;padding:0 10px;gap:8px}
  .topbar .ctx,#rolehost{display:none}
  .body{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto}
  /* A tab bar, so every destination has to be on screen. It used to scroll
     sideways, which on a 414px phone meant the last tab sat past the edge and
     nothing said so — a navigation item you cannot see is one that does not
     exist. The items share the width instead, and the label shrinks to fit. */
  .nav{flex-direction:row;gap:0;padding:5px 2px calc(5px + env(safe-area-inset-bottom));
    overflow:hidden;order:2;border-top:1px solid rgba(255,255,255,.08)}
  .nav .grp{display:none}
  .nav a{flex:1 1 0;min-width:0;flex-direction:column;gap:4px;justify-content:center;
    font-size:11px;padding:8px 2px;text-align:center;white-space:nowrap;
    overflow:hidden;text-overflow:ellipsis}
  .nav .ico{flex:none}
  main{order:1;padding:14px 14px 22px}
  .pagehead{flex-direction:column;align-items:stretch;gap:10px}
  .pagehead-actions{margin-left:0}
  .cards{grid-template-columns:repeat(2,minmax(0,1fr))}
  .focus{grid-template-columns:minmax(0,1fr)}
  .stage{min-height:0;padding:18px 14px}
  .marks{grid-template-columns:repeat(2,1fr);gap:8px}
  .mark{padding:16px 8px}
  /* Was `.bar > *{flex:1 1 44%}` — too generic: it stretched buttons and the
     refresh control to half a row. Now only form controls fill the row; buttons
     stay content-sized and wrap naturally, and a search input spans full width. */
  .bar > *{flex:0 1 auto;min-width:0}
  .bar > .inline-field{flex:1 1 44%}
  .bar > input[type="search"], .bar > .search{flex:1 1 100%}
  .bar > .grow{flex:1 1 100%}
  .bar > .btn, .bar > button{flex:0 0 auto}
  .bar > .spacer{display:none}
  .sheet-body{grid-template-columns:1fr}
  table{font-size:12px}
  th,td{padding:7px 9px}
}
@media (max-width: 560px){
  /* Stacked one to a row, five figures ran to two full screens before the
     Overview showed a single class — the counts are short (a number and three
     words), so they stay two across and only the type gets smaller. */
  .cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  .card{padding:11px 12px}
  .card .v{font-size:21px}
  .card .n{font-size:11px}
  .portrait{width:110px;height:110px;font-size:32px}
  .stage .who{font-size:20px}
}
@media (max-width: 360px){
  /* Below this a two-column figure wraps its own caption, which is worse than
     the scrolling it saves. */
  .cards{grid-template-columns:minmax(0,1fr)}
}

/* ---------------------------------------------------------------- school week sheet */
.weekgrid{display:flex;flex-direction:column;gap:2px}
.weekrow{display:flex;align-items:center;gap:10px;padding:7px 8px;border-radius:8px;cursor:pointer}
.weekrow:hover{background:var(--surface-2)}
.weekday{min-width:88px;font-size:13.5px}
.weektimes{margin-left:auto;display:flex;align-items:center;gap:6px}
.weektimes input{padding:4px 7px;border-radius:7px;border:1px solid var(--line);
  background:var(--surface);font-size:12.5px;font-family:var(--mono)}
.sheet-body.one{grid-template-columns:minmax(0,1fr)}
.swatch{display:inline-block;width:22px;height:14px;border-radius:4px;
  box-shadow:inset 0 0 0 1px rgba(8,26,20,.18)}
.colorfield{display:flex;align-items:center;gap:8px}
.colorfield input[type=color]{width:38px;height:30px;padding:0;border:1px solid var(--line);
  border-radius:7px;background:var(--surface);cursor:pointer}


/* ---------------------------------------------------------------- timetable
   Phone (< 744px): a day agenda — .ttp-*. Desk: a compact true-to-time week
   with an editor panel — .ttw-*. Bottom sheets for both — .tts-*.
   Exam is amber, activity is blue, everywhere. */
.ttmark{flex:none;display:inline-grid;place-items:center;border-radius:9px;font-weight:700;
  background:color-mix(in srgb,var(--slot) 14%,#fff);color:color-mix(in srgb,var(--slot) 55%,#16211C);line-height:1}
.ttmark.act{width:38px;height:38px;--slot:var(--blue)}
.ttmark.day{width:38px;height:38px;--slot:var(--accent);font-size:15px}
.ttp-pill{display:inline-flex;align-items:center;height:20px;padding:0 7px;border-radius:5px;
  font-family:var(--mono);font-size:11px;font-weight:600;letter-spacing:.06em;color:#fff;
  background:var(--ink-3);flex:none}
.ttp-pill.now{background:var(--accent)}
.ttp-pill.exam{background:var(--amber)}
.ttp-pill.act{background:var(--blue)}
.ttp-pill.hol{background:var(--rose)}

/* ---- phone ---- */
#main:has(> .wrap > .ttp){padding:0}
.ttp{display:flex;flex-direction:column;min-height:100%}
.ttp-top{position:sticky;top:0;z-index:5;height:56px;display:flex;align-items:center;gap:6px;
  padding:0 8px 0 16px;color:#fff}
.ttp-top h2{margin:0;font-size:19px;font-weight:600;letter-spacing:-.01em;white-space:nowrap}
.ttp-classchip{display:inline-flex;align-items:center;gap:6px;height:38px;padding:0 14px;
  border-radius:999px;border:1px solid rgba(255,255,255,.32);background:rgba(255,255,255,.14);
  color:#fff;font-size:15px;white-space:nowrap;cursor:pointer;min-width:0;max-width:44vw}
.ttp-classchip > span:first-child{overflow:hidden;text-overflow:ellipsis}
.ttp-caret{font-size:11px;opacity:.85}
.ttp-icon{width:44px;height:44px;flex:none;display:grid;place-items:center;border:0;
  background:none;color:#fff;border-radius:10px;cursor:pointer}
.ttp-icon:active{background:rgba(255,255,255,.14)}
.ttp-tabs{position:sticky;top:56px;z-index:4;display:grid;gap:6px;padding:8px 10px;
  background:var(--surface);border-bottom:1px solid var(--line-2)}
.ttp-tab{position:relative;height:58px;min-width:0;border:0;border-radius:10px;background:none;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
  cursor:pointer;color:var(--ink);padding:0 2px}
.ttp-tab-d{font-size:14.5px;font-weight:600;white-space:nowrap}
.ttp-tab-ar{font-size:12px;color:var(--ink-3);white-space:nowrap;overflow:hidden;max-width:100%}
.ttp-tab.on{background:var(--accent);color:#fff}
.ttp-tab.on .ttp-tab-ar{color:rgba(255,255,255,.85)}
.ttp-tab.today::after{content:'';position:absolute;top:7px;right:9px;width:6px;height:6px;
  border-radius:50%;background:var(--accent)}
.ttp-tab.on.today::after{background:#fff}
.ttp-tab-bar{position:absolute;bottom:5px;width:18px;height:3px;border-radius:2px}
.ttp-tab-bar.exam{background:var(--amber)}
.ttp-tab-bar.act{background:var(--blue)}
.ttp-tab-bar.hol{background:var(--rose)}
.ttp-tab.on .ttp-tab-bar{background:#fff}
@media (max-width:400px){ .ttp-tab-d{font-size:13px} .ttp-tabs{gap:3px;padding:8px 6px} }

.ttp-list{flex:1;display:flex;flex-direction:column;gap:8px;padding:14px 14px 28px;background:var(--ground)}
.ttp-dayhead{display:flex;align-items:center;gap:10px;padding:2px 2px 4px}
.ttp-dayinfo{flex:1;min-width:0;display:flex;flex-wrap:wrap;align-items:baseline;column-gap:10px}
.ttp-dayname{font-size:16px;font-weight:600}
.ttp-daysum{font-size:12.5px;color:var(--ink-2)}
.ttp-weeknav{display:flex;align-items:center;gap:4px;flex:none}
.ttp-weeknav button{min-width:44px;height:44px;border:1px solid var(--line);background:var(--surface);
  border-radius:9px;font-size:18px;cursor:pointer;color:var(--ink-2)}
.ttp-weeknav .ttp-thisweek{font-size:13px;padding:0 10px;background:var(--accent-soft);
  border-color:transparent;color:var(--accent);font-weight:600}
.ttp-row{display:grid;grid-template-columns:48px minmax(0,1fr);gap:10px;align-items:start}
.ttp-time{padding-top:12px;line-height:1.25}
.ttp-t0{font-size:14px;font-weight:600}
.ttp-t0.dim{font-weight:400;color:var(--ink-3)}
.ttp-ar{max-width:30%}
.ttp-t1{font-size:12px;color:var(--ink-3)}
.ttp-card{display:block;width:100%;text-align:start;font:inherit;color:inherit;cursor:pointer;
  background:var(--surface);border:1px solid var(--line-2);border-left:4px solid var(--slot);
  border-radius:12px;padding:12px 14px;min-width:0}
.ttp-card.now{box-shadow:0 0 0 2px var(--accent)}
.ttp-card.exam{background:#FBF5E6;border-left-color:var(--amber)}
.ttp-card.act{background:var(--blue-soft);border-color:#C3D7E8;border-left-color:var(--blue);cursor:default}
.ttp-tags{display:flex;align-items:center;gap:8px;margin-bottom:8px;min-width:0}
.ttp-left{font-size:13px;font-weight:600;color:var(--accent);white-space:nowrap}
.ttp-prog{flex:1;height:4px;border-radius:2px;background:var(--accent-soft);overflow:hidden;min-width:20px}
.ttp-prog > span{display:block;height:100%;background:var(--accent)}
.ttp-examline{font-size:13px;font-weight:600;color:var(--amber);margin:-2px 0 8px}
.ttp-main{display:flex;align-items:center;gap:12px;min-width:0}
.ttp-txt{flex:1;min-width:0}
.ttp-name{font-size:16px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ttp-meta{font-size:13.5px;color:var(--ink-2);margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ttp-ar{font-size:15px;color:var(--ink-3);flex:none;max-width:38%;overflow:hidden;white-space:nowrap}
.ttp-act-t{font-size:16px;font-weight:600}
.ttp-act-s{font-size:13.5px;color:var(--ink-2);margin-top:2px}
.ttp-act-r{font-size:13px;color:var(--ink-2);margin-top:6px}
.ttp-same{background:var(--surface);border:1px solid var(--line-2);border-radius:12px;padding:10px}
.ttp-same-h{font-size:13px;font-weight:600;color:var(--ink-2);margin:2px 2px 8px}
.ttp-same-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.ttp-mini{text-align:start;font:inherit;color:inherit;cursor:pointer;min-width:0;min-height:44px;
  background:color-mix(in srgb,var(--slot) 14%,#fff);border:0;border-left:3px solid var(--slot);
  border-radius:9px;padding:8px 10px}
.ttp-mini.exam{background:var(--amber-soft);border-left-color:var(--amber)}
.ttp-mini .ttp-pill{margin-bottom:4px}
.ttp-mini-n{font-size:15px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ttp-mini-t{font-size:11.5px;color:var(--ink-2)}
.ttp-mini-p{font-size:12.5px;color:var(--ink-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ttp-break{height:32px;display:flex;align-items:center;gap:8px;padding:0 12px;margin-top:6px;
  border:1px dashed var(--line);border-radius:10px;font-size:13.5px;color:var(--ink-2)}
.ttp-free{width:100%;height:62px;display:flex;align-items:center;justify-content:space-between;
  padding:0 14px;border:1.5px dashed #C9D3CC;border-radius:12px;background:none;font:inherit;
  font-size:13.5px;color:var(--ink-3)}
button.ttp-free{cursor:pointer}
.ttp-add{color:var(--accent);font-weight:600}
.ttp-banner{border-radius:12px;padding:12px 14px;border:1px solid var(--line-2);background:var(--surface)}
.ttp-banner.exam{background:#FBF5E6;border-left:4px solid var(--amber)}
.ttp-banner.act{background:var(--blue-soft);border-color:#C3D7E8;border-left:4px solid var(--blue)}
.ttp-banner.hol{background:var(--rose-soft);border-left:4px solid var(--rose)}
.ttp-banner-t{font-size:16px;font-weight:600;margin-top:6px}
.ttp-banner-s{font-size:13.5px;color:var(--ink-2);margin-top:2px}

/* ---- bottom sheets (a centred card on a desk) ---- */
.tts-back{position:fixed;top:0;left:0;right:0;bottom:0;z-index:60;background:rgba(8,26,20,.42);
  display:flex;align-items:flex-end;justify-content:center}
.tts{width:100%;max-width:560px;max-height:calc(100% - 40px);overflow:auto;background:var(--surface);
  border-radius:22px 22px 0 0;padding:10px 20px 24px;box-shadow:0 -10px 30px rgba(8,26,20,.18)}
.tts.safe{padding-bottom:calc(24px + env(safe-area-inset-bottom))}
@media (min-width:744px){
  .tts-back{align-items:center}
  .tts{border-radius:18px;max-width:440px;padding-top:20px}
  .tts-grab{display:none}
}
.tts-grab{width:40px;height:5px;border-radius:3px;background:var(--line);margin:0 auto 14px}
.tts-title{font-size:20px;font-weight:650;letter-spacing:-.01em}
.tts-sub{font-size:13.5px;color:var(--ink-2);margin-top:3px}
.tts-body{display:flex;flex-direction:column;gap:12px;margin-top:14px}
.tts-grab + .tts-body{margin-top:0}
.tts-body:empty{display:none}
.tts-foot{display:flex;gap:10px;margin-top:18px;position:sticky;bottom:0;background:var(--surface)}
.tts-foot .btn{min-height:48px;justify-content:center;padding-inline:18px;font-size:15px}
.tts-grow{flex:1}
.tts-big{flex:1;font-size:16px!important}
.tts-danger{color:var(--rose);border-color:color-mix(in srgb,var(--rose) 45%,#fff);background:var(--surface)}
.tts-kv{border:1px solid var(--line-2);border-radius:12px;overflow:hidden}
.tts-kv > div{display:flex;justify-content:space-between;gap:12px;padding:13px 16px;font-size:15px}
.tts-kv > div + div{border-top:1px solid var(--line-2)}
.tts-kv span{color:var(--ink-3)}
.tts-kv b{font-weight:500;text-align:end}
.tts-rows{display:flex;flex-direction:column}
.tts-row{min-height:52px;display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:0 6px;border:0;border-bottom:1px solid var(--line-2);background:none;font:inherit;
  font-size:16px;text-align:start;cursor:pointer;color:var(--ink)}
.tts-row:last-child{border-bottom:0}
.tts-row.on{color:var(--accent);font-weight:600}
.tts-row.dim{color:var(--ink-3);justify-content:center}
.tts-lesson{display:flex;align-items:center;gap:14px}
.tts-exam{background:#FBF5E6;border-left:4px solid var(--amber);border-radius:10px;padding:10px 12px}
.tts-exam-t{font-size:15px;font-weight:600;margin-top:6px}
.tts-exam-s{font-size:13px;color:var(--ink-2)}
.tts-subjects{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.tts-subject{min-height:52px;display:flex;align-items:center;gap:10px;padding:8px 12px;
  border:1px solid var(--line);border-radius:12px;background:var(--surface);font:inherit;
  font-size:15px;text-align:start;cursor:pointer;color:var(--ink);min-width:0}
.tts-subject > span:last-child{overflow:hidden;text-overflow:ellipsis}
.tts .ttw-fields{padding:0}
.tts .ttw-field input{height:44px;font-size:16px}

/* ---- desk ---- */
.ttw{display:flex;flex-direction:column;gap:14px}
.ttw-head{display:flex;align-items:flex-end;gap:16px;flex-wrap:wrap}
.ttw-title{flex:1;min-width:220px}
.ttw-title h2.page{font-size:22px;font-weight:650}
.ttw-title .page-sub{font-size:13.5px;color:var(--ink-3)}
.ttw-acts{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.ttw-acts > .btn{height:34px}
.ttw-weeksw{display:flex;align-items:center;height:34px;border:1px solid var(--line);border-radius:8px;
  background:var(--surface);overflow:hidden}
.ttw-weeksw button{width:32px;height:100%;border:0;background:none;cursor:pointer;font-size:17px;color:var(--ink-2)}
.ttw-weeksw button:hover{background:var(--surface-2)}
.ttw-range{padding:0 6px;font-size:13.5px;font-weight:600;white-space:nowrap}
.ttw-acts > .ttw-this{background:var(--accent-soft);border-color:transparent;color:var(--accent);font-weight:600}
.ttw-acts > .ttw-this[disabled]{cursor:default;opacity:1}
.ttw-class{display:flex;align-items:center;gap:8px;height:34px;padding-left:10px;border:1px solid var(--line);
  border-radius:8px;background:var(--surface)}
.ttw-class > span{font-size:12.5px;color:var(--ink-3)}
.ttw-class .combo-input{border-color:transparent;background:none}
.ttw-dots{position:relative}
.ttw-dots .btn{height:34px;width:34px;justify-content:center;padding:0}
.ttw-menu{display:none;position:absolute;right:0;top:calc(100% + 6px);z-index:20;min-width:230px;
  background:var(--surface);border:1px solid var(--line-2);border-radius:10px;padding:5px;
  box-shadow:0 12px 30px rgba(8,26,20,.16)}
.ttw-dots.open .ttw-menu{display:block}
.ttw-menu button{display:block;width:100%;text-align:start;border:0;background:none;padding:9px 11px;
  border-radius:7px;font-size:13.5px;cursor:pointer;color:var(--ink)}
.ttw-menu button:hover{background:var(--surface-2)}
.ttw-legend{display:flex;gap:16px;flex-wrap:wrap;font-size:12.5px;color:var(--ink-2);margin-top:-6px}
.ttw-legend span{display:inline-flex;align-items:center;gap:6px}
.ttw-legend i{display:inline-block;width:10px;height:14px;border-radius:3px;border-left:3px solid}
.ttw-legend i.exam{background:var(--amber-soft);border-color:var(--amber)}
.ttw-legend i.act{background:var(--blue-soft);border-color:var(--blue)}
.ttw-legend i.same{background:var(--accent-soft);border-color:var(--accent);margin-right:-3px}
.ttw-strip{display:flex;align-items:center;gap:12px;background:var(--surface);border:1px solid var(--line-2);
  border-radius:12px;padding:8px 10px}
.ttw-strip-h{font-family:var(--mono);font-size:10.5px;letter-spacing:.08em;text-transform:uppercase;
  color:var(--ink-3);width:62px;line-height:1.2;flex:none}
.ttw-chips{display:flex;gap:6px;flex-wrap:wrap;flex:1;min-width:0}
.ttw-chip{display:inline-flex;align-items:center;gap:7px;height:32px;padding:0 10px 0 6px;border-radius:8px;
  border:1px solid var(--line-2);background:color-mix(in srgb,var(--slot) 6%,#fff);font-size:13px;
  white-space:nowrap;cursor:grab;user-select:none}
.ttw-chip:active{cursor:grabbing}
.ttw-chip .ttmark{border-radius:6px}
.ttw-len{display:flex;align-items:center;gap:6px;font-size:12.5px;color:var(--ink-3);flex:none}
.ttw-len input{width:64px;height:32px}
.ttw-body{display:grid;grid-template-columns:minmax(0,1fr) 260px;gap:16px;align-items:start}
.ttw-cal{background:var(--surface);border:1px solid var(--line-2);border-radius:14px;overflow:hidden;min-width:0}
.ttw-cal.fc{--fc-border-color:#EEF2EE;--fc-page-bg-color:var(--surface);
  --fc-neutral-bg-color:var(--surface-2);--fc-today-bg-color:#FAFCFB;
  --fc-now-indicator-color:var(--accent);font-family:inherit;font-size:13px}
.ttw-cal.fc .fc-scrollgrid{border:0}
.ttw-cal.fc .fc-timegrid-slot{height:45px}
.ttw-cal.fc .fc-timegrid-slot-minor{border-top-style:none}
.ttw-cal.fc .fc-timegrid-slot-label-cushion{font-family:var(--mono);font-size:11.5px;color:var(--ink-3)}
/* the console's table rules (mono, uppercase, padded th/td) are for data
   tables, not the calendar's own layout table */
.ttw-cal.fc th,.ttw-cal.fc td{padding:0;font-family:var(--sans);font-size:inherit;letter-spacing:0;
  text-transform:none;color:inherit;border-bottom:0}
.ttw-cal.fc .fc-col-header-cell{background:var(--surface);text-align:start;vertical-align:top;
  border-bottom:1px solid var(--line-2)}
.ttw-cal.fc .fc-timegrid-col-events{margin:0 3px}
.ttw-cal.fc .fc-timegrid-event-harness > .fc-timegrid-event{bottom:3px}
.ttw-cal.fc .fc-timegrid-event-harness + .fc-timegrid-event-harness > .fc-timegrid-event{left:3px}
.ttw-cal.fc .fc-timegrid-slot-label-frame{text-align:right;padding-right:8px}
.ttw-cal.fc .fc-timegrid-slot-label{vertical-align:top}
.ttw-cal.fc .fc-timegrid-slot-label-cushion{position:relative;top:-9px}
.ttw-cal.fc .fc-timegrid-now-indicator-line{border-width:2px 0 0;border-color:var(--accent)}
.ttw-cal.fc .fc-timegrid-now-indicator-line::before{content:'';position:absolute;left:-5px;top:-5px;
  width:8px;height:8px;border-radius:50%;background:var(--accent)}
.ttw-cal.fc .fc-timegrid-now-indicator-arrow{border:0;margin-top:-10px;left:4px}
.tt-nowpill{display:inline-block;font-family:var(--mono);font-size:11px;font-weight:600;color:#fff;
  background:var(--accent);border-radius:5px;padding:2px 5px}
.ttw-cal.fc .fc-col-header-cell.fc-day-today{background:var(--accent-soft)}
.ttw-cal.fc .fc-col-header-cell-cushion{display:block;padding:12px 10px 10px;color:var(--ink);text-decoration:none}
.tt-dh{display:flex;flex-direction:column;gap:5px}
.tt-dh-top{display:flex;align-items:baseline;justify-content:space-between;gap:6px}
.tt-dh-name{font-size:14px;font-weight:600;white-space:nowrap}
.fc-day-today .tt-dh-name{color:var(--accent)}
.tt-dh-ar{font-size:13px;color:var(--ink-3);white-space:nowrap;overflow:hidden}
.tt-dh-chips{display:flex;gap:4px;flex-wrap:wrap}
.tt-dh-chip{font-family:var(--mono);font-size:10.5px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;
  padding:2px 6px;border-radius:4px;border:0;cursor:pointer}
.tt-dh-chip.exam{background:var(--amber-soft);color:var(--amber)}
.tt-dh-chip.act{background:var(--blue-soft);color:var(--blue)}
.tt-dh-chip.hol{background:var(--rose-soft);color:var(--rose)}
.ttw-cal .fc-timegrid-event{--slot:#6E7F76;border:0;border-left:3px solid var(--slot);border-radius:8px;
  background:color-mix(in srgb,var(--slot) 14%,#fff);box-shadow:none;overflow:hidden;cursor:pointer}
.ttw-cal .fc-timegrid-event .fc-event-main{color:var(--ink);padding:5px 7px}
.ttw-cal .fc-timegrid-event:hover{box-shadow:0 3px 10px rgba(8,26,20,.12)}
.ttw-cal .fc-timegrid-event.tt-exam{background:var(--amber-soft);border-left-color:var(--amber)}
.ttw-cal .fc-timegrid-event.tt-act{background:var(--blue-soft);border-left-color:var(--blue)}
.ttw-cal .fc-timegrid-event.tt-break{border-left:0;
  background:repeating-linear-gradient(135deg,#F5F8F4 0 6px,#EBEFEB 6px 12px)}
.ttw-cal .fc-timegrid-event.tt-sel{box-shadow:0 0 0 2px var(--ink)}
.ttw-cal.fc .fc-bg-event{opacity:1;background:none}
.ttw-cal.fc .fc-bg-event.tt-free{margin:2px 3px;border:1.5px dashed #C9D3CC;border-radius:8px;
  display:flex;align-items:center;justify-content:center}
.ttw-cal.fc .fc-bg-event.tt-holiday{background:repeating-linear-gradient(135deg,var(--rose-soft) 0 8px,#fff 8px 16px);
  display:flex;align-items:flex-start;justify-content:center;padding-top:10px}
.tt-bg-label{font-size:12px;color:var(--ink-3);text-align:center;padding:0 4px}
.tt-holiday .tt-bg-label{color:var(--rose);font-weight:600}
.tt-ev{display:flex;flex-direction:column;gap:1px;min-width:0}
.tt-ev > *{flex:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tt-ev-title{font-size:13px;font-weight:600;line-height:1.25}
.tt-ev-time{font-size:11px;color:var(--ink-2)}
.tt-ev-sub{font-size:12px;color:var(--ink-2)}
.tt-ev-tag{font-family:var(--mono);font-size:10px;font-weight:600;letter-spacing:.08em}
.tt-ev-tag.exam{color:var(--amber)}
.tt-ev-tag.act{color:var(--blue)}
.tt-ev-break{font-size:11.5px;color:var(--ink-2);text-align:center;padding-top:1px}

.ttw-panel{background:var(--surface);border:1px solid var(--line-2);border-radius:14px;position:sticky;top:0;
  min-width:0}
.ttw-pempty{padding:18px 16px;font-size:13px;color:var(--ink-3);line-height:1.5}
.ttw-pempty-t{font-size:15px;font-weight:600;color:var(--ink);margin-bottom:6px}
.ttw-phead{display:flex;align-items:center;gap:10px;padding:14px 16px;border-bottom:1px solid var(--line-2)}
.ttw-phead-t{flex:1;min-width:0}
.ttw-pname{font-size:16px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ttw-psub{font-size:12px;color:var(--ink-2)}
.ttw-par{font-size:14px;color:var(--ink-3);flex:none}
.ttw-pexam,.ttw-pact{margin:12px 16px 0;padding:10px 12px;border-radius:10px;
  background:#FBF5E6;border-left:3px solid var(--amber);display:flex;flex-direction:column;gap:4px;align-items:flex-start}
.ttw-pact{background:var(--blue-soft);border-left-color:var(--blue)}
.ttw-pexam-t{font-size:14px;font-weight:600}
.ttw-pexam-s{font-size:12.5px;color:var(--ink-2)}
.ttw-pexam .btn{margin-top:4px}
.ttw-psame{margin:12px 16px 0;display:flex;flex-direction:column;gap:6px}
.ttw-psame-i{display:flex;flex-direction:column;align-items:flex-start;gap:1px;text-align:start;font:inherit;
  font-size:12px;color:var(--ink-2);padding:7px 10px;border:1px solid var(--line-2);border-left:3px solid var(--slot);
  border-radius:8px;background:var(--surface);cursor:pointer}
.ttw-psame-i b{font-size:13px;color:var(--ink)}
.ttw-pform{display:flex;flex-direction:column}
.ttw-fields{display:flex;flex-direction:column;gap:12px;padding:14px 16px}
.ttw-field{display:flex;flex-direction:column;gap:5px;min-width:0}
.ttw-flabel{font-family:var(--mono);font-size:10.5px;letter-spacing:.08em;text-transform:uppercase;color:var(--ink-3)}
.ttw-field input{height:34px;width:100%}
.ttw-times{display:flex;align-items:center;gap:8px}
.ttw-times input{flex:1;min-width:0}
.ttw-pfoot{display:flex;align-items:center;gap:8px;padding:12px 16px;border-top:1px solid var(--line-2)}
.ttw-pfoot .linkbtn{font-size:13.5px}
.ttw-pgroup{display:flex;flex-direction:column;gap:8px;padding:14px 16px}
.ttw-pgroup .ttw-psame-i{padding:10px 12px;font-size:12.5px}
.ttw-pgroup .ttw-psame-i b{font-size:14px}
.ttw-pback{border:0;background:none;color:var(--accent);font-size:12.5px;cursor:pointer;padding:10px 16px 0;text-align:start}
.ttw-pkv{display:flex;flex-direction:column;gap:10px;padding:14px 16px}
.ttw-kv{display:flex;flex-direction:column;gap:2px;font-size:13.5px}
@media (pointer:coarse){
  .ttw-field input,.ttw-len input{height:40px;font-size:16px}
}
@media (max-width:1100px) and (min-width:744px){
  .ttw-body{grid-template-columns:minmax(0,1fr) 230px}
}

/* ------------------------------------------------ the month Calendar */
.calhost{background:var(--surface);border:1px solid var(--line-2);border-radius:12px;
  padding:14px;margin-top:12px;overflow-x:auto}
/* FullCalendar puts its own `fc` class on the element we already gave
   `calhost`, so they are one node, not two — every rule here written as
   `.calhost .fc …` asked for an `.fc` *inside* `.calhost`, matched nothing,
   and had never taken effect. Written against the single element they do. */
.calhost.fc{--fc-border-color:var(--line-2);--fc-page-bg-color:var(--surface);
  --fc-neutral-bg-color:var(--surface-2);--fc-today-bg-color:var(--accent-soft);
  font-family:inherit;font-size:12.5px}
.calhost .fc-theme-standard td,.calhost .fc-theme-standard th{border-color:var(--line-2)}
.calhost.fc .fc-toolbar-title{font-size:16px;font-weight:600}
.calhost.fc .fc-button{background:var(--surface-2);border:1px solid var(--line-2);
  color:var(--ink);text-transform:none;box-shadow:none;font-size:12.5px;padding:5px 10px}
.calhost.fc .fc-button-primary:not(:disabled).fc-button-active,
.calhost.fc .fc-button-primary:hover{background:var(--accent-soft);border-color:var(--accent);color:var(--ink)}
.calhost.fc .fc-daygrid-day-number{color:var(--ink-2);font-size:12px;padding:4px 6px}
.calhost .fc-daygrid-event{border-radius:6px;padding:1px 5px;font-size:11px;font-weight:600;
  border:none;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.calhost .cal-holiday{background:var(--amber-soft);color:var(--amber)}
.calhost .cal-special{background:#eef4fd;color:#1c467a}
.calhost .cal-assess{background:var(--accent-soft);color:#0A5A49}
.calhost .cal-assess.upcoming{border:1px dashed var(--accent-line)}
.calhost .cal-assess.done.pub::before{content:'✓ ';color:var(--accent)}
.cal-dayflag{padding:9px 12px;border-radius:8px;margin-bottom:10px;font-weight:600}
.cal-dayflag.holiday{background:#fdecea;color:#8a1c12}
.cal-dayflag.special{background:#eef4fd;color:#1c467a}
.cal-dayadmin{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px}
.cal-lessons{display:flex;flex-direction:column;gap:8px}
.cal-lesson{display:flex;gap:10px;align-items:flex-start;padding:8px 10px;border-radius:8px;
  background:var(--surface-2);border:1px solid var(--line-2)}
.cal-lesson.off{opacity:.6}
.cal-lesson.off .cal-lesson-title{text-decoration:line-through}
.cal-lesson-mark{width:6px;align-self:stretch;border-radius:4px;background:var(--slot,#6E7F76);flex:none}
.cal-lesson-body{flex:1;min-width:0}
.cal-lesson-title{font-weight:600;font-size:13px}
.cal-lesson-time{font-size:11px;margin-top:2px;display:flex;gap:8px;align-items:center}
.cal-lesson-acts{display:flex;gap:8px;flex:none;align-items:center}
.pill.danger{background:#fdecea;color:#8a1c12}
.kv{display:flex;justify-content:space-between;gap:12px;padding:6px 0;border-bottom:1px solid var(--line-2)}
/* day shading: closed weekdays and holidays */
.calhost .fc-daygrid-day.cal-noschool{
  background:repeating-linear-gradient(135deg,var(--surface-2) 0 7px,transparent 7px 14px)}
.calhost .fc-daygrid-day.cal-noschool .fc-daygrid-day-number{color:var(--ink-3)}
.calhost .fc-daygrid-day.cal-holidaycell{background:var(--amber-soft)}
.cal-legend{display:flex;gap:18px;flex-wrap:wrap;margin-top:10px;font-size:12px;color:var(--ink-2)}
.cal-lg{display:inline-flex;align-items:center;gap:6px}
.cal-lg .sw{width:16px;height:12px;border-radius:3px;display:inline-block;border:1px solid var(--line-2)}
.cal-lg .sw.school{background:var(--surface)}
.cal-lg .sw.noschool{background:repeating-linear-gradient(135deg,var(--surface-2) 0 4px,transparent 4px 8px)}
.cal-lg .sw.holiday{background:var(--amber-soft);border-color:#DCC38A}
.cal-lg .sw.school{background:var(--blue-soft);border-color:#A9C6DC}
.cal-lg .sw.assess{background:var(--accent-soft);border-color:var(--accent-line)}
.cal-jump{display:inline-flex;align-items:center;gap:8px}
.cal-jump input{padding:6px 9px;border:1px solid var(--line-2);border-radius:8px;background:var(--surface);
  font-size:12.5px;color:var(--ink)}

/* Untitled-UI-flavoured chrome: soft borders, rounded, calm buttons */
.calhost.fc .fc-toolbar.fc-header-toolbar{margin-bottom:14px;gap:10px;flex-wrap:wrap}
.calhost.fc .fc-button-group{gap:0;border:1px solid var(--line-2);border-radius:9px;overflow:hidden;box-shadow:0 1px 2px rgba(8,26,20,.04)}
.calhost.fc .fc-button{background:var(--surface);border:0;border-right:1px solid var(--line-2);
  color:var(--ink-2);text-transform:none;box-shadow:none;font-size:12.5px;font-weight:500;padding:7px 13px;border-radius:0}
.calhost.fc .fc-button:last-child{border-right:0}
.calhost.fc .fc-button-primary:not(:disabled).fc-button-active{background:var(--accent-soft);color:var(--ink)}
.calhost.fc .fc-button-primary:hover{background:var(--surface-2);color:var(--ink)}
.calhost.fc .fc-today-button{border-radius:9px;border:1px solid var(--line-2)}
.calhost.fc .fc-prev-button,.calhost.fc .fc-next-button{border-radius:9px;border:1px solid var(--line-2);color:var(--ink-2);padding:7px 11px}
.calhost .fc-daygrid-day-frame{padding:3px}
.calhost.fc .fc-daygrid-day.fc-day-today{background:var(--accent-soft)}
/* school day = a calm blue tint; the hours stamped small under the number */
.calhost .fc-daygrid-day.cal-schoolday{background:color-mix(in srgb,var(--blue-soft) 55%,var(--surface))}
.calhost .cal-hours{font-size:10px;color:var(--blue);
  font-family:var(--mono);padding:0 6px 2px;text-align:right}
/* timed lesson blocks in the week/day view */
.calhost .cal-lessonev{--slot:#6E7F76;border:1px solid color-mix(in srgb,var(--slot) 40%,var(--surface));
  border-left:3px solid var(--slot);border-radius:7px;
  background:color-mix(in srgb,var(--slot) 15%,var(--surface));box-shadow:0 1px 2px rgba(8,26,20,.08)}
.calhost .cal-lessonev.off{opacity:.5}
.calhost .cal-lessonev.off .cal-ev-t{text-decoration:line-through}
/* compact lesson chip on the month grid */
.cal-mini{--slot:#6E7F76;display:flex;align-items:center;gap:5px;min-width:0;padding:0 2px}
.cal-mini-dot{width:6px;height:6px;border-radius:50%;background:var(--slot);flex:none}
.cal-mini-t{font-size:11px;color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.calhost .fc-daygrid-event.cal-lessonev{background:transparent;border:0;box-shadow:none}
.calhost .fc-daygrid-event.cal-lessonev:hover{transform:none;box-shadow:none;background:var(--surface-2)}
.cal-ev{padding:2px 5px;min-width:0}
.cal-ev-t{font-weight:600;font-size:11.5px;color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cal-ev-s{font-size:10px;color:var(--ink-3)}
/* agenda / list view */
.calhost .fc-list{border-radius:10px;overflow:hidden;border:1px solid var(--line-2)}
.calhost.fc .fc-list-day-cushion{background:var(--surface-2)}
.calhost .fc-list-event:hover td{background:var(--surface-2)}

/* calendar-08 card: month on top, the day's events listed underneath */
.calhost{border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom:0;margin-bottom:0}
.cal-daypanel{background:var(--surface);border:1px solid var(--line-2);border-top:1px solid var(--line-2);
  border-radius:0 0 12px 12px;padding:14px 16px;display:flex;flex-direction:column;gap:12px}
.cal08-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.cal08-date{font-size:13.5px;font-weight:600;color:var(--ink)}
.btn.tiny{padding:4px 10px;font-size:12px;border-radius:8px}
.cal08-list{display:flex;flex-direction:column;gap:8px}
.cal08-ev{--slot:#6E7F76;display:flex;align-items:center;gap:12px;padding:9px 12px;border-radius:10px;
  background:color-mix(in srgb,var(--slot) 12%,var(--surface));transition:opacity .15s}
.cal08-ev.clickable{cursor:pointer}
.cal08-ev.clickable:hover{opacity:.8}
.cal08-ev.off{opacity:.5}
.cal08-ev.off .cal08-name{text-decoration:line-through}
.cal08-dot{width:7px;height:7px;border-radius:50%;background:var(--slot);flex:none}
.cal08-name{flex:1;min-width:0;font-size:13px;font-weight:500;color:var(--ink);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cal08-time{flex:none;font-size:11.5px;font-weight:600;color:color-mix(in srgb,var(--slot) 75%,var(--ink))}
.cal08-holiday{padding:12px 14px;border-radius:12px;font-weight:600;
  background:var(--amber-soft);color:var(--amber)}
.empty.small{padding:12px;font-size:12.5px;color:var(--ink-3)}

@media (max-width:743.98px){
  .calhost{padding:10px;border-radius:12px}
  .calhost .cal-hours{display:none}
  /* filters: legend wraps with room; jump-to-date gets its own full line */
  .cal-legend{gap:9px 14px;font-size:12px;flex-wrap:wrap;padding:2px}
  .cal-legend .spacer{display:none}
  .cal-jump{width:100%;justify-content:space-between;margin-top:8px;
    padding-top:9px;border-top:1px solid var(--line-2)}
  .cal-jump input{flex:1;margin-left:10px}
  /* toolbar breathes: title on its own line, nav + views below */
  .calhost.fc .fc-toolbar.fc-header-toolbar{flex-direction:column;gap:11px;align-items:stretch;margin-bottom:12px}
  .calhost.fc .fc-toolbar-chunk{display:flex;justify-content:center;gap:8px}
  .calhost.fc .fc-toolbar-chunk:nth-child(2){order:-1}
  .calhost.fc .fc-toolbar-title{font-size:18px;text-align:center}
  .calhost.fc .fc-button{padding:9px 15px;font-size:13.5px}
  /* agenda rows roomier and readable */
  .calhost.fc .fc-list-event > td{padding:13px 12px}
  .calhost.fc .fc-list-event-time{font-size:12.5px}
  .calhost.fc .fc-list-event-title{font-size:13.5px}
  .calhost.fc .fc-list-day-cushion{padding:11px 12px;font-size:12px}
  /* Every lesson in a day here runs the same period, so the time column said
     "06:15 PM - 07:30 PM" six times over and took nearly half the row, while
     the subject — the one thing that differs between them — was the part that
     ran off the edge. A narrow time that wraps, and a subject that wraps
     instead of truncating.

     FullCalendar sets `white-space:nowrap` on the time cell and sizes the
     three columns itself, so both need overriding by name rather than by
     layout — `table-layout:fixed` only split the row into equal thirds and
     slid the dot under the text. */
  .calhost .fc-list-table{width:100%;max-width:100%}
  .calhost.fc .fc-list-table .fc-list-event-time{
    white-space:normal !important;width:96px;
    line-height:1.25;font-size:11.5px;color:var(--ink-3);padding-right:6px}
  .calhost.fc .fc-list-table .fc-list-event-graphic{
    width:16px;padding-left:0;padding-right:0}
  .calhost.fc .fc-list-table .fc-list-event-title{
    white-space:normal !important;overflow-wrap:anywhere;text-align:left}
  /* The date on the right of a day heading is the long half; let it sit under
     the weekday rather than run past the edge. */
  .calhost.fc .fc-list-day-side-text{margin-left:auto}
  /* "SEPTEMBER 22," — the date was cut mid-string, comma and all. */
  .calhost.fc .fc-list-day-cushion{display:flex;flex-wrap:wrap;gap:2px 10px}
  .calhost.fc .fc-list-day-text,
  .calhost.fc .fc-list-day-side-text{white-space:normal}
  /* month cells: keep the number readable, hide the tiny chips clutter */
  .calhost.fc .fc-daygrid-day-number{font-size:13px;padding:5px 7px}
  /* day panel + card footer roomier */
  .cal-daypanel{padding:15px 14px;gap:13px}
  .cal08-ev{padding:11px 12px}
  .cal08-date{font-size:14px}
}

/* ---- fluid pass: soften both calendars away from a hard brick grid ---- */
.calhost .fc-scrollgrid{border-radius:14px;overflow:hidden;
  border-color:var(--line-2)}
/* internal cell lines whisper instead of shout */
.calhost .fc-theme-standard td,.calhost .fc-theme-standard th{
  border-color:color-mix(in srgb,var(--line-2) 55%,var(--surface))}
.calhost.fc .fc-daygrid-day-frame{border-radius:10px;transition:background .15s}
.calhost.fc .fc-daygrid-day-frame:hover{background:color-mix(in srgb,var(--surface-2) 70%,transparent)}
/* rounded, soft, shadowless-until-hover events — the app's pill language */
.calhost .fc-daygrid-event,.calhost .fc-timegrid-event{border-radius:9px;transition:transform .12s,box-shadow .12s}
.calhost .fc-daygrid-event:hover,.calhost .fc-timegrid-event:hover{transform:translateY(-1px);box-shadow:0 4px 12px rgba(8,26,20,.12)}
.calhost.fc .fc-daygrid-day.fc-day-today{background:var(--accent-soft)}
.calhost.fc .fc-scrollgrid-section > *{border-right:0}
/* the outer FC frame is redundant inside our card */
.calhost.fc .fc-scrollgrid{border-left:0;border-top:0}

/* --------------------------------------------------- moving a class up */
.sheet.wide{width:min(760px,100%)}
.field.span2{grid-column:1 / -1}
.rosterbox{max-height:260px;overflow:auto;border:1px solid var(--line-2);border-radius:10px;
  padding:4px;background:var(--surface-2)}
.rosterrow{display:flex;align-items:center;gap:10px;padding:6px 9px;border-radius:7px;
  cursor:pointer;font-size:13px;background:var(--surface);margin-bottom:2px}
.rosterrow:hover{background:var(--surface-2)}
.rosterrow .mono{min-width:80px;flex:none}
.rosterrow > span:nth-child(3){flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* ------------------------------------------------------------ the family
   A parent opens this on a phone, in a corridor, to answer one question. Big
   type, few numbers, no tables where a list will do. */
.childbar{display:flex;align-items:center;gap:14px;padding:14px 16px;background:var(--surface);
  border:1px solid var(--line-2);border-radius:12px;margin-bottom:16px}
.childface{width:44px;height:44px;border-radius:50%;background:var(--accent-soft);
  color:#0A5A49;display:grid;place-items:center;font-family:var(--mono);font-size:15px;flex:none}
.childface.big{width:56px;height:56px;font-size:18px}
.childname{font-size:16px;font-weight:600;letter-spacing:-.01em}
.childwho{font-size:12.5px;color:var(--ink-3);margin-top:2px}
/* The child block doubling as a switcher: only when there is more than one. */
.childbar.pick{cursor:pointer}
.childbar.pick:hover{border-color:var(--accent-line)}
.childcaret{flex:none;font-size:11px;color:var(--ink-3);padding:0 4px}
.childmenu-back{position:fixed;inset:0;z-index:95}
.childmenu{position:fixed;min-width:220px;max-height:60vh;overflow:auto;background:var(--surface);
  border:1px solid var(--line-2);border-radius:12px;box-shadow:0 12px 32px rgba(0,0,0,.14);padding:6px}
.childmenu-row{display:flex;align-items:center;gap:12px;padding:9px 10px;border-radius:9px;cursor:pointer}
.childmenu-row:hover{background:var(--surface-2)}
.childmenu-row.on{background:var(--accent-soft)}
.childface.sm{width:34px;height:34px;font-size:12px}
.childcard{display:flex;align-items:center;gap:14px;padding:16px;background:var(--surface);
  border:1px solid var(--line-2);border-radius:12px;margin-bottom:10px;cursor:pointer}
.childcard:hover{border-color:var(--accent-line)}
.childcard .chev{font-size:22px;color:var(--ink-3)}
.childstats{display:flex;gap:22px;margin-top:10px}
.ministat .k{font-family:var(--mono);font-size:9.5px;letter-spacing:.09em;text-transform:uppercase;
  color:var(--ink-3)}
.ministat .v{font-size:19px;letter-spacing:-.02em;margin-top:2px}
.ministat .n{font-size:11px;color:var(--ink-3)}

.subjcard{background:var(--surface);border:1px solid var(--line-2);border-radius:12px;
  margin-bottom:10px;overflow:hidden}
.subjhead{display:flex;align-items:center;gap:9px;padding:11px 14px;border-bottom:1px solid var(--line-2)}
.subjname{font-weight:600}
.subjavg{font-family:var(--mono);font-size:14px}
.trend{font-family:var(--mono);font-size:11px;padding:2px 7px;border-radius:999px;margin-right:8px}
.trend.up{background:var(--accent-soft);color:#0A5A49}
.trend.down{background:var(--amber-soft);color:var(--amber)}
.marklist{padding:4px 0}
.markrow{display:flex;align-items:center;gap:10px;padding:7px 14px;font-size:13px;
  border-bottom:1px solid var(--line-2)}
.markrow:last-child{border-bottom:0}
.markscore{font-size:12px;color:var(--ink-2)}
.markpct{font-size:12.5px;min-width:52px;text-align:right}

.daylist{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px}
.daycard{background:var(--surface);border:1px solid var(--line-2);border-radius:12px;overflow:hidden}
.dayhead{display:flex;justify-content:space-between;padding:10px 14px;font-weight:600;
  border-bottom:1px solid var(--line-2);font-size:13px}
.dayrow{display:flex;align-items:center;gap:9px;padding:8px 14px;font-size:13px;
  border-bottom:1px solid var(--line-2)}
.dayrow:last-child{border-bottom:0}
.dayrow.brk{background:var(--surface-2);color:var(--ink-2)}
.daytime{font-size:11.5px;color:var(--ink-3);min-width:40px}
.daydot{width:8px;height:8px;border-radius:3px;background:var(--slot);flex:none}

.invcard{background:var(--surface);border:1px solid var(--line-2);border-radius:12px;
  margin-bottom:10px;overflow:hidden}
.invhead{display:flex;align-items:center;gap:8px;padding:11px 14px;
  border-bottom:1px solid var(--line-2);font-size:12.5px}
.invbody{padding:4px 14px 10px}
.invline{display:flex;justify-content:space-between;padding:6px 0;font-size:13px;
  border-bottom:1px solid var(--line-2)}
.invline:last-child{border-bottom:0}
.invk{color:var(--ink-3)}
.invv.due{color:var(--rose);font-weight:600}

/* --------------------------------------------------- crest, crop, and photos */
/* A crest replaces the letter in the mark, so the mark stops being a gradient
   tile and becomes a frame the school's own picture sits in. */
.brandmark.has-logo{background:rgba(255,255,255,.92);padding:2px}
.brandmark img{width:100%;height:100%;object-fit:contain;border-radius:5px;display:block}
#signin-mark{width:56px;height:56px;border-radius:14px;font-size:24px}
#signin-mark.has-logo{padding:4px}

.imgfield{display:flex;gap:12px;align-items:center}
.imgfield-preview{width:76px;height:76px;flex:none;border-radius:12px;background:var(--surface-2);
  border:1px solid var(--line-2);display:grid;place-items:center;overflow:hidden}
.imgfield-preview img{width:100%;height:100%;object-fit:contain}
/* Empty, it is the target — dashed, wider, and it says what it wants. */
.imgfield-preview.empty{width:118px;height:100px;cursor:pointer;gap:5px;
  border:1.5px dashed var(--accent-line);background:var(--accent-soft);
  color:var(--accent);align-content:center;justify-items:center;padding:6px;text-align:center}
.imgfield-preview.empty:hover{background:#D2E9E1}
.imgfield-preview.empty:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.imgfield-empty{font-size:11.5px;color:var(--ink-3);line-height:1.25}
.imgfield-preview.empty .imgfield-empty{color:var(--accent);font-weight:600}
.imgfield-actions{display:flex;flex-direction:column;gap:5px}
.imgfield-actions .btn{padding:5px 10px;font-size:12px}

.sheet.crop{width:min(400px,100%)}
.sheet-body.crop-body{grid-template-columns:minmax(0,1fr);justify-items:center;gap:10px}
.crop-canvas{width:320px;height:320px;max-width:100%;border-radius:12px;cursor:grab;
  border:1px solid var(--line);background:#fff;touch-action:none}
.crop-canvas:active{cursor:grabbing}
.crop-hint{font-size:11.5px;color:var(--ink-3)}
.crop-zoom{width:280px;max-width:100%;accent-color:var(--accent)}

.schoolmaster{display:flex;gap:22px;padding:15px;align-items:flex-start;flex-wrap:wrap}
.schoolmaster .grow{min-width:260px}

/* ------------------------------------------------------- the bell and inbox */
.bell{position:relative;background:rgba(255,255,255,.12);border:1px solid rgba(255,255,255,.2);
  color:#fff;border-radius:8px;width:30px;height:26px;cursor:pointer;font-size:13px;line-height:1}
.bell:hover{background:rgba(255,255,255,.22)}
.bell.on{background:rgba(255,255,255,.24)}
.bell-count{position:absolute;top:-6px;right:-6px;min-width:16px;height:16px;padding:0 4px;
  border-radius:8px;background:var(--rose);color:#fff;font-size:10px;font-weight:700;
  display:grid;place-items:center;font-family:var(--mono)}

.msglist{padding:4px 0}
.msg{padding:11px 15px;border-bottom:1px solid var(--line-2)}
.msg:last-child{border-bottom:0}
.msg.unread{background:var(--accent-soft);cursor:pointer}
.msg-head{display:flex;align-items:baseline;gap:8px;font-size:13px}
.msg-body{margin-top:4px;font-size:13px;color:var(--ink-2);white-space:pre-wrap}
.msg-link{display:inline-block;margin-top:6px;font-size:12px;color:var(--blue);
  font-family:var(--mono);word-break:break-all}
.pill.ok{background:var(--accent-soft);border-color:var(--accent-line);color:#0A5A49}
.pill.dim{background:var(--surface-2);color:var(--ink-3)}

/* ------------------------------------------------------- a person's record */
tr.clickable{cursor:pointer}
tr.clickable:hover{background:var(--surface-2)}
.face{width:26px;height:26px;border-radius:8px;overflow:hidden;display:inline-grid;
  place-items:center;background:var(--accent-soft);color:#0A5A49;font-size:10px;
  font-weight:700;font-family:var(--mono)}
.face img{width:100%;height:100%;object-fit:cover}
.sheet.wide{width:min(760px,100%)}
.personhead{display:flex;gap:16px;align-items:flex-start;flex-wrap:wrap;margin-bottom:12px}
.personhead .grow{min-width:280px;flex:1}
.personhead .imgfield-preview.empty{width:96px;height:88px}
.bar.tight{margin:0;gap:6px}
.rowacts{display:inline-flex;gap:10px;white-space:nowrap}

/* ------------------------------------------------- the phone's More sheet */
.morelist{display:grid;grid-template-columns:1fr;gap:2px;padding:8px 10px 14px}
/* The same five headings the sidebar uses, so More is the same map at a
   different size rather than a second, flatter one. */
.moregrp{font-family:var(--mono);font-size:10px;letter-spacing:.1em;text-transform:uppercase;
  color:var(--ink-3);padding:12px 12px 4px}
.moregrp:first-child{padding-top:2px}
.morefind-wrap{padding:10px 14px 0}
.morefind{width:100%;padding:10px 12px;border-radius:10px;border:1px solid var(--line);
  background:var(--surface);font-size:16px;color:var(--ink);outline:none}
.morefind:focus{border-color:var(--accent-line)}
.morerow{display:flex;align-items:center;gap:10px;padding:12px 12px;border:0;border-radius:10px;
  background:none;cursor:pointer;font-size:15px;text-align:left;color:var(--ink)}
.morerow:hover,.morerow:active{background:var(--surface-2)}
.morerow .ico{color:var(--accent);opacity:.9;flex:none}

/* --------------------------------------------------------- a subject's mark */
/* The icon a school gave a subject, or the colour it was given instead. Same
   footprint either way, so a timetable does not jump about as icons are added. */
.submark{width:22px;height:22px;flex:none;border-radius:7px;display:inline-grid;
  place-items:center;overflow:hidden;background:var(--surface-2)}
.submark img{width:100%;height:100%;object-fit:cover;display:block}
.submark.plain{background:color-mix(in srgb, var(--slot) 18%, #fff);color:var(--slot)}

/* A picker that is acting on your choice. The spinner sits where the caret is,
   because that is where you were just looking. */
.combo.busy .combo-caret{visibility:hidden}
.combo.busy::after{
  content:"";position:absolute;right:9px;top:50%;margin-top:-7px;
  width:14px;height:14px;border-radius:50%;
  border:2px solid var(--line-2);border-top-color:var(--accent);
  animation:combo-spin .6s linear infinite;
}
.combo.busy .combo-input{opacity:.6;cursor:progress}
@keyframes combo-spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){
  .combo.busy::after{animation-duration:1.6s}
}

/* ------------------------------------------------------------------- paging */
/* Sits inside the panel, under the table it belongs to, so it reads as part of
   the same object rather than a control floating near it. */
.pager{display:flex;align-items:center;gap:8px;flex-wrap:wrap;
  padding:12px 14px;border-top:1px solid var(--line);background:var(--surface-2)}
.pager .btn.small{padding:5px 11px;font-size:12.5px}
.pager .btn.small:disabled{opacity:.42;cursor:default}
.pager-at{font-size:12px;color:var(--ink-3);padding:0 4px;white-space:nowrap;
  font-variant-numeric:tabular-nums}
/* A published mark a guardian can open, when the teacher attached something. */
.markdrop{border-bottom:1px solid var(--line-1)}
.markdrop:last-child{border-bottom:0}
.markdrop>summary{list-style:none;cursor:pointer}
.markdrop>summary::-webkit-details-marker{display:none}
.markdrop>summary:hover{background:var(--surface-2)}
.markdrop[open]>summary{background:var(--surface-2)}
.markfiles{padding:4px 14px 12px}
.markfiles .panel{margin:8px 0 0}
.filepad{padding:12px 14px}
.filecount{display:inline-flex;align-items:center;gap:3px;font-size:11px;
  color:var(--ink-3);border:1px solid var(--line-2);border-radius:999px;padding:1px 7px}

@media (max-width:743.98px){
  .pager{gap:6px}
  .pager .combo{min-width:120px}
  .pager .spacer{display:none}
  .pager-at{width:100%;order:-1;padding:0 0 2px}
  /* Prev and Next are the two controls on this bar a thumb actually aims at,
     and at 26px tall they were half the size a thumb needs. */
  .pager .btn.small{min-height:40px;padding:8px 18px}
}

/* ----------------------------------------------------------------- calendar */
/* Terms and enrolment periods side by side: they are two answers to the same
   question about one year, and reading them apart hides that they disagree. */
.calgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(340px,1fr));
  gap:14px;margin-top:14px;align-items:start}
.panel-note{padding:10px 14px;font-size:13px;color:var(--ink-3);
  border-bottom:1px solid var(--line);background:var(--surface-2)}
.panel-warn{margin-top:10px;padding:11px 14px;border-radius:8px;font-size:13.5px;
  background:#FBEAE6;border:1px solid #E5B7AE;color:#7A2B22}
/* `.pill` is already defined above, for the register. Only the modifier is new
   — redefining the base here would quietly restyle every attendance chip. */
.pill.on{border-color:var(--accent-line);background:var(--accent-soft);color:var(--accent)}

/* -------------------------------------------------------------------- roles */
/* One card per role, collapsed. Expanded it is a long list of checkboxes, and
   nine of those open at once is a wall — so they open one at a time. */
.rolecard{background:var(--surface);border:1px solid var(--line);border-radius:10px;
  margin-bottom:8px;overflow:hidden}
.rolecard summary{display:flex;align-items:center;gap:10px;padding:13px 16px;
  cursor:pointer;list-style:none;user-select:none}
.rolecard summary::-webkit-details-marker{display:none}
.rolecard summary:hover{background:var(--surface-2)}
.rolecard[open] summary{border-bottom:1px solid var(--line);background:var(--surface-2)}
.rolename{font-weight:600;font-size:15px}
.rolebody{padding:16px}
.permgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));
  gap:14px;margin:12px 0 4px;align-items:start}
.permgroup{border:1px solid var(--line);border-radius:8px;overflow:hidden}
.permgroup-h{font-family:var(--mono);font-size:10px;letter-spacing:.13em;text-transform:uppercase;
  color:var(--ink-3);padding:8px 12px;background:var(--surface-2);border-bottom:1px solid var(--line)}
.permrow{display:grid;grid-template-columns:auto 1fr;gap:4px 9px;align-items:baseline;
  padding:8px 12px;cursor:pointer;border-bottom:1px solid var(--line)}
.permrow:last-child{border-bottom:none}
.permrow:hover{background:var(--surface-2)}
.permrow input{grid-row:1 / span 3;align-self:center;margin:0}
.permname{font-size:13.5px}
.permcode{font-size:10.5px;color:var(--ink-3);grid-column:2}
/* What this actually turns on, taken from the same table the navigation uses */
.permopens{grid-column:2;font-size:11px;color:var(--accent)}

/* --------------------------------------------------------- attendance grid */
/* Wide by nature: a term is a hundred columns. It scrolls inside its own frame
   and the student column stays put, so a name is never lost off the left. */
.gridwrap{overflow:auto;max-height:70vh}
/* auto, not 100%: the global table rule stretches it, and six days of
   marks then sit under five tally columns a hand's width apart. */
.gridtable{border-collapse:separate;border-spacing:0;font-size:12px;width:auto}
.gridtable th,.gridtable td{border-bottom:1px solid var(--line);white-space:nowrap}
.gridtable thead th{position:sticky;top:0;z-index:2;background:var(--surface-2);
  border-bottom:1px solid var(--line-2)}
.gridname{position:sticky;left:0;z-index:3;background:var(--surface);text-align:left;
  text-transform:none;letter-spacing:normal;
  padding:6px 12px;font-weight:500;max-width:230px;overflow:hidden;text-overflow:ellipsis;
  border-right:1px solid var(--line-2)}
.gridtable thead .gridname{z-index:4;background:var(--surface-2)}
.gridday{padding:4px 0;width:26px;min-width:26px;text-align:center;font-weight:500}
.gridday-dow{display:block;font-size:9px;color:var(--ink-3);text-transform:uppercase}
.gridday-num{display:block;font-family:var(--mono);font-size:11px}
.gridcell{width:26px;min-width:26px;text-align:center;font-family:var(--mono);
  font-size:11px;padding:5px 0;color:var(--ink-3)}
.gridcell.present{background:var(--accent-soft);color:#0A5A49}
.gridcell.absent{background:var(--rose-soft);color:var(--rose);font-weight:600}
.gridcell.late{background:var(--amber-soft);color:var(--amber)}
.gridcell.excused{background:var(--blue-soft);color:var(--blue)}
.gridcell.leave{background:#EAE3F5;color:#5A3E93;font-weight:600}
.gridcell.none{color:var(--line-2)}
.gridtot{width:38px;min-width:38px;padding:5px 9px;text-align:right;font-family:var(--mono);font-size:11px;
  color:var(--ink-3);background:var(--surface-2);border-left:1px solid var(--line)}
.gridtot.bad{color:var(--rose);font-weight:600}
.gridtot.rate{color:var(--ink)}
.gridkey{display:flex;gap:12px;flex-wrap:wrap;align-items:center;font-size:11.5px;
  color:var(--ink-3)}
.gridkey-item{display:inline-flex;align-items:center;gap:5px}
.gridkey .gridcell{display:inline-block;border-radius:3px;width:20px;min-width:20px;padding:2px 0}

/* The class-subjects panel carries five verbs per row and does not fit the
   standard sheet — the last one was clipped by the edge rather than reachable. */
.sheet.xwide{width:min(1080px,calc(100vw - 32px))}
.sheet.xwide .tablewrap{overflow-x:auto}

/* ---------------------------------------------------------------- audit log */
/* One row per change, collapsed to a line: when, what kind, what it was about,
   which fields moved, and who. Opened, the fields that actually differ. */
.auditrow{border-bottom:1px solid var(--line)}
.auditrow:last-of-type{border-bottom:none}
.auditrow summary{display:flex;align-items:baseline;gap:12px;padding:9px 14px;
  cursor:pointer;list-style:none;font-size:13.5px}
.auditrow summary::-webkit-details-marker{display:none}
.auditrow summary:hover{background:var(--surface-2)}
.auditrow[open] summary{background:var(--surface-2);border-bottom:1px solid var(--line)}
.auditwhen{display:inline-flex;gap:6px;font-size:11.5px;white-space:nowrap;min-width:120px}
.auditact{font-size:10.5px;letter-spacing:.08em;text-transform:uppercase;
  padding:2px 7px;border-radius:999px;border:1px solid var(--line-2);white-space:nowrap}
.auditact.insert{background:var(--accent-soft);border-color:var(--accent-line);color:#0A5A49}
.auditact.update{background:var(--amber-soft);border-color:#DCC38A;color:var(--amber)}
.auditact.delete{background:var(--rose-soft);border-color:#E1A9A2;color:var(--rose)}
.auditwhat{font-weight:500;white-space:nowrap}
.auditsum{font-size:12.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.auditmore{display:flex;align-items:center;gap:10px;padding:10px 14px}
.auditlabel{font-size:13px;font-weight:500;min-width:0;max-width:34ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.auditwho{font-size:12.5px;white-space:nowrap}
.auditdetail{padding:12px 14px 14px;background:var(--surface)}
.auditdetail .tablewrap{overflow-x:auto}
.small{font-size:11px}
@media (max-width:743.98px){
  .auditrow summary{flex-wrap:wrap;gap:6px 10px}
  .auditsum{width:100%;white-space:normal}
}

/* ------------------------------------------------------------------- files */
/* A thumbnail for a picture, a mark for anything else, and the name doing the
   work — the same row whether it is a photograph of a script or a spreadsheet. */
.filegrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:8px}
.filecard{display:flex;align-items:center;gap:10px;padding:8px 10px;
  border:1px solid var(--line);border-radius:8px;background:var(--surface);min-width:0}
.filethumb{width:38px;height:38px;flex:none;border-radius:6px;overflow:hidden;
  background:var(--surface-2);display:grid;place-items:center}
.filethumb img{width:100%;height:100%;object-fit:cover}
.filethumb.doc{color:var(--ink-3)}
.filemeta{display:flex;flex-direction:column;min-width:0;gap:1px}
.filename{font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.filemeta .mono{font-size:10.5px}

/* -------------------------------------------------------- marking one by one */
/* The card and the work side by side: a teacher is holding the paper while they
   type the number, and the two belong on one screen. */
.focus .side{min-width:0}
.focus .side h4{margin:0 0 10px;font-size:13px;font-weight:600}
.markentry{display:flex;align-items:baseline;gap:8px;justify-content:center;
  margin:14px 0 4px}
.markbox{width:120px;font-size:26px;text-align:center;padding:8px 10px;
  border:1px solid var(--line-2);border-radius:10px;font-family:var(--mono)}
.markbox:focus{outline:2px solid var(--accent);outline-offset:1px}
.face.big{width:74px;height:74px;font-size:24px;margin:0 auto 10px}
@media (max-width:743.98px){
  .filegrid{grid-template-columns:1fr}
}

/* ------------------------------------------------------ marks, read across */
/* The mark grid borrows the attendance report's table wholesale; only the cell
   differs, because a percentage needs room where a P did not. */
.gridsub{padding:6px 8px;text-align:left;font-weight:600;font-size:11.5px;
  max-width:120px;overflow:hidden;text-overflow:ellipsis}
.gridsub .swatch{margin-right:5px}
.swatch.sm{display:inline-block;width:8px;height:8px;border-radius:2px;vertical-align:middle}
.markcell{min-width:62px;text-align:center;font-family:var(--mono);font-size:11.5px;
  padding:5px 8px}
.markcell.good{background:var(--accent-soft);color:#0A5A49;font-weight:600}
.markcell.ok{background:var(--surface-2);color:var(--ink-2)}
.markcell.watch{background:var(--amber-soft);color:var(--amber)}
.markcell.bad{background:var(--rose-soft);color:var(--rose);font-weight:600}
.markcell.none{color:var(--line-2)}
.markcell.avg{background:var(--surface-2);color:var(--ink-2);font-weight:600}
.gridfoot th,.gridfoot td{border-top:1px solid var(--line-2);background:var(--surface-2)}
.gridkey .markcell{display:inline-block;border-radius:3px;padding:2px 7px;min-width:0}

/* ------------------------------------------------ marks, one level at a time */
.crumbs{display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin:0 0 12px;
  font-size:12.5px}
.crumb-sep{color:var(--ink-3)}
/* Crumbs sit on a white panel. `.linkbtn` defaults to white (for the dark
   topbar), so without these the trail is white-on-white (#10). */
.crumb{color:var(--ink-2)}
.crumb.linkbtn{color:var(--accent);font-size:12.5px}
.crumb.linkbtn:hover{text-decoration:underline}
.crumb.here{font-weight:600;color:var(--ink)}
.chartgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(330px,1fr));
  gap:12px;padding:12px 14px}
.chartcard{border:1px solid var(--line);border-radius:10px;background:var(--surface);
  overflow:hidden}
.chartcard.summary{border-style:dashed;background:var(--surface-2)}
.chartcard.openable .chartcard-head{cursor:pointer}
.chartcard.openable:hover{border-color:var(--line-2)}
.chartcard-head{display:flex;align-items:center;gap:8px;padding:9px 12px;
  border-bottom:1px solid var(--line);font-size:13px}
.chartname{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chartcard-head>div:first-child{min-width:0;overflow:hidden}
.chartcard-head .mono.dim,.chartoverall{white-space:nowrap;flex:none}
.chartoverall{font-family:var(--mono);font-size:12px;padding:1px 7px;border-radius:999px}
.chartoverall.good{background:var(--accent-soft);color:#0A5A49}
.chartoverall.ok{background:var(--surface-2);color:var(--ink-2)}
.chartoverall.watch{background:var(--amber-soft);color:var(--amber)}
.chartoverall.bad{background:var(--rose-soft);color:var(--rose)}
.chartoverall.none{color:var(--ink-3)}
.chartopen{color:var(--ink-3);font-size:16px}
.chartbars{padding:10px 12px;display:grid;gap:7px}
.barline{display:grid;grid-template-columns:96px 1fr;align-items:center;gap:9px}
.barlabel{font-size:11.5px;color:var(--ink-2);overflow:hidden;text-overflow:ellipsis;
  white-space:nowrap}
.barlabel .swatch{margin-right:5px}
.barrow{display:flex;align-items:center;gap:8px}
.bartrack{flex:1;height:8px;border-radius:999px;background:var(--surface-2);overflow:hidden}
.barfill{height:100%;border-radius:999px;background:var(--bar);transition:width .18s ease}
.barval{font-size:11px;color:var(--ink-2);min-width:44px;text-align:right}
.barval.good{color:#0A5A49;font-weight:600}
.barval.watch{color:var(--amber)}
.barval.bad{color:var(--rose);font-weight:600}
.barval.none{color:var(--ink-3)}

@media (max-width:743.98px){
  .chartgrid{grid-template-columns:1fr;padding:10px}
}

/* --------------------------------------------------- a screen of its own */
.noscroll{overflow:hidden}
/* Opaque and above the bottom tab bar (z-index 70 clears the sheet's 60):
   a marking screen you can read the list through is not a screen. */
.sheetful-back{position:fixed;inset:0;background:var(--ground);z-index:70;
  display:flex;padding-bottom:env(safe-area-inset-bottom)}
.sheetful{flex:1;display:flex;flex-direction:column;min-width:0}
.sheetful > header{display:flex;align-items:center;gap:12px;padding:12px 18px;
  border-bottom:1px solid var(--line);background:var(--surface);position:sticky;top:0;z-index:2}
.sheetful-title{display:flex;flex-direction:column;gap:1px;min-width:0}
.sheetful-title > span:first-child{font-weight:600;font-size:15px;overflow:hidden;
  text-overflow:ellipsis;white-space:nowrap}
.sheetful-title .mono{font-size:11px}
.sheetful-body{flex:1;overflow:auto;padding:16px 18px;-webkit-overflow-scrolling:touch}

/* A code under a name reads as one cell; beside it, it reads as two columns
   the table does not have room for. */
.block{display:block;font-size:10.5px;margin-top:1px}

/* A row in the list is a way back to that student, so it looks like one. */
/* ------------------------------------------------------------------ tiles */
/* Every button on the marking screen is one of these, and they are all the
   same height whatever is written on them: two lines of text, the second
   optional, and the grid decides the width. Irregular buttons were the
   complaint and a shared size is the only reliable answer. */
/* `width:100%` matters: the stage centres its children, so without it the
   grid shrinks to its content and two rows of tiles come out different
   widths — which was the complaint. */
.tiles{display:grid;gap:8px;margin-top:10px;width:100%}
.tiles.two{grid-template-columns:1fr 1fr}
.tile{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
  min-height:54px;padding:9px 10px;border-radius:12px;border:1px solid var(--line);
  background:var(--surface-2);color:var(--ink);cursor:pointer;font-family:inherit;
  text-align:center;width:100%}
.tile .lbl{font-size:13px;font-weight:600;line-height:1.2;text-wrap:balance}
.tile .key{font-family:var(--mono);font-size:10px;color:var(--ink-3);line-height:1.15}
.tile:hover:not(:disabled){border-color:var(--accent-line)}
.tile:disabled{opacity:.4;cursor:not-allowed}
.tile.done{background:var(--accent-soft);border-color:var(--accent-line)}
.tile.go{background:var(--accent);border-color:var(--accent);color:#fff}
.tile.go .key{color:rgba(255,255,255,.72)}
.tile.go:hover:not(:disabled){background:#0C6A56}

/* ------------------------------------------------------------ the outcome */
/* Three figures on one line, flush to the panel's own edges — a card set that
   leaves a gutter down each side reads as a mistake at this width. */
/* `.stage` centres its children as flex items and reserves 440px of height
   for a portrait that is not on this screen. Neither is wanted here. */
.stage.finish{text-align:left;padding:16px;align-items:stretch;min-height:0}
.stage.finish h3{margin:0 0 12px;font-size:17px;text-align:left}
.stage.finish .notice{margin:12px 0 0}
.statrow{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.stat{border:1px solid var(--line);border-radius:10px;background:var(--surface-2);
  padding:10px;min-width:0}
.stat .k{font-family:var(--mono);font-size:9.5px;letter-spacing:.06em;text-transform:uppercase;
  color:var(--ink-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.stat .v{font-size:17px;font-weight:600;margin-top:3px;line-height:1.1;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.stat .n{font-size:10.5px;color:var(--ink-3);margin-top:2px;line-height:1.2}

/* ----------------------------------------------------------- student list */
/* Scrolls inside itself and follows whoever is being marked. The page never
   moves: the card is what the teacher is looking at. */
/* `position:relative` so a row's offsetTop is measured against this list and
   not against some ancestor — that is what makes "scroll to the student being
   marked" land on the right row. */
.studentlist{max-height:260px;overflow:auto;position:relative;
  -webkit-overflow-scrolling:touch}
.slrow{display:grid;grid-template-columns:26px minmax(0,1fr) auto;align-items:center;gap:9px;
  width:100%;padding:8px 14px;background:none;border:0;border-bottom:1px solid var(--line-1);
  font:inherit;color:inherit;text-align:left;cursor:pointer}
.slrow:last-child{border-bottom:0}
.slrow:hover{background:var(--surface-2)}
.slrow.here{background:var(--accent-soft)}
.slrow.here .slname{font-weight:600}
.slnum{font-size:11px;color:var(--ink-3)}
.slname{font-size:13px;min-width:0;overflow-wrap:anywhere}
.slmark{font-size:12px;white-space:nowrap}
.slrow.blank .slmark{color:var(--ink-3)}

/* A name over its code is one cell; side by side it is two the table has no
   room for. */
.cellstack{display:block;min-width:0}
.cellname{overflow-wrap:anywhere}
/* A status that wraps to two lines reads as two statuses. */
.pill.none,.pill.part,.pill.done{white-space:nowrap}
.pill.none{background:var(--surface-2);color:var(--ink-3)}
.pill.part{background:var(--amber-soft);color:var(--amber)}
.pill.done{background:var(--accent-soft);color:#0A5A49}

@media (max-width:560px){
  /* the date is one thing; broken over two lines it stops looking like one */
  .panel table td:nth-child(2){white-space:nowrap;font-size:12px}
  .panel table th:nth-child(2){white-space:nowrap}
}

@media (max-width:430px){
  .tile .lbl{font-size:12.5px}
  .tile{min-height:52px;padding:8px}
  .stat .v{font-size:16px}
}

@media (max-width:700px){
  .sheetful-body{padding:12px}
  .sheetful > header{padding:10px 12px}
  /* wide enough for three digits and a decimal, narrow enough that the
     "/ 20" beside it stays on the same line */
  .markbox{width:150px}
}

/* -------------------------------------------------- form: textarea & sync */
/* A multi-line note in a sheet, styled to match the single-line inputs. */
.field textarea,.sheet-body textarea{width:100%;padding:6px 9px;border-radius:8px;
  border:1px solid var(--line);background:var(--surface);font-size:13px;
  font-family:inherit;color:var(--ink);outline:none;resize:vertical;min-height:60px}
.field textarea:focus,.sheet-body textarea:focus{border-color:var(--accent-line)}
@media (pointer: coarse){ .field textarea,.sheet-body textarea{font-size:16px} }
/* A "same as phone" tick sitting above its field. */
.syncfield{display:flex;flex-direction:column;gap:5px}
.syncfield .sync-toggle{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;
  color:var(--ink-2);cursor:pointer;margin:0}
.syncfield .sync-toggle input[type=checkbox]{width:auto;flex:none;margin:0}
.syncfield input:disabled{background:var(--surface-2);color:var(--ink-3);cursor:not-allowed}

/* ------------------------------------------------ students: sortable heads */
th.sortable{cursor:pointer;user-select:none;white-space:nowrap}
th.sortable:hover{color:var(--accent)}
th.sortable.sorted{color:var(--accent)}

/* --------------------------------------------- students: column chooser */
.colmenu-back{position:fixed;inset:0;z-index:100}
.colmenu{position:fixed;z-index:101;background:var(--surface);border:1px solid var(--line);
  border-radius:10px;box-shadow:0 12px 28px rgba(8,26,20,.16);padding:6px;
  max-height:70vh;overflow:auto;min-width:180px}
.colmenu-row{display:flex;align-items:center;gap:8px;padding:6px 9px;border-radius:7px;
  font-size:13px;cursor:pointer;margin:0}
.colmenu-row:hover{background:var(--surface-2)}
.colmenu-row input[type=checkbox]{width:auto;flex:none;margin:0}

/* --------------------------------------------- remark: truncated with an (i) */
.remarkcell{display:inline-flex;align-items:center;gap:5px}
.remark-i{color:var(--ink-3);padding:0;border:none;background:none;cursor:pointer;
  display:inline-flex;align-items:center}
.remark-i:hover{color:var(--accent)}
.infopop-back{position:fixed;inset:0;z-index:120}
.infopop{position:fixed;z-index:121;max-width:340px;background:var(--surface);
  border:1px solid var(--line);border-radius:10px;box-shadow:0 12px 28px rgba(8,26,20,.16);
  padding:10px 12px;font-size:12.5px;color:var(--ink);line-height:1.5;white-space:pre-wrap}

/* ---------------------------- fees report: collapsible Period>Std>Class>Student */
.rtree .gridname{display:flex;align-items:center;gap:7px}
.rtree tr.rlvl-1 .gridname{padding-left:24px}
.rtree tr.rlvl-2 .gridname{padding-left:48px}
.rtree tr.rlvl-3 .gridname{padding-left:72px}
.rtree tr.hidden{display:none}
.rtree tr.togglerow{cursor:pointer}
.rtree tr.togglerow:hover td,.rtree tr.togglerow:hover .gridname{background:var(--surface-2)}
.rtree tr.leaf .gridname{cursor:default}
.rtree tr.rlvl-0{font-weight:600}
.rtree .rname{overflow:hidden;text-overflow:ellipsis}
.rtree .rcode{font-family:var(--mono);font-size:10.5px;color:var(--ink-3)}

/* --------------------------------------------------- import: styled file */
.filepick{display:inline-flex;align-items:center;gap:9px}
.filepick-name{font-size:12px;max-width:220px;overflow:hidden;text-overflow:ellipsis;
  white-space:nowrap}

/* --------------------------------------------- fees: generate mode chooser */
.genopts{display:flex;flex-direction:column;gap:10px}
.genopt{display:flex;align-items:center;gap:12px;text-align:left;width:100%;
  padding:13px 14px;border:1px solid var(--line);border-radius:10px;
  background:var(--surface);cursor:pointer}
.genopt:hover{border-color:var(--accent-line);background:var(--surface-2)}
.genopt-ico{flex:none;color:var(--accent);display:inline-flex}
.genopt-text{display:flex;flex-direction:column;gap:2px;min-width:0}
.genopt-title{font-weight:600;font-size:13.5px}
.genopt-desc{font-size:12px}

/* On phones, action buttons in a filter bar shrink to their icon; the button's
   title shows the label on hover / long-press. Keeps the bar from stacking. */
@media (max-width: 560px){ .bar .btn .lbl{ display: none; } }

/* Dual calendar — English, Hijri (Misri), or both */
.caltoday{display:flex;align-items:center;gap:22px;flex-wrap:wrap;background:var(--surface);border:1px solid var(--line-2);
  border-radius:12px;padding:12px 15px;margin:4px 0 12px}
.caltoday .k{font-family:var(--mono);font-size:10px;letter-spacing:.09em;text-transform:uppercase;color:var(--ink-3)}
.caltoday .v{font-size:16px;margin-top:3px}
.caltoday .ar{font-size:13px;color:var(--ink-2);direction:rtl;text-align:left}
.caltoday .hij{border-left:1px solid var(--line-2);padding-left:22px}
.calmode{display:inline-flex;border:1px solid var(--line);border-radius:9px;overflow:hidden}
.calmode button{border:0;background:var(--surface);padding:7px 14px;cursor:pointer;font-size:13px;color:var(--ink-2)}
.calmode button+button{border-left:1px solid var(--line)}
.calmode button.on{background:var(--accent);color:#fff}
.calhijrisub{font-size:13px;color:var(--accent);text-align:center;margin:-2px 0 6px;min-height:1px}
.calhost .fc-daygrid-day-top{justify-content:space-between;align-items:baseline}
.cal-hijri{font-family:var(--mono);font-size:10.5px;color:var(--accent);padding:4px 6px 0}
.cal-hijri.first{font-weight:700}
.hijrimonth{background:var(--surface);border:1px solid var(--line-2);border-radius:12px;padding:12px}
.hm-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:10px}
.hm-title{margin:0 auto;text-align:center;font-size:18px;font-weight:600}
.hm-title .ar{font-size:14px;font-weight:400;color:var(--ink-2)}
.hm-greg{font-size:12px}
.hm-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px}
.hm-grid .hw{font-family:var(--mono);font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--ink-3);text-align:center;padding:4px 0}
.hm-grid .hd{min-height:78px;border:1px solid var(--line-2);border-radius:8px;background:var(--surface);display:flex;flex-direction:column;
  align-items:flex-start;padding:6px 7px;cursor:pointer;text-align:left;gap:2px}
.hm-grid .hd.empty{border:0;background:none;cursor:default}
.hm-grid .hd .hn{font-size:18px;font-weight:600;color:var(--ink)}
.hm-grid .hd .gd{font-family:var(--mono);font-size:10.5px;color:var(--ink-3)}
.hm-grid .hd .hl{font-size:10.5px;color:var(--amber);line-height:1.2}
.hm-grid .hd.hol{background:var(--amber-soft);border-color:#DCC38A}
.hm-grid .hd.today{outline:2px solid var(--accent);outline-offset:-1px}
.checkline{display:flex;gap:10px;align-items:flex-start;padding:10px 12px;border:1px solid var(--line-2);border-radius:10px;cursor:pointer}
.checkline input{margin-top:3px}
@media (max-width:743.98px){
  .caltoday{gap:12px}.caltoday .hij{border-left:0;padding-left:0}
  .hm-grid .hd{min-height:58px;padding:4px}.hm-grid .hd .hn{font-size:15px}.hm-grid .hd .hl{display:none}
}

/* Assessments — subject-wise exams */
.atype{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.atype.three{grid-template-columns:repeat(3,minmax(0,1fr))}
.atype button{border:1px solid var(--line);background:var(--surface);border-radius:10px;padding:10px;text-align:left;cursor:pointer}
.atype button.on{border-color:var(--accent);background:var(--accent-soft)}
.atype b{display:block;font-size:13px} .atype small{color:var(--ink-3);font-size:11.5px}
.pair{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.subjpick{border:1px solid var(--line-2);border-radius:10px;overflow:hidden}
.subjpick .sp{display:grid;grid-template-columns:22px minmax(0,1fr) 92px;gap:10px;align-items:center;padding:9px 12px;border-top:1px solid var(--line-2);cursor:pointer}
.subjpick .sp:first-of-type{border-top:0}
.subjpick .sp.off{color:var(--ink-3)}
.subjpick .sp input[type=number]{width:100%;text-align:center;font-family:var(--mono)}
.subjpick .sp .t{font-size:11.5px;color:var(--ink-3)}
.subjpick .hdr{display:grid;grid-template-columns:22px minmax(0,1fr) 92px;gap:10px;padding:7px 12px;background:var(--surface-2);
  font-family:var(--mono);font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--ink-3)}
.totalbox{border:1px solid var(--accent-line);background:var(--accent-soft);border-radius:10px;padding:10px 12px}
.totalbox .k{font-family:var(--mono);font-size:10px;letter-spacing:.09em;text-transform:uppercase;color:var(--accent)}
.totalbox .v{font-family:var(--mono);font-size:24px;color:var(--accent);margin:2px 0}
.footalloc{font-family:var(--mono);font-size:12.5px;margin-right:auto;align-self:center;white-space:nowrap}
.footalloc.ok{color:var(--accent)}
.subjchips{display:inline-flex;flex-wrap:wrap;gap:4px}
.subjchips span{font-family:var(--mono);font-size:11px;background:var(--surface-2);border-radius:6px;padding:2px 7px}
.subjtabs{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:12px}
.chips{display:inline-flex;gap:6px;flex-wrap:wrap}
.mgrid td,.mgrid th{white-space:nowrap}
.mgrid th.sub{text-align:center}
.mgrid th.clickable{cursor:pointer}
.mgrid th .mx{display:block;font-size:10px;color:var(--ink-3);letter-spacing:.04em;text-transform:none;font-family:var(--mono)}
.mgrid td.c{text-align:center;font-family:var(--mono)}
.mgrid tr.avg td{background:var(--surface-2);font-weight:600}
.mgrid .tot{font-weight:600}
.mgrid tr.here td{background:var(--accent-soft)}
.mgrid tr.done td:first-child{color:var(--accent)}
.mgrid .low,.low{color:var(--rose)}
.cellin{width:62px;text-align:center;font-family:var(--mono);padding:6px 4px !important}
.cellin:focus{outline:2px solid var(--accent);outline-offset:1px;background:#fff}
.cellin:disabled{background:var(--surface-2);color:var(--ink-3)}
.cellin.bad,.mstu input.bad{border-color:var(--rose)!important;background:var(--rose-soft)}
.keyhint{display:flex;flex-wrap:wrap;gap:14px;align-items:center;font-size:12px;color:var(--ink-2);
  padding:9px 12px;border:1px dashed var(--line);border-radius:10px;margin-bottom:12px;background:var(--surface)}
kbd{font-family:var(--mono);font-size:11px;border:1px solid var(--line);border-bottom-width:2px;border-radius:5px;padding:1px 6px;background:var(--surface-2);margin-right:4px}
.mstu{background:var(--surface);border:1px solid var(--line-2);border-radius:14px;padding:16px;display:grid;gap:12px}
.mstu .who{display:flex;gap:12px;align-items:center}
.mstu .who .face{width:52px;height:52px;flex:none;font-size:18px}
.mstu .mf{display:grid;grid-template-columns:minmax(0,1fr) 84px 44px;gap:8px;align-items:center;padding:6px 0;border-top:1px solid var(--line-2)}
.mstu .mf input[type=number]{text-align:center;font-family:var(--mono);font-size:18px;padding:9px 4px}
.mstu .mf input[type=checkbox]{width:24px;height:24px;justify-self:center}
.mstu .totrow{display:flex;justify-content:space-between;font-weight:600;padding-top:10px;border-top:2px solid var(--line)}
.scard{background:var(--surface);border:1px solid var(--line-2);border-radius:12px;padding:12px 14px;display:grid;gap:8px}
.scard .top{display:flex;align-items:center;gap:10px}
.scard .chips span{font-family:var(--mono);font-size:11px;background:var(--surface-2);border-radius:6px;padding:3px 7px}
.stack{display:grid;gap:10px}
.progressline{height:6px;border-radius:4px;background:var(--surface-2);overflow:hidden}
.progressline span{display:block;height:100%;background:var(--accent)}
.publist{border:1px solid var(--line-2);border-radius:10px;overflow:auto;max-height:52vh}
.pubrow{display:flex;align-items:center;gap:10px;padding:9px 12px;border-top:1px solid var(--line-2);cursor:pointer}
.pubrow:first-child{border-top:0}
.pubrow.off{color:var(--ink-3);cursor:default}
@media (max-width:743.98px){
  .pair{grid-template-columns:1fr}
  .atype.three{grid-template-columns:1fr}
}
.typechips{display:inline-flex;gap:6px;flex-wrap:wrap}
.typechip{border:1px solid var(--line);background:var(--surface);border-radius:999px;padding:6px 12px;font-size:12.5px;cursor:pointer;color:var(--ink-2)}
.typechip.on{background:var(--accent);border-color:var(--accent);color:#fff}
@media (max-width:743.98px){.pagehead-actions{flex-wrap:wrap}}

/* Calendar — one control bar: class · today in both calendars · which calendar */
.calbar{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:18px;align-items:end;
  background:var(--surface);border:1px solid var(--line-2);border-radius:12px;padding:12px 15px;margin:4px 0 12px}
.calbar-class .field{margin:0}
.calbar-class .combo{width:190px}
.calbar .k{display:block;font-family:var(--mono);font-size:10px;letter-spacing:.09em;text-transform:uppercase;color:var(--ink-3);margin-bottom:6px}
.calbar-today{display:flex;flex-wrap:wrap;align-items:baseline;column-gap:8px;padding-bottom:6px;border-left:1px solid var(--line-2);padding-left:18px}
.calbar-today .k{flex-basis:100%}
.calbar-today .v{font-size:15px}
.calbar-today .v.hij{color:var(--accent)}
.calbar-today .sep{color:var(--ink-3)}
.calbar-today .ar{font-size:13px;color:var(--ink-2)}
.calbar-mode{justify-self:end}
.calbar-mode .calmode{height:36px}
.btngroup{display:inline-flex}
.btngroup .btn{border-radius:0;min-width:36px;justify-content:center}
.btngroup .btn:first-child{border-radius:8px 0 0 8px}
.btngroup .btn:last-child{border-radius:0 8px 8px 0;margin-left:-1px}
.hm-head{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:8px;margin-bottom:12px}
.hm-nav{display:flex;gap:8px;align-items:center}
.hm-title{margin:0;text-align:center}
.hm-greg{justify-self:end;font-family:var(--mono);font-size:12px;color:var(--ink-3)}
.actionmenu{min-width:210px;padding:4px}
.actionmenu .btnrow{display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:7px;font-size:13px}
.um-caret{margin-left:6px;font-size:10px;color:var(--ink-3)}
@media (max-width:743.98px){
  .calbar{grid-template-columns:1fr;gap:12px;align-items:stretch}
  .calbar-class .combo{width:100%}
  .calbar-today{border-left:0;padding-left:0;padding-bottom:0}
  .calbar-mode{justify-self:stretch}
  .calbar-mode .calmode{display:flex}
  .calbar-mode .calmode button{flex:1}
  .hm-head{grid-template-columns:1fr auto;grid-template-areas:"title title" "nav range"}
  .hm-title{grid-area:title}.hm-nav{grid-area:nav}.hm-greg{grid-area:range}
}
.cal-legend .calhijrisub{margin:0 14px 0 0;text-align:right;font-size:12.5px}
.cal-legend .calhijrisub:empty{display:none}
@media (max-width:743.98px){.cal-legend .calhijrisub{flex-basis:100%;text-align:left;margin:0}}
@media (max-width:743.98px){
  .calbar-class .combo{width:100% !important}
  .calbar-today .sep{display:none}
  .calbar-today .v.hij{flex-basis:100%}
}

/* Both view: the Hijri date (Arabic) top right, the English date bottom right */
.calhost.dual .fc-daygrid-day-frame{position:relative;padding-bottom:22px}
.calhost.dual .fc-daygrid-day-top{justify-content:flex-end}
.calhost.dual .fc-daygrid-day-number{position:absolute;right:6px;bottom:3px;font-size:11px;color:var(--ink-3);padding:0}
.calhost .cal-hijri{font-family:inherit;font-size:15px;line-height:1.2;color:var(--accent);padding:4px 6px 0;font-weight:600}
.calhost .cal-hijri.first{font-size:12px}
.calbar-today .v.ar{font-size:16px}
.cal-legend .calhijrisub{font-size:14px}
.hm-title .ar{font-size:20px;font-weight:600;color:var(--ink)}
.hm-grid .hw.ar{font-family:inherit;font-size:12px;letter-spacing:0;text-transform:none}
.hm-grid .hd{align-items:flex-end}
.hm-grid .hd .hn{font-size:22px}
@media (max-width:743.98px){.hm-grid .hd .hn{font-size:17px}.hm-grid .hw.ar{font-size:10px}}
.calhost.dual .fc-daygrid-day-top{flex-direction:row;justify-content:flex-end}

/* ---------------------------------------------------------------- register bar
   Class and date side by side, then Today / List view / Save. On a wide screen
   the actions sit to the right; on a phone each row fills the width and the
   three buttons share it equally, instead of a fixed-width class picker
   running under the date and two small buttons left in a corner. */
.regbar{display:flex;flex-wrap:wrap;align-items:flex-end;gap:10px 12px;margin-bottom:14px}
.regbar-pick{display:grid;grid-template-columns:minmax(0,220px) minmax(0,180px);gap:10px}
.regbar-pick .field{min-width:0}
.regbar-pick input[type="date"]{width:100%;min-width:0;box-sizing:border-box}
.regbar-acts{display:flex;gap:8px;margin-left:auto}
@media (max-width:743.98px){
  .regbar{flex-direction:column;align-items:stretch}
  .regbar-pick{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .regbar-acts{margin-left:0}
  .regbar-acts .btn{flex:1 1 0;justify-content:center}
}

/* ------------------------------------------------------------ multi-pick filter
   A dropdown of ticks (Terms on Fees collection). Sized and bordered like a
   combo so it sits in a filter bar beside them. */
.mpick{position:relative;min-width:0}
.mpick-sum{list-style:none;cursor:pointer;border:1px solid var(--line-2);border-radius:9px;
  background:var(--surface);padding:8px 28px 8px 11px;font-size:13.5px;color:var(--ink);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;position:relative}
.mpick-sum::-webkit-details-marker{display:none}
.mpick-sum::after{content:'▾';position:absolute;right:10px;top:50%;transform:translateY(-50%);color:var(--ink-3);font-size:11px}
.mpick[open] .mpick-sum{border-color:var(--accent)}
.mpick-list{position:absolute;z-index:30;top:calc(100% + 4px);left:0;min-width:100%;max-height:260px;overflow:auto;
  background:var(--surface);border:1px solid var(--line-2);border-radius:10px;padding:6px;
  box-shadow:0 8px 24px rgba(8,26,20,.12)}
.mpick-opt{display:flex;align-items:center;gap:8px;padding:7px 8px;border-radius:7px;cursor:pointer;font-size:13.5px}
.mpick-opt:hover{background:var(--surface-2)}
.btnrow{display:inline-flex;gap:8px}

/* ------------------------------------------------------- calendar: phone bar
   Title, then one line: ‹ › · Today's classes · This week | Month. */
.calnav{display:flex;flex-direction:column;gap:10px;margin:2px 0 10px}
.calnav-title{text-align:center;font-size:18px;font-weight:600;color:var(--ink)}
.calnav-sub{font-size:13px;font-weight:500;color:var(--accent);margin-top:2px}
.calnav-row{display:flex;align-items:center;gap:8px}
.calnav-row .btngroup .btn{padding:8px 13px}
.calnav-row > .btn{flex:1 1 auto;min-width:0;white-space:nowrap;justify-content:center}
.calnav-views{flex:none}
.calnav-views button{padding:8px 12px;white-space:nowrap}

/* ------------------------------------------- calendar: the shared month grid
   Lessons as dots in their subject colour, a test as a ring; days the class
   does not run dimmed; the tapped day outlined. The English grid reads left to
   right, the Hijri one keeps its numerals to the right. */
.hm-grid .hd.en{align-items:flex-start}
.hm-grid .hd .gd.hj{font-family:inherit;font-size:12.5px;color:var(--accent);font-weight:600}
.hm-grid .hd.off{opacity:.5}
.hm-grid .hd.sel{border-color:var(--accent);background:var(--accent-soft)}
.hm-grid .hd .hdots{display:flex;flex-wrap:wrap;gap:3px;margin-top:auto;padding-top:4px}
.hm-grid .hd .hdots i{width:6px;height:6px;border-radius:50%;background:var(--slot,#6E7F76)}
.hm-grid .hd .hdots i.test{background:none;border:1.5px solid var(--accent);box-sizing:border-box}
@media (max-width:743.98px){
  .hm-grid{gap:3px}
  .hm-grid .hd{min-height:62px}
  .hm-grid .hd .hdots i{width:5px;height:5px}
}

/* ------------------------------------------------ calendar: Today | Week | Month
   No FullCalendar on this screen any more: the host is a plain container. */
.calhost:not(.fc){background:none;border:0;padding:0;border-radius:0;margin-bottom:0}
.calnav-row{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:10px}
.calnav-title{text-align:center;font-size:17px;font-weight:600;color:var(--ink);line-height:1.25}
.calnav-sub{font-size:12.5px;font-weight:500;color:var(--accent)}
@media (max-width:743.98px){
  /* the title on its own line, the arrows and the three views on one below */
  .calnav-row{grid-template-columns:auto 1fr;grid-template-areas:"title title" "nav views"}
  .calnav-row .calnav-title{grid-area:title}
  .calnav-row .btngroup{grid-area:nav}
  .calnav-row .calnav-views{grid-area:views;justify-self:end}
}

/* A day: weekday ——— English date | Hijri date, and under it one line of what
   happens — the span of the day and its subjects. Closed by default in a week;
   open, the lessons below, one line each. */
.callist{display:flex;flex-direction:column;gap:8px}
.calday{background:var(--surface);border:1px solid var(--line-2);border-radius:12px;overflow:hidden}
.calday.today{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent) inset}
.calday.hol{background:var(--amber-soft)}
.calday.off{opacity:.65}
.calday > summary{list-style:none;cursor:pointer;padding:11px 14px;display:flex;flex-direction:column;gap:5px}
.calday > summary::-webkit-details-marker{display:none}
.calday-top{display:flex;align-items:center;gap:10px}
.calday-name{font-family:var(--mono);font-size:12px;font-weight:700;letter-spacing:.08em;
  text-transform:uppercase;color:var(--accent);flex:none}
.calday-rule{flex:1;border-top:1px dashed var(--line);min-width:12px}
.calday-date{font-family:var(--mono);font-size:12px;font-weight:600;color:var(--ink-2);flex:none;text-align:right}
.calday-top::after{content:'▾';font-size:11px;color:var(--ink-3);transition:transform .15s}
.calday[open] .calday-top::after{transform:rotate(180deg)}
.calday-sum{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 10px;font-size:13px;color:var(--ink)}
.calday-time{font-weight:600;white-space:nowrap}
.calday-names{color:var(--ink-2)}
.calday-hol{font-weight:600;color:var(--amber)}
.calday-tag{font-size:11.5px;padding:1px 8px;border-radius:99px;background:var(--surface-2);color:var(--ink-2)}
.calday-tag.test{background:var(--accent-soft);color:#0A5A49}
.calday-rows{display:flex;flex-direction:column;gap:6px;padding:4px 14px 12px;border-top:1px solid var(--line-2)}
.calday-row{--slot:#6E7F76;display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:9px;
  background:color-mix(in srgb,var(--slot) 9%,var(--surface))}
.calday-row.clickable{cursor:pointer}
.calday-row.clickable:hover{opacity:.85}
.calday-row.off{opacity:.5}
.calday-row.off .calday-rname{text-decoration:line-through}
.calday-row.test{--slot:var(--accent)}
.calday-rtime{flex:none;font-size:12px;font-weight:600;white-space:nowrap;
  color:color-mix(in srgb,var(--slot) 70%,var(--ink))}
.calday-rname{flex:1;min-width:0;font-size:13px;font-weight:500;color:var(--ink);overflow-wrap:anywhere}
.calday-open{align-self:flex-start;margin-top:2px;font-size:12.5px}
.cal-daypanel:empty{display:none}
.cal-daypanel .calday{border:0;border-radius:0}

/* A destructive button: red outline, red on hover (Delete an assessment). */
.btn.danger{color:#B42318;border-color:#F1B8B2}
.btn.danger:hover{background:#FDECEA;border-color:#B42318}

/* New message: who on the left (whole school, then classes / guardians /
   people as tick lists), what on the right. Wide, so a long class list or a
   guardian search has room; one column on a phone. */
.sheet.msg-sheet{width:min(1040px,100%);height:min(720px,90vh);max-height:90vh}
.msg-compose{flex:1;min-height:0;display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr)}
.msg-who,.msg-what{min-height:0;padding:14px 16px;display:flex;flex-direction:column;gap:10px}
.msg-who{border-inline-end:1px solid var(--line-2);background:var(--surface-2)}
.msg-what{overflow:auto}
.msg-school{display:flex;align-items:flex-start;gap:10px;padding:11px 12px;cursor:pointer;
  border:1px solid var(--line);border-radius:10px;background:var(--surface)}
.msg-school:hover{border-color:var(--accent-line)}
.msg-school:has(input:checked){border-color:var(--accent);background:var(--accent-soft)}
.msg-school input{margin-top:3px}
.msg-school .grow{display:flex;flex-direction:column;gap:2px}
/* Only the list gives way when the pane is short. The tab bar scrolls sideways,
   which in a flex column lets it shrink to nothing — and it did, leaving its
   bottom border as a stray line. */
.msg-who > :not(.msg-list){flex-shrink:0}
.msg-who .subtabs{margin-bottom:0}
.msg-count{display:inline-block;min-width:18px;margin-inline-start:6px;padding:0 5px;border-radius:999px;
  background:var(--accent);color:#fff;font-size:11px;line-height:18px;text-align:center;font-weight:600}
.msg-tools{display:flex;align-items:center;gap:12px}
.msg-search{flex:1;min-width:0}
.msg-bulk{display:flex;gap:12px;flex:none}
.msg-list{flex:1;min-height:120px;max-height:none;background:var(--surface)}
.msg-list .pickrow{cursor:pointer}
.msg-list .pickrow .grow{flex:1;min-width:0}
.msg-list .pickrow.is-off{cursor:default}
.msg-list .pickrow.is-off > :not(input){opacity:.6}
.msg-list.is-covered{opacity:.75}
.msg-group{padding:9px 12px 5px;font-family:var(--mono);font-size:10px;letter-spacing:.08em;
  text-transform:uppercase;color:var(--ink-3);border-bottom:1px solid var(--line)}
.msg-to{display:flex;flex-wrap:wrap;gap:6px;min-height:38px;padding:6px;align-items:center;
  border:1px solid var(--line);border-radius:8px;background:var(--surface-2)}
.msg-to > .field-help{padding:0 4px}
.msg-chip{display:inline-flex;align-items:center;gap:4px;padding:3px 4px 3px 10px;border-radius:999px;
  font-size:12.5px;background:var(--surface);border:1px solid var(--line)}
.msg-chip.school{background:var(--accent-soft);border-color:var(--accent-line);color:#0A5A49;font-weight:600}
.msg-chip-x{border:0;background:none;cursor:pointer;color:var(--ink-3);font-size:15px;line-height:1;
  width:20px;height:20px;border-radius:50%}
.msg-chip-x:hover{background:rgba(0,0,0,.07);color:var(--ink)}
.msg-body{flex:1}
.msg-body textarea{flex:1;min-height:140px;resize:vertical}
/* Phone: the whole screen, one column that scrolls as one — who, then the
   message — with Cancel / Send held at the bottom. Nothing in it is squeezed
   to fit, so nothing can be drawn over anything else. */
@media (max-width:743.98px){
  .sheet-back:has(> .msg-sheet){padding:0;place-items:stretch}
  .sheet.msg-sheet{width:100%;height:100dvh;max-height:100dvh;border-radius:0}
  .msg-compose{display:block;flex:1;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch}
  .msg-who,.msg-what{min-height:auto;overflow:visible;padding:14px 16px}
  .msg-who{border-inline-end:0;border-bottom:1px solid var(--line-2)}
  .msg-who > *{flex-shrink:0}
  .msg-tools{flex-wrap:wrap;gap:8px 14px}
  .msg-search{flex:1 1 100%;min-height:44px;font-size:16px}
  .msg-bulk .linkbtn{min-height:32px}
  .msg-list{flex:none;max-height:min(320px,45dvh);overflow-y:auto}
  .msg-list .pickrow{min-height:44px}
  .msg-list .pickrow .dim{font-size:12px;text-align:end}
  .msg-who .subtab{padding:10px 14px}
  .msg-what input,.msg-what textarea{font-size:16px}
  .msg-what input{min-height:44px}
  .msg-body textarea{min-height:120px}
  .msg-sheet > footer .btn{min-height:44px;padding:0 18px}
}

/* ------------------------------------------------------------ calendar (kal)
   One month, two calendars. Web: the grid, with the day card and "Coming up"
   in a 352px column beside it. Phone: one column inside the app's own top bar
   and tabs. Hijri text is always Arabic (--ar), Gregorian always English.
   Categories: school day, no school, holiday, assessment — and events, which
   carry their own colour. */
.kal{display:flex;flex-direction:column;gap:14px;min-width:0}
.kal-ar{font-family:var(--ar);direction:rtl;unicode-bidi:isolate}
.kal-eyebrow{font-family:var(--mono);font-size:11px;letter-spacing:.12em;text-transform:uppercase;color:var(--ink-3)}
.kal-head{display:flex;align-items:flex-end;gap:16px;flex-wrap:wrap}
.kal-headl{display:flex;flex-direction:column;gap:6px;min-width:0}
.kal-titlerow{display:flex;align-items:baseline;gap:18px;flex-wrap:wrap}
.kal-title{font-size:34px;font-weight:600;letter-spacing:-.01em;line-height:1.1;color:var(--ink);white-space:nowrap}
.kal-sub{font-size:23px;color:var(--accent);white-space:nowrap}
.kal-sub-en{font-family:var(--sans)}
.kal-acts{display:flex;gap:8px;margin-inline-start:auto;align-items:center}
.kal-acts .btn{white-space:nowrap;height:40px;padding:0 16px;font-size:14px}
.kal-body{display:grid;grid-template-columns:minmax(0,1fr) 352px;gap:16px;align-items:start}
.kal-panel{background:var(--surface);border:1px solid var(--line);border-radius:14px;overflow:hidden;min-width:0}
.kal-tools{display:flex;align-items:center;gap:8px;padding:12px 14px;border-bottom:1px solid var(--line-2)}
.kal-arrow{width:40px;height:40px;justify-content:center;padding:0;font-size:18px}
.kal-seg{display:inline-flex;border:1px solid var(--line);border-radius:10px;overflow:hidden;background:var(--surface)}
.kal-seg button{border:0;background:none;padding:0 16px;height:38px;font-size:14px;color:var(--ink-2);cursor:pointer}
.kal-seg button+button{border-inline-start:1px solid var(--line)}
.kal-seg button.on{background:var(--accent);color:#fff}

/* the grid */
.kal-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr))}
.kal-wd{padding:10px 12px 8px;font-family:var(--mono);font-size:12px;letter-spacing:.08em;text-transform:uppercase;
  color:var(--ink-3);border-bottom:1px solid var(--line-2)}
.kal-cell{position:relative;display:flex;flex-direction:column;align-items:stretch;gap:4px;min-width:0;height:112px;
  padding:8px 8px 18px;text-align:start;background:#fff;border:0;border-inline-end:1px solid var(--line-2);
  border-bottom:1px solid var(--line-2);cursor:pointer;font:inherit;color:var(--ink);overflow:hidden}
.kal-cell:nth-child(7n){border-inline-end:0}
.kal-cell:hover{background:var(--surface-2)}
.kal-cell.htint{background:#F5F9F6}
.kal-cell.off{background:repeating-linear-gradient(135deg,#F1F5F1 0 5px,#FFF 5px 10px);color:#7C8B82}
.kal-cell.hol{background:#FBF3E2;color:var(--amber)}
.kal-cell.out{opacity:.5}
.kal-cell.sel{box-shadow:inset 0 0 0 2px var(--ink)}
.kal-cell.hstart::before{content:"";position:absolute;inset-block:0;inset-inline-start:0;width:4px;background:var(--accent)}
.kal-nums{display:flex;align-items:center;gap:8px;min-height:30px}
.kal-n{font-size:17px;font-weight:500;line-height:1;min-width:30px;height:30px;display:inline-grid;place-items:center;border-radius:50%}
.mode-hijri .kal-n{font-size:22px}
.kal-cell.today .kal-n{background:var(--accent);color:#fff}
.kal-s{font-size:18px;color:var(--accent);line-height:1}
.mode-hijri .kal-s{font-size:12px;font-family:var(--mono);color:var(--ink-3)}
.kal-hpill{align-self:flex-start;max-width:100%;padding:2px 8px;border-radius:7px;background:var(--accent-soft);
  color:var(--accent);font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.kal-chip{display:block;max-width:100%;padding:3px 8px;border-radius:7px;font-size:12.5px;line-height:1.3;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.kal-chip.hol{background:#F7EED9;color:var(--amber)}
.kal-chip.test{background:var(--blue-soft);color:var(--blue)}
.kal-chip.ev{background:color-mix(in srgb,var(--ev) 15%,#fff);color:color-mix(in srgb,var(--ev) 82%,#000);
  border-inline-start:3px solid var(--ev)}
.kal-more{font-size:11.5px;color:var(--ink-3);padding-inline-start:2px}
.kal-dots{position:absolute;inset-block-end:7px;inset-inline-end:8px;display:flex;gap:3px}
.kal-dots i{width:6px;height:6px;border-radius:50%}
.kal-legend{display:flex;flex-wrap:wrap;gap:8px 20px;padding:12px 16px;font-size:13px;color:var(--ink-2)}
.kal-legend span{display:inline-flex;align-items:center;gap:8px}
.kal-legend .sw{width:16px;height:16px;border-radius:4px;border:1px solid #B9C6BE;display:inline-block}
.kal-legend .sw.school{background:#fff}
.kal-legend .sw.noschool{background:repeating-linear-gradient(135deg,#F1F5F1 0 3px,#FFF 3px 6px)}
.kal-legend .sw.holiday{background:#FBF3E2;border-color:#DCC38A}
.kal-legend .sw.assess{background:var(--blue-soft);border-color:#9CC0E2}
.kal-legend .sw.event{background:conic-gradient(#7A3E9D 0 33%,#C2571A 0 66%,#2563A8 0);border-color:transparent}

/* the side column: the day, then what is coming */
.kal-side{display:flex;flex-direction:column;gap:16px;min-width:0}
.kal-card{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:18px 20px;min-width:0}
.kal-card:empty{display:none}
.kal-dayhead{display:flex;align-items:flex-start;gap:12px;justify-content:space-between}
.kal-dayg{font-size:27px;font-weight:600;margin-top:6px;line-height:1.15}
.kal-dayh{font-size:22px;color:var(--accent);margin-top:4px}
.kal-status{display:flex;align-items:center;gap:10px;margin-top:14px;padding:10px 14px;border-radius:10px;
  background:var(--accent-soft);color:#0A5A49;font-size:15px}
.kal-status i{width:9px;height:9px;border-radius:50%;background:var(--accent);flex:none}
.kal-status.hol{background:#F7EED9;color:var(--amber)}
.kal-status.hol i{background:var(--amber)}
.kal-status.off{background:var(--surface-2);color:var(--ink-3)}
.kal-status.off i{background:#B9C6BE}
.kal-hours{margin-inline-start:auto;font-family:var(--mono);font-size:12.5px}
.kal-sec{margin-top:18px}
.kal-sech{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:8px;
  font-family:var(--mono);font-size:11px;letter-spacing:.12em;text-transform:uppercase;color:var(--ink-3)}
.kal-sech .dim{font-family:var(--sans);font-size:13px;letter-spacing:0;text-transform:none}
.kal-tl{display:flex;flex-direction:column}
.kal-tlrow{display:grid;grid-template-columns:76px 12px minmax(0,1fr);gap:12px;padding:6px 0;position:relative}
.kal-tlrow > i{width:11px;height:11px;border-radius:50%;margin-top:5px;position:relative;z-index:1}
.kal-tlrow:not(:last-child)::after{content:"";position:absolute;left:93px;top:22px;bottom:-6px;width:2px;background:var(--line-2)}
.kal-tltime{display:flex;flex-direction:column;font-family:var(--mono);font-size:12.5px}
.kal-tltime span{color:var(--ink-3);font-size:11.5px}
.kal-tlname{font-size:15.5px;font-weight:500;display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.kal-tlwho{font-size:14px;color:var(--ink-2)}
.kal-tlrow.off .kal-tlname{text-decoration:line-through;color:var(--ink-3)}
.kal-tlrow.brk .kal-tlname{color:var(--ink-2)}
.kal-evrow{display:flex;gap:10px;padding:9px 10px;border-radius:10px;
  background:color-mix(in srgb,var(--ev) 9%,#fff);border-inline-start:3px solid var(--ev);margin-bottom:6px}
.kal-evrow > i{display:none}
.kal-evrow.clickable{cursor:pointer}
.kal-evrow.clickable:hover{background:color-mix(in srgb,var(--ev) 15%,#fff)}
.kal-evrow .grow{flex:1;min-width:0}
.kal-evtitle{font-weight:600;font-size:15px}
.kal-evmeta{font-size:12.5px;color:var(--ink-2);margin-top:2px}
.kal-evdesc{font-size:13px;color:var(--ink-2);margin-top:4px;white-space:pre-wrap}
.kal-testrow{display:flex;gap:10px;width:100%;padding:9px 10px;border:0;border-radius:10px;background:var(--blue-soft);
  color:var(--blue);font:inherit;font-size:14px;text-align:start;cursor:pointer;margin-bottom:6px}
.kal-testrow .grow{flex:1;min-width:0}
.kal-open{display:inline-block;margin-top:14px;font-size:13px}
.kal-up .kal-eyebrow{margin-bottom:6px}
.kal-uprow{display:flex;gap:12px;align-items:center;width:100%;padding:12px 0;border:0;border-top:1px solid var(--line-2);
  background:none;font:inherit;text-align:start;cursor:pointer;color:var(--ink)}
.kal-uprow .grow{flex:1;min-width:0}
.kal-update{display:flex;flex-direction:column;gap:2px;width:84px;flex:none}
.kal-update b{font-family:var(--mono);font-size:12.5px}
.kal-update .kal-ar{color:var(--accent);font-size:14px;text-align:start}
.kal-uptitle{font-size:15px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.kal-upkind{font-size:13px}
.kal-upkind.hol{color:var(--amber)}
.kal-upkind.test{color:var(--blue)}
.kal-upkind.ev{color:color-mix(in srgb,var(--ev) 85%,#000)}
.kal-upwhen{font-size:13px;white-space:nowrap}

/* the event form */
.sheet.kal-evsheet{width:min(640px,100%)}
.kal-evsheet .span2{grid-column:1 / -1}
.kal-typerow{display:flex;flex-wrap:wrap;gap:6px}
.kal-type{display:inline-flex;align-items:center;gap:7px;height:36px;padding:0 13px;border-radius:999px;
  border:1px solid var(--line);background:var(--surface);font:inherit;font-size:13.5px;color:var(--ink);cursor:pointer}
.kal-type i{width:10px;height:10px;border-radius:50%;background:var(--ev)}
.kal-type.on{border-color:var(--ev);background:color-mix(in srgb,var(--ev) 12%,#fff);font-weight:600}
.kal-swatches{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.kal-swatch{width:30px;height:30px;border-radius:50%;border:2px solid #fff;box-shadow:0 0 0 1px var(--line);cursor:pointer}
.kal-swatch.on{box-shadow:0 0 0 2px var(--ink)}
.kal-swatches input[type=color]{width:38px;height:32px;padding:0 2px;border:1px solid var(--line);border-radius:8px;background:none;cursor:pointer}
.kal-timerow{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.kal-timerow[hidden]{display:none}
.kal-switch{display:flex;gap:12px;align-items:flex-start;padding:12px 14px;border-radius:12px;background:var(--surface-2);
  border:1px solid var(--line-2);cursor:pointer}
.kal-switch input[type=checkbox]{margin-top:3px;flex:none}
.kal-switch-l{display:flex;gap:12px;align-items:flex-start;flex:1;min-width:0;cursor:pointer}
.kal-daysbox{display:inline-flex;align-items:center;gap:8px;flex:none}
.kal-days{width:64px}

/* phone: the month in one column, inside the real top bar and tabs */
.kal-phone{gap:12px}
.kal-prow{display:flex;align-items:center;gap:10px;min-width:0}
.kal-ptitle{font-size:25px;font-weight:700;margin:0}
.kal-prow .btn,.kal-pbtns .btn{height:44px;font-size:15px;white-space:nowrap}
.kal-pbtns{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.kal-pbtns .btn{justify-content:center}
.kal-pmonth{position:relative;min-width:0;display:flex;flex-direction:column;gap:2px}
.kal-phone .kal-title{font-size:21px;display:flex;align-items:center;gap:6px}
.kal-phone .kal-title .um-caret{font-size:12px;color:var(--ink-3)}
.kal-phone .kal-sub{font-size:15px}
.kal-jump{position:absolute;inset:0;opacity:0;width:100%;height:100%;cursor:pointer}
.kal-phone .kal-arrow{width:44px;height:44px;border-radius:50%}
.kal-phone .kal-seg{flex:1}
.kal-phone .kal-seg button{flex:1;height:44px;padding:0 6px}
.kal-phone .combo{min-width:0}
.kal-classpick{height:44px;max-width:42%;padding:0 10px;border:1px solid var(--line);border-radius:10px;
  background:var(--surface);color:var(--ink);font:inherit;font-size:15px;text-overflow:ellipsis}
.kal-phone .kal-gridhost{margin:0 -4px}
.kal-phone .kal-wd{padding:6px 0;text-align:center;border:0;font-size:11.5px}
.kal-phone .kal-cell{height:50px;padding:3px 0 0;align-items:center;gap:0;border:0;background:none;border-radius:0}
.kal-phone .kal-cell.htint{background:#E3EFE8}
.kal-phone .kal-cell.off{background:none;color:#8A9890}
.kal-phone .kal-cell.hol{background:none;color:var(--amber)}
.kal-phone .kal-cell.sel{box-shadow:none}
.kal-phone .kal-cell.hstart::before{inset-block:8px;width:3px;border-radius:2px}
.kal-phone .kal-nums{flex-direction:column;gap:1px;min-height:0}
.kal-phone .kal-n{font-size:19px;min-width:32px;height:32px}
.kal-phone .mode-hijri .kal-n{font-size:20px}
.kal-phone .kal-s{font-size:12.5px}
.kal-phone .kal-cell.today .kal-n{background:none;color:inherit;box-shadow:inset 0 0 0 1.5px var(--accent)}
.kal-phone .kal-cell.sel .kal-n{background:var(--ink);color:#fff;box-shadow:none}
.kal-phone .kal-cell.sel .kal-s{color:var(--ink)}
.kal-marks{display:flex;gap:2px;justify-content:center;margin-top:1px}
.kal-marks i{width:4px;height:4px;border-radius:50%}
.kal-phone .kal-legend{padding:4px 0;gap:6px 14px}
.kal-phone .kal-card{border-radius:16px;padding:16px}
.kal-phone .kal-dayhead .kal-status{margin-top:0;padding:6px 12px;border-radius:999px;font-size:13.5px;white-space:nowrap}
.kal-phone .kal-dayhead .kal-status i{display:none}
.kal-phone .kal-dayg{font-size:23px}
.kal-phone .kal-dayh{font-size:19px}
.kal-phone .kal-tlrow{grid-template-columns:70px 12px minmax(0,1fr)}
.kal-phone .kal-tlrow:not(:last-child)::after{left:87px}
@media (max-width:1180px){
  .kal-body{grid-template-columns:minmax(0,1fr)}
  .kal-side{display:grid;grid-template-columns:1fr 1fr;align-items:start}
}
@media (max-width:743.98px){
  .kal-side{grid-template-columns:minmax(0,1fr)}
  .sheet.kal-evsheet .sheet-body{grid-template-columns:minmax(0,1fr)}
  .kal-evsheet input[type=text],.kal-evsheet input[type=date],.kal-evsheet input[type=time]{font-size:16px;min-height:44px}
}

/* A phone held sideways: the app is built for portrait, so say so rather
   than squeeze it. Phones only — a tablet or laptop is wide in any position. */
.turn-phone{display:none}
@media (orientation:landscape) and (max-height:500px) and (hover:none) and (pointer:coarse){
  .turn-phone{position:fixed;inset:0;z-index:9999;display:flex;flex-direction:column;align-items:center;
    justify-content:center;gap:14px;padding:24px;text-align:center;background:var(--board,#16241F);color:#fff}
  .turn-phone svg{width:56px;height:56px;animation:turn-phone 1.8s ease-in-out infinite}
  .turn-phone b{font-size:20px}
  .turn-phone span{font-size:15px;opacity:.8;max-width:320px}
  body:has(.turn-phone){overflow:hidden}
}
@keyframes turn-phone{0%,30%{transform:rotate(-90deg)}60%,100%{transform:rotate(0)}}
@media (prefers-reduced-motion:reduce){.turn-phone svg{animation:none}}

/* Audit: one line per thing somebody did, its rows inside when opened */
.auditact.signin{background:var(--blue-soft);border-color:#9CC0E2;color:var(--blue)}
.auditgroup-rows{padding:4px 0 8px 18px;background:var(--surface-2)}
.auditgroup-rows .auditrow summary{padding:7px 12px}

/* ---------------------------------------------------------- touch minimums
   App Store and Play review measure these: a tap target of 44pt (48dp on
   Android), text no smaller than 12px, and a phone's own text size honoured
   rather than overridden. Touch screens only — a desk keeps its density. */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
@media (pointer:coarse){
  :root{ --ctl-h:44px; }
  .btn,.combo-input,select{min-height:44px}
  .btn.iconbtn,.linkbtn.iconbtn{min-width:44px;min-height:44px}
  .combo-opt{min-height:44px}
  .field-label,.inline-field > span,.combo-hint,.nav .grp{font-size:12px}
  select,textarea,.combo-input{font-size:16px}
}

/* ------------------------------------------------------------------- the app
   Inside the Android and iOS apps the top bar, the tab bar, the More list and
   the account menu are native (core-app.js), so the console's own are hidden
   and each screen fills the space between the app's two bars. The app's top
   bar shows the screen's title, so the page heading would only repeat it. */
.in-app .topbar,.in-app #nav,.in-app .turn-phone{display:none !important}
.in-app #app{grid-template-rows:minmax(0,1fr)}
.in-app .body{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
.in-app h2.page{display:none}
/* the timetable's own dark header keeps its class picker and actions; the
   title is the app's */
.in-app .ttp-top > h2,.in-app .kal-ptitle{display:none}
.in-app main{overscroll-behavior-y:contain}
@media (max-width:743.98px){
  .in-app main{padding:12px 16px 28px}
}
/* the app draws no toast of its own; the console's sit above its tab bar */
.in-app .toasts{top:auto;bottom:12px}
/* pull to refresh */
.ptr{position:fixed;top:-64px;left:50%;z-index:70;width:40px;height:40px;border-radius:50%;
  display:grid;place-items:center;background:var(--surface);color:var(--ink-3);
  box-shadow:0 4px 14px rgba(8,26,20,.18);transform:translate(-50%,0);pointer-events:none}
.ptr.ready{color:var(--accent)}
.ptr.spinning{transform:translate(-50%,88px);color:var(--accent);animation:ptr-spin .8s linear infinite}
@keyframes ptr-spin{from{transform:translate(-50%,88px) rotate(0)}to{transform:translate(-50%,88px) rotate(360deg)}}
/* an app too old for this server */
.app-update{position:fixed;inset:0;z-index:9999;display:flex;flex-direction:column;align-items:center;
  justify-content:center;gap:12px;padding:24px;text-align:center;background:var(--board);color:#fff}
.app-update b{font-size:21px}
.app-update span{font-size:16px;opacity:.85;max-width:340px;line-height:1.45}

/* ------------------------------------------------------------ phone layout
   The phone layout from the mobile handoff, under the one breakpoint (744, the
   narrowest iPad held upright). Body 16px, fields 48px and 16px (so iOS never
   zooms on focus), filters two to a row, tables as stacked rows, sheets that
   rise from the bottom. Tablets and desks keep the dense web layout. */
@media (max-width:743.98px){
  body{font-size:16px}
  :root{ --ctl-h:48px; }
  main{padding:16px 16px 28px}
  .page-sub{font-size:14px}
  h2.page{font-size:24px}

  /* filters: a white card, two to a row; a search spans the row */
  .bar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;align-items:end;
    background:var(--surface);border:1px solid var(--line-2);border-radius:16px;padding:12px}
  .bar > *{min-width:0;width:100%}
  .bar > .inline-field,.bar > .combo{flex:none}
  .bar > input[type=search],.bar > .search,.bar > .grow,.bar > .inline-field:has(input[type=search]){grid-column:1 / -1}
  .bar > .spacer{display:none}
  .bar .btn{justify-content:center}
  /* a row of buttons inside a filter card or a panel header is a row, not a
     second card */
  .bar .bar,.panel header .bar,.bar.tight{display:flex;flex-wrap:wrap;gap:8px;
    background:none;border:0;border-radius:0;padding:0}
  .inline-field > span,.field-label{font-size:12px;color:#5C6D64}
  input[type=text],input[type=date],input[type=search],input[type=number],input[type=password],
  .combo-input,select,textarea{font-size:16px;border-radius:12px}
  input[type=text],input[type=date],input[type=search],input[type=number],input[type=password]{
    height:48px;border-width:1.5px;background:var(--surface-2)}

  /* the native picker that stands in for combo() */
  .combo.native{display:block;width:100%;min-width:0}
  .combo-select{width:100%;height:48px;padding:0 36px 0 12px;border:1.5px solid var(--line);border-radius:12px;
    background:var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235C6D64' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat right 14px center;
    -webkit-appearance:none;appearance:none;color:var(--ink);font:inherit;font-size:16px}
  .combo.native.busy{opacity:.6}

  /* buttons a thumb can hit */
  .btn{min-height:48px;border-radius:12px;font-size:15px;padding:8px 14px}
  .btn.big{min-height:52px}

  /* cards */
  .card,.panel,.stat{border-radius:16px}
  .card .k,.stat .k{font-size:12px}
  .card .n{font-size:13.5px}

  /* a table as a column of rows: the first cell titles the row, every other
     cell is a labelled line beneath it */
  .tablewrap.stack{overflow:visible;border:0;background:none}
  .tablewrap.stack table,.tablewrap.stack tbody{display:block;width:100%}
  .tablewrap.stack thead{display:none}
  .tablewrap.stack tr{display:block;background:var(--surface);border:1px solid var(--line-2);
    border-radius:16px;padding:12px 14px;margin:0 0 10px}
  .tablewrap.stack tr.clickable:active{background:#F7FAF7}
  .tablewrap.stack td{display:flex;justify-content:space-between;align-items:baseline;gap:12px;
    padding:4px 0;border:0;font-size:15px;text-align:end;min-width:0;overflow-wrap:anywhere}
  .tablewrap.stack td::before{content:attr(data-label);flex:none;max-width:45%;text-align:start;
    font-family:var(--mono);font-size:12px;letter-spacing:.04em;text-transform:uppercase;color:#5C6D64}
  .tablewrap.stack td:not([data-label])::before,.tablewrap.stack td[data-label=""]::before{content:none}
  .tablewrap.stack td:first-child{display:block;text-align:start;font-size:16px;font-weight:600;
    padding:0 0 6px;margin-bottom:4px;border-bottom:1px solid var(--line-2)}
  .tablewrap.stack td:first-child::before{content:none}
  .tablewrap.stack td:empty{display:none}
  .tablewrap.stack td .empty{width:100%;text-align:center}
  .tablewrap.stack .num{font-family:var(--mono)}
  .tablewrap.stack td .btn,.tablewrap.stack td .iconbtn{min-height:44px}

  /* sheets rise from the bottom, with a grab handle */
  .sheet-back{place-items:end stretch;padding:0}
  .sheet{width:100%;max-height:calc(100% - 24px);border-radius:24px 24px 0 0;
    box-shadow:0 -10px 30px rgba(8,26,20,.18);padding-bottom:env(safe-area-inset-bottom)}
  .sheet > header{position:relative;padding:22px 16px 14px;font-size:21px;font-weight:700}
  .sheet > header::before{content:'';position:absolute;top:8px;left:50%;width:38px;height:5px;
    margin-left:-19px;border-radius:3px;background:#D6DED8}
  /* rows as tall as what is in them: a card that clips its corners
     (overflow:hidden) would otherwise be squeezed to nothing in a sheet
     shorter than its content */
  .sheet-body{background:var(--ground);padding:16px;grid-auto-rows:max-content}
  .sheet > footer{background:var(--surface);padding:12px 16px}
  .sheet > footer .btn{flex:1;min-height:52px;justify-content:center}
  .sheet header [aria-label="Close"]{width:44px;height:44px;border-radius:50%;background:var(--surface-2)}

  /* the full-screen marking overlay: a thumb-sized Close, nothing under the
     home indicator */
  .sheetful > header{min-height:56px}
  .sheetful > header .btn{min-height:44px;min-width:72px;justify-content:center}
  .sheetful-title > span:first-child{font-size:17px}
  .sheetful-title .mono{font-size:12px}
  .sheetful-body{padding:16px 16px calc(24px + env(safe-area-inset-bottom))}

  /* toasts sit at the bottom, centred */
  .toasts{left:16px;right:16px;top:auto;bottom:16px;align-items:center}
  .toast{max-width:480px;width:100%}
}
@media (min-width:744px){
  .sheet{border-radius:20px;width:min(640px,calc(100% - 48px));max-height:86%}
}
