/* RVNP attendance — colours taken from the institution's crest:
   green field, red top plate, black RVNP box, white. */
@font-face { font-family: "Lexend"; src: url("fonts/lexend.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url("fonts/source-sans-3.woff2") format("woff2"); font-weight: 200 900; font-display: swap; }

:root {
  --crest-green: #23ab5f;   /* the crest's field — large fills only */
  --forest: #0b5d33;        /* header, links, focus */
  --crest-red: #e7363e;     /* the crest's top plate */
  --black: #000;            /* the RVNP box: primary actions */

  --paper: #f2f5f3;
  --surface: #ffffff;
  --sunk: #e9efeb;
  --ink: #16211b;
  --ink-2: #33433a;
  --muted: #5b6b62;
  --line: #d3ddd6;
  --line-strong: #b4c3b9;
  --link: var(--forest);
  --focus: #0b5d33;

  --btn-bg: var(--black); --btn-ink: #fff;

  --p: #10773c;  --p-soft: #e0f2e7;
  --a: #c42830;  --a-soft: #fbe4e5;
  --l: #a35f00;  --l-soft: #fcefd8;
  --e: #33598a;  --e-soft: #e2eaf5;

  --r-sm: 6px;
  --r-lg: 12px;
  --display: "Lexend", system-ui, sans-serif;
  --text: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1511; --surface: #16201a; --sunk: #1d2a22;
    --ink: #e7efea; --ink-2: #c8d5cd; --muted: #93a79b;
    --line: #283a2f; --line-strong: #3a5143;
    --link: #6fd39a; --focus: #6fd39a;
    --btn-bg: #fff; --btn-ink: #000;
    --p: #4fcd84; --p-soft: #15301f;
    --a: #ff7178; --a-soft: #3a1719;
    --l: #f0b14d; --l-soft: #362711;
    --e: #8db4ee; --e-soft: #18263b;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.5 var(--text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
h2 { font-size: 1.125rem; margin: 0 0 .5rem; }
p { margin: .25rem 0 .75rem; }
code { font-size: .875em; background: var(--sunk); padding: .05em .35em; border-radius: 4px; }
a { color: var(--link); text-underline-offset: .15em; }
.muted { color: var(--muted); }
.err-text { color: var(--a); font-weight: 600; }
.small { font-size: .875rem; }
.center { text-align: center; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
svg.i { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- header: the crest's red plate over its green field ---------- */
.chrome { position: sticky; top: 0; z-index: 20; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: calc(.55rem + env(safe-area-inset-top)) 1rem .55rem;
  background: var(--forest); color: #fff;
  border-top: 5px solid var(--crest-red);
}
.brand { display: flex; align-items: center; gap: .7rem; min-width: 0; flex: 1 1 auto; }
.crest { flex-shrink: 0; width: 44px; height: 44px; border-radius: 8px; background: #fff; padding: 2px; display: grid; place-items: center; }
.crest img { width: 40px; height: 40px; display: block; }
.brand > div { min-width: 0; }
.brand strong, .brand span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand strong { font-family: var(--display); font-weight: 600; font-size: 1.0625rem; line-height: 1.2; }
.brand span { font-size: .875rem; color: #cfe6d8; }
.status { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .8125rem; font-weight: 600; padding: .2rem .6rem .2rem .5rem; border-radius: 99px; background: rgba(255,255,255,.12); color: #fff; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #9fb5a8; }
.badge.online::before { background: #5ee08f; }
.badge.offline::before { background: #ff8a8f; }
@media (max-width: 400px) { .badge { font-size: 0; padding: .45rem; gap: 0; } }

/* ---------- tabs: bottom bar on phones, a row under the header on wide screens ---------- */
.tabs { display: flex; background: var(--surface); border-bottom: 1px solid var(--line); padding: 0 .5rem; }
.tabs button {
  appearance: none; border: 0; background: none; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; gap: .45rem; min-height: 48px; padding: 0 1rem;
  font: 500 .9375rem var(--display); border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--ink); border-bottom-color: var(--crest-green); font-weight: 600; }
.tabs button.active svg.i { color: var(--forest); }
@media (prefers-color-scheme: dark) { .tabs button.active svg.i { color: var(--link); } }
@media (max-width: 759px) {
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 0 0 env(safe-area-inset-bottom);
    border-bottom: 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr);
  }
  .tabs button { flex-direction: column; justify-content: center; gap: 2px; height: var(--nav-h); padding: 0; font-size: .8125rem; border-bottom: 0; border-top: 3px solid transparent; margin: -1px 0 0; }
  .tabs button.active { border-top-color: var(--crest-green); }
  .tabs svg.i { width: 22px; height: 22px; }
  body:not(.student) main { padding-bottom: calc(var(--nav-h) + 1.5rem + env(safe-area-inset-bottom)); }
  body:not(.student) #toast { bottom: calc(var(--nav-h) + .75rem + env(safe-area-inset-bottom)); }
}

main { max-width: 840px; margin: 0 auto; padding: 1rem; }
.tab { display: none; }
.tab.active { display: block; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1rem; margin-bottom: 1rem; }
@media (min-width: 560px) { .card { padding: 1.25rem; } }
.notice { border-left: 5px solid var(--crest-red); }
.notice .crest-big { width: 72px; height: 72px; display: block; margin-bottom: .5rem; }
.warn-banner { border: 1px solid color-mix(in srgb, var(--l) 45%, var(--line)); background: var(--l-soft); color: var(--ink); font-weight: 600; font-size: .9375rem; padding: .75rem 1rem; }

/* ---------- forms ---------- */
label { display: block; font-size: .9375rem; font-weight: 600; color: var(--ink-2); margin-bottom: .875rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem; height: 46px;
  font: 400 1rem var(--text); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: .55rem .75rem;
}
textarea { height: auto; resize: vertical; }
select { appearance: none; padding-right: 2.25rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 8l5 5 5-5' fill='none' stroke='%235b6b62' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .6rem center; background-size: 18px; }
select:disabled { opacity: .6; cursor: default; }
input:focus, select:focus, textarea:focus { outline: 3px solid color-mix(in srgb, var(--focus) 35%, transparent); outline-offset: 0; border-color: var(--focus); }
input[type=file] { height: auto; padding: .5rem; }
label.check { display: flex; align-items: center; gap: .5rem; color: var(--ink); font-weight: 500; }
label.check input { width: auto; height: auto; margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .875rem; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
.tag { font-size: .75rem; font-weight: 600; color: var(--muted); background: var(--sunk); padding: .05rem .45rem; border-radius: 99px; vertical-align: middle; }

.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 44px; padding: .5rem 1rem; border-radius: var(--r-sm);
  font: 600 .9375rem/1.2 var(--display); cursor: pointer; white-space: nowrap; text-decoration: none;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: background-color .15s, border-color .15s;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primary { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--btn-bg) 82%, var(--forest)); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--sunk); }
.btn.danger { color: var(--a); border-color: color-mix(in srgb, var(--a) 45%, var(--line)); }
.btn.small { min-height: 40px; padding: .35rem .8rem; font-size: .875rem; }
.btn.big { width: 100%; min-height: 60px; font-size: 1.125rem; margin: .75rem 0 .5rem; gap: .6rem; }
.btn.big svg.i { width: 26px; height: 26px; }
.topbar .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.35); color: #fff; }
.topbar .btn:hover { background: rgba(255,255,255,.2); border-color: #fff; }
.topbar .btn.syncing .sync-icon { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.count { background: var(--crest-red); color: #fff; border-radius: 99px; padding: .05rem .4rem; font: 700 .75rem/1.3 var(--display); min-width: 1.35rem; text-align: center; }
.count.zero { background: rgba(255,255,255,.2); }
.row-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.row-actions .btn.ghost { border-color: var(--line); background: var(--surface); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
label.file input { padding: .45rem; }

/* ---------- open a register ---------- */
.session-form { display: flex; flex-direction: column; gap: .75rem; }
.session-form label { margin: 0; }
.session-form .btn { min-height: 48px; font-size: 1rem; }
.sf-row { display: grid; grid-template-columns: 1fr 1.4fr 1.2fr; gap: .75rem; }
@media (max-width: 760px) { .sf-row { grid-template-columns: 1fr 1fr; } .sf-row label:last-child { grid-column: 1 / -1; } }
.kind-row, .catweeks { display: flex; flex-wrap: wrap; gap: .4rem; }
.catweeks { border: 0; padding: 0; margin: .5rem 0; }
.catweeks legend { font-weight: 600; margin-bottom: .35rem; }
.kchip { display: inline-flex; margin: 0; cursor: pointer; }
.kchip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kchip span { padding: .4rem .8rem; border: 1px solid var(--line-strong); border-radius: 99px; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.kchip input:checked + span { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-ink); }
.kchip input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.kchip.off { cursor: not-allowed; }
.kchip.off span { opacity: .45; }

/* the weekly timetable: Mon–Fri × 6 slots; tap a slot, tap the next for a double */
.timetable { display: grid; grid-template-columns: 3.1rem repeat(3, minmax(0, 1fr)) 1.1rem repeat(3, minmax(0, 1fr)); gap: 4px; }
.tt-corner { }
.tt-day, .tt-time { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .78rem; color: var(--muted); line-height: 1.15; padding: .2rem 0; }
.tt-day b, .tt-time b { color: var(--ink); font-size: .85rem; }
.tt-day.today b { color: var(--p); }
.tt-time { align-items: center; text-align: center; }
.tt-day { align-items: flex-start; padding-left: .1rem; }
.tt-cell { min-height: 46px; border: 1px dashed var(--line-strong); border-radius: 8px; background: var(--surface); padding: 2px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font: inherit; font-size: .72rem; color: var(--muted); cursor: pointer; overflow: hidden; }
.tt-cell:hover:not(:disabled) { border-style: solid; border-color: var(--ink-2); }
.tt-cell.future { background: var(--sunk); border-style: solid; border-color: transparent; cursor: default; }
.tt-cell.picked { background: var(--p-soft); border: 2px solid var(--p); color: var(--p); }
.tt-cell .other { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; max-width: 100%; }
.tt-cell.have { border: 1px solid transparent; background: var(--p-soft); color: var(--p); }
.tt-cell.have b { font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tt-cell.have.cat { background: var(--e-soft); color: var(--e); }
.tt-cell.have.extra { background: var(--l-soft); color: var(--l); }
.tt-cell.cont { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -4px; }
.tt-lunch { display: flex; align-items: center; justify-content: center; border-left: 1px dashed var(--line); border-right: 1px dashed var(--line); }
.tt-lunch span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.empty-state { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center; padding: 2rem 1rem; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); }
.empty-state .i { width: 2rem; height: 2rem; color: var(--p); }
.empty-state b { color: var(--ink); font: 600 1.05rem var(--display); }
#openBtn { white-space: normal; line-height: 1.25; padding-top: .55rem; padding-bottom: .55rem; }
#register[data-kind="cat"] { border-top: 4px solid var(--e); }
#register[data-kind="extra"] { border-top: 4px solid var(--l); }
.pill.cat { background: var(--e-soft); color: var(--e); }
.weeks li.catwk b { color: var(--e); }
.cats h2 { margin-top: 0; }

/* ---------- the register ---------- */
.register { padding-top: 1rem; }
.reg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.reg-head h2 { margin: 0; font-size: 1.375rem; font-weight: 700; letter-spacing: -.02em; }
.reg-head p { margin: .15rem 0 .75rem; }
.save-state { display: inline-flex; align-items: center; gap: .35rem; font-size: .8125rem; font-weight: 600; padding: .25rem .6rem; border-radius: 99px; background: var(--sunk); color: var(--muted); white-space: nowrap; }
.save-state.ok { background: var(--p-soft); color: var(--p); }
.save-state.err { background: var(--a-soft); color: var(--a); }

.counts { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; font-size: .875rem; font-weight: 600; padding: .25rem .65rem; border-radius: 99px; background: var(--sunk); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.chip.P, .chip.A, .chip.L, .chip.E { background: var(--surface); border: 1px solid var(--line); }
.chip.P::before, .chip.A::before, .chip.L::before, .chip.E::before { content: ""; width: 9px; height: 9px; border-radius: 3px; }
.chip.P::before { background: var(--p); }
.chip.A::before { background: var(--a); }
.chip.L::before { background: var(--l); }
.chip.E::before { background: var(--e); }

.reg-tools { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.reg-tools input { flex: 1 1 220px; margin: 0; }
.reg-tools .quick { display: flex; flex-wrap: wrap; gap: .25rem; }
@media (max-width: 420px) { .reg-tools .quick .btn { padding: .5rem .55rem; font-size: .875rem; } }
.reg-tools .qr-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; flex: 1 1 100%; }
.reg-tools .qr-actions .btn { min-width: 0; padding: .5rem .6rem; }
@media (max-width: 400px) { .reg-tools .qr-actions .btn { font-size: .875rem; gap: .35rem; } }
@media (min-width: 760px) { .reg-tools .qr-actions { display: flex; flex: 0 1 auto; margin-left: auto; } }

.trainee-list { list-style: none; margin: 0 -1rem .75rem; padding: 0; border-top: 1px solid var(--line); }
@media (min-width: 560px) { .trainee-list { margin: 0 -1.25rem .75rem; } }
.trow { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .6rem 1rem; border-bottom: 1px solid var(--line); }
@media (min-width: 560px) { .trow { padding: .6rem 1.25rem; } }
.trow:nth-child(even) { background: color-mix(in srgb, var(--sunk) 45%, transparent); }
.tinfo { min-width: 0; }
.tname { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-weight: 600; font-size: 1rem; line-height: 1.3; overflow-wrap: anywhere; }
.tadm { display: block; font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.trow.unlisted .tname { color: var(--muted); }
.trow.unlisted .tadm::after { content: " — no longer on the class list"; }
.trow.flash { animation: flash 1.4s ease-out; }
@keyframes flash { from { background: var(--p-soft); } to { background: transparent; } }
.trainee-list .empty { list-style: none; }

/* P / A / L / E keys */
.seg { display: inline-flex; gap: 4px; flex-shrink: 0; }
.seg button {
  appearance: none; width: 44px; height: 44px; border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface);
  font: 700 1rem var(--display); transition: background-color .12s, color .12s, border-color .12s;
}
.seg button[data-s="P"] { color: var(--p); }
.seg button[data-s="A"] { color: var(--a); }
.seg button[data-s="L"] { color: var(--l); }
.seg button[data-s="E"] { color: var(--e); }
.seg button.on { color: #fff; }
.seg button.on[data-s="P"] { background: var(--p); border-color: var(--p); }
.seg button.on[data-s="A"] { background: var(--a); border-color: var(--a); }
.seg button.on[data-s="L"] { background: var(--l); border-color: var(--l); }
.seg button.on[data-s="E"] { background: var(--e); border-color: var(--e); }
@media (prefers-color-scheme: dark) { .seg button.on { color: #08110c; } }
@media (max-width: 370px) { .seg button { width: 40px; } .trow { gap: .5rem; } }

.notes { margin-top: .5rem; }
.reg-actions { display: flex; justify-content: flex-end; gap: .5rem; }

/* QR check-in tag on a register row */
.qrtag { display: inline-flex; align-items: center; margin-left: .4rem; font: 700 .6875rem var(--display); padding: .1rem .4rem; border-radius: 4px; background: var(--forest); color: #fff; vertical-align: 2px; }
.qrtag.bad { background: var(--a-soft); color: var(--a); }

/* ---------- registers list ---------- */
.filters { display: flex; gap: .75rem; flex-wrap: wrap; }
.filters select { flex: 1 1 160px; margin: 0; }
.pill { display: inline-flex; align-items: center; gap: .3rem; font-size: .8125rem; font-weight: 600; padding: .15rem .55rem; border-radius: 99px; white-space: nowrap; }
.pill.synced { background: var(--p-soft); color: var(--p); }
.pill.pending { background: var(--l-soft); color: var(--l); }
.pill.locked { background: var(--sunk); color: var(--muted); }
.pill.rejected { background: var(--a-soft); color: var(--a); white-space: normal; text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }

/* ---------- reports ---------- */
.report-filters { display: grid; grid-template-columns: repeat(5, 1fr); gap: .75rem; }
.report-filters label { margin: 0; }
@media (max-width: 760px) { .report-filters { grid-template-columns: 1fr 1fr; } .report-filters label:first-child { grid-column: 1 / -1; } }
.report-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-bottom: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.report-summary .empty { grid-column: 1 / -1; }
@media (max-width: 560px) { .report-summary { grid-template-columns: 1fr 1fr; } }
.stat { padding: .85rem 1rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: -1px; }
.stat:nth-child(4n) { border-right: 0; }
@media (max-width: 560px) { .stat:nth-child(2n) { border-right: 0; } }
.stat b { display: block; font: 700 1.75rem/1.15 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: .875rem; color: var(--muted); }
.stat.warn b { color: var(--a); }
.table-wrap { padding: 0; overflow-x: auto; }
.report-table { width: 100%; border-collapse: collapse; font-size: .9375rem; font-variant-numeric: tabular-nums; }
.report-table th, .report-table td { padding: .6rem .75rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.report-table th { font: 600 .8125rem var(--display); color: var(--muted); background: var(--sunk); }
.report-table td.num, .report-table th.num { text-align: right; }
.report-table td.who { white-space: normal; min-width: 8rem; font-weight: 600; }
.report-table td.who small { display: block; color: var(--muted); font-size: .8125rem; font-weight: 400; }
.report-table tr:last-child td { border-bottom: 0; }
@media (max-width: 520px) {
  .report-table th, .report-table td { padding: .55rem .35rem; }
  .report-table th:first-child, .report-table td:first-child { padding-left: .75rem; }
  .report-table td.who { min-width: 0; }
  .bar { display: none; }
}
.report-table tr.below td { background: color-mix(in srgb, var(--a-soft) 45%, var(--surface)); }
.report-table tr.below td:first-child { box-shadow: inset 4px 0 var(--a); }
.report-table tr.below td:last-child { color: var(--a); font-weight: 700; }
.bar { display: inline-block; width: 64px; height: 8px; border-radius: 2px; background: var(--sunk); vertical-align: middle; margin-right: .5rem; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--p); }
tr.below .bar i { background: var(--a); }
@media (max-width: 520px) { .report-table .bar { display: none; } }

/* ---------- camera scanner ---------- */
.scan-dialog, .qr-dialog { border: 0; border-radius: var(--r-lg); padding: 1rem; background: var(--surface); color: var(--ink); }
.scan-dialog { width: min(440px, 94vw); }
.scan-dialog::backdrop, .qr-dialog::backdrop { background: rgba(4, 20, 11, .78); }
.scan-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.scan-head strong { font: 600 1.0625rem var(--display); }
.video-wrap { position: relative; border-radius: 10px; overflow: hidden; background: #000; aspect-ratio: 1; }
.video-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame { position: absolute; inset: 16%; border-radius: 14px; box-shadow: 0 0 0 999px rgba(0,0,0,.35);
  background:
    linear-gradient(#fff, #fff) top left / 34px 4px, linear-gradient(#fff, #fff) top left / 4px 34px,
    linear-gradient(#fff, #fff) top right / 34px 4px, linear-gradient(#fff, #fff) top right / 4px 34px,
    linear-gradient(#fff, #fff) bottom left / 34px 4px, linear-gradient(#fff, #fff) bottom left / 4px 34px,
    linear-gradient(#fff, #fff) bottom right / 34px 4px, linear-gradient(#fff, #fff) bottom right / 4px 34px;
  background-repeat: no-repeat; }
.scan-mode { margin: .875rem 0 .25rem; }
.scan-result { font-weight: 600; text-align: center; margin: .75rem 0 0; min-height: 1.5em; }
.scan-result.ok { color: var(--p); }
.scan-result.err { color: var(--a); }

/* ---------- lesson QR screen (shown to the class) ---------- */
.qr-dialog { width: min(560px, 100vw); max-width: 100vw; border-top: 6px solid var(--crest-red); }
@media (max-width: 600px) {
  .qr-dialog#lessonQrDialog { width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; display: none; flex-direction: column; padding: calc(.75rem + env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom)); }
  .qr-dialog#lessonQrDialog[open] { display: flex; }
}
.qr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; margin-bottom: .75rem; }
.qr-head strong { display: block; font: 700 1.125rem/1.3 var(--display); letter-spacing: -.01em; }
@media (min-width: 600px) { .qr-head strong { font-size: 1.375rem; } }
.qr-head .muted { display: block; margin-top: .1rem; }
.qr-box { background: #fff; border-radius: 10px; padding: .5rem; display: flex; justify-content: center; border: 1px solid var(--line); }
.qr-box svg { width: min(88vw, 480px); height: auto; display: block; }
.qr-timer { height: 8px; border-radius: 4px; background: var(--sunk); margin: .875rem 0 .75rem; overflow: hidden; }
.qr-timer i { display: block; height: 100%; background: var(--crest-green); transition: width .25s linear; }
.qr-live { text-align: center; margin: .25rem 0; font: 500 1.0625rem var(--display); }
.qr-live b { font-size: 2.5rem; font-weight: 700; letter-spacing: -.03em; color: var(--p); margin-right: .2rem; font-variant-numeric: tabular-nums; vertical-align: -.1em; }
.qr-live span { display: block; color: var(--muted); font: 400 .9375rem var(--text); margin-top: .1rem; }
.qr-note { text-align: center; color: var(--muted); font-size: .9375rem; margin: .5rem auto 0; max-width: 34em; }
.join-link { display: flex; gap: .5rem; margin-top: .75rem; }
.join-link input { margin: 0; font-size: .875rem; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom)); transform: translate(-50%, 1rem);
  background: #000; color: #fff; padding: .75rem 1.1rem; border-radius: 8px; max-width: min(92vw, 30rem);
  font-size: .9375rem; font-weight: 500; transition: transform .25s ease, opacity .25s ease; z-index: 50;
  opacity: 0; pointer-events: none;
  border-left: 5px solid var(--line-strong);
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }
#toast.ok { border-left-color: var(--crest-green); }
#toast.err { border-left-color: var(--crest-red); }

/* ---------- printed QR ID cards ---------- */
.print-area { display: none; }
@media print {
  body.printing > *:not(.print-area) { display: none !important; }
  body.printing .print-area { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6mm; padding: 6mm; }
  .qr-card { border: 1px solid #999; border-top: 3mm solid #e7363e; border-radius: 3mm; padding: 4mm; text-align: center; break-inside: avoid; font: 10pt "Source Sans 3", system-ui, sans-serif; color: #000; }
  .qr-card svg { width: 32mm; height: 32mm; }
  .qr-card b { display: block; margin-top: 2mm; font-family: "Lexend", sans-serif; }
  .qr-card small { display: block; color: #333; }
}

/* ---------- student app ---------- */
body.student main { max-width: 520px; }
.profile { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
.profile strong { display: block; font: 600 1.1875rem/1.25 var(--display); }
.profile span { display: block; }
.result { text-align: center; border-width: 2px; padding: 1.5rem 1rem; }
.result.ok { border-color: var(--p); background: color-mix(in srgb, var(--p-soft) 55%, var(--surface)); }
.result.err { border-color: var(--a); background: color-mix(in srgb, var(--a-soft) 55%, var(--surface)); }
.result-icon { width: 72px; height: 72px; margin: 0 auto .75rem; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--muted); }
.result-icon svg { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.result.ok .result-icon { background: var(--p); }
.result.err .result-icon { background: var(--a); }
@media (prefers-color-scheme: dark) { .result-icon { color: #08110c; } }
.result h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; }
.result p { margin: .25rem 0; }
.result.ok .result-icon { animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.setup-intro { display: flex; gap: .875rem; align-items: flex-start; margin-bottom: .5rem; }
.setup-intro img { width: 64px; height: 64px; flex-shrink: 0; }
.setup-intro h2 { margin-top: .2rem; }
#setupForm select { font-size: 1.0625rem; height: 52px; }
.pick-list { list-style: none; margin: .5rem 0 0; padding: 0; max-height: 50vh; overflow-y: auto; border-top: 1px solid var(--line); }
.pick-list button { width: 100%; text-align: left; display: flex; justify-content: space-between; gap: .5rem; padding: .75rem .25rem; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: inherit; cursor: pointer; }
.pick-list button span { color: var(--muted); font-size: .875rem; }
.scan-hint { color: var(--muted); font-size: .9375rem; text-align: center; margin: 0 0 1.25rem; }
.history { list-style: none; margin: 0 -1rem; padding: 0; border-top: 1px solid var(--line); }
@media (min-width: 560px) { .history { margin: 0 -1.25rem; } }
.history li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
@media (min-width: 560px) { .history li { padding: .7rem 1.25rem; } }
.history li:last-child { border-bottom: 0; }
.history li b { display: block; font-weight: 600; }
.history li span.muted { display: block; }
#historyCard { padding-bottom: 0; overflow: hidden; }
body.student .topbar .btn.syncing { opacity: .7; }
.linkish { background: none; border: 0; padding: .5rem; color: var(--link); font: inherit; font-size: .9375rem; text-decoration: underline; text-underline-offset: .15em; cursor: pointer; }
body.student .view-checkin > #scanBtn { margin: 0 0 .5rem; width: 100%; }
.device-foot { color: var(--muted); font-size: .8125rem; text-align: center; margin-top: 1.5rem; }

/* ---------- sign-in ---------- */
body.locked { overflow: hidden; }
.signin { position: fixed; inset: 0; z-index: 100; background: var(--paper); overflow-y: auto; display: grid; place-items: center;
  padding: calc(1.5rem + env(safe-area-inset-top)) 1rem calc(1.5rem + env(safe-area-inset-bottom)); border-top: 6px solid var(--crest-red); }
.signin-card { width: min(400px, 100%); text-align: center; }
.signin-card > img { display: block; margin: 0 auto .75rem; background: #fff; border-radius: 12px; padding: 4px; }
.signin-card h1 { font-size: 1.625rem; margin: 0; }
.signin-tag { margin: .1rem 0 .35rem; font-family: var(--display); font-weight: 600; letter-spacing: .02em; color: var(--p); }
.signin-card form { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.25rem; margin: 1.25rem 0 1rem; }
.signin-card form h2 { margin-top: 0; }
.signin-card #siCode { text-transform: uppercase; }

/* ---------- small bits ---------- */
.hint { display: block; font-size: .8125rem; font-weight: 600; color: var(--p); margin-top: .25rem; min-height: 1.2em; }
.hint.bad { color: var(--a); }
.ptag { display: inline-flex; align-items: center; margin-left: .35rem; font: 600 .6875rem var(--display); padding: .1rem .45rem; border-radius: 4px; background: var(--l-soft); color: var(--l); vertical-align: 2px; }
.warn-text { color: var(--l); font-weight: 600; }
.tabs .dot { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--crest-red); color: #fff; font: 700 .6875rem/18px var(--display); text-align: center; }
@media (max-width: 759px) {
  .tabs { grid-template-columns: repeat(var(--tabs, 5), 1fr); }
  .tabs button { position: relative; }
  .tabs .dot { position: absolute; top: 6px; left: calc(50% + 6px); }
}
.input-suffix { display: flex; align-items: center; gap: .5rem; }
.input-suffix input { width: 6rem; flex: 0 0 auto; }
.input-suffix span { font-weight: 400; color: var(--muted); font-size: .875rem; margin-top: .3rem; }
.profile-card { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; }
.profile-card h2 { margin: 0; font-size: 1.25rem; }
.profile-card p { margin: .15rem 0 0; }
details.advanced summary { cursor: pointer; font: 600 .9375rem var(--display); }
details.advanced[open] summary { margin-bottom: .75rem; }
.sheet-dialog { border: 0; border-radius: var(--r-lg); padding: 1rem; width: min(480px, 96vw); background: var(--surface); color: var(--ink); border-top: 6px solid var(--crest-red); }
.sheet-dialog.wide { width: min(720px, 96vw); }
.sheet-dialog::backdrop { background: rgba(4, 20, 11, .7); }
.sheet-dialog input[type=search] { margin-bottom: .5rem; }
.pin-big { font: 700 2.5rem var(--display); letter-spacing: .3em; text-align: center; margin: .5rem 0 1rem; color: var(--ink); }

/* ---------- reports: term register ---------- */
.report-filters { grid-template-columns: 2fr 2fr 1fr; }
@media (max-width: 760px) { .report-filters { grid-template-columns: 1fr 1fr; } .report-filters label:first-child { grid-column: 1 / -1; } }
.report-source { margin: -.25rem 0 .75rem; }
.report-controls { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.chips select { width: auto; margin: 0; height: 40px; font-size: .875rem; }
.chipbtn { appearance: none; min-height: 40px; padding: .3rem .85rem; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font: 600 .875rem var(--display); cursor: pointer; }
.chipbtn.on { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-ink); }
.rlist { list-style: none; padding: 0; overflow: hidden; }
.rrow { display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
@media (min-width: 560px) { .rrow { padding: .7rem 1.25rem; } }
.rrow:last-child { border-bottom: 0; }
.rrow.below { box-shadow: inset 4px 0 var(--a); }
.rinfo { flex: 1; min-width: 0; }
.rinfo b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.rpct { text-align: right; flex-shrink: 0; min-width: 4.25rem; }
.rpct b { display: block; font: 700 1.125rem var(--display); font-variant-numeric: tabular-nums; }
.rrow.below .rpct b { color: var(--a); }
.rpct span { font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.strip { display: flex; gap: 3px; margin-top: .4rem; flex-wrap: nowrap; }
.strip .wk { display: flex; gap: 1px; }
.strip i, .legend i { display: inline-block; width: 6px; height: 12px; border-radius: 1.5px; background: var(--line); }
@media (min-width: 400px) { .strip i { width: 7px; } .strip { gap: 4px; } }
.strip i.P, .legend i.P { background: var(--p); }
.strip i.L, .legend i.L { background: var(--l); }
.strip i.A, .legend i.A { background: var(--a); }
.strip i.E, .legend i.E { background: var(--e); }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .8125rem; color: var(--muted); margin: -.25rem 0 1rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.sheet-wrap { padding: 0; overflow: auto; max-height: 75vh; }
.sheet-table { border-collapse: separate; border-spacing: 0; font-size: .8125rem; font-variant-numeric: tabular-nums; }
.sheet-table th, .sheet-table td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: .35rem .4rem; white-space: nowrap; background: var(--surface); }
.sheet-table thead th { position: sticky; top: 0; z-index: 2; background: var(--sunk); font: 600 .75rem var(--display); color: var(--ink-2); }
.sheet-table thead tr:nth-child(2) th { top: 29px; }
.sheet-table .sticky { position: sticky; z-index: 1; }
.sheet-table thead .sticky { z-index: 3; }
.sheet-table .n { left: 0; min-width: 2.25rem; text-align: center; }
.sheet-table .adm { left: 2.25rem; min-width: 8.5rem; }
.sheet-table .nm { left: 10.75rem; min-width: 12rem; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; box-shadow: 2px 0 0 var(--line-strong); }
.sheet-table .wkh, .sheet-table .end { border-right: 2px solid var(--line-strong); }
.sheet-table .sub { font-size: .6875rem; color: var(--muted); text-align: center; min-width: 1.6rem; }
.sheet-table td.c { text-align: center; font: 700 .75rem var(--display); min-width: 1.6rem; padding: .35rem .15rem; }
.sheet-table td.c.P { color: var(--p); } .sheet-table td.c.A { color: #fff; background: var(--a); }
.sheet-table td.c.L { color: var(--l); background: var(--l-soft); } .sheet-table td.c.E { color: var(--e); background: var(--e-soft); }
.sheet-table .num { text-align: right; min-width: 4rem; }
.sheet-table tr.below td.pct { color: var(--a); font-weight: 700; }
@media (max-width: 560px) { .sheet-table .adm { display: none; } .sheet-table .nm { left: 2.25rem; min-width: 9rem; } }
.signoff .so-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.signoff h2 { margin: 0; }
.so-status { font-size: .8125rem; font-weight: 600; padding: .2rem .65rem; border-radius: 99px; background: var(--sunk); color: var(--muted); }
.so-status.ok { background: var(--p-soft); color: var(--p); } .so-status.err { background: var(--a-soft); color: var(--a); } .so-status.wait { background: var(--l-soft); color: var(--l); }
.so-quote { background: var(--sunk); border-radius: var(--r-sm); padding: .5rem .75rem; }
.report-actions { margin-top: .5rem; }

/* ---------- manage ---------- */
.msec-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.mlist { list-style: none; margin: .5rem -1rem 0; padding: 0; border-top: 1px solid var(--line); }
@media (min-width: 560px) { .mlist { margin: .5rem -1.25rem 0; } }
.mlist > li { border-bottom: 1px solid var(--line); }
.mlist > li:last-child { border-bottom: 0; }
.mrow { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: .75rem; text-align: left; padding: .75rem 1rem; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; min-height: 56px; }
@media (min-width: 560px) { .mrow { padding: .75rem 1.25rem; } }
.mrow:hover { background: var(--sunk); }
.mrow b, .mlist li > span > b, .req b { font-weight: 600; }
.mrow small, .mlist small { display: block; color: var(--muted); font-size: .8125rem; }
.mlist .req, .mlist.students li, .mlist.staff li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .75rem; padding: .7rem 1rem; }
@media (min-width: 560px) { .mlist .req, .mlist.students li, .mlist.staff li { padding: .7rem 1.25rem; } }
.mlist .req > div:first-child { flex: 1 1 260px; min-width: 0; }
.req-actions, .st-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.st-actions select { width: auto; margin: 0; height: 40px; font-size: .875rem; }
.mlist .gone b { text-decoration: line-through; color: var(--muted); }
.mlist.staff li > span:first-child { flex: 1 1 220px; }
.roles { display: flex; gap: .3rem; flex-wrap: wrap; }
.rolechip { display: inline-flex; align-items: center; gap: .3rem; margin: 0; font-size: .8125rem; font-weight: 600; padding: .25rem .6rem; border: 1px solid var(--line-strong); border-radius: 99px; cursor: pointer; min-height: 36px; }
.rolechip input { width: auto; height: auto; margin: 0; }
.rolechip:has(input:checked) { background: var(--p-soft); border-color: var(--p); color: var(--p); }
.mdone { margin-top: .75rem; }
.mdone summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: .9375rem; }
ol.steps { margin: .75rem 0; padding-left: 1.25rem; }
ol.steps li { margin: .35rem 0; line-height: 1.45; }
#m-move label.btn { display: inline-flex; margin-top: .25rem; }
.weeks { list-style: none; padding: 0; margin: .5rem 0 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: .35rem; }
.weeks li { white-space: nowrap; }
.weeks li { background: var(--sunk); border-radius: var(--r-sm); padding: .35rem .6rem; font-size: .875rem; }
.weeks b { font-family: var(--display); font-weight: 600; margin-right: .25rem; }
.termform { margin-top: .75rem; }
.breaks { display: flex; flex-wrap: wrap; gap: .4rem; }
.breaks input { width: auto; flex: 0 1 11rem; }
.preview { margin-top: .75rem; }
.preview .table-wrap { margin: .5rem 0 .75rem; border: 1px solid var(--line); border-radius: var(--r-sm); }
.import { margin: .75rem 0 0; background: var(--paper); }
.import-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .5rem; overflow-wrap: anywhere; }
fieldset.streams, fieldset.missing { border: 1px solid var(--line); border-radius: var(--r-sm); padding: .5rem .75rem; margin: 0 0 .75rem; display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
fieldset legend { font-size: .8125rem; font-weight: 600; color: var(--ink-2); padding: 0 .25rem; }
fieldset label.check { margin: 0; min-height: 36px; font-size: .9375rem; }
fieldset .more { flex-basis: 100%; }
fieldset .more summary { cursor: pointer; color: var(--link); font-size: .875rem; font-weight: 600; padding: .25rem 0; }
fieldset .more[open] { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
fieldset .more[open] summary { flex-basis: 100%; }
.missing label.check { flex-basis: 100%; }
.diff { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .5rem .75rem; margin-bottom: .75rem; }
.diff p { margin: .2rem 0; }
.d-add b { color: var(--p); }
.overview-table tr { cursor: pointer; }
.overview-table tr.behind td { background: color-mix(in srgb, var(--l-soft) 60%, var(--surface)); }
.overview-table tr:hover td { background: var(--sunk); }
.msec .table-wrap { border: 1px solid var(--line); border-radius: var(--r-sm); margin-top: .5rem; }

/* ---------- printed term register (Print or save PDF) ---------- */
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body.print-register .print-area { display: block !important; padding: 0 !important; }
  .reg-print { font: 8.5pt "Times New Roman", serif; color: #000; }
  .rp-head { display: flex; gap: 6mm; align-items: flex-start; }
  .rp-head img { width: 26mm; height: auto; }
  .rp-title { flex: 1; }
  .rp-title h1 { font: bold 13pt "Times New Roman", serif; text-align: center; margin: 0 0 2mm; }
  .rp-title h2 { font: bold 10pt "Times New Roman", serif; margin: 2mm 0 0; padding-left: 30mm; }
  .rp-title p { font: bold italic 9pt "Times New Roman", serif; margin: 1mm 0 2mm; padding-left: 30mm; }
  .rp-fields { width: 100%; border-collapse: collapse; }
  .rp-fields th { text-align: left; font-weight: bold; width: 28mm; padding: 1mm 0; }
  .rp-fields td { border-bottom: .3mm solid #000; padding: 1mm 2mm; }
  .rp-grid, .rp-comments { width: 100%; border-collapse: collapse; margin-top: 2mm; }
  .rp-grid th, .rp-grid td, .rp-comments th, .rp-comments td { border: .2mm solid #000; padding: .8mm 1mm; text-align: center; }
  .rp-grid td.l { text-align: left; white-space: nowrap; }
  .rp-grid .c { width: 3.6mm; padding: .8mm 0; }
  .rp-grid .e { border-right-width: .5mm; }
  .rp-grid thead { display: table-header-group; }
  .rp-grid tr { break-inside: avoid; }
  .rp-comments th { width: 40mm; text-align: left; height: 10mm; }
  .rp-comments td { text-align: left; }
}

.roster-empty { display: flex; flex-direction: column; align-items: center; gap: .5rem; text-align: center; padding: 1.5rem 1rem; }
.roster-empty span { max-width: 34em; }

/* Class list preview: which stream each student goes to */
.placement { margin-top: .75rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.pl-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: .35rem; }
.pl-head .btn { margin-left: auto; }
.placement .plSearch { margin: .35rem 0 .5rem; }
.pl-list { list-style: none; margin: 0; padding: 0; max-height: 26rem; overflow: auto; border: 1px solid var(--line); border-radius: 10px; counter-reset: pl; }
.pl-list li { display: flex; align-items: center; gap: .5rem; padding: .4rem .6rem; border-bottom: 1px solid var(--line); counter-increment: pl; }
.pl-list li:last-child { border-bottom: 0; }
.pl-list li::before { content: counter(pl); color: var(--muted); font-size: .75rem; min-width: 1.6rem; text-align: right; }
.pl-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pl-who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-who small { color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: none; }
.seg button { border: 0; background: transparent; padding: .35rem .65rem; min-width: 2.2rem; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-ink); }
.pill.extra { background: var(--l-soft); color: var(--l); }

/* ---------- student app: evidence (POE) ---------- */
.view-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; margin-bottom: 1rem; background: var(--sunk); border-radius: var(--r-lg); }
.view-tabs button { appearance: none; border: 0; border-radius: 9px; padding: .65rem .5rem; background: none; color: var(--ink-2); font: 600 .9375rem var(--display); cursor: pointer; }
.view-tabs button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
body.student .view-checkin, body.student .view-poe, body.student .view-subs { display: none; }
body.student:not([data-view]) .view-checkin, body.student[data-view="checkin"] .view-checkin,
body.student[data-view="poe"] .view-poe, body.student[data-view="subs"] .view-subs { display: block; }
.field-label { font-weight: 600; margin: .75rem 0 .4rem; }
.item-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.kchip-btn { appearance: none; padding: .45rem .85rem; border: 1px solid var(--line-strong); border-radius: 99px; background: var(--surface); color: var(--ink-2); font: 600 .9rem var(--text); cursor: pointer; min-height: 40px; }
.kchip-btn.on { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-ink); }
.kchip-btn.approved:not(.on) { border-color: var(--p); color: var(--p); }
.kchip-btn.returned:not(.on) { border-color: var(--a); color: var(--a); }
.poe-doc { border: 1px solid var(--line); border-radius: var(--r-lg); padding: .75rem; margin-bottom: .75rem; background: var(--paper); }
.poe-doc-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .5rem; }
.poe-pages { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: .5rem; }
.poe-pages li { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.poe-pages img { display: block; width: 100%; aspect-ratio: 210 / 297; object-fit: cover; background: var(--sunk); }
.poe-pages img.f-document { filter: grayscale(1) contrast(1.6) brightness(1.08); }
.poe-pages img.f-grey { filter: grayscale(1); }
.poe-pages li > span:not(.pg-tools) { position: absolute; top: 4px; left: 4px; background: rgba(0, 0, 0, .65); color: #fff; font-size: .75rem; font-weight: 700; border-radius: 99px; padding: 0 .4rem; }
.pg-tools { display: flex; border-top: 1px solid var(--line); }
.pg-tools button { flex: 1; appearance: none; border: 0; background: none; color: var(--ink-2); padding: .3rem 0; font: 600 .875rem var(--text); cursor: pointer; min-height: 32px; }
.pg-tools button:disabled { opacity: .3; }
.pg-tools button[data-del] { color: var(--a); }
.seg.filt { margin-bottom: .5rem; }
.seg.filt button { width: auto; height: 36px; padding: 0 .75rem; font: 600 .875rem var(--text); color: var(--ink-2); }
.seg.filt button[aria-pressed="true"] { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-ink); }
.poe-doc .row-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
#poeSave { margin-top: .25rem; }
.poe-list li { align-items: flex-start; }
/* "Notify me about my evidence" under the Save button in the student app */
.notify-row { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.notify-row p { margin: .25rem 0 0 1.75rem; }
.poe-acts { display: flex; flex-direction: column; align-items: flex-end; gap: .1rem; flex-shrink: 0; }
.poe-acts .linkish { padding: .2rem 0; font-size: .875rem; }
#poeListCard { padding-bottom: 0; overflow: hidden; }
.crop-dialog { border: 0; border-radius: var(--r-lg); padding: .75rem; background: var(--surface); color: var(--ink); width: min(560px, 96vw); max-height: 96vh; }
.crop-dialog::backdrop { background: rgba(4, 20, 11, .85); }
.crop-stage { position: relative; display: flex; justify-content: center; touch-action: none; user-select: none; }
.crop-stage canvas { display: block; max-width: 100%; border-radius: 6px; }
#cropHandles { position: absolute; pointer-events: none; }
.crop-stage .handle { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 3px solid #4fcd84; background: rgba(79, 205, 132, .25); pointer-events: auto; touch-action: none; cursor: grab; }
.crop-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .75rem; flex-wrap: wrap; }
.crop-actions .primary { flex: 1 1 auto; }

/* ---------- POE tab (trainers, HOD, MIS Officer) ---------- */
.poe-head .row-actions { margin: .25rem 0 .75rem; }
.poe-chips { margin: .5rem 0 .75rem; }
.chipbtn .n { display: inline-block; min-width: 1.4em; padding: 0 .35em; margin-left: .2rem; border-radius: 99px; background: var(--sunk); color: var(--ink); font-size: .75rem; }
.chipbtn.on .n { background: color-mix(in srgb, var(--btn-ink) 22%, transparent); color: inherit; }
.poe-filters { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.poe-filters select, .poe-filters input { margin: 0; }
.poe-filters input { grid-column: 1 / -1; }
@media (min-width: 640px) { .poe-filters { grid-template-columns: 1fr 1.4fr 1.2fr; } .poe-filters input { grid-column: auto; } }
.poe-receive { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.poe-group { padding-bottom: 0; overflow: hidden; }
.poe-group .msec-head h2 { font-size: 1.0625rem; }
.poe-row { display: flex; align-items: center; gap: .25rem; padding-left: 1rem; }
.poe-pick { width: 22px; height: 22px; flex-shrink: 0; margin: 0 .25rem 0 0; }
.poe-open { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "who pill" "what pill"; align-items: center; gap: .1rem .75rem;
  appearance: none; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; padding: .65rem 1rem .65rem 0; cursor: pointer; }
.poe-open:hover .poe-who b { text-decoration: underline; }
.poe-who { grid-area: who; min-width: 0; display: flex; flex-wrap: wrap; gap: 0 .5rem; align-items: baseline; }
.poe-who b { font-weight: 600; }
.poe-what { grid-area: what; display: flex; gap: .5rem; align-items: center; }
.poe-open .pill { grid-area: pill; }
.item-tag { display: inline-block; font: 700 .75rem/1.5 var(--display); padding: 0 .45rem; border-radius: 5px; background: var(--e-soft); color: var(--e); vertical-align: middle; }
.poe-dialog { padding: 1rem; max-height: 96vh; }
.poe-view-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.poe-view-head h2 { margin: 0; font-size: 1.1875rem; }
.poe-view-head p { margin: .2rem 0 0; }
.poe-decided { margin: .5rem 0 0; padding: .45rem .7rem; border-radius: var(--r-sm); font-size: .9rem; background: var(--sunk); }
.poe-decided.approved { background: var(--p-soft); color: var(--p); }
.poe-decided.returned { background: var(--a-soft); color: var(--a); }
.poe-pages-view { margin: .75rem -1rem; padding: .5rem; max-height: max(240px, calc(100vh - 380px)); overflow-y: auto; background: var(--sunk); display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.poe-pages-view .poe-page, .poe-img { max-width: 100%; height: auto; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.poe-view-actions { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.poe-nav { display: flex; gap: .5rem; }
.poe-decide { margin-top: .75rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.poe-decide textarea { width: 100%; }
.poe-decide .row-actions { justify-content: flex-end; }
.drive-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem 1rem; }
.drive-list select { width: auto; max-width: 100%; margin: 0; }
/* POE by student */
.poe-mode { margin: .25rem 0 .75rem; }
.poe-sum { margin: 0 .25rem .5rem; }
.poe-stu { padding: 0; overflow: hidden; margin-bottom: .5rem; }
.poe-stu > summary { display: flex; align-items: center; justify-content: space-between; gap: .5rem .75rem; flex-wrap: wrap; padding: .7rem 1rem; cursor: pointer; list-style: none; }
.poe-stu > summary::-webkit-details-marker { display: none; }
.poe-stu > summary::after { content: '▾'; color: var(--muted); margin-left: auto; transition: transform .15s; }
.poe-stu[open] > summary::after { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .poe-stu > summary::after { transition: none; } }
.poe-tally { display: flex; gap: .3rem; flex-wrap: wrap; }
.poe-stu .table-wrap { border-top: 1px solid var(--line); overflow-x: auto; }
.poe-matrix { border-collapse: collapse; width: 100%; font-size: .875rem; }
.poe-matrix th, .poe-matrix td { padding: .35rem .4rem; border-bottom: 1px solid var(--line); text-align: center; }
.poe-matrix thead th { font: 600 .75rem var(--display); color: var(--muted); background: var(--sunk); }
.poe-matrix tbody th { text-align: left; font-weight: 600; min-width: 9rem; padding-left: 1rem; }
.poe-matrix tr:last-child > * { border-bottom: 0; }
.pm.none { color: var(--line-strong); }
.pm-btn { appearance: none; min-width: 36px; min-height: 32px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); font: 700 .9375rem var(--display); cursor: pointer; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.pm-btn small { font: 600 .625rem var(--text); opacity: .8; }
.pm-btn.approved { background: var(--p-soft); border-color: var(--p); color: var(--p); }
.pm-btn.approved.received { background: var(--p); color: #fff; }
@media (prefers-color-scheme: dark) { .pm-btn.approved.received { color: #08110c; } }
.pm-btn.submitted { background: var(--l-soft); border-color: var(--l); color: var(--l); }
.pm-btn.returned { background: var(--a-soft); border-color: var(--a); color: var(--a); }
.poe-why { color: var(--muted); max-width: 22ch; text-align: right; line-height: 1.3; }
.drive-pick { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
.drive-pick input[type=text] { width: 16rem; max-width: 100%; margin: 0; }
.ok-text { color: var(--p); }

/* ---------- Reports → Marks ---------- */
.report-mode { max-width: 360px; }
#marksCard { display: none; }
#tab-reports.marks-mode #marksCard { display: block; }
#tab-reports.marks-mode > :not(#reportMode):not(.report-filters):not(#marksCard) { display: none !important; }
#tab-reports.marks-mode .report-filters label:last-child { display: none; }
.marks-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.marks-head h2 { margin: 0; }
.marks-head p { margin: .2rem 0 0; }
.save-state.ok { background: var(--p-soft); color: var(--p); }
.save-state.pending { background: var(--l-soft); color: var(--l); }
.marks-wrap { overflow-x: auto; margin: .75rem -1rem 0; border-top: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
.marks-table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 640px; font-variant-numeric: tabular-nums; }
.marks-table th, .marks-table td { border-bottom: 1px solid var(--line); padding: 0; text-align: center; }
.marks-table thead th { font: 600 .75rem var(--display); color: var(--muted); background: var(--sunk); padding: .35rem .25rem; }
.marks-table thead th.prac { background: color-mix(in srgb, var(--l-soft) 70%, var(--sunk)); }
.marks-table .mt-name { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; min-width: 9.5rem; max-width: 13rem; border-right: 1px solid var(--line); }
.marks-table thead .mt-name { background: var(--sunk); padding-left: 1rem; z-index: 2; }
.marks-table tbody .mt-name { padding: .4rem .5rem .4rem .25rem; }
.marks-table .mt-in { min-width: 0; }
.marks-table .mt-sn { position: sticky; left: 0; z-index: 1; background: var(--surface); width: 2.75rem; min-width: 2.75rem; color: var(--muted); font-size: .8125rem; }
.marks-table thead .mt-sn { background: var(--sunk); z-index: 2; padding-left: .5rem; }
.marks-table .mt-name { left: 2.75rem; }
.marks-search { margin: .5rem 0 0; }
.marks-table .mt-name b { display: block; font-weight: 600; font-size: .9rem; line-height: 1.2; }
.marks-table .mt-name small { display: block; color: var(--muted); font-size: .75rem; }
.mt-n { color: var(--muted); font-size: .75rem; min-width: 1.4em; text-align: right; }
.marks-table input.mk { display: block; width: 3.6rem; height: 40px; margin: 3px auto; padding: 0 .25rem; text-align: center; font: 600 1rem var(--text); border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); }
.marks-table input.mk:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.marks-table input.mk[readonly] { border-color: transparent; background: none; }
.marks-table input.mk.bad { border-color: var(--a); background: var(--a-soft); }
.marks-table td.avg { font: 700 .95rem var(--display); color: var(--ink-2); min-width: 3rem; }
.marks-table tr.dirty .mt-name { box-shadow: inset 3px 0 0 var(--l); }
.marks-table tr.gone .mt-name b { color: var(--muted); }
.marks-actions { margin-top: .75rem; }
.regcodes { margin: .75rem 0; padding: .75rem; border: 1px dashed var(--line-strong); border-radius: var(--r-sm); } .regcodes p { margin: 0 0 .5rem; }

/* ---------- tables: folding, paging, export ---------- */
.fold { margin-top: .5rem; }
.fold > summary { cursor: pointer; font-weight: 600; font-size: .9375rem; color: var(--ink-2); padding: .55rem .75rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--sunk); list-style: none; display: flex; align-items: center; gap: .5rem; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: "›"; display: inline-block; transition: transform .15s; font-size: 1.1rem; line-height: 1; }
.fold[open] > summary::before { transform: rotate(90deg); }
.fold[open] > summary { margin-bottom: .5rem; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .75rem; padding: .6rem .25rem 0; font-size: .875rem; color: var(--muted); }
.pager .pg-ctl { display: inline-flex; align-items: center; gap: .5rem; }
.pager .pg-now { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; }
.pager select { width: auto; height: 36px; margin: 0; font-size: .875rem; }
.table-card { padding: 0; overflow: hidden; }
.table-card .pager { padding: .6rem 1rem; border-top: 1px solid var(--line); }
.table-actions { padding: .75rem 1rem; border-top: 1px solid var(--line); }
.poe-table td.num, .poe-table th.num { text-align: center; }
.poe-table tr.stu-row { cursor: pointer; }
.poe-table tr.stu-row:hover td { background: var(--sunk); }
.poe-table tr.stu-row td:first-child::before { content: "›"; display: inline-block; width: 1rem; color: var(--muted); transition: transform .15s; }
.poe-table tr.stu-row.open td:first-child::before { transform: rotate(90deg); }
.poe-table tr.stu-row.open td { background: var(--sunk); }
.poe-table tr.stu-detail > td { padding: .5rem .75rem 1rem; white-space: normal; background: var(--surface); }
.poe-table tr.stu-detail .table-wrap { border: 1px solid var(--line); border-radius: var(--r-sm); }
.poe-table td .pill { padding: .05rem .5rem; }
.term-now { font-size: 1.0625rem; margin: .25rem 0 .75rem; }
.class-table tr[data-group] { cursor: pointer; }
.class-table tr[data-group]:hover td { background: var(--sunk); }

/* smaller choices: the evidence filters, and the CAT weeks */
.poe-chips { gap: .3rem; }
.poe-chips .chipbtn { min-height: 30px; padding: .1rem .6rem; font-size: .8125rem; }
.poe-chips .chipbtn .n { min-width: 1.2em; font-size: .6875rem; }
.catweeks { gap: .3rem; }
.catweeks .kchip span { padding: .15rem .55rem; font-size: .8125rem; }

/* profile */
.role-line { margin: .1rem 0 0; }
.backup-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
.backup-actions .btn { width: 100%; min-height: 46px; justify-content: center; text-align: center; margin: 0; }

/* a printed or saved-as-PDF table */
@media print {
  body.print-table .print-area { display: block !important; padding: 0 !important; }
  .tbl-print { font: 10pt Arial, sans-serif; color: #000; }
  .tbl-print h1 { font: bold 14pt Arial, sans-serif; margin: 0 0 1mm; }
  .tbl-print p { margin: 0 0 4mm; }
  .tbl-print table { width: 100%; border-collapse: collapse; }
  .tbl-print th, .tbl-print td { border: 1px solid #999; padding: 1.5mm 2mm; text-align: left; vertical-align: top; }
  .tbl-print th { background: #eee; }
}

/* ---------- wide screens: the tabs become a side bar ---------- */
@media (min-width: 900px) {
  body:not(.student) .tabs {
    position: fixed; left: 0; bottom: 0; top: var(--top-h, 66px); width: var(--side-w); z-index: 15;
    flex-direction: column; gap: 2px; padding: .75rem .6rem; overflow-y: auto;
    border-bottom: 0; border-right: 1px solid var(--line);
  }
  body:not(.student) .tabs button {
    width: 100%; justify-content: flex-start; min-height: 44px; padding: 0 .9rem; margin: 0;
    border-bottom: 0; border-left: 3px solid transparent; border-radius: var(--r-sm);
  }
  body:not(.student) .tabs button:hover { background: var(--sunk); }
  body:not(.student) .tabs button.active { background: var(--sunk); border-left-color: var(--crest-green); }
  body:not(.student) .tabs .dot { margin-left: auto; }
  body:not(.student) main { margin: 0 0 0 var(--side-w); max-width: 1000px; }
  body.dn-on:not(.student) .tabs { top: calc(var(--top-h, 66px) + var(--dn-h, 46px)); }
}
:root { --side-w: 220px; }

/* ---------- student app ---------- */
.subs-empty { display: none; padding: 2rem 1rem; }
.view-subs:not(:has(.card:not([hidden]))) .subs-empty { display: block; }
.setup-intro { align-items: flex-end; }
.setup-intro img { width: 96px; height: 96px; margin-bottom: .25rem; }
.item-chips { gap: .3rem; margin-bottom: .5rem; }
.item-chips .kchip-btn { min-height: 32px; padding: .2rem .65rem; font-size: .8125rem; }
.result { padding: 1rem .875rem; }
.result-icon { width: 52px; height: 52px; margin-bottom: .5rem; }
.result-icon svg { width: 30px; height: 30px; }
.result h2 { font-size: 1.25rem; }
.result p { font-size: .9375rem; }

/* register rows: serial number, and the padding of the timetable's times */
.sn { flex: 0 0 auto; width: 2rem; color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.trow .tinfo { flex: 1 1 auto; }
td.tadm { display: table-cell; }

.tt-time b { font-size: .7rem; font-weight: 600; line-height: 1.2; }
.repeat-row { display: flex; align-items: center; gap: .5rem; margin: 0; font-weight: 600; }
.repeat-row input { width: 20px; height: 20px; margin: 0; }
.tiny { font-size: .75rem; }
.poe-what .item-tag { font-size: .7rem; padding: .05rem .4rem; }
.so-search { margin: .25rem 0 .5rem; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--ink); }
.sort-ind { font-size: .7rem; }

/* sortable headings, locked marks, archived classes, the end-of-term notice */
th[data-tsort] { cursor: pointer; user-select: none; }
th[data-tsort]:hover { color: var(--ink); }
.marks-table input.mk.locked { background: var(--sunk); color: var(--muted); border-style: dashed; }
.report-lock { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; justify-content: space-between; padding: .6rem .85rem; margin: .5rem 0; border-radius: var(--r-sm); background: var(--l-soft); color: var(--ink); font-size: .9rem; }
.archive-row { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.ov-term { display: flex; align-items: center; gap: .5rem; margin: 0 0 .5rem; font-weight: 600; }
.ov-term select { width: auto; margin: 0; height: 38px; }
.archived-list li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .6rem 1rem; border-bottom: 1px solid var(--line); }
.archived-list li small { display: block; color: var(--muted); }
.list-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .25rem 0 .5rem; }
.list-tools input[type=search] { flex: 1 1 14rem; margin: 0; }
.list-tools select, #regSort { width: auto; flex: 0 0 auto; margin: 0; height: 40px; font-size: .875rem; }

/* ---------- 4.11: lunch slot, roster line, first-time PIN, absences, POE preview ---------- */
#rosterInfo { white-space: pre-line; }
.list-tools input[type=search] { height: 40px; }
.tt-lunch-cell { border-left: 1px dashed var(--line); border-right: 1px dashed var(--line); min-height: 46px; }
.timetable.lunch-open { grid-template-columns: 3.1rem repeat(3, minmax(0, 1fr)) minmax(2.4rem, .75fr) repeat(3, minmax(0, 1fr)); }
.tt-cell.lunch:not(.have):not(.picked) { background: color-mix(in srgb, var(--l-soft) 55%, var(--surface)); }
.item-tag.small-tag { font-size: .65rem; padding: 0 .35rem; line-height: 1.4; vertical-align: .15em; }
.default-pin { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; justify-content: space-between; padding: .75rem; margin: 0 0 .75rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--sunk); }
.default-pin p { margin: .15rem 0 0; }
.default-pin .dp-row { display: flex; gap: .4rem; align-items: center; }
.default-pin input { width: 9rem; height: 38px; margin: 0; }
.mlist.staff li .sn { flex: 0 0 auto; width: 1.75rem; color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.alert-limit { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.alert-limit label { margin: 0; flex: 1 1 18rem; }
.alert-limit .input-suffix input { width: 5rem; }
.alerts-head .poe-filters { margin-top: .75rem; }
.alerts-table td.who { font-weight: 600; }

/* ---------- student app 4.11 ---------- */
body.student .status { gap: .35rem; }
body.student .status .badge, body.student .status .btn { height: 30px; min-height: 30px; padding: 0 .55rem; font-size: .75rem; display: inline-flex; align-items: center; }
body.student .status .btn svg.i { width: 15px; height: 15px; }
.tiny-pill { font-size: .6875rem; padding: .05rem .45rem; }
.my-qr { display: flex; flex-direction: column; align-items: center; gap: .35rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.my-qr #pQr { width: min(70vw, 240px); background: #fff; padding: 8px; border-radius: 10px; }
.my-qr #pQr svg { display: block; width: 100%; height: auto; }
.fold-card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5rem; }
.fold-card > summary::-webkit-details-marker { display: none; }
.fold-card > summary h2 { margin: 0; flex: 1; }
.fold-card > summary::after { content: "›"; font-size: 1.3rem; color: var(--muted); transition: transform .15s; }
.fold-card[open] > summary::after { transform: rotate(90deg); }
.fold-card[open] > summary { margin-bottom: .5rem; }
.count-pill:not(:empty) { font-size: .75rem; font-weight: 700; padding: .05rem .5rem; border-radius: 99px; background: var(--sunk); color: var(--ink-2); }
#poeItems .kchip-btn, .item-chips .kchip-btn { min-height: 28px; padding: .1rem .55rem; font-size: .75rem; }
.poe-doc .row-actions .btn { min-height: 34px; font-size: .8125rem; padding: .25rem .7rem; }
.crop-actions { flex-wrap: wrap; }

/* ---------- 4.12: staff code column, lunch, the college logo in the student profile ---------- */
.mlist.staff li .st-code { width: 4.5rem; font-weight: 600; color: var(--ink-2); }
.tt-cell.lunch.off { cursor: default; opacity: .75; }
.tt-cell.lunch.off:hover { border-style: dashed; border-color: var(--line-strong); }
.profile { flex-direction: row; align-items: center; justify-content: space-between; gap: .75rem; }
.profile-who { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; min-width: 0; }
.profile .inst { display: flex; flex-direction: column; align-items: center; gap: .2rem; flex-shrink: 0; text-align: center; }
.profile .inst img { width: 52px; height: 52px; display: block; }
.profile .inst span { font-size: .75rem; font-weight: 600; color: var(--ink-2); }

/* ---------- the camera for evidence pages, inside the app ---------- */
.doc-cam { width: min(560px, 96vw); }
.doc-video { aspect-ratio: 3 / 4; max-height: 68vh; margin: 0 auto; }
.doc-video .page-frame { position: absolute; inset: 6% 8%; border: 2px dashed rgba(255, 255, 255, .85); border-radius: 6px; pointer-events: none; }
.cam-actions { display: flex; justify-content: center; padding: .5rem 0 .25rem; }
.shutter { width: 68px; height: 68px; border-radius: 50%; border: 4px solid var(--surface); background: var(--p); box-shadow: 0 0 0 3px var(--p); cursor: pointer; }
.shutter:active { transform: scale(.94); }
.shutter:disabled { opacity: .5; }

/* ---------- 4.13.2: smaller text on phones, in both apps ----------
 * Sizes are in rem, so a 13 px base (instead of 16 px) makes all text and spacing about 19% smaller.
 * Typing boxes stay at 16 px: an iPhone zooms the page when you tap into smaller text. */
@media (max-width: 600px) {
  html { font-size: 13px; }
  body { font-size: 13px; }
  input, select, textarea { font-size: 16px; }
}

/* ---------- Google Drive (students' own Drive) ---------- */
.google-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; justify-content: space-between; padding: .6rem .75rem; margin: .5rem 0 .75rem; border: 1px solid var(--line); border-radius: var(--r, 10px); background: var(--surface); }
.poe-changed { margin: .5rem 0; padding: .5rem .75rem; border-radius: 8px; background: #fef3c7; color: #78350f; font-weight: 600; }

/* ---------- backup ---------- */
.backup-alert { margin: 0 0 .75rem; padding: .65rem .8rem; border-radius: 8px; background: #fef3c7; color: #78350f; border-left: 5px solid #d97706; }
.backup-alert.full { background: #fee2e2; color: #7f1d1d; border-left-color: var(--crest-red, #b91c1c); }
.gauge { height: 12px; border-radius: 999px; background: var(--line); overflow: hidden; margin: .5rem 0 .25rem; }
.gauge span { display: block; height: 100%; background: var(--p); }
.gauge.warn span { background: #d97706; }
.gauge.full span { background: var(--crest-red, #b91c1c); }

/* A short form on one row: fields and the button the same height, the button lined up with the boxes. */
.inline-form { display: flex; align-items: flex-end; gap: .5rem; margin: .75rem 0 .5rem; }
.inline-form label { margin: 0; min-width: 0; }
.inline-form label.grow { flex: 1 1 0; }
.inline-form label.narrow { flex: 0 0 6.5rem; }
.inline-form input, .inline-form select { width: 100%; height: 44px; min-height: 44px; margin: 0; box-sizing: border-box; }
.inline-form .btn { flex: 0 0 auto; height: 44px; min-height: 44px; margin: 0; padding-block: 0; box-sizing: border-box; }

/* Student tables (My POE submissions, My attendance) */
.stu-table td { white-space: normal; vertical-align: top; }
.stu-table .acts { display: flex; flex-wrap: wrap; gap: .1rem .75rem; margin-top: .2rem; }
.stu-table .sub { display: block; font-size: .85em; color: var(--muted, #667); }
.poe-doc-head { gap: .5rem; }
