
/* ============================================================
   Theme layer v2 — matches the final demo design:
   lavender paper with doodles, glass light sidebar, gradient icon tiles,
   20px cards, gradient primary buttons, coloured KPI edges.
   ============================================================ */
:root{
  --paper:#e3e7f4; --surface:#fff; --surface-2:#f4f6fb; --line:#d6dcec; --line-2:#c4cce3; --fg:#0f172a; --muted:#5b6478; --faint:#8790a5;
  --pri:#059669; --pri-d:#047857; --pri-soft:#e6f7ef; --pri-line:#a7f3d0;
  --grad:linear-gradient(135deg,#34d399,#059669 55%,#047857);
  --shadow:0 1px 2px rgba(15,23,42,.05),0 14px 32px -14px rgba(30,27,75,.22);
  --shadow-up:0 14px 28px -12px color-mix(in srgb,var(--pri) 50%,transparent);
  --glow1:rgba(99,102,241,.16); --glow2:color-mix(in srgb,var(--p1) 12%,transparent);
  --doodle:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='520' viewBox='0 0 520 520' fill='none' stroke='%233730a3' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' opacity='.09'%3E%3Cpath d='M48 86q22-12 44 0v54q-22-12-44 0z M92 86q22-12 44 0v54q-22-12-44 0z M100 100h26M100 112h26M100 124h18'/%3E%3Cg transform='rotate(-35 330 90)'%3E%3Crect x='280' y='82' width='84' height='16' rx='3'/%3E%3Cpath d='M364 82l18 8-18 8M294 82v16'/%3E%3C/g%3E%3Cpath d='M376 214l46-20 46 20-46 20z M396 223v18q26 14 52 0v-18 M468 214v28'/%3E%3Ccircle cx='112' cy='300' r='34'/%3E%3Cellipse cx='112' cy='300' rx='14' ry='34'/%3E%3Cpath d='M78 300h68 M70 330a46 46 0 0 0 84 4 M112 346v14 M96 362h32'/%3E%3Crect x='268' y='232' width='66' height='58' rx='7'/%3E%3Cpath d='M268 250h66 M286 224v14 M316 224v14'/%3E%3Ccircle cx='286' cy='266' r='2'/%3E%3Ccircle cx='301' cy='266' r='2'/%3E%3Ccircle cx='316' cy='266' r='2'/%3E%3Ccircle cx='286' cy='278' r='2'/%3E%3Ccircle cx='301' cy='278' r='2'/%3E%3Cpath d='M446 392c-14-10-34-2-34 18 0 22 18 36 34 28 16 8 34-6 34-28 0-20-20-28-34-18z M446 392q2-12 12-16'/%3E%3Crect x='186' y='398' width='92' height='62' rx='6'/%3E%3Cpath d='M186 418h92M186 438h92'/%3E%3Ccircle cx='204' cy='418' r='5'/%3E%3Ccircle cx='216' cy='418' r='5'/%3E%3Ccircle cx='228' cy='438' r='5'/%3E%3Ccircle cx='250' cy='438' r='5'/%3E%3Ccircle cx='262' cy='438' r='5'/%3E%3Cg transform='rotate(18 380 480)'%3E%3Crect x='330' y='470' width='110' height='20' rx='3'/%3E%3Cpath d='M342 470v8M354 470v5M366 470v8M378 470v5M390 470v8M402 470v5M414 470v8M426 470v5'/%3E%3C/g%3E%3Cpath d='M36 200h20M46 190v20 M466 34l14 14M480 34l-14 14 M196 166h18M196 174h18 M60 448l16-28 16 28z'/%3E%3Cpath d='M214 52l3 8 8 3-8 3-3 8-3-8-8-3 8-3z M488 300l2 6 6 2-6 2-2 6-2-6-6-2 6-2z M30 30l2 5 5 2-5 2-2 5-2-5-5-2 5-2z'/%3E%3C/svg%3E"); --scene:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 360' fill='none' stroke='%234f46e5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cstyle%3E.d{stroke-dasharray:900;stroke-dashoffset:900;animation:d 2.8s cubic-bezier(.4,0,.2,1) forwards}.d2{animation-delay:.45s}.d3{animation-delay:.9s}@keyframes d{to{stroke-dashoffset:0}}@media (prefers-reduced-motion:reduce){.d{animation:none;stroke-dashoffset:0}}%3C/style%3E%3Cpath class='d' d='M20 330H620'/%3E%3Cpath class='d' d='M190 172L320 100L450 172'/%3E%3Crect class='d' x='200' y='170' width='240' height='160'/%3E%3Cg class='d d2'%3E%3Ccircle cx='320' cy='138' r='16'/%3E%3Cpath d='M320 128v10l7 5'/%3E%3C/g%3E%3Cpath class='d d2' d='M296 330V286a24 24 0 0 1 48 0V330'/%3E%3Cg class='d d2'%3E%3Crect x='222' y='196' width='36' height='30' rx='3'/%3E%3Crect x='382' y='196' width='36' height='30' rx='3'/%3E%3Crect x='222' y='258' width='36' height='30' rx='3'/%3E%3Crect x='382' y='258' width='36' height='30' rx='3'/%3E%3Cpath d='M240 196v30M222 211h36M400 196v30M382 211h36M240 258v30M222 273h36M400 258v30M382 273h36'/%3E%3C/g%3E%3Cg class='d d3'%3E%3Cpath d='M200 220H120V330 M440 220H520V330 M112 224l44-24 44 22 M440 222l44-22 44 24'/%3E%3Crect x='138' y='246' width='26' height='24' rx='3'/%3E%3Crect x='476' y='246' width='26' height='24' rx='3'/%3E%3Crect x='138' y='290' width='26' height='24' rx='3'/%3E%3Crect x='476' y='290' width='26' height='24' rx='3'/%3E%3C/g%3E%3Cpath class='d d3' d='M320 100V44 M320 46h32l-9 9 9 9h-32'/%3E%3Cg class='d d3'%3E%3Ccircle cx='566' cy='70' r='22'/%3E%3Cpath d='M566 32v-10M566 118v-10M528 70h-10M614 70h-10M539 43l-7-7M600 104l-7-7M539 97l-7 7M600 36l-7 7'/%3E%3C/g%3E%3Cg class='d d2'%3E%3Ccircle cx='70' cy='282' r='28'/%3E%3Cpath d='M70 310v20M70 298l-10-10M70 302l10-12'/%3E%3Ccircle cx='590' cy='292' r='20'/%3E%3Cpath d='M590 312v18'/%3E%3C/g%3E%3Cpath class='d d3' d='M60 86a16 16 0 0 1 30-6 14 14 0 0 1 24 12H56a10 10 0 0 1 4-6z M392 52a14 14 0 0 1 26-4 12 12 0 0 1 20 10h-50a8 8 0 0 1 4-6z'/%3E%3C/svg%3E"); --scene-op:.2;
  --r:20px; --rc:14px; --side-w:272px;
}
:root[data-theme="dark"]{
  --paper:#0e1428; --surface:#151c36; --surface-2:#1a2342; --line:#27315a; --line-2:#36427a; --fg:#e6eaf7; --muted:#a2acce; --faint:#7882aa;
  --pri:#34d399; --pri-d:#10b981; --pri-soft:#12372f; --pri-line:#1f6e57;
  --glow1:rgba(99,102,241,.22); --glow2:color-mix(in srgb,var(--p1) 10%,transparent); --scene-op:.08;
  --shadow:0 1px 2px rgba(0,0,0,.3),0 14px 32px -14px rgba(0,0,0,.55);
}
body{background-color:var(--paper);background-image:radial-gradient(900px 520px at 100% -5%,var(--glow1),transparent 62%),radial-gradient(800px 480px at -5% 105%,var(--glow2),transparent 60%),var(--doodle);background-size:auto,auto,520px 520px;background-attachment:fixed}
:root[data-theme="dark"] body{background-image:radial-gradient(900px 520px at 100% -5%,var(--glow1),transparent 62%),radial-gradient(800px 480px at -5% 105%,var(--glow2),transparent 60%)}
body::before{background:color-mix(in srgb,var(--surface) 80%,transparent)}
.ms-bg{position:fixed;bottom:-6px;inset-inline-end:-1vw;width:min(780px,64vw);aspect-ratio:640/360;background:var(--scene) no-repeat center/contain;opacity:var(--scene-op);pointer-events:none;z-index:0}
.app,.auth,.portal{position:relative;z-index:1}

/* ---- sidebar ---- */
.side{background:color-mix(in srgb,var(--surface) 86%,transparent);backdrop-filter:blur(18px) saturate(1.4);-webkit-backdrop-filter:blur(18px) saturate(1.4);color:var(--fg);border-inline-end:1px solid var(--line)}
.brand{border-bottom:0;padding:16px 14px 10px;gap:10px}
.brand-logo{width:38px;height:38px;border-radius:12px;background:var(--grad);color:#fff;box-shadow:0 10px 20px -10px color-mix(in srgb,var(--pri) 80%,transparent),inset 0 1px 0 rgba(255,255,255,.35)}
.brand-logo .ico{width:21px;height:21px}
.brand-logo.has-img{background:#fff;box-shadow:0 0 0 1px var(--line)}
.brand-logo img{object-fit:contain}
.brand-name{font-size:.92em;line-height:1.3;color:var(--fg)}
.brand-sub{color:var(--muted);font-family:"Plus Jakarta Sans",sans-serif;font-size:.7em;font-weight:600}
.side .icon-btn{color:var(--muted)}
.side .icon-btn:hover{background:color-mix(in srgb,var(--pri) 9%,transparent);color:var(--pri)}
.nav{padding:4px 12px 12px;scrollbar-color:var(--line-2) transparent}
.nav-sec{margin-top:2px}
.nav-sec.bottom{margin-top:auto;padding-top:10px;border-top:1px solid var(--line)}
.nav{display:flex;flex-direction:column}
.nav-head{--g1:var(--p1);--g2:var(--pri);position:relative;isolation:isolate;padding:7px 9px;gap:12px;color:var(--fg);font-weight:700;font-size:.93em;border-radius:16px}
.nav-head::before{content:"";position:absolute;inset:0;border-radius:16px;z-index:-1;transition:background .25s,box-shadow .25s}
.nav-head:hover{background:transparent}
.nav-head:hover::before{background:color-mix(in srgb,var(--g2) 8%,transparent)}
.nav-head .tile{width:38px;height:38px;padding:8px;border-radius:13px;color:#fff;flex:none;background:linear-gradient(145deg,var(--g1),var(--g2));box-shadow:0 7px 14px -8px var(--g2),inset 0 1px 0 rgba(255,255,255,.4);filter:saturate(.78) brightness(.97);transition:transform .45s cubic-bezier(.3,1.6,.5,1),box-shadow .3s}
.nav-head .tile svg{width:22px;height:22px;display:block}
.nav-head:hover .tile{transform:translateY(-1px) rotate(-6deg) scale(1.07)}
.nav-head.on{background:transparent}
.nav-head.on::before,.nav-sec.open>.nav-head.cur::before{background:color-mix(in srgb,var(--g2) 11%,var(--surface));box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--g2) 24%,transparent),0 12px 26px -18px var(--g2)}
.nav-head.on .tile,.nav-head.cur .tile{filter:saturate(.9);box-shadow:0 0 0 3px var(--surface),0 0 0 5px color-mix(in srgb,var(--g2) 40%,transparent),0 10px 20px -8px var(--g2)}
.nav-head .chev{opacity:.55}
.nav-head[data-mod="dashboard"]{--g1:#2dd4bf;--g2:#0d9488}
.nav-head[data-mod="weekly"]{--g1:#34d399;--g2:#059669}
.nav-head[data-mod="exams"]{--g1:#818cf8;--g2:#4338ca}
.nav-head[data-mod="activities"]{--g1:#fcd34d;--g2:#f97316}
.nav-head[data-mod="absence"]{--g1:#fda4af;--g2:#e11d48}
.nav-head[data-mod="circ"]{--g1:#7dd3fc;--g2:#0284c7}
.nav-head[data-mod="manage"]{--g1:#94a3b8;--g2:#334155}
.nav-head[data-mod="guide"]{--g1:#c4b5fd;--g2:#7c3aed}
.nav-sub{margin:4px 0 6px;margin-inline-start:28px;padding-inline-start:12px;border-inline-start:2px dotted var(--line-2)}
.nav-link{padding:8px 12px;padding-inline-start:12px;color:var(--muted);font-weight:600;border-radius:10px;font-size:.88em;transition:background .2s,color .2s,transform .2s}
.nav-link:hover{background:var(--surface-2);color:var(--fg);transform:translateX(-2px)}
[dir="ltr"] .nav-link:hover{transform:translateX(2px)}
.nav-link.on,[dir="rtl"] .nav-link.on{background:var(--grad);color:#fff;box-shadow:0 8px 18px -10px color-mix(in srgb,var(--pri) 85%,transparent)}
.nav-badge{background:#f59e0b;color:#1f1300}
.side-foot{border-top:1px solid var(--line);background:transparent}
.me:hover{background:var(--surface-2)}
.avatar{background:linear-gradient(135deg,var(--p1),var(--pri-d));color:#fff}
.me-role{color:var(--muted)}
.side-top-actions{margin-inline-start:auto;display:flex;gap:2px}

/* ---- top bar (mobile) ---- */
.topbar{background:color-mix(in srgb,var(--surface) 80%,transparent);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);border-bottom:1px solid var(--line)}
.mbrand{display:none;align-items:center;gap:8px;min-width:0}
.mbrand .brand-logo{width:32px;height:32px;border-radius:10px}
.mbrand b{font-size:.92em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* ---- surfaces & controls ---- */
.card{border-color:var(--line);border-radius:var(--r);box-shadow:var(--shadow)}
.card-h{background:linear-gradient(180deg,color-mix(in srgb,var(--pri) 5%,transparent),transparent)}
.ph h1{font-size:1.55em;font-weight:800;letter-spacing:-.01em}
.btn{border-radius:12px}
.btn.pri{background:linear-gradient(135deg,var(--p1),var(--pri) 60%,var(--pri-d));border-color:transparent;color:#fff;box-shadow:0 6px 16px -8px color-mix(in srgb,var(--pri) 65%,transparent),inset 0 1px 0 rgba(255,255,255,.22)}
.btn.pri:hover{background:linear-gradient(135deg,var(--p1),var(--p1) 40%,var(--pri));color:#fff;border-color:transparent}
:root[data-theme="dark"] .btn.pri{color:#fff}
.btn:active:not(:disabled){transform:scale(.97)}
.btn:not(.pri):not(.danger):hover{background:var(--pri-soft)}
input[type="text"],input[type="password"],input[type="email"],input[type="date"],input[type="time"],input[type="number"],input[type="url"],input[type="search"],input[type="tel"],select,textarea{border-radius:12px;transition:border-color .2s,box-shadow .2s}
input:focus,select:focus,textarea:focus{box-shadow:0 0 0 4px color-mix(in srgb,var(--pri) 18%,transparent)}
input[type="time"]{direction:ltr;text-align:center;min-width:118px;font-variant-numeric:tabular-nums}
.tabs .on{border-bottom-color:var(--pri);color:var(--pri-d)}
.tbl th{background:color-mix(in srgb,var(--paper) 55%,var(--surface))}
.pill.on{background:var(--grad);border-color:transparent;color:#fff}

/* KPI cards with coloured inline-start edge (demo style) */
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px}
.kpi2{display:flex;flex-direction:column;gap:2px;text-align:start;background:var(--surface);border:1px solid var(--line);border-inline-start:4px solid var(--line-2);border-radius:16px;padding:12px 14px;color:var(--fg);text-decoration:none;transition:transform .15s,box-shadow .15s}
a.kpi2:hover{transform:translateY(-3px);box-shadow:var(--shadow)}
.kpi2 .v{font-size:1.9em;font-weight:800;line-height:1.1;font-variant-numeric:tabular-nums}
.kpi2 .v small{font-size:.5em;color:var(--muted);font-weight:700}
.kpi2 .l{font-weight:700;font-size:.85em}
.kpi2 .s{font-size:.74em;color:var(--muted)}
.kpi2.ok{border-inline-start-color:var(--pri)} .kpi2.warn{border-inline-start-color:#d97706} .kpi2.bad{border-inline-start-color:#be123c} .kpi2.info{border-inline-start-color:#2563eb}
.attn{display:flex;align-items:center;gap:12px;padding:10px 14px;border-radius:12px;background:var(--warn-bg);color:var(--warn);font-weight:700;text-decoration:none}
.attn+.attn{margin-top:8px}
.attn .n{font-size:1.4em;font-weight:800;min-width:26px;text-align:center}
.attn.ok{background:var(--ok-bg);color:var(--ok)}
.attn .btn{margin-inline-start:auto}
.prog{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,2fr) 44px;gap:10px;align-items:center;padding:6px 0}
.prog .who b{display:block;font-size:.9em}
.prog .who small{color:var(--muted);font-size:.76em}
.bar.lo>i{background:#be123c} .bar.mid>i{background:#d97706} .bar.hi>i{background:var(--pri)}
.stack-bar{display:flex;height:10px;border-radius:6px;overflow:hidden;background:var(--surface-2);border:1px solid var(--line)}
.stack-bar i{display:block;height:100%}
.legend{display:flex;gap:14px;flex-wrap:wrap;font-size:.8em;color:var(--muted)}
.legend span::before{content:"";display:inline-block;width:10px;height:10px;border-radius:3px;background:var(--c);margin-inline-end:6px;vertical-align:-1px}
.donut{display:flex;align-items:center;gap:20px;flex-wrap:wrap}
.donut svg{width:140px;height:140px;flex:none}
.filters{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.filters label{display:flex;gap:8px;align-items:center;font-weight:700;font-size:.85em;color:var(--muted)}
.filters select{width:auto;min-height:38px}

/* switches */
input.sw{appearance:none;-webkit-appearance:none;flex:none;width:46px;height:26px;border-radius:999px;background:var(--line-2);position:relative;cursor:pointer;margin:0;transition:background .25s;border:0}
input.sw::before{content:"";position:absolute;top:3px;inset-inline-start:3px;width:20px;height:20px;border-radius:50%;background:#fff;box-shadow:0 2px 6px rgba(15,23,42,.25);transition:inset-inline-start .3s cubic-bezier(.3,1.4,.5,1)}
input.sw:checked{background:linear-gradient(135deg,var(--p1),var(--pri-d))}
input.sw:checked::before{inset-inline-start:23px}

/* stage timing editor */
.ptable{width:100%;border-collapse:separate;border-spacing:0 6px}
.ptable td{padding:0 4px;vertical-align:middle}
.ptable tr.brk td.lab{color:#b45309}
.ptable tr.bad input{border-color:var(--bad);background:var(--bad-bg)}
.ptable .lab{font-weight:800;white-space:nowrap;min-width:84px}
.ptable .dur{color:var(--muted);font-size:.82em;white-space:nowrap}
.tl{display:flex;flex-direction:column;gap:4px}
.tl div{display:flex;justify-content:space-between;gap:10px;padding:6px 12px;border-radius:10px;background:var(--surface-2);font-size:.88em}
.tl div.b{background:var(--warn-bg);color:var(--warn)}
.tl div b{font-variant-numeric:tabular-nums;direction:ltr;unicode-bidi:isolate}

/* page motion */
@keyframes ms-rise{from{opacity:0;transform:translateY(14px) scale(.99)}to{opacity:1;transform:none}}
.content>*{animation:ms-rise .5s cubic-bezier(.16,1,.3,1) both}
.content>*:nth-child(2){animation-delay:.05s}.content>*:nth-child(3){animation-delay:.1s}.content>*:nth-child(n+4){animation-delay:.14s}
@media (prefers-reduced-motion:reduce){.content>*{animation:none}.nav-head .tile{transition:none}}

@media (max-width:900px){
  .side{background:var(--surface);width:min(86vw,320px)}
  .mbrand{display:flex}
  .topbar h1#page-title{display:none}
  .topbar-in{padding:8px 12px}
  .ms-bg{display:none}
}
@media (max-width:640px){
  .kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
  .prog{grid-template-columns:minmax(0,1fr) 80px 38px}
  .ph h1{font-size:1.3em}
  .card{border-radius:16px}
  .donut svg{width:120px;height:120px}
}
.mobile-spacer{display:none}
@media (max-width:900px){.mobile-spacer{display:block}}
.side .dot{top:2px;inset-inline-end:2px;border:2px solid var(--surface)}
.filters select{max-width:100%}
@media (max-width:640px){
  .filters label{flex:1 1 100%;flex-wrap:wrap}
  .filters label select{flex:1;min-width:0}
  #term-switch select{max-width:34vw!important}
  .mbrand b{max-width:28vw}
}

/* language switch (top bar, sign-in, family page) */
.langseg{padding:3px;border-radius:12px;flex:none}
.langseg button{min-width:38px;padding:5px 10px;font-weight:800;font-size:.85em}
.langseg button[lang="en"]{font-family:"Plus Jakarta Sans",sans-serif}
.langseg button.on{background:var(--grad);color:#fff;box-shadow:0 6px 14px -8px color-mix(in srgb,var(--pri) 80%,transparent)}
@media (min-width:901px){.topbar:has(#term-switch:empty){display:block}}
.topbar-in{justify-content:flex-end}
/* show / hide password */
.pw-wrap{position:relative;display:block}
.pw-wrap input{padding-inline-end:46px}
.pw-eye{position:absolute;inset-inline-end:4px;top:50%;transform:translateY(-50%);width:38px;height:34px;border:0;background:none;border-radius:9px;color:var(--muted);cursor:pointer;display:grid;place-items:center}
.pw-eye:hover{background:var(--surface-2);color:var(--pri)}

/* ===== questions (student, preview, marking) ===== */
:root{--man:#b45309;--man-bg:#fff4dc;--man-bd:#f5c26b}
.qcard{background:var(--surface);border:1px solid var(--line);border-radius:18px;box-shadow:var(--shadow);padding:16px 18px;border-inline-start:4px solid var(--pri)}
.qcard.man{border-inline-start-color:#f59e0b}
.qhead{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:8px}
.qn{width:30px;height:30px;border-radius:50%;background:var(--grad);color:#fff;display:grid;place-items:center;font-weight:800;flex:none;font-size:.9em}
.qh{font-size:.82em;color:var(--muted);font-weight:700}
.qp{font-size:.78em;font-weight:800;color:var(--muted);white-space:nowrap}
.qtype{display:inline-flex;padding:2px 9px;border-radius:999px;font-size:.74em;font-weight:800;background:var(--pri-soft);color:var(--pri-d);border:1px solid var(--pri-line)}
.qtype.man{background:var(--man-bg);color:var(--man);border-color:var(--man-bd)}
.manual-tag{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:999px;background:var(--man-bg);color:var(--man);border:1px solid var(--man-bd);font-size:.72em;font-weight:800;white-space:nowrap;vertical-align:middle;margin-inline-start:6px}
.manual-tag svg{width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.qtext{font-size:1.06em;font-weight:700;line-height:1.8;white-space:pre-wrap;margin-bottom:10px}
.qimg{display:block;max-width:100%;max-height:360px;border-radius:12px;border:1px solid var(--line);margin:4px 0 12px}
.opts{display:grid;gap:8px}
.opt{display:flex;align-items:center;gap:12px;width:100%;text-align:start;padding:11px 14px;border-radius:14px;border:1.5px solid var(--line-2);background:var(--surface);cursor:pointer;font-weight:600;font-size:1em;color:var(--fg);transition:border-color .15s,background .15s,transform .1s}
.opt:hover:not(:disabled){border-color:var(--pri)}
.opt:active:not(:disabled){transform:scale(.99)}
.opt.on{border-color:var(--pri);background:var(--pri-soft);color:var(--pri-d)}
.opt.sel{border-color:#2563eb;box-shadow:0 0 0 3px rgba(37,99,235,.18)}
.opt:disabled{cursor:default}
.ol{width:28px;height:28px;border-radius:50%;border:1.5px solid var(--line-2);display:grid;place-items:center;font-weight:800;font-size:.85em;flex:none}
.ol.sq{border-radius:8px}
.opt.on .ol{background:var(--pri);border-color:var(--pri);color:#fff}
.tfrow{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.opt.big{justify-content:center;font-size:1.1em;padding:16px}
.filltext{line-height:2.6;font-size:1.06em}
.filltext input.blank{display:inline-block;width:150px;min-height:36px;padding:4px 10px;margin:0 4px;border-radius:10px;text-align:center;font-weight:700}
.match{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.mcol{display:grid;gap:8px;align-content:start}
.pool{display:flex;flex-wrap:wrap;gap:8px;padding:10px;border:1.5px dashed var(--line-2);border-radius:14px;min-height:52px;margin-bottom:10px}
.card-chip{padding:8px 14px;border-radius:12px;border:1.5px solid var(--line-2);background:var(--surface);font-weight:700;cursor:pointer;font-size:.95em}
.card-chip.sel{border-color:#2563eb;box-shadow:0 0 0 3px rgba(37,99,235,.18)}
.card-chip.on{background:var(--pri-soft);border-color:var(--pri-line);color:var(--pri-d)}
.groups{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px}
.gbox{border:1.5px solid var(--line-2);border-radius:14px;padding:10px;min-height:96px;cursor:pointer;background:var(--surface-2)}
.gbox:hover{border-color:var(--pri)}
.gitems{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.hotwrap{display:flex;justify-content:center}
.hotimg{position:relative;display:inline-block;max-width:100%;cursor:crosshair;user-select:none;touch-action:none}
.hotimg img{display:block;max-width:100%;max-height:440px;border-radius:12px;border:1px solid var(--line)}
.hotwrap.sm .hotimg img{max-height:220px}
.hotdot{position:absolute;width:22px;height:22px;margin:-11px 0 0 -11px;border-radius:50%;background:#2563eb;border:3px solid #fff;box-shadow:0 2px 8px rgba(0,0,0,.35);pointer-events:none}
[dir="rtl"] .hotdot{margin:-11px -11px 0 0}
.hotarea{position:absolute;border:3px dashed var(--pri);background:color-mix(in srgb,var(--p1) 18%,transparent);border-radius:8px;pointer-events:none}
.passage{background:var(--surface-2);border:1px solid var(--line);border-radius:14px;padding:14px 16px;line-height:1.9;white-space:pre-wrap;margin-bottom:12px}
.subq{border-top:1px dashed var(--line);padding-top:12px;margin-top:12px}
.subq .opts{margin-top:8px}
textarea.essay{min-height:140px;font-size:1em}
/* builder */
.qpalette{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:8px}
.qadd{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:10px 12px;border-radius:14px;border:1.5px solid var(--pri-line);background:var(--pri-soft);color:var(--pri-d);font-weight:800;cursor:pointer;text-align:start;font-size:.88em}
.qadd:hover{border-color:var(--pri)}
.qadd.man{background:var(--man-bg);color:var(--man);border-color:var(--man-bd)}
.qadd .manual-tag{margin:0}
.qed{background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:14px;display:grid;gap:10px;border-inline-start:4px solid var(--pri)}
.qed.man{border-inline-start-color:#f59e0b;background:linear-gradient(90deg,transparent,var(--man-bg) 0)}
[dir="rtl"] .qed.man,.qed.man{background:color-mix(in srgb,var(--man-bg) 35%,var(--surface))}
.okpick input{width:20px;height:20px;accent-color:var(--pri)}
.qthumb{width:64px;height:64px;object-fit:cover;border-radius:10px;border:1px solid var(--line)}
.subed{border:1px dashed var(--line-2);border-radius:12px;padding:10px;display:grid;gap:8px}
.gedit{display:grid;gap:6px}
.rot180{transform:rotate(180deg)}
.exam-head{display:flex;justify-content:space-between;gap:10px;align-items:center;flex-wrap:wrap}
.paper-in .pq{border:0;padding:0}
/* marking */
.rv{list-style:none;padding:0;margin:0;display:grid;gap:4px}
.rv li{padding:6px 10px;border-radius:10px;border:1px solid var(--line)}
.rv li.key{border-color:var(--pri-line);background:var(--pri-soft)}
.rv li.pick{font-weight:800}
.ok-mark{color:var(--ok);font-weight:800}.bad-mark{color:var(--bad);font-weight:800}
.rvblank{padding:1px 8px;border-radius:8px;font-weight:700}
.rvblank.good{background:var(--ok-bg);color:var(--ok)}.rvblank.bad{background:var(--bad-bg);color:var(--bad)}
.essay-ans{white-space:pre-wrap;background:var(--surface-2);border:1px solid var(--line);border-radius:12px;padding:12px;line-height:1.8}
.restbl th.manh{background:var(--man-bg);color:var(--man)}
.restbl td.pend{background:color-mix(in srgb,var(--man-bg) 70%,transparent)}
.restbl td.edited{box-shadow:inset 0 -3px 0 #2563eb}
.pendbtn{background:var(--man-bg);color:var(--man);border-color:var(--man-bd)}
.warnc{color:var(--bad);font-weight:800}
/* student app */
.stu{min-height:100vh}
.stu-bar{position:sticky;top:0;z-index:30;display:flex;align-items:center;gap:10px;padding:10px 16px;background:color-mix(in srgb,var(--surface) 82%,transparent);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);border-bottom:1px solid var(--line)}
.stu-main{max-width:900px;margin:0 auto;padding:20px 16px 60px}
.stu-ex.live{border-color:var(--pri);box-shadow:0 14px 30px -18px color-mix(in srgb,var(--pri) 70%,transparent)}
.codein{font-size:1.6em!important;text-align:center;letter-spacing:.3em;font-weight:800;text-transform:uppercase;font-family:"Plus Jakarta Sans",sans-serif}
.exam-bar{position:sticky;top:58px;z-index:20;display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:12px 14px;margin-bottom:14px;background:color-mix(in srgb,var(--surface) 92%,transparent);backdrop-filter:blur(10px);border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow)}
.timer{font-variant-numeric:tabular-nums;font-size:.9em;direction:ltr}
.timer.bad{background:var(--bad-bg);color:var(--bad)}
@media (max-width:640px){
  .match{grid-template-columns:1fr 1fr;gap:8px}
  .opt{padding:10px 12px}
  .filltext input.blank{width:110px}
  .exam-bar{top:54px}
  .qcard{padding:14px}
}
@media (max-width:640px){.exam-bar>.grow{flex:1 1 100%}}

/* full school name everywhere */
.brand-name{white-space:normal;overflow-wrap:anywhere}
.mbrand{min-width:0;flex:1}
.mbrand b{white-space:normal!important;overflow:visible!important;text-overflow:clip!important;max-width:none!important;line-height:1.25;font-size:.9em;overflow-wrap:anywhere}
.side-term{display:none;padding:0 14px 8px}
.side-term select{width:100%;max-width:none!important}
@media (max-width:900px){
  .topbar #term-switch{display:none}
  .side-term{display:block}
  .topbar-in{gap:8px}
  .topbar .mobile-spacer{display:none}
}

/* ===== theme colours chosen by the administration (School profile → Appearance) ===== */
:root{--p1:#10b981;--pri:#059669;--pri-d:#047857;--p-deep:#064e3b;--pri-soft:#e6f7ef;--pri-line:#a7f3d0;--grad:linear-gradient(135deg,var(--p1),var(--pri) 55%,var(--pri-d))}
:root[data-accent="teal"]{--p1:#14b8a6;--pri:#0d9488;--pri-d:#0f766e;--p-deep:#134e4a;--pri-soft:#e3f7f5;--pri-line:#99f6e4}
:root[data-accent="blue"]{--p1:#3b82f6;--pri:#2563eb;--pri-d:#1d4ed8;--p-deep:#1e3a8a;--pri-soft:#e8f0fe;--pri-line:#bfdbfe}
:root[data-accent="indigo"]{--p1:#6366f1;--pri:#4f46e5;--pri-d:#4338ca;--p-deep:#312e81;--pri-soft:#eef0ff;--pri-line:#c7d2fe}
:root[data-accent="purple"]{--p1:#a855f7;--pri:#9333ea;--pri-d:#7e22ce;--p-deep:#581c87;--pri-soft:#f5ecff;--pri-line:#e9d5ff}
:root[data-accent="rose"]{--p1:#f43f5e;--pri:#e11d48;--pri-d:#be123c;--p-deep:#881337;--pri-soft:#ffeef1;--pri-line:#fecdd3}
:root[data-accent="amber"]{--p1:#f59e0b;--pri:#d97706;--pri-d:#b45309;--p-deep:#78350f;--pri-soft:#fff5e1;--pri-line:#fde68a}
:root[data-accent="slate"]{--p1:#64748b;--pri:#475569;--pri-d:#334155;--p-deep:#0f172a;--pri-soft:#eef2f7;--pri-line:#cbd5e1}
/* plain background (no illustrations) */
:root[data-bg="plain"] body{background-image:radial-gradient(900px 520px at 100% -5%,var(--glow1),transparent 62%),radial-gradient(800px 480px at -5% 105%,color-mix(in srgb,var(--p1) 10%,transparent),transparent 60%)}
:root[data-bg="plain"] .ms-bg{display:none}
/* swatches */
.swatches{display:flex;flex-wrap:wrap;gap:10px}
.swatch{display:flex;align-items:center;gap:8px;padding:6px 12px 6px 6px;border-radius:999px;border:1.5px solid var(--line-2);background:var(--surface);cursor:pointer;font-weight:700;font-size:.88em}
[dir="rtl"] .swatch{padding:6px 6px 6px 12px}
.swatch i{width:26px;height:26px;border-radius:50%;flex:none;box-shadow:inset 0 0 0 2px rgba(255,255,255,.6)}
.swatch.on{border-color:var(--pri);box-shadow:0 0 0 3px color-mix(in srgb,var(--pri) 25%,transparent)}

.qimg.sz-s{max-height:160px}.qimg.sz-m{max-height:280px}.qimg.sz-l{max-height:440px}
.hotwrap.sz-s .hotimg img{max-height:200px}.hotwrap.sz-m .hotimg img{max-height:320px}.hotwrap.sz-l .hotimg img{max-height:460px}
/* row actions: same height, even spacing, one baseline */
.tbl td.acts{white-space:normal;text-align:end}
.tbl td.acts>*{vertical-align:middle;margin:3px 0}
.tbl td.acts>*+*{margin-inline-start:6px}
.tbl td.acts .btn.sm{min-height:34px}
.tbl td.acts .icon-btn{width:34px;height:34px}
/* timetable: days in rows, periods in columns */
.ttg-h{min-width:720px}
.ttg-h th.ttday{text-align:start;white-space:nowrap;font-size:.85em;color:var(--fg);padding:4px 8px}
.ttg-h th.ttb{width:26px;padding:0}
.ttg-h th.ttb span{writing-mode:vertical-rl;font-size:.7em;color:#b45309;font-weight:700}
.ttg-h td.brk{width:26px;min-width:26px;padding:0;background:repeating-linear-gradient(180deg,var(--warn-bg),var(--warn-bg) 6px,transparent 6px,transparent 12px);border:0}
/* one question at a time */
.qnav{display:flex;align-items:center;gap:10px;justify-content:space-between;margin-top:14px;flex-wrap:wrap}
.qdots{display:flex;flex-wrap:wrap;gap:6px;justify-content:center;flex:1}
.qdot{width:34px;height:34px;border-radius:50%;border:1.5px solid var(--line-2);background:var(--surface);font-weight:800;cursor:pointer}
.qdot.done{background:var(--pri-soft);border-color:var(--pri-line);color:var(--pri-d)}
.qdot.cur{background:var(--grad);color:#fff;border-color:transparent}
/* screen style by grade */
.tier-kid .qtext{font-size:1.3em}
.tier-kid .opt{font-size:1.15em;padding:16px 18px;border-radius:18px}
.tier-kid .opt.big{font-size:1.35em;padding:22px}
.tier-kid .ol{width:36px;height:36px}
.tier-kid .card-chip{font-size:1.1em;padding:12px 18px}
.tier-teen .opt{padding:9px 12px}
.rlesson{padding:10px 12px;border:1px solid var(--line);border-radius:14px;background:var(--surface)}
.rlesson.now{border-color:var(--pri);background:var(--pri-soft)}
.rlesson.done{opacity:.6}
.nav-head[data-mod="remote"]{--g1:#67e8f9;--g2:#0891b2}

/* student pages sit above the background illustration */
.stu{position:relative;z-index:1}
/* show/hide password: the eye sits on the right side, the text keeps clear of it */
.pw-wrap .pw-eye{inset-inline-end:auto;right:4px;left:auto}
.pw-wrap input{padding-inline-end:12px;padding-right:46px!important}
.codein::placeholder{color:var(--line-2);letter-spacing:.3em;opacity:.8}
.pinin{-webkit-text-security:disc;text-align:center;letter-spacing:.4em}
/* student: clock bar and Today page */
.stu-clock{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;padding:8px 16px;background:var(--grad);color:#fff;font-size:.9em}
.stu-clock .t{font-variant-numeric:tabular-nums;direction:ltr;font-size:1.05em}
.avatar.big{width:72px;height:72px;font-size:1.8em;display:grid;place-items:center;border-radius:50%}
.curp{background:var(--grad);color:#fff;border-radius:18px;padding:14px 16px;margin-bottom:14px;box-shadow:var(--shadow-up)}
.cdpill{display:inline-block;margin-top:8px;padding:4px 12px;border-radius:999px;background:rgba(255,255,255,.2);font-weight:800;font-variant-numeric:tabular-nums}
.pcard{display:flex;gap:12px;padding:12px 14px;border:1px solid var(--line);border-inline-start:5px solid var(--sc);border-radius:16px;background:var(--surface)}
.pcard.now{border-color:var(--sc);box-shadow:0 0 0 3px color-mix(in srgb,var(--sc) 20%,transparent)}
.pcard.done{opacity:.6}
.ptime{display:flex;flex-direction:column;align-items:center;min-width:74px;font-variant-numeric:tabular-nums}
.ptime b{font-size:1.05em}.ptime span{color:var(--muted);font-size:.85em}.ptime small{color:var(--muted);font-size:.72em;margin-top:2px}
.sdot{width:10px;height:10px;border-radius:50%;background:var(--sc);display:inline-block}
.ps{font-size:1.08em}
.pl{margin-top:4px}
.pst{font-size:.85em;font-weight:800;margin-top:4px;color:var(--pri-d)}
.pcard.later .pst{color:#b45309}
.platb{display:inline-flex;align-items:center;gap:4px;padding:2px 9px;border-radius:999px;font-size:.75em;font-weight:800;color:var(--pc);background:color-mix(in srgb,var(--pc) 12%,transparent);border:1px solid color-mix(in srgb,var(--pc) 30%,transparent)}
.joinbtn{width:100%;margin-top:10px;min-height:46px;font-size:1.02em}
.joinbtn:disabled{opacity:.45}
.brkline{display:flex;align-items:center;gap:10px;color:#b45309;font-size:.82em;font-weight:700}
.brkline::before,.brkline::after{content:"";flex:1;border-top:1.5px dashed var(--line-2)}

/* matching: room for the lines, coloured pairs */
.match{position:relative;gap:44px!important}
.match svg.mlines{position:absolute;inset:0;pointer-events:none;overflow:visible}
.match .opt.on{border-color:var(--lc,var(--pri));background:color-mix(in srgb,var(--lc,var(--pri)) 10%,var(--surface));color:var(--fg)}
.match .opt.on .ol{background:var(--lc,var(--pri));border-color:var(--lc,var(--pri))}
@media (max-width:640px){.match{gap:30px!important}}
/* print preview */
.pv-open body{overflow:hidden}
.pvw{position:fixed;inset:0;z-index:200;background:#3f4655;display:flex;flex-direction:column}
.pvbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:10px 14px;padding-top:calc(10px + env(safe-area-inset-top,0px));background:var(--surface);border-bottom:1px solid var(--line)}
.pvscroll{flex:1;overflow:auto;padding:16px 12px 40px;display:flex;justify-content:center;align-items:flex-start}
.pvpaper{background:#fff;box-shadow:0 20px 50px -15px rgba(0,0,0,.5);transform-origin:top center;position:relative;flex:none}
[dir="rtl"] .pvpaper{transform-origin:top center}
.pvpaper .sheet{padding:42px 45px;max-width:none}
.pvbreak{position:absolute;left:0;right:0;border-top:2px dashed #94a3b8;pointer-events:none}
.pvbreak::after{content:attr(data-n);position:absolute;top:4px;inset-inline-end:8px;font-size:11px;color:#64748b;background:#fff;padding:0 6px;border-radius:6px}
@media (max-width:640px){.pvbar .btn{flex:1;min-width:0;padding-inline:8px}.pvbar>.grow{flex:1 1 100%}}
@media print{.pvw{display:none!important}}

.nav-head[data-mod="pickup"]{--g1:#fb923c;--g2:#c2410c}
/* pickup */
.pkcall{display:flex;align-items:center;gap:12px;padding:14px 16px;border:1.5px solid var(--line);border-radius:16px;background:var(--surface)}
.pkcall.again{border-color:#dc2626;background:#fef2f2;animation:pkpulse 1.6s ease-in-out infinite}
.pkcall.again .pkname{color:#b91c1c}
.pkcall.waiting{border-color:var(--pri-line);background:var(--pri-soft)}
.pkcall.done{opacity:.75}
.pkname{font-size:1.15em}
.pkstate{margin-top:4px;font-weight:800;color:var(--pri-d)}
.pkstate.ok{color:var(--ok)}
.btn.big{min-height:48px;padding-inline:20px;font-size:1.02em}
@keyframes pkpulse{50%{box-shadow:0 0 0 6px rgba(220,38,38,.15)}}
@media (prefers-reduced-motion:reduce){.pkcall.again{animation:none}}
/* social icons (family page) */
.socrow{display:flex;flex-wrap:wrap;gap:10px;justify-content:center}
.soc{width:42px;height:42px;border-radius:50%;display:grid;place-items:center;box-shadow:0 6px 14px -8px rgba(0,0,0,.45);transition:transform .15s}
.soc svg{width:26px;height:26px}
a:hover>.soc{transform:translateY(-2px) scale(1.06)}
.cdept{display:flex;justify-content:space-between;gap:10px;padding:6px 0;border-bottom:1px dashed var(--line)}
/* accounts: filters and phone layout */
.uf-panel{display:flex}
.uf-toggle{display:none}
.fchip{cursor:pointer;border:0}
@media (max-width:900px){
  .uf-toggle{display:inline-flex}
  .uf-panel{display:none;flex-direction:column;align-items:stretch}
  .uf-panel.open{display:flex}
  .uf-panel label{justify-content:space-between}
  .uf-panel select{flex:1;max-width:60%}
}
@media (max-width:640px){
  .tbl.cards td.acts{display:grid!important;grid-template-columns:1fr 1fr;gap:6px;text-align:start}
  .tbl.cards td.acts>*{margin:0!important;width:100%;justify-content:center}
  .tbl.cards td.acts .icon-btn{width:100%;border:1px solid var(--line)}
  .ph{flex-wrap:wrap}
  .ph>.btn,.ph>button{flex:1 1 calc(50% - 8px)}
}
/* import centre on phones: one block per type, buttons below the text */
@media (max-width:700px){
  .imp-row,.steps>li,.impc>li{flex-wrap:wrap!important}
  .imp-row>.grow,.impc .grow{flex:1 1 calc(100% - 50px)!important;min-width:0}
  .imp-row .btn,.impc .btn{flex:1 1 calc(50% - 6px)}
}
details.tech summary{cursor:pointer;margin-top:4px}
input[type="date"]:invalid:not(:focus)::-webkit-datetime-edit{color:transparent}
input[type="date"]:invalid:not(:focus){background-image:none}
@media (max-width:640px){ .icon-btn{min-width:38px;min-height:38px} }
/* phones: a card's heading keeps its own line; its buttons/chips wrap below */
@media (max-width:640px){
  .card-h{flex-wrap:wrap;row-gap:8px}
  .card-h>h2,.card-h>h3,.card-h>.grow,.card-h>b{flex:1 1 100%;min-width:0}
}
@media (max-width:640px){ .content>.row>p.grow,.content>.row>.grow:first-child{flex:1 1 100%;min-width:0} .content>.row{flex-wrap:wrap} }
.morebtn{width:100%;margin-top:8px;justify-content:center}
@media (max-width:640px){ .kpis{grid-template-columns:repeat(3,minmax(0,1fr))!important} .kpis .kpi2 .v{font-size:1.3em} }
/* a single family card is printed larger */
.scards.one{display:flex;justify-content:center}
.scard.big{width:150mm;height:auto;padding:10mm;font-size:1.35em}
.scard.big .sc-qr{width:48mm;height:48mm}
.scard.big .sc-code{font-size:2em}
/* ---------- menu: search, caption, overview link ---------- */
.nav-q{padding:4px 10px 8px}
.nav-q input{min-height:38px;font-size:.9em;border-radius:12px}
.nav-res{display:flex;flex-direction:column;padding:0 6px}
.nav-cap{margin:14px 16px 4px;font-size:.72em;font-weight:800;letter-spacing:.04em;color:var(--muted)}
.nav-link.hubl{font-weight:800;color:var(--pri-d)}
/* ---------- hub pages ---------- */
.hubgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:12px}
.hubcard{display:flex;align-items:center;gap:12px;padding:16px;border:1px solid var(--line);border-radius:16px;background:var(--surface);color:var(--fg);text-decoration:none;transition:transform .12s,box-shadow .12s}
.hubcard:hover{transform:translateY(-2px);box-shadow:var(--shadow-up);border-color:var(--pri-line)}
.hubcard b{display:block;margin-bottom:2px}
.hubcard .small{display:block}
.hubic{width:42px;height:42px;border-radius:12px;display:grid;place-items:center;background:var(--pri-soft);color:var(--pri-d);flex:none}
.hubgo{font-size:1.6em;color:var(--muted)}
[dir="rtl"] .hubgo{transform:scaleX(-1)}
.allsec{margin-bottom:20px}
.allsec h3{margin:0 0 10px}
/* ---------- breadcrumb ---------- */
.crumbs{display:flex;align-items:center;gap:8px;font-size:.85em;margin:-4px 0 10px;color:var(--muted)}
.crumbs a{color:var(--pri-d);font-weight:700;text-decoration:none}
/* ---------- bottom bar (phones and narrow tablets) ---------- */
.bnav{display:none!important}
@media (max-width:899px){
  .bnav:not([hidden]){display:flex!important;position:fixed;inset:auto 0 0 0;z-index:60;background:var(--surface);border-top:1px solid var(--line);padding:6px 4px calc(6px + env(safe-area-inset-bottom,0px));box-shadow:0 -8px 24px -18px rgba(0,0,0,.35)}
  .bn{flex:1;min-width:0;display:flex;flex-direction:column;align-items:center;gap:2px;padding:4px 2px;border:0;background:none;color:var(--muted);font:inherit;font-size:.68em;font-weight:700;text-decoration:none;position:relative;min-height:52px;justify-content:center;cursor:pointer}
  .bn svg,.bn .nicon{width:28px!important;height:28px!important;max-width:28px;flex:none;opacity:.75}
  .bn span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
  .bn.on{color:var(--pri-d)}
  .bn.on svg,.bn.on .nicon{opacity:1}
  .bn-badge{position:absolute;top:2px;inset-inline-start:calc(50% + 6px);min-width:17px;height:17px;border-radius:9px;background:#dc2626;color:#fff;font-size:10px;font-style:normal;display:grid;place-items:center;padding:0 4px}
  .app .content{padding-bottom:calc(92px + env(safe-area-inset-bottom,0px))}
  .toasts{bottom:calc(80px + env(safe-area-inset-bottom,0px))!important}
  .topbar [data-act="nav-open"]{display:none}
  html.kb-open .bnav,html:has(.modal) .bnav,html:has(#pvw) .bnav,html:has(.bsheet-back) .bnav{display:none!important}
  /* student: tabs become the bottom bar */
  .stu .stabs{position:fixed;inset:auto 0 0 0;z-index:60;margin:0;border-radius:0;background:var(--surface);border-top:1px solid var(--line);padding:6px 4px calc(6px + env(safe-area-inset-bottom,0px));display:flex;justify-content:space-around;box-shadow:0 -8px 24px -18px rgba(0,0,0,.35)}
  .stu .stabs button{flex:1;font-size:.72em;min-height:48px;border-radius:12px;padding:4px 2px}
  .stu .stu-main{padding-bottom:calc(90px + env(safe-area-inset-bottom,0px))}
  html.kb-open .stu .stabs{display:none}
}
.bsheet-back{position:fixed;inset:0;z-index:150;background:rgba(15,23,42,.45);display:flex;align-items:flex-end}
.bsheet{width:100%;background:var(--surface);border-radius:20px 20px 0 0;padding:10px 12px calc(14px + env(safe-area-inset-bottom,0px));max-height:75vh;overflow:auto;animation:bsup .18s ease-out}
.bsh-h{display:flex;justify-content:space-between;align-items:center;padding:6px 6px 10px}
.bsh-link{display:flex;flex-direction:column;padding:14px 12px;border-radius:12px;color:var(--fg);text-decoration:none;font-weight:700;border-bottom:1px solid var(--line)}
.bsh-link:active{background:var(--pri-soft)}
@keyframes bsup{from{transform:translateY(30px);opacity:.6}}
@media (prefers-reduced-motion:reduce){.bsheet{animation:none}}
@media (max-width:640px){ .ph>.grow{flex:1 1 100%;min-width:0} }
/* =========================================================
   1.6.1 — calm grouped lists (menu, overview, sheets) and a light bottom bar
   ========================================================= */
.lwrap{max-width:720px;margin-inline:auto}
.lgroup{margin-bottom:22px}
.lcap{display:block;margin:0 6px 8px;font-size:.88rem;font-weight:700;color:var(--muted);letter-spacing:0}
.lcard{background:var(--surface);border-radius:18px;overflow:hidden;border:1px solid var(--line)}
.lrow{display:flex;align-items:center;gap:14px;width:100%;min-height:56px;padding:14px 16px;border:0;background:none;color:var(--fg);font:inherit;font-size:1rem;text-align:start;text-decoration:none;position:relative;cursor:pointer}
.lrow+.lrow::before{content:"";position:absolute;top:0;inset-inline-start:54px;inset-inline-end:16px;border-top:1px solid var(--line)}
.lrow:hover{background:color-mix(in srgb,var(--pri) 5%,transparent)}
.lrow:focus-visible{outline:2px solid var(--pri);outline-offset:-2px}
.lrow .lico{width:24px;height:24px;flex:none}
.lrow .grow{min-width:0}
.lt{display:block;font-weight:500}
.ld{display:none}
@media (min-width:900px){.ld{display:block;font-size:.82rem;color:var(--muted);margin-top:2px}}
.chev{width:8px;height:8px;border-inline-end:2px solid var(--line-2);border-bottom:2px solid var(--line-2);transform:rotate(-45deg);flex:none;opacity:.9}
[dir="rtl"] .chev{transform:rotate(135deg)}
.lrow.danger .lt{color:var(--bad);font-weight:700}
.lrow[hidden],.lgroup[hidden]{display:none!important}
.quick{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:14px}
.qtile{display:flex;flex-direction:column;align-items:center;gap:6px;padding:18px 10px 16px;border:1px solid var(--line);border-radius:18px;background:var(--surface);color:var(--fg);font:inherit;cursor:pointer;min-width:0}
.qtile .lico{width:30px;height:30px}
.qtile b{font-size:1.02rem}
.qtile span{font-size:.8rem;color:var(--muted);max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.qtile:hover{border-color:var(--pri-line)}
.lsearch{width:100%;min-height:44px;border-radius:14px;margin-bottom:18px}
/* bottom bar: light surface, line icons, the active item in the platform colour */
@media (max-width:899px){
  .bnav:not([hidden]){background:var(--surface);border-top:1px solid var(--line);box-shadow:none;padding:4px 6px calc(4px + env(safe-area-inset-bottom,0px))}
  .bn{color:#7b8790;font-size:.7rem;font-weight:600;min-height:56px;gap:3px}
  .bn svg,.bn .lico{width:24px!important;height:24px!important;opacity:1;stroke-width:1.8}
  .bn.on{color:var(--pri-d);font-weight:800}
  .bn.on svg{stroke-width:2.3}
  .acct-btn{display:inline-grid!important}
}
.acct-btn{display:none!important;place-items:center;text-decoration:none}
.avatar.sm{width:30px;height:30px;font-size:.85rem;display:grid;place-items:center;border-radius:50%}
/* sheets */
.bsheet{background:var(--bg,#f2f4f3);padding:6px 12px calc(16px + env(safe-area-inset-bottom,0px))}
.bsh-grab{width:40px;height:4px;border-radius:4px;background:var(--line-2);margin:4px auto 6px}
.bsh-h{padding:4px 6px 12px}
.bsh-h b{font-size:1.05rem}
.prefbox{display:flex;flex-direction:column;gap:8px;padding:0 4px 6px}
.prefbox .lcap{margin:8px 2px 0}
.seg.wide{display:flex;width:100%}
.seg.wide button{flex:1;min-height:42px}
/* phones: calmer type and spacing; the page illustration recedes */
@media (max-width:640px){
  .ph h1{font-size:1.35rem}
  .ph p{font-size:.88rem}
  .card-h h2{font-size:1rem}
  .content{padding-inline:14px}
  .ms-bg,.bg-art{opacity:.35}
}
/* chevron points along the reading direction */
.chev{border:0;border-right:2px solid var(--line-2);border-bottom:2px solid var(--line-2);transform:rotate(-45deg)}
[dir="rtl"] .chev{transform:rotate(135deg)}
@media (max-width:899px){ .topbar .acct-btn{display:inline-grid!important} }
@media (max-width:640px){ .ms-bg{opacity:.2} }
/* =========================================================
   1.7.0
   ========================================================= */
/* smaller "My account" / "Settings" tiles */
.quick{gap:10px;margin-bottom:12px}
.qtile{flex-direction:row;justify-content:flex-start;gap:10px;padding:12px 14px;border-radius:16px;text-align:start}
.qtile .lico{width:24px;height:24px;flex:none}
.qtile b{font-size:.95rem;display:block}
.qtile span{display:block;font-size:.74rem}
.qtile>div{min-width:0}
/* the language switch shows only the other language on phones */
@media (max-width:899px){
  .langseg button.on{display:none!important}
  .langseg{padding:0!important;border:0!important;background:none!important;box-shadow:none!important}
  .langseg button{min-width:40px;min-height:40px;border-radius:12px!important;border:1px solid var(--line)!important;background:var(--surface)!important;color:var(--fg)!important;font-weight:800}
}
/* sign-out next to the bell */
.signout-btn .lico{color:#dc2626}
/* breadcrumb: a link on phones, plain text on computers */
.crumb-d{display:none}
@media (min-width:900px){ .crumb-m{display:none} .crumb-d{display:inline;font-weight:700;color:var(--fg)} }
/* no guidance lines under page titles (only those marked necessary stay) */
.ph p:not(.keep){display:none}
/* duty roster on phones: one card per day, a full-width picker per stage */
@media (max-width:640px){
  .dutytbl td[data-l]{display:flex!important;flex-direction:column;align-items:stretch;gap:4px}
  .dutytbl td[data-l]::before{text-align:start}
  .dutytbl select{width:100%;max-width:none;min-height:44px}
  .dutytbl .dday{font-size:1.05rem;padding-bottom:4px}
}
/* cards never wider than the screen */
@media (max-width:640px){
  .tw .tbl.cards{min-width:0!important;width:100%!important}
  .tbl.cards td{min-width:0;overflow-wrap:anywhere}
  .tbl.cards td.acts .row{flex-wrap:wrap}
}
/* accounts and students on phones: colour icon buttons in one tidy row */
@media (max-width:640px){
  .icoacts td.acts{display:flex!important;flex-wrap:wrap;gap:10px;justify-content:flex-start;grid-template-columns:none!important}
  .icoacts td.acts .btn,.icoacts td.acts .icon-btn{font-size:0!important;width:44px!important;height:44px;min-height:44px;padding:0!important;border-radius:50%!important;display:inline-grid!important;place-items:center;gap:0;flex:none!important;border:1px solid transparent!important}
  .icoacts td.acts .btn svg,.icoacts td.acts .icon-btn svg{width:20px;height:20px;margin:0}
  .icoacts [data-act="edit"]{color:#2563eb;background:#eff6ff}
  .icoacts [data-act="teaching"]{color:#7c3aed;background:#f5f3ff}
  .icoacts [data-act="scopes"]{color:#0d9488;background:#f0fdfa}
  .icoacts [data-act="reset"],.icoacts [data-act="newcode"],.icoacts [data-act="pin"]{color:#b45309;background:#fffbeb}
  .icoacts [data-act="toggle"][data-on="1"]{color:#ea580c;background:#fff7ed}
  .icoacts [data-act="toggle"][data-on="0"]{color:#16a34a;background:#f0fdf4}
  .icoacts [data-act="remove"],.icoacts [data-act="del"]{color:#dc2626;background:#fef2f2}
  .icoacts [data-act="card"],.icoacts [data-act="famcard"]{color:#0891b2;background:#ecfeff}
}
/* student tabs: full names on wide screens; on phones a bottom bar with icons and short names */
.stabs .ts{display:none}
.stabs .lico{display:none}
.stabs button{position:relative}
.sdot-b{position:absolute;top:6px;inset-inline-end:calc(50% - 18px);width:8px;height:8px;border-radius:50%;background:#dc2626}
@media (min-width:900px){ .stabs .sdot-b{position:static;display:inline-block;margin-inline-start:6px;vertical-align:middle} }
@media (max-width:899px){
  .stu .stabs{overflow:visible!important;padding:4px 6px calc(4px + env(safe-area-inset-bottom,0px))!important;gap:0!important;justify-content:stretch!important}
  .stu .stabs button{flex:1 1 0!important;min-width:0;display:flex!important;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-height:56px;padding:4px 2px!important;border:0!important;border-radius:12px!important;background:none!important;box-shadow:none!important;color:#7b8790;font-size:.7rem!important;font-weight:600}
  .stu .stabs button::after,.stu .stabs button::before{display:none!important}
  .stu .stabs button.on{color:var(--pri-d);font-weight:800}
  .stu .stabs button.on .lico{stroke-width:2.3}
  .stu .stabs .lico{display:block;width:24px;height:24px}
  .stu .stabs .tl{display:none}
  .stu .stabs .ts{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
}
/* codes copy on tap */
.code{cursor:copy;position:relative;transition:background-color .2s,box-shadow .2s}
.code.copied{background:#dcfce7!important;box-shadow:0 0 0 3px #86efac}
@media (hover:none){ .code::after{content:"";display:inline-block;width:12px;height:12px;margin-inline-start:6px;vertical-align:-1px;opacity:.55;background:currentColor;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='9' y='9' width='11' height='11' rx='2'/%3E%3Cpath d='M5 15V5a1 1 0 0 1 1-1h10'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='9' y='9' width='11' height='11' rx='2'/%3E%3Cpath d='M5 15V5a1 1 0 0 1 1-1h10'/%3E%3C/svg%3E") center/contain no-repeat} }
@media print{ .code::after{display:none!important} }
/* phones: cards never exceed the screen (buttons shrink and wrap, dates wrap) */
@media (max-width:640px){
  .tbl.cards tbody,.tbl.cards tr{max-width:100%}
  .tbl.cards td.nowrap{white-space:normal}
  .tbl.cards td.acts{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .tbl.cards td.acts .btn{white-space:normal;min-width:0;line-height:1.25;text-align:center}
}
/* phones: tabs wrap so every tab is visible without sliding (not the student bottom bar) */
@media (max-width:640px){
  .tabs:not(.stabs){flex-wrap:wrap;overflow:visible!important;gap:6px;border-bottom:0!important;padding-bottom:2px}
  .tabs:not(.stabs) button{flex:1 1 auto;min-height:40px;padding:8px 12px;border:1px solid var(--line)!important;border-radius:999px!important;background:var(--surface);margin:0!important}
  .tabs:not(.stabs) button::after{display:none!important}
  .tabs:not(.stabs) button.on{background:var(--pri-soft)!important;border-color:var(--pri-line)!important;color:var(--pri-d)}
}
@media (max-width:640px){ .tbl.cards{display:block!important;width:100%!important} .tbl.cards>tbody{display:block;width:100%} }
@media (max-width:640px){ .tbl.cards>thead{display:none!important} }
@media (max-width:640px){ .tw:has(> .tbl.cards){overflow-x:hidden} }
@media (max-width:640px){ .icoacts td.acts{flex-direction:row!important;align-items:center} .icoacts td.acts::before{display:none!important} }
@media (max-width:640px){ .tbl.cards.icoacts td.acts{display:flex!important;flex-direction:row!important;flex-wrap:wrap;gap:10px;grid-template-columns:none!important} }
@media (max-width:640px){ .tw:has(> .tbl.cards){overflow-x:hidden!important} }
@media (max-width:640px){ .tbl.cards td[data-l]{flex-wrap:wrap;row-gap:4px} .tbl.cards td[data-l]>div.tiny{flex:1 1 100%;min-width:0} }
/* family links: the stop button is red and set apart from Copy / New link */
.pl-revoke{color:#dc2626!important;background:#fef2f2!important;border:1px solid #fecaca!important;margin-inline-start:auto}
td.acts:has(.pl-revoke){display:flex;align-items:center;gap:8px;flex-wrap:wrap}
td.acts .pl-revoke{margin-inline-start:18px}
/* phones: a circular row puts its buttons on their own line so the title/date line keeps its width */
@media (max-width:640px){ li.row:has(> [data-act="c-cancel"]),li.row:has(> [data-act="c-restore"]){flex-wrap:wrap;row-gap:8px} li.row:has(> [data-act="c-cancel"])>.grow,li.row:has(> [data-act="c-restore"])>.grow{flex:1 1 100%} }

/* =========================================================
   1.8.0 — marks sheet and exam types
   ========================================================= */
.mlist{display:flex;flex-direction:column;gap:6px;margin-top:10px}
.mrow{display:flex;align-items:center;gap:8px;padding:8px 10px;border:1px solid var(--line);border-radius:12px;background:var(--surface);flex-wrap:nowrap}
.mrow.inactive{opacity:.65}
.mrow .grow{min-width:0}
.mrow .grow b{display:block;overflow-wrap:anywhere}
.mscore-in{width:84px;min-height:40px;text-align:center;font-variant-numeric:tabular-nums}
.mscore-in.bad{border-color:#dc2626;background:#fef2f2}
.mstatus{width:104px;min-height:40px}
.mscore{font-size:1.05rem;white-space:nowrap}
@media (max-width:640px){
  .mrow{flex-wrap:wrap}
  .mrow .grow{flex:1 1 100%}
  .mscore-in{flex:1 1 90px}
  .mstatus{flex:1 1 120px;width:auto}
  .modal-f{flex-wrap:wrap}
  .modal-f .btn{flex:1 1 calc(50% - 8px)}
}
.xtrow.off .lt{opacity:.6}
.xt-del{color:#dc2626}
@media (max-width:640px){ .modal-f .btn.sm{flex:1 1 calc(33.3% - 8px);padding-inline:6px;font-size:.78rem;white-space:normal;line-height:1.2} .modal-f .btn.pri,.modal-f .btn:not(.sm){flex:1 1 calc(50% - 8px)} }
@media (max-width:640px){ .xtrow{flex-wrap:wrap;row-gap:6px} .xtrow>.grow{flex:1 1 100%} .xtrow>.icon-btn{flex:1 1 0;min-width:44px} }

/* marks sheet rows: the name takes the space, the mark box and status keep a fixed width (also wins over the global input width) */
.mlist .mrow{display:flex;align-items:center;gap:10px}
.mlist .mrow>.grow{flex:1 1 0;min-width:140px}
.mlist .mrow input.mscore-in{flex:0 0 96px;width:96px;max-width:96px}
.mlist .mrow select.mstatus{flex:0 0 124px;width:124px;max-width:124px}
.mlist .mrow .mscore{flex:0 0 auto}
@media (max-width:640px){
  .mlist .mrow{flex-wrap:wrap}
  .mlist .mrow>.grow{flex:1 1 100%}
  .mlist .mrow input.mscore-in{flex:1 1 90px;width:auto;max-width:none}
  .mlist .mrow select.mstatus{flex:1 1 120px;width:auto;max-width:none}
}

/* transcripts and certificates in the preview and the student view */
.sheet.multi{max-width:none}
.stu-page{position:relative;padding:6px 4px 14px;page-break-after:always;break-after:page;min-height:240mm;background:#fff}
.stu-page:last-child{page-break-after:auto;break-after:auto}
.stu-page .trinfo{display:flex;flex-wrap:wrap;gap:6px 22px;margin:4px 2px 12px;font-size:13px}
.trtable{width:100%;border-collapse:collapse;font-size:12.5px;margin-bottom:10px}
.trtable th,.trtable td{border:1px solid #cbd5e1;padding:6px 8px;text-align:center;vertical-align:middle}
.trtable th{background:#ecfdf5;color:#065f46;font-weight:800}
.trtable th small{display:block;font-weight:600;color:#64748b}
.trtable td.sub,.trtable th.sub{text-align:start;min-width:120px}
.trtable td small{color:#64748b}
.trtable .live{font-style:italic;color:#92400e}
.trtable .okc{color:#047857}.trtable .badc{color:#b91c1c}
.trtable.compact{font-size:12px}
.trtable.compact th,.trtable.compact td{padding:5px 6px}
.trnote{font-size:11px;color:#64748b;margin:2px 2px 8px}
.trresult{display:flex;gap:28px;flex-wrap:wrap;justify-content:center;margin:14px 0 6px;padding:12px 16px;border-radius:14px;font-size:15px;border:2px solid currentColor}
.trresult.okc{color:#047857;background:#ecfdf5}.trresult.badc{color:#b91c1c;background:#fef2f2}
.stu-page .sign{display:flex;justify-content:space-between;gap:20px;margin-top:70px;font-size:13px}
.stu-page .sign>div{flex:1;text-align:center;border-top:1px solid #64748b;padding-top:8px}
.stu-page.certificate{border:3px double #0f766e;border-radius:18px;padding:18px 20px 20px}
.stu-page .wm{position:absolute;inset:0;display:grid;place-items:center;font-size:150px;font-weight:900;letter-spacing:.05em;color:rgba(220,38,38,.13);transform:rotate(-30deg);pointer-events:none;z-index:2;overflow:hidden;white-space:nowrap}
.stu-page .draftbar{margin:0 0 8px;padding:6px 12px;border-radius:10px;background:#fef2f2;color:#b91c1c;border:1px dashed #dc2626;font-weight:800;font-size:12px;text-align:center}

/* the student's own transcript on a phone: one card per subject instead of a wide table */
@media (max-width:640px){
  .stu-transcript .tw{overflow:visible}
  .stu-transcript .trtable.compact{display:block;border:0}
  .stu-transcript .trtable.compact thead{display:none}
  .stu-transcript .trtable.compact tbody{display:flex;flex-direction:column;gap:10px}
  .stu-transcript .trtable.compact tr{display:block;border:1px solid var(--line);border-radius:14px;padding:8px 12px;background:var(--surface)}
  .stu-transcript .trtable.compact td{display:flex;justify-content:space-between;align-items:baseline;gap:10px;border:0;padding:4px 0;text-align:end}
  .stu-transcript .trtable.compact td.sub{font-size:1.05rem;padding-bottom:6px;border-bottom:1px solid var(--line);margin-bottom:4px;text-align:start}
  .stu-transcript .trtable.compact td[data-l]::before{content:attr(data-l);color:var(--muted);font-weight:600;font-size:.85rem}
}

/* a marks row someone else changed while the sheet was open */
.mlist .mrow.conflict{border-color:#dc2626;background:#fef2f2}
.mlist .mrow .cnote{font-size:.8rem;color:#b91c1c;margin-top:2px}

/* 1.10.0: settings buttons at the top of feature pages; tabs made of links */
.ph .phbtns{gap:8px;flex-wrap:wrap;align-items:center}
.setbtn{white-space:nowrap}
@media (max-width:640px){
  .ph .phbtns{width:100%}
  .ph .phbtns .btn{flex:1 1 auto;justify-content:center}
  .tabs:not(.stabs) a{flex:1 1 auto;min-height:40px;padding:8px 12px;border:1px solid var(--line)!important;border-radius:999px!important;background:var(--surface);margin:0!important;text-align:center;display:inline-flex;align-items:center;justify-content:center}
  .tabs:not(.stabs) a.on{background:var(--pri-soft)!important;border-color:var(--pri-line)!important;color:var(--pri-d)}
}
.linkrow:hover{border-color:var(--pri-line)}
/* staff details */
.clickrow{cursor:pointer}
.clickrow:hover td{background:var(--pri-soft)}
.udet-sec{border:1px solid var(--line);border-radius:14px;padding:6px 12px;margin-bottom:6px}
.udet-row{display:flex;justify-content:space-between;gap:12px;padding:6px 0;border-bottom:1px solid var(--line)}
.udet-row:last-child{border-bottom:0}
.udet-h{font-size:.95rem;margin:16px 0 8px}
.udet-subs{display:flex;flex-wrap:wrap;gap:6px}
.udet-g{margin-bottom:8px}
.udet-g .lrow{padding:8px 0;border-bottom:1px solid var(--line);align-items:flex-start;gap:10px}
@media (max-width:640px){ .udet-g .lrow{flex-direction:column} }
.qtile>div{flex:1 1 auto}

/* fill-in-the-blank text keeps the lines the teacher typed */
.filltext, .pfill { white-space: pre-wrap; }

/* family page: small social icons at the bottom (the link keeps a comfortable tap area) */
.socrow.sm{gap:2px}
.socrow.sm a{padding:6px;border-radius:50%}
.socrow.sm .soc{width:32px;height:32px;box-shadow:0 4px 10px -7px rgba(0,0,0,.45)}
.socrow.sm .soc svg{width:19px;height:19px}

/* section plan: subject approval grid */
.stgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:10px}
.stcell{display:flex;align-items:center;gap:10px;padding:10px 12px;border:1px solid var(--line);border-inline-start:4px solid var(--line);border-radius:12px;background:var(--surface);min-width:0}
.stcell .grow{min-width:0}
.stcell b{display:block;overflow-wrap:anywhere}
.stcell .chip,.stcell .tag{flex-shrink:0;white-space:nowrap}
.stcell.st-approved{border-inline-start-color:var(--ok)}
.stcell.st-submitted{border-inline-start-color:var(--info)}
.stcell.st-returned{border-inline-start-color:var(--warn)}
.stcell.st-none{border-inline-start-color:var(--line-2)}
.stsum{display:flex;flex-wrap:wrap;gap:6px 14px;color:var(--muted)}
.stsum .st-approved b{color:var(--ok)}.stsum .st-submitted b{color:var(--info)}.stsum .st-returned b{color:var(--warn)}
@media (max-width:640px){.stgrid{grid-template-columns:1fr}}

/* online lessons: one link or a link per section */
.lmseg{display:grid;grid-template-columns:1fr 1fr;width:100%}
.lmseg button{white-space:normal;line-height:1.3;min-height:40px}
.perlinks{display:grid;gap:8px}
.perrow{display:grid;grid-template-columns:72px minmax(0,1fr) 130px;gap:8px;align-items:center}
.perrow .persec{font-weight:800}
@media (max-width:640px){.perrow{grid-template-columns:1fr;gap:6px;padding-bottom:6px;border-bottom:1px dashed var(--line)}}

/* 1.11.0: one layout for every page header — title, then the page's buttons in a fixed order:
   settings ⚙ · other actions · "Data ▾" menu · the one main (green) button at the end. */
.ph{align-items:center;gap:8px 10px}
.ph>.grow{flex:1 1 280px;min-width:0}
.ph>.btn,.ph>a.btn,.ph>.dmenu,.ph>button{flex:0 0 auto}
.ph .btn,.ph .dmenu>summary{min-height:40px;padding-inline:14px;font-size:.9em}
.ph>.setbtn{order:12}
.ph>.dmenu{order:15}
.ph>.btn.pri{order:20}
/* "Data ▾" menu */
.dmenu{position:relative}
.dmenu>summary{list-style:none;cursor:pointer;user-select:none}
.dmenu>summary::-webkit-details-marker{display:none}
.dmenu .dcaret{font-size:.75em;opacity:.65;margin-inline-start:2px}
.dmenu[open]>summary{background:var(--surface-2)}
.dmenu-pop{position:absolute;inset-inline-end:0;top:calc(100% + 6px);z-index:60;min-width:240px;background:var(--surface);border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow-lg);padding:6px;display:grid;gap:2px}
.dmenu-item{display:flex;align-items:center;gap:10px;width:100%;min-height:42px;padding:8px 12px;border:0;background:none;border-radius:9px;cursor:pointer;font:inherit;font-size:.92em;font-weight:700;color:var(--fg);text-align:start}
.dmenu-item:hover,.dmenu-item:focus-visible{background:var(--surface-2);outline:none}
.dmenu-item svg{width:18px;height:18px;flex-shrink:0;color:var(--muted)}
@media (max-width:640px){
  .ph{gap:8px}
  .ph>.grow{flex:1 1 100%;order:-2}
  .ph>.btn,.ph>a.btn,.ph>.dmenu,.ph>button{flex:1 1 calc(50% - 4px);min-width:0;justify-content:center}
  .ph>.btn.pri{flex:1 1 100%;order:-1}
  .ph>.dmenu>summary{width:100%;justify-content:center}
  .ph .btn span,.ph .dmenu>summary span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  /* the menu opens full width under the header buttons, so it never runs off the screen */
  .ph{position:relative}
  .ph>.dmenu{position:static}
  .ph>.dmenu .dmenu-pop{left:0;right:0;inset-inline:0;top:calc(100% + 6px);min-width:0;padding:8px;box-shadow:0 18px 50px -12px rgba(0,0,0,.45)}
  .dmenu-item{min-height:48px}
}
@media print{.dmenu{display:none!important}}

/* 1.11.0: one filter card for every page */
.fcard{margin-bottom:14px;padding:14px 16px}
.fgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px 12px;align-items:end}
.ff{display:flex;flex-direction:column;gap:4px;min-width:0;margin:0}
.ff .fl{font-size:.78em;font-weight:800;color:var(--muted)}
.fgrid :is(select,input:not([type=checkbox])){width:100%!important;min-width:0;max-width:none!important}
.ff.check{flex-direction:row;align-items:center;gap:8px;min-height:42px}
.ffoot{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:10px;padding-top:10px;border-top:1px dashed var(--line)}
.fcount{font-size:.85em;font-weight:700;color:var(--muted)}
@media (max-width:640px){
  .fcard{padding:12px}
  .fgrid{grid-template-columns:1fr 1fr;gap:8px}
  .ff.wide{grid-column:1/-1}
}
/* actions on selected rows (accounting): their own bar above the table */
.selbar{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:12px}
@media (max-width:640px){.selbar>.btn{flex:1 1 calc(50% - 4px);justify-content:center}.selbar>.check{flex:1 1 100%}}
/* staff accounts: the same filter card; on phones the filters fold under the search */
.ufilters .uf-panel.fgrid{display:grid;margin-top:10px}
@media (max-width:900px){.ufilters .uf-panel.fgrid{display:none}.ufilters .uf-panel.fgrid.open{display:grid}}
.selbar:not(:has(*)){display:none}
/* the header (with its "Data" menu) sits above the cards that follow it */
.ph{position:relative;z-index:30}
@media (max-width:640px){
  .ph>.btn,.ph>a.btn,.ph>.dmenu>summary{white-space:normal;text-align:center;line-height:1.25;overflow:hidden}
}
.dmenu>summary,.dmenu-item,.dmenu-pop{box-sizing:border-box}
/* short counters never break over two lines */
.stsum>span,.fcount,.row.small>.chip,.row.small>.num{white-space:nowrap}
.row.small>.bar{flex:1 1 120px;max-width:180px}
/* a "Data ▾" menu outside a page header (e.g. inside a tab) opens full width on phones too */
@media (max-width:640px){
  .row:has(>.dmenu){position:relative;z-index:30}
  .row>.dmenu{position:static}
  .row>.dmenu .dmenu-pop{left:0;right:0;inset-inline:0;top:calc(100% + 6px);min-width:0;padding:8px}
}
