/* Scorebook — quiet chrome, dense score grid, official print sheets. */
:root {
  --ink: #1E1B4B;
  --muted: #64648A;
  --paper: #EEF0FA;
  --panel: #FFFFFF;
  --line: #E4E4F2;
  --line-strong: #C9C8E0;
  --red: #6D28D9;
  --red-ink: #5B21B6;
  --red-wash: #EFE9FE;
  --input: #FFFFFF;
  --surface: #FFFFFF; --card: #FFFFFF; --soft: #F1F5F9;
  --head: #2E1065;
  --shadow: 0 1px 2px rgba(46, 16, 101, .06), 0 8px 24px -12px rgba(46, 16, 101, .18);
  --rail-bg: linear-gradient(180deg, #2E1A86 0%, #3B1C9E 45%, #4C1D95 100%);
  --hero-bg: linear-gradient(120deg, #8B5CF6 0%, #A855F7 45%, #D946EF 100%);
  --saffron: #D99A0B;
  --ok: #1F7A4D;
  --warn: #9A5B00;
  --warn-wash: #FFF5E0;

  --gA: #A86F00; --gA-bg: #FFF1CF;
  --gB: #1F7A4D; --gB-bg: #E3F4EA;
  --gC: #2357A6; --gC-bg: #E6EEFA;
  --gD: #4F5B6E; --gD-bg: #ECEFF3;
  --gE: #A4500C; --gE-bg: #FCEBDD;
  --gF: #B42318; --gF-bg: #FDE7E5;

  --font: 'Kantumruy Pro', 'Noto Sans Khmer', 'Khmer OS Siemreap', system-ui, sans-serif;
  --moul: 'Moul', 'Khmer OS Muol Light', serif;
  --radius: 16px;
  --radius-sm: 10px;
  --rail: 268px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.35; margin: 0; font-weight: 600; }
h1 { font-size: 1.25rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.98rem; }
p { margin: 0 0 0.5rem; }
a { color: var(--red); }
code { background: var(--paper); padding: 0 4px; border-radius: 4px; font-size: 0.9em; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0.5rem 0; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Buttons & fields ---------- */
.btn {
  font: inherit; font-weight: 500; font-size: 0.92rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-ink); }
.btn-ghost { background: var(--panel); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-danger { background: var(--gF); color: #fff; }
.btn-sm { padding: 3px 10px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.link-btn { font: inherit; background: none; border: 0; padding: 0; color: var(--red); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.icon-btn { background: none; border: 0; padding: 6px; border-radius: var(--radius-sm); color: var(--muted); cursor: pointer; display: inline-flex; }
.icon-btn:hover { color: var(--ink); background: var(--paper); }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; color: var(--muted); }
.field > span, .field-label { font-size: 0.88rem; color: var(--muted); }
.field-label { margin: 0.75rem 0 0.25rem; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
input, select, textarea {
  font: inherit; font-size: 0.95rem; color: var(--ink);
  padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--input); min-width: 0;
}
textarea { width: 100%; font-size: 0.9rem; }
input:disabled { background: var(--paper); color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.checks { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px 10px; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.checks legend { padding: 0 4px; font-weight: 600; font-size: 0.88rem; }
.checks label, .check-line { display: inline-flex; align-items: center; gap: 6px; font-size: 0.92rem; color: var(--ink); }
.form-error { color: var(--gF); font-size: 0.9rem; margin: 0; }
.notice { background: var(--paper); border-left: 3px solid var(--line-strong); padding: 10px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.notice-warn { background: var(--warn-wash); border-left-color: var(--saffron); color: #5a3b00; }
.notice-lock { background: var(--red-wash); border-left-color: var(--red); color: var(--red-ink); }
.pill { white-space: nowrap; font-size: 0.78rem; padding: 2px 10px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); color: var(--muted); }
.pill-demo { background: var(--warn-wash); border-color: #F1D69A; color: #6a4500; }

/* ---------- Shell ---------- */
.app-shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px 14px; border-bottom: 1px solid var(--line); }
.brand-mark { width: 38px; height: 38px; flex: none; border-radius: 9px; background: var(--red); color: #fff; display: grid; place-items: center; font-family: var(--moul); font-size: 1.05rem; padding-top: 3px; }
.brand-mark.big { width: 56px; height: 56px; font-size: 1.5rem; border-radius: 12px; }
.brand-logo { width: 40px; height: 40px; object-fit: contain; flex: none; }
.login-logo { width: 92px; height: 92px; object-fit: contain; flex: none; border-radius: 14px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 0.9rem; line-height: 1.35; }
.brand-text small { color: var(--muted); font-size: 0.78rem; }
.rail nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.rail ul { list-style: none; margin: 0; padding: 0; }
.rail a { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-size: 0.93rem; }
.rail a:hover { background: var(--paper); }
.rail a[aria-current] { background: var(--red-wash); color: var(--red-ink); font-weight: 600; }
.nav-group { margin: 14px 10px 4px; font-size: 0.8rem; color: var(--muted); }
.rail-foot { border-top: 1px solid var(--line); padding: 12px 12px 12px 16px; display: flex; align-items: center; gap: 8px; }
.who { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.who strong { font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: var(--muted); font-size: 0.78rem; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; background: rgba(245, 246, 248, 0.94); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--line); }
.topbar-tools { display: flex; align-items: center; gap: 12px; }
.year-pick { white-space: nowrap; display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); }
#view { padding: 22px 28px 48px; max-width: 1200px; width: 100%; outline: none; }
.bottombar { display: none; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 16px; }
.toolbar-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 12px; }
.panel-head p { margin: 0; }
.loading { padding: 40px; color: var(--muted); text-align: center; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.panel .table-scroll { border: 0; }
.list-table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.list-table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 0.85rem; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.list-table td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list-table tr:last-child td { border-bottom: 0; }
.list-table tr.is-off td { color: var(--muted); }
.row-actions { text-align: right; white-space: nowrap; }
.scale-table td { padding: 6px 14px; }

/* ---------- Score grid (the working surface) ---------- */
.sheet-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; margin-bottom: 6px; }
.sheet-head h2 { font-size: 1.15rem; }
.sheet-head p { margin: 0; }
.sheet-actions { display: flex; align-items: center; gap: 12px; }
.save-state { font-size: 0.85rem; padding-left: 16px; position: relative; color: var(--muted); }
.save-state::before { content: ''; position: absolute; left: 0; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--line-strong); }
.save-state.ok::before { background: var(--ok); }
.save-state.busy::before { background: var(--saffron); animation: pulse 1s infinite; }
.save-state.bad { color: var(--gF); }
.save-state.bad::before { background: var(--gF); }
@keyframes pulse { 50% { opacity: 0.3; } }

.grid-wrap { background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; max-width: 720px; }
.score-grid { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.score-grid th { background: var(--head); color: #fff; font-weight: 500; font-size: 0.85rem; padding: 8px 10px; text-align: left; }
.score-grid td { border-top: 1px solid var(--line); padding: 0 10px; height: 42px; }
.score-grid tbody tr:nth-child(5n) td { border-bottom: 1px solid var(--line-strong); }
.score-grid tbody tr:hover td, .score-grid tbody tr:focus-within td { background: #FBF7EC; }
.c-no { width: 52px; color: var(--muted); }
.c-name { white-space: nowrap; }
.c-g { width: 84px; color: var(--muted); white-space: nowrap; }
.c-score { width: 120px; }
.c-grade { width: 76px; }
.score-grid th.c-score, .score-grid th.c-grade { text-align: center; }
.cell {
  width: 100%; text-align: center; font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums;
  border: 1px solid transparent; background: transparent; border-radius: 4px; padding: 5px 6px;
}
.cell:hover { border-color: var(--line-strong); }
.cell:focus { outline: none; border-color: var(--red); background: #fff; box-shadow: 0 0 0 3px var(--red-wash); }
.cell.saving { color: var(--muted); }
.cell.bad, .cell.failed { border-color: var(--gF); background: var(--gF-bg); }
.c-grade { text-align: center; }

.grade-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-weight: 700; font-size: 0.85rem; }
.g-A { color: var(--gA); background: var(--gA-bg); box-shadow: inset 0 0 0 1.5px var(--saffron); }
.g-B { color: var(--gB); background: var(--gB-bg); }
.g-C { color: var(--gC); background: var(--gC-bg); }
.g-D { color: var(--gD); background: var(--gD-bg); }
.g-E { color: var(--gE); background: var(--gE-bg); }
.g-F { color: var(--gF); background: var(--gF-bg); }
.g-bg-A { background: var(--saffron); } .g-bg-B { background: var(--gB); } .g-bg-C { background: var(--gC); }
.g-bg-D { background: #8C96A8; } .g-bg-E { background: #D9864A; } .g-bg-F { background: var(--gF); }

/* ---------- Dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; display: flex; flex-direction: column; color: var(--muted); font-size: 0.88rem; }
.stat-n { font-size: 1.8rem; font-weight: 700; color: var(--ink); line-height: 1.3; }
.stat-n small { font-size: 1rem; color: var(--muted); font-weight: 500; }
.meter { display: block; height: 6px; background: var(--paper); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--ok); }
.tracker { border-collapse: collapse; width: 100%; }
.tracker > tbody > tr > th, .tracker > tr > th { text-align: left; font-weight: 600; padding: 10px 14px 10px 0; vertical-align: top; white-space: nowrap; width: 1%; }
.tracker th small { display: block; color: var(--muted); font-weight: 400; font-size: 0.8rem; }
.tracker .cells-td { padding: 6px 0; border-bottom: 1px solid var(--line); }
.tracker tr:last-child .cells-td { border-bottom: 0; }
.inner { border-collapse: separate; border-spacing: 6px 0; }
.cell-status { font: inherit; font-size: 0.85rem; border-radius: var(--radius-sm); padding: 5px 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; min-width: 104px; text-align: left; line-height: 1.4; }
.cell-status b { font-weight: 600; font-variant-numeric: tabular-nums; }
.cell-status:disabled { cursor: default; opacity: 0.75; }
.cell-status.s-done { border-color: #B9DFC8; background: var(--gB-bg); }
.cell-status.s-part { border-color: #F1D69A; background: var(--warn-wash); }
.cell-status.s-none { border-style: dashed; color: var(--muted); }
.legend { font-size: 0.82rem; color: var(--muted); display: flex; gap: 6px 12px; align-items: center; flex-wrap: wrap; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.dot.s-done { background: var(--gB-bg); border: 1px solid #B9DFC8; }
.dot.s-part { background: var(--warn-wash); border: 1px solid #F1D69A; }
.dot.s-none { border: 1px dashed var(--line-strong); }
.dist-bar { display: flex; height: 18px; border-radius: 4px; overflow: hidden; background: var(--paper); }
.dist-bar .seg { display: block; height: 100%; }
.dist-legend { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.88rem; }
.welcome { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 28px; max-width: 640px; }
.setup-steps { padding-left: 1.4rem; margin: 12px 0 0; }
.setup-steps li { padding: 4px 0; }
.setup-steps li.done a { color: var(--muted); text-decoration: line-through; }
.year-list { list-style: none; padding: 0; margin: 0 0 8px; }
.year-list li { display: flex; gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }

/* ---------- Login ---------- */
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: 100%; max-width: 420px; }
.login-head { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.login-head h1 { font-family: var(--moul); font-weight: 400; font-size: 1.3rem; }
.login-head p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.demo-hint { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 0.85rem; color: var(--muted); }
.demo-hint p { margin-bottom: 6px; }
.demo-hint .link-btn { margin-right: 14px; }

/* ---------- Dialog & toast ---------- */
.dialog { border: 0; border-radius: 14px; padding: 0; width: min(520px, 94vw); color: var(--ink); }
.dialog-wide { width: min(760px, 96vw); }
.dialog::backdrop { background: rgba(29, 36, 51, 0.45); }
.dialog-form { display: flex; flex-direction: column; max-height: 88vh; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 10px; }
.dialog-body { padding: 4px 20px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.dialog .form-error { padding: 0 20px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 0.9rem; max-width: 92vw; transition: opacity 0.25s; }
.toast-success { background: #174F35; }
.toast-error { background: var(--gF); }
.toast-warn { background: #7A4A00; }
.toast.out { opacity: 0; }

/* ---------- Official paper (screen preview) ---------- */
.paper { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 28px 32px 24px; max-width: 980px; overflow-x: auto; }
.moul { font-family: var(--moul); font-weight: 400; }
.paper-head { display: flex; justify-content: space-between; gap: 24px; text-align: center; font-size: 0.86rem; line-height: 1.9; }
.paper-head p { margin: 0; }
.ph-left { text-align: center; }
.ornament { color: var(--muted); letter-spacing: 4px; font-size: 0.8rem; }
.paper-title { text-align: center; font-size: 1.05rem; margin: 18px 0 2px; line-height: 1.8; }
.paper-sub { text-align: center; margin-bottom: 14px; }
.result-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.result-table th, .result-table td { border: 1px solid #8A93A3; padding: 3px 6px; text-align: center; }
.result-table th { font-weight: 600; background: #F2F3F5; line-height: 1.4; }
.result-table .t-name { text-align: left; white-space: nowrap; }
.result-table .t-sub { min-width: 52px; }
.result-table .t-avg { font-weight: 700; }
.result-table .t-fail { color: var(--gF); font-weight: 600; }
.result-table td.missing { color: var(--gF); }
.result-table tr.no-score td { color: var(--muted); }
.paper-summary { margin-top: 10px; font-size: 0.85rem; }
.paper-sign { display: flex; justify-content: space-between; margin-top: 18px; text-align: center; font-size: 0.86rem; }
.paper-sign > div { width: 42%; }
.paper-sign p { margin: 0; }
.paper-sign .sign-date { line-height: 1.9; margin-bottom: 2px; font-size: .8rem; }
.paper-sign > div:last-child { width: 54%; }
.sign-name { margin-top: 56px !important; font-weight: 600; }
.paper-scale { margin-top: 14px; font-size: 0.72rem; color: var(--muted); }

.h-rank { color: var(--muted); }


/* ================= Theme v1.1 — violet dashboard ================= */
[data-theme="dark"] {
  --ink: #E8E7FF; --muted: #A3A3C8; --paper: #0F0E24; --panel: #1A1838; --line: #2C2A52; --line-strong: #403D6E;
  --red: #A78BFA; --red-ink: #C4B5FD; --red-wash: #2A2256; --input: #13122C; --head: #3B1C9E;
  --warn-wash: #3A2A0C; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px -14px rgba(0,0,0,.7);
  --gA-bg: #3B2E0A; --gB-bg: #0E3324; --gC-bg: #122A4D; --gD-bg: #262A38; --gE-bg: #3A230F; --gF-bg: #3D1414;
  --gA: #FCD34D; --gB: #6EE7B7; --gC: #93C5FD; --gD: #CBD5E1; --gE: #FDBA74; --gF: #FCA5A5; --warn: #FCD34D;
  --surface: #1A1838; --card: #1A1838; --soft: #24214A;
  color-scheme: dark;
}
[data-theme="dark"] .btn-primary { color: #1A1838; }
[data-theme="dark"] .score-grid tbody tr:hover td, [data-theme="dark"] .score-grid tbody tr:focus-within td { background: #221F47; }
[data-theme="dark"] .cell:focus { background: var(--input); }
[data-theme="dark"] .cell-status { background: var(--panel); color: var(--ink); }
[data-theme="dark"] .notice-warn { color: #F5D9A0; }
.paper { color: #1D2433; }
.paper .muted { color: #5B6475; }

body { background: var(--paper); }
.btn { border-radius: 999px; padding: 7px 16px; }
.btn-primary { background: linear-gradient(135deg, #7C3AED, #A855F7); box-shadow: 0 4px 14px -6px rgba(124, 58, 237, .7); }
.btn-primary:hover { background: linear-gradient(135deg, #6D28D9, #9333EA); }
.panel, .stat, .welcome, .table-scroll { border-color: var(--line); box-shadow: var(--shadow); }
.panel { padding: 20px 24px; }

/* Rail */
.rail { background: var(--rail-bg); border-right: 0; color: #fff; }
.brand { border-bottom: 1px solid rgba(255,255,255,.12); padding: 20px 18px 16px; }
.brand-logo { width: 46px; height: 46px; border-radius: 12px; background: #fff; padding: 3px; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.brand-text strong { font-family: var(--moul); font-weight: 400; font-size: 0.82rem; line-height: 1.6; color: #fff; }
.brand-text small { color: rgba(255,255,255,.75); display: flex; align-items: center; gap: 6px; }
.ver { font-size: 0.7rem; padding: 0 7px; border-radius: 6px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.1); color: #fff; }
.rail nav { padding: 12px 12px; }
.rail a { color: rgba(255,255,255,.86); padding: 9px 12px; border-radius: 12px; margin: 2px 0; border: 1px solid transparent; }
.rail a:hover { background: rgba(255,255,255,.08); color: #fff; }
.rail a[aria-current] { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; border-color: rgba(255,255,255,.28); box-shadow: inset 3px 0 0 #C4B5FD, 0 6px 18px -10px rgba(0,0,0,.5); }
.nav-group { color: rgba(255,255,255,.6); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.nav-group::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.16); }
.rail-foot { border-top: 1px solid rgba(255,255,255,.12); flex-direction: column; align-items: stretch; gap: 10px; padding: 14px; }
.who { flex-direction: row; align-items: center; gap: 10px; }
.who > div { display: flex; flex-direction: column; min-width: 0; }
.who strong { color: #fff; }
.who small { color: rgba(255,255,255,.7); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #FBBF24, #F472B6); color: #2E1065; display: grid; place-items: center; font-weight: 700; flex: none; }
.rail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rail-btn { height: 38px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.1); color: #FDE68A; cursor: pointer; display: grid; place-items: center; }
.rail-btn:hover { background: rgba(255,255,255,.18); }
.rail-btn-out { background: linear-gradient(135deg, #DC2626, #E11D48); color: #fff; border-color: transparent; }
.rail :focus-visible { outline-color: #FDE68A; }

/* Topbar */
.topbar { background: color-mix(in srgb, var(--paper) 88%, transparent); border-bottom: 1px solid var(--line); padding: 16px 32px; }
.topbar h1 { font-family: var(--moul); font-weight: 400; font-size: 1.35rem; line-height: 1.8; white-space: nowrap; }
.topbar-tools { gap: 10px; flex-wrap: nowrap; justify-content: flex-end; }
.round-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow); }
.round-btn:hover { border-color: var(--red); }
.round-ok { color: #16A34A; }
.round-btn.spin .ico { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.clock-pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: 999px; background: color-mix(in srgb, #6366F1 10%, var(--panel)); border: 1px solid color-mix(in srgb, #6366F1 35%, transparent); color: #4338CA; font-size: 0.86rem; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
[data-theme="dark"] .clock-pill { color: #C7D2FE; }
.year-pick select { border-radius: 999px; padding: 6px 14px; }
#view { padding: 26px 32px 56px; max-width: 1320px; }

/* Hero */
.hero { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  background: var(--hero-bg); color: #fff; border-radius: 22px; padding: 28px 32px; margin-bottom: 20px;
  box-shadow: 0 18px 40px -18px rgba(168, 85, 247, .75); }
.hero::before, .hero::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,.08); pointer-events: none; }
.hero::before { width: 320px; height: 320px; right: -80px; top: -140px; }
.hero::after { width: 200px; height: 200px; left: 38%; bottom: -120px; }
.hero-text { position: relative; z-index: 1; min-width: 0; }
.hero-kicker { font-size: 0.82rem; font-weight: 600; opacity: .9; margin: 0; }
.hero-date { font-family: var(--moul); font-weight: 400; font-size: 1.6rem; line-height: 1.9; margin: 2px 0; }
.hero-time { font-size: 0.9rem; opacity: .95; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.live { display: inline-flex; align-items: center; gap: 5px; background: rgba(0,0,0,.18); border-radius: 999px; padding: 1px 10px; font-size: 0.75rem; font-weight: 600; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: #4ADE80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .3); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.hero-pill { color: #fff; text-decoration: none; font-size: 0.88rem; font-weight: 600; padding: 7px 16px; border-radius: 999px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.4); }
.hero-pill:hover { background: rgba(255,255,255,.28); }
.hero-pill.ghost { background: transparent; }
.rings { position: relative; z-index: 1; display: flex; gap: 16px; flex-wrap: wrap; }
.ring { --p: 0; --c: #fff; width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(255,255,255,.22) 0); }
.ring-in { width: 78px; height: 78px; border-radius: 50%; background: #7B3AEA; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring-in b { font-size: 1.25rem; line-height: 1.2; }
.ring-in small { font-size: 0.66rem; opacity: .9; line-height: 1.3; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 14px; margin-bottom: 22px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 18px 10px 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; text-decoration: none; color: var(--ink); font-size: 0.86rem; font-weight: 600; line-height: 1.45; transition: transform .15s, box-shadow .15s; }
.tile:hover { transform: translateY(-3px); box-shadow: 0 14px 28px -14px rgba(109, 40, 217, .45); border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }
.tile-ico { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-size: 1.75rem; box-shadow: inset 0 -3px 0 rgba(0,0,0,.06); }
[data-theme="dark"] .tile-ico { background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.tile-ico { background: linear-gradient(180deg, #FFFFFF, #F1F5F9); box-shadow: 0 6px 14px -8px rgba(15, 23, 42, .35), inset 0 0 0 1px rgba(15, 23, 42, .05); }
.tile-ico .ti { width: 50px; height: 50px; display: block; }
.tile:hover .tile-ico .ti { transform: scale(1.06); }
.tile-ico .ti { transition: transform .15s; }

/* Progress panel */
.ph-title { display: flex; gap: 12px; align-items: center; }
.ph-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--red-wash); font-size: 1.3rem; flex: none; }
.ph-title h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ph-title p { margin: 0; font-size: 0.84rem; }
.chip { font-size: 0.75rem; font-weight: 600; padding: 1px 10px; border-radius: 999px; background: color-mix(in srgb, #6366F1 12%, var(--panel)); color: #4F46E5; border: 1px solid color-mix(in srgb, #6366F1 30%, transparent); }
[data-theme="dark"] .chip { color: #C7D2FE; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 6px 0 14px; }
.kpi { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 16px; color: #FDE7C7;
  background: linear-gradient(135deg, #5B3214, #7A4519); box-shadow: 0 10px 22px -14px rgba(91, 50, 20, .9); }
.kpi small { display: block; font-size: 0.78rem; font-weight: 600; line-height: 1.45; color: #FCD9A8; }
.kpi b { font-size: 1.35rem; color: #fff; font-variant-numeric: tabular-nums; line-height: 1.4; }
.kpi em { font-style: normal; font-size: 0.8rem; font-weight: 500; color: #FCD9A8; }
.kpi-ico { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.12); font-size: 1.2rem; flex: none; }
.meter.big { height: 10px; border-radius: 6px; margin: 0 0 10px; }
.meter span { background: linear-gradient(90deg, #22C55E, #A3E635); border-radius: 6px; }
.progress-panel .legend { margin-bottom: 8px; }
.welcome { max-width: none; border-radius: var(--radius); }

/* Login */
.login-shell { background: radial-gradient(1200px 600px at 10% -10%, #C4B5FD 0, transparent 60%), radial-gradient(900px 500px at 110% 110%, #F0ABFC 0, transparent 55%), var(--paper); }
.login-card { border-radius: 22px; box-shadow: 0 24px 60px -28px rgba(76, 29, 149, .55); }

/* ---- Dashboard v1.2: progress per class, overview, staff ---- */
.ph-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pick { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); font-size: 0.9rem; }
.pick select { border: 0; background: transparent; padding: 6px 8px; font-weight: 600; }
.seg-tabs { display: inline-flex; padding: 4px; gap: 2px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); }
.seg-tabs button { font: inherit; font-size: 0.85rem; border: 0; background: transparent; color: var(--muted); padding: 5px 14px; border-radius: 9px; cursor: pointer; }
.seg-tabs button[aria-selected="true"] { background: var(--panel); color: var(--red); font-weight: 700; box-shadow: var(--shadow); }
.tip { background: color-mix(in srgb, #06B6D4 9%, var(--panel)); border: 1px dashed color-mix(in srgb, #06B6D4 45%, transparent); color: color-mix(in srgb, #0E7490 85%, var(--ink)); border-radius: 12px; padding: 10px 14px; font-size: 0.88rem; font-weight: 500; margin: 4px 0 14px; }
[data-theme="dark"] .tip { color: #A5F3FC; }
.class-progress { display: flex; flex-direction: column; gap: 12px; }
.cp-row { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: color-mix(in srgb, var(--paper) 45%, var(--panel)); }
.cp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 0.9rem; }
.cp-badge { color: #fff; font-weight: 700; padding: 4px 12px; border-radius: 10px; background: linear-gradient(135deg, #F59E0B, #F97316); box-shadow: 0 4px 10px -4px rgba(249, 115, 22, .7); }
.cp-teacher { font-weight: 600; }
.st { margin-left: auto; font-size: 0.78rem; font-weight: 600; padding: 2px 12px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); }
.st-done { background: var(--gB-bg); color: var(--gB); border-color: transparent; }
.st-part { background: var(--warn-wash); color: var(--warn); border-color: transparent; }
.cp-bar { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.cp-track { flex: 1; height: 12px; border-radius: 999px; background: var(--line); overflow: hidden; }
.cp-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #F59E0B, #FBBF24); transition: width .4s; }
.cp-fill.cp-done { background: linear-gradient(90deg, #16A34A, #4ADE80); }
.cp-pct { min-width: 54px; text-align: center; font-size: 0.82rem; color: #fff; background: #1E293B; border-radius: 999px; padding: 2px 10px; }
.cp-cells { display: flex; flex-wrap: wrap; gap: 6px; }
.empty-line { padding: 14px; text-align: center; }

.overview { margin: 26px 0 8px; }
.ov-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.ov-title { font-family: var(--moul); font-weight: 400; font-size: 1.3rem; line-height: 1.9; }
.ov-head p { margin: 0; }
.ov-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.count-chips { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; padding: 7px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 0.84rem; }
.c-monk { color: #D97706; } .c-boy { color: #2563EB; } .c-girl { color: #DB2777; }
.round-print { background: linear-gradient(135deg, #6366F1, #8B5CF6); border: 0; font-size: 1rem; }
.big-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.grade-cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.bc, .gc, .sc { position: relative; overflow: hidden; display: flex; gap: 12px; align-items: center; color: #fff; background: var(--bg); border-radius: 16px; padding: 18px; box-shadow: 0 12px 24px -16px rgba(30, 27, 75, .7); }
.bc::after, .gc::after, .sc::after { content: ''; position: absolute; right: -30px; bottom: -40px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,.12); }
.bc small, .gc small, .sc small { display: block; font-weight: 700; font-size: 0.82rem; line-height: 1.5; }
.bc b, .gc b, .sc b { display: block; font-size: 1.7rem; line-height: 1.3; font-variant-numeric: tabular-nums; }
.bc em, .gc em, .sc em { display: block; font-style: normal; font-size: 0.76rem; opacity: .92; line-height: 1.45; }
.gc { padding: 14px 12px; align-items: flex-start; } .gc b { font-size: 1.4rem; }
.bc-ico { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.2); font-size: 1.25rem; font-weight: 700; }
.gc .bc-ico { width: 36px; height: 36px; font-size: 1rem; }
.ov-grid3 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.2fr) minmax(0,1fr); gap: 16px; margin-bottom: 16px; }
.ov-grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.side-stack { display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 0.98rem; }
.mini-link { font-size: 0.76rem; font-weight: 600; color: #2563EB; background: color-mix(in srgb, #3B82F6 10%, var(--panel)); padding: 3px 10px; border-radius: 999px; text-decoration: none; white-space: nowrap; }
[data-theme="dark"] .mini-link { color: #93C5FD; }
.donut { border-radius: 50%; display: grid; place-items: center; flex: none; }
.donut-md { width: 130px; height: 130px; } .donut-lg { width: 150px; height: 150px; }
.donut-in { width: 64%; height: 64%; border-radius: 50%; background: var(--panel); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.donut-in b { font-size: 1.35rem; line-height: 1.2; }
.donut-in small { font-size: 0.72rem; color: var(--muted); }
.donut-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-col { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.legend-list { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 6px; font-size: 0.86rem; }
.legend-list li { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; }
.legend-list .dot { width: 10px; height: 10px; border-radius: 50%; margin: 0; }
.legend-list small { display: block; color: var(--muted); font-size: 0.72rem; line-height: 1.2; }
.legend-list b { font-variant-numeric: tabular-nums; }
.legend-list b.bad { color: #EF4444; } .legend-list b.ok { color: #16A34A; }
.vbars { display: flex; align-items: flex-end; gap: 10px; height: 210px; padding-top: 6px; background: repeating-linear-gradient(to top, transparent 0 calc(25% - 1px), var(--line) calc(25% - 1px) 25%); background-size: 100% calc(100% - 34px); background-repeat: no-repeat; }
.vbar { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.vbar b { font-size: 0.78rem; white-space: nowrap; }
.vbar-col { flex: 1; width: 70%; max-width: 44px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.vbar-col span { display: block; width: 100%; border-radius: 8px 8px 3px 3px; min-height: 2px; }
.vbar small { font-size: 0.7rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.empty-note { color: var(--muted); text-align: center; padding: 36px 8px; }
.top-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.top-list li { display: grid; grid-template-columns: 28px 1fr auto 30px; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 12px; background: color-mix(in srgb, var(--paper) 55%, var(--panel)); }
.medal { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 0.8rem; font-weight: 700; background: var(--line); }
.medal.m1 { background: #FBBF24; color: #fff; } .medal.m2 { background: #94A3B8; color: #fff; } .medal.m3 { background: #D97706; color: #fff; }
.tl-name { font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-name small { display: block; color: var(--muted); font-weight: 400; font-size: 0.74rem; }
.table-scroll.flat { box-shadow: none; border: 0; }
.class-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.88rem; }
.class-table th { background: #0F172A; color: #fff; font-weight: 600; padding: 10px 12px; text-align: center; white-space: nowrap; }
.class-table th:first-child { text-align: left; border-radius: 10px 0 0 10px; } .class-table th:last-child { border-radius: 0 10px 10px 0; }
.class-table td { padding: 9px 12px; text-align: center; border-bottom: 1px solid var(--line); }
.class-table td:first-child { text-align: left; }
.class-table a { color: #2563EB; text-decoration: none; font-weight: 600; white-space: nowrap; }
[data-theme="dark"] .class-table a { color: #93C5FD; }
.tag { font-weight: 700; font-size: 0.82rem; padding: 2px 8px; border-radius: 8px; }
.tag-ok { background: var(--gB-bg); color: var(--gB); } .tag-a { color: #7C3AED; } .tag-bad { background: var(--gF-bg); color: var(--gF); }
.spark { width: 70px; height: 22px; }
.motto { display: flex; align-items: center; gap: 12px; }
.motto h3 { font-size: 1rem; margin-bottom: 4px; }
.motto p { font-size: 0.84rem; color: var(--muted); margin-bottom: 6px; }
.stars { color: #F59E0B; letter-spacing: 2px; }
.motto-art { font-size: 3.4rem; line-height: 1; }
.legend-list.compact { max-height: 160px; overflow-y: auto; }

.staff-stats { margin-top: 26px; }
.ss-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.staff-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.sc { flex-direction: column; align-items: flex-start; gap: 0; min-height: 120px; }
.sc-ico { position: absolute; right: 16px; top: 18px; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.35); font-size: 1.2rem; z-index: 1; }
.mini-ring { --p: 0; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; z-index: 1;
  background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255,255,255,.25) 0); }
.mini-ring i { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 0.72rem; font-weight: 700; background: rgba(0,0,0,.18); }
.pill-list { list-style: none; padding: 0; margin: 0; width: 100%; display: flex; flex-direction: column; gap: 8px; }
.pill-list li { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); font-size: 0.88rem; }
.pill-list .dot { width: 10px; height: 10px; border-radius: 50%; margin: 0; }
.pill-list b { margin-left: auto; }
.type-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.type-table td:first-child { white-space: nowrap; }
.type-table th { color: var(--muted); font-weight: 600; padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.type-table th:first-child, .type-table td:first-child { text-align: left; }
.type-table td { padding: 9px 6px; text-align: center; border-bottom: 1px solid var(--line); }
.type-table td .dot { width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }
.type-table small { color: var(--muted); }
.type-table .num { display: inline-block; min-width: 26px; padding: 1px 6px; border-radius: 6px; background: var(--paper); font-size: 0.8rem; }
.type-table tfoot td { background: color-mix(in srgb, #3B82F6 8%, var(--panel)); color: #2563EB; font-weight: 700; border: 0; }
[data-theme="dark"] .type-table tfoot td { color: #93C5FD; }
.load-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.load-list li { display: grid; grid-template-columns: minmax(0, 1.2fr) 1fr auto; gap: 10px; align-items: center; font-size: 0.86rem; }
.ll-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ll-name small { display: block; font-weight: 400; color: var(--muted); font-size: 0.74rem; }
.ll-bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.ll-bar span { display: block; height: 100%; background: linear-gradient(90deg, #6366F1, #A855F7); border-radius: 999px; }
.dash-foot { text-align: center; color: var(--muted); font-size: 0.82rem; margin: 28px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
@media (max-width: 1200px) {
  .grade-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ov-grid3 { grid-template-columns: 1fr 1fr; }
  .ov-grid3 > .card:nth-child(2) { grid-column: span 2; order: 3; }
  .ov-grid2 { grid-template-columns: 1fr; }
  .staff-grid > .card:nth-child(2) { grid-column: span 2; order: 3; }
}
@media (max-width: 900px) {
  .big-cards, .staff-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .grade-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .ov-grid3, .staff-grid { grid-template-columns: 1fr; }
  .ov-grid3 > .card:nth-child(2), .staff-grid > .card:nth-child(2) { grid-column: auto; order: 0; }
  .bc, .sc { padding: 14px; } .bc b, .sc b { font-size: 1.35rem; }
  .bc-ico { width: 36px; height: 36px; font-size: 1rem; }
  .mini-ring { width: 42px; height: 42px; } .mini-ring i { width: 32px; height: 32px; font-size: 0.62rem; }
  .sc-ico { width: 36px; height: 36px; right: 12px; top: 12px; }
  .st { margin-left: 0; }
  .ph-tools { width: 100%; }
  .seg-tabs { width: 100%; } .seg-tabs button { flex: 1; padding: 5px 6px; }
  .ov-tools { width: 100%; }
}

/* ================= Home page (portal) ================= */
.app-shell.portal-mode { grid-template-columns: 1fr; }
.portal-mode .rail, .portal-mode .topbar, .portal-mode .bottombar { display: none !important; }
.portal-mode #view { padding: 0; max-width: none; }
.home { min-height: 100vh; background: var(--paper); }
.home-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 10px 32px; background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: blur(8px); border-top: 4px solid #2563EB; border-bottom: 1px solid var(--line); }
.home-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-width: 0; }
.home-brand img { width: 44px; height: 44px; border-radius: 10px; object-fit: contain; background: #fff; box-shadow: var(--shadow); }
.home-brand strong { display: block; font-family: var(--moul); font-weight: 400; font-size: 1rem; line-height: 1.7; color: #1E3A8A; }
[data-theme="dark"] .home-brand strong { color: #BFDBFE; }
.home-brand small { display: block; font-size: 0.78rem; color: var(--muted); line-height: 1.3; }
.home-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.who-chip { font-size: 0.85rem; font-weight: 600; color: #1D4ED8; padding: 6px 14px; border-radius: 999px; background: color-mix(in srgb, #3B82F6 12%, var(--panel)); border: 1px solid color-mix(in srgb, #3B82F6 35%, transparent); }
.who-chip em { font-style: normal; font-weight: 500; }
[data-theme="dark"] .who-chip { color: #BFDBFE; }
.home .btn-primary { background: linear-gradient(135deg, #1D4ED8, #2563EB); box-shadow: 0 6px 14px -8px rgba(37, 99, 235, .9); }
.home-actions .btn-primary { background: linear-gradient(135deg, #1D4ED8, #2563EB); box-shadow: 0 6px 14px -8px rgba(37, 99, 235, .9); border-radius: 10px; }
.btn-out { background: color-mix(in srgb, #EF4444 8%, var(--panel)); color: #DC2626; border: 1px solid color-mix(in srgb, #EF4444 40%, transparent); border-radius: 10px; }
.btn-out:hover { background: color-mix(in srgb, #EF4444 15%, var(--panel)); }
.home-wrap { max-width: 1240px; margin: 0 auto; padding: 26px 32px 40px; }
.home-hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(380px, 1.15fr) minmax(220px, 1fr) 270px; grid-template-areas: 'text art clock'; align-items: center; gap: 12px 20px; min-height: 320px;
  padding: 30px 36px; border-radius: 24px; color: #fff; isolation: isolate;
  background:
    radial-gradient(600px 300px at 58% 110%, rgba(219, 39, 119, .28), transparent 65%),
    radial-gradient(500px 260px at 58% 0%, rgba(251, 191, 36, .16), transparent 60%),
    linear-gradient(120deg, #0A1A38 0%, #12325E 52%, #0B1E3F 100%);
  box-shadow: 0 24px 50px -28px rgba(11, 30, 63, .9); }
.home-hero::before { content: ''; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: radial-gradient(rgba(165, 243, 252, .22) 1px, transparent 1.2px); background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 35%, #000 75%, transparent); mask-image: linear-gradient(90deg, transparent, #000 35%, #000 75%, transparent); }
.home-hero.has-img { display: flex; flex-wrap: wrap; justify-content: space-between; background: linear-gradient(90deg, rgba(8, 22, 48, .88) 0%, rgba(8, 22, 48, .55) 55%, rgba(8, 22, 48, .8) 100%), var(--hero-img) center / cover no-repeat, #0B1E3F; }
.hh-text { grid-area: text; } .hh-clock { grid-area: clock; }
.hh-art { grid-area: art; align-self: stretch; position: relative; min-height: 270px; margin: -30px 0 -30px; }
.ha-back { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 50% 62% at 50% 58%, #000 40%, transparent 100%); mask-image: radial-gradient(ellipse 50% 62% at 50% 58%, #000 40%, transparent 100%); }
.ha-buddha { position: absolute; z-index: 3; bottom: 2%; left: 50%; height: 96%; width: auto; transform: translateX(-55.5%);
  filter: drop-shadow(0 0 16px rgba(253, 230, 138, .35)) drop-shadow(0 14px 16px rgba(0, 0, 0, .45)); }
.ha-halo { position: absolute; z-index: 2; left: 50%; top: 13.5%; height: 46%; aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none; }
.ha-quill { position: absolute; z-index: 2; left: 1%; bottom: 4%; height: 64%; width: auto; transform: rotate(-5deg);
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .45)) drop-shadow(0 0 10px rgba(251, 191, 36, .25)); }
.ha-monks { position: absolute; z-index: 2; right: 0; bottom: 9%; width: 40%; margin: 0; transform: rotate(3deg); border-radius: 14px; overflow: hidden;
  border: 3px solid rgba(255, 255, 255, .9); box-shadow: 0 16px 28px -10px rgba(0, 0, 0, .6), 0 0 0 6px rgba(103, 232, 249, .12); background: #fff; }
.ha-monks img { display: block; width: 100%; height: auto; }
.ha-monks figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 4px; font-size: 0.68rem; font-weight: 700; color: #fff; text-align: center;
  background: linear-gradient(transparent, rgba(12, 74, 110, .85)); }
.ha-spin { transform-origin: 280px 160px; animation: haSpin 60s linear infinite; }
.ha-wheel { transform-origin: 60px 60px; animation: haSpin 90s linear infinite; }
.ha-tw { animation: haTw 3.2s ease-in-out infinite; }
@keyframes haSpin { to { transform: rotate(360deg); } }
@keyframes haFloat { 50% { transform: translateY(-4px); } }
@keyframes haTw { 0%, 100% { opacity: .15; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-6px); } }
.hh-text { position: relative; z-index: 1; min-width: 0; }
.hh-motto { font-size: 1rem; opacity: .9; margin: 0; }
.hh-quote { margin: 16px 0 0; padding: 10px 14px 10px 16px; border-left: 3px solid #FBBF24; border-radius: 0 12px 12px 0; background: linear-gradient(90deg, rgba(251, 191, 36, .14), transparent); max-width: 440px; transition: opacity .45s, transform .45s; }
.hh-quote.out { opacity: 0; transform: translateY(4px); }
.hh-quote blockquote { margin: 0; font-family: var(--moul); font-size: 0.92rem; line-height: 1.9; color: #FDE68A; }
.hh-quote figcaption { font-size: 0.84rem; color: #E0E7FF; opacity: .9; }
.hh-be { text-align: right; font-size: 0.82rem; font-weight: 700; color: #FDE68A; padding-top: 8px; }
.hh-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.hh-chip { font-size: 0.82rem; font-weight: 600; padding: 5px 14px; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.3); backdrop-filter: blur(6px); }
.home-hero h1 { font-family: var(--moul); font-weight: 400; font-size: 1.6rem; line-height: 1.9; margin: 0 0 6px; text-shadow: 0 2px 10px rgba(0,0,0,.35); }
.hh-clock { position: relative; z-index: 1; min-width: 0; padding: 16px 22px; border-radius: 18px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.28); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); text-shadow: 0 1px 4px rgba(0,0,0,.55); }
.hh-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,.18); font-size: 0.82rem; font-weight: 600; }
.hh-day { padding: 2px 10px; border-radius: 8px; background: rgba(59, 130, 246, .35); white-space: nowrap; }
.hh-year { color: #FDE68A; }
.hh-time { text-align: right; font-size: 1.85rem; white-space: nowrap; font-weight: 700; letter-spacing: .5px; line-height: 1.5; font-variant-numeric: tabular-nums; margin-top: 6px; }
.hh-date { text-align: right; font-size: 1.05rem; white-space: nowrap; font-weight: 700; color: #fff; padding: 12px 0 10px; border-bottom: 1px solid rgba(255,255,255,.22); }
.hh-status { text-align: right; font-size: 0.78rem; color: #86EFAC; margin-top: 6px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.18); }
.hh-status i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #22C55E; box-shadow: 0 0 0 3px rgba(34, 197, 94, .25); margin-right: 4px; }
.home-sec { margin-top: 34px; }
.hs-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.hs-head h2 { font-family: var(--moul); font-weight: 400; font-size: 1.25rem; line-height: 1.9; color: #1E3A8A; }
[data-theme="dark"] .hs-head h2 { color: #BFDBFE; }
.hs-head p { margin: 0; }
.chip-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip-tabs button { font: inherit; font-size: 0.86rem; font-weight: 600; padding: 6px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; box-shadow: var(--shadow); }
.chip-tabs button small { font-weight: 500; color: var(--muted); }
.chip-tabs button[aria-selected="true"] { background: #12325E; border-color: #12325E; color: #fff; }
.chip-tabs button[aria-selected="true"] small { color: #BFDBFE; }
.chip-tabs.solid { margin: 0; }
.empty-box { border: 2px dashed var(--line-strong); border-radius: 18px; background: color-mix(in srgb, var(--panel) 70%, transparent); padding: 46px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty-box span { font-size: 2.4rem; opacity: .6; }
.empty-box p { color: var(--muted); font-size: 0.88rem; max-width: 520px; margin: 0; }
.ann-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.ann { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid #3B82F6; border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.ann-urgent { border-left-color: #EF4444; } .ann-exam { border-left-color: #8B5CF6; } .ann-event { border-left-color: #10B981; }
.ann-top { display: flex; justify-content: space-between; align-items: center; font-size: 0.78rem; color: var(--muted); }
.ann-cat { font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--paper); color: var(--ink); }
.ann-urgent .ann-cat { background: var(--gF-bg); color: var(--gF); }
.ann h3 { font-size: 1.02rem; }
.ann p { font-size: 0.9rem; color: var(--ink); margin: 0; flex: 1; }
.ann-foot { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; padding-top: 8px; border-top: 1px solid var(--line); }
.link-btn.danger { color: var(--gF); }
.vid-tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.search { flex: 1; min-width: 220px; display: flex; align-items: center; gap: 8px; padding: 0 16px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.search input { border: 0; background: transparent; flex: 1; padding: 10px 0; outline: none; }
.search:focus-within { border-color: #3B82F6; }
.vid-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.vid { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.vid-thumb { position: relative; aspect-ratio: 16 / 9; border: 0; padding: 0; cursor: pointer; background: linear-gradient(135deg, #12325E, #1E3A8A); display: block; width: 100%; }
.vid-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vid-play { position: absolute; inset: 0; margin: auto; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: rgba(220, 38, 38, .92); color: #fff; font-size: 1.2rem; box-shadow: 0 6px 18px rgba(0,0,0,.35); transition: transform .15s; }
.vid-thumb:hover .vid-play { transform: scale(1.1); }
.vid-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.vid-body h3 { font-size: 0.95rem; }
.vid-body p { font-size: 0.82rem; color: var(--muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vid-pl { font-size: 0.76rem; color: #2563EB; font-weight: 600; }
.vid-admin { font-size: 0.8rem; margin-top: 4px; }
.pl-group { margin-bottom: 22px; }
.pl-group h3 { margin-bottom: 10px; } .pl-group h3 small { color: var(--muted); font-weight: 400; }
.dialog-video { width: min(900px, 96vw); background: var(--panel); }
.video-frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-desc { padding: 12px 20px 16px; margin: 0; color: var(--muted); }
.home-foot { text-align: center; color: var(--muted); font-size: 0.82rem; margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); }
@media (max-width: 1180px) {
  .home-hero { grid-template-columns: minmax(0, 1fr) 270px; grid-template-areas: 'text clock'; }
  .hh-art { position: absolute; inset: 0 20% 0 30%; margin: 0; opacity: .32; z-index: -1; }
  .ha-monks, .ha-quill { display: none; }
}
@media (max-width: 900px) {
  .home-top { padding: 8px 14px; }
  .home-brand strong { font-size: 0.82rem; }
  .who-chip { display: none; }
  .home-wrap { padding: 14px 14px 90px; }
  .home-hero { display: flex; flex-direction: column; align-items: stretch; padding: 22px 18px; min-height: 0; }
  .hh-art { position: relative; inset: auto; opacity: 1; z-index: 0; min-height: 240px; margin: -6px -8px 4px; order: -1; }
  .ha-monks, .ha-quill { display: block; }
  .ha-monks { width: 38%; bottom: 12%; } .ha-quill { height: 58%; }
  .home-hero h1 { font-size: 1.2rem; }
  .hh-clock { width: 100%; min-width: 0; }
  .hh-time { font-size: 1.7rem; }
  .portal-mode .bottombar { display: grid !important; }
}

/* Public home: sign-in in the header */
.public-shell { min-height: 100vh; }
.demo-strip { width: 100%; font-size: 0.8rem; color: var(--muted); text-align: right; }
.dialog-qr { width: min(360px, 94vw); background: var(--panel); }
.qr-body { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 6px 20px 22px; text-align: center; }
.qr-body img { border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.qr-body p { font-size: 0.82rem; word-break: break-all; margin: 0; }
@media (max-width: 900px) { .demo-strip { text-align: left; } }

/* Home: school information & contact */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.ci-card { position: relative; display: flex; flex-direction: column; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid #0284C7; border-radius: 16px; padding: 18px 22px; box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
a.ci-card:hover { border-color: #0284C7; }
.ci-hours { border-left-color: #F59E0B; }
.ci-ico { font-size: 1.2rem; }
.ci-go { position: absolute; right: 18px; top: 16px; font-size: 1.4rem; color: var(--muted); }
.ci-card small { font-weight: 700; font-size: 0.85rem; color: var(--muted); }
.ci-phone b { font-size: 1.15rem; color: #12325E; letter-spacing: .5px; }
[data-theme="dark"] .ci-phone b { color: #BFDBFE; }
.ci-card p { margin: 0; font-size: 0.8rem; }
.ci-status { position: absolute; right: 18px; top: 16px; font-size: 0.76rem; font-weight: 700; padding: 3px 12px; border-radius: 999px; background: var(--paper); color: var(--muted); border: 1px solid var(--line-strong); }
.ci-status.on { background: var(--gB-bg); color: var(--gB); border-color: transparent; }
.day-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.day-chips span { font-size: 0.8rem; font-weight: 600; padding: 2px 10px; border-radius: 8px; border: 1px solid #FCD9A8; background: color-mix(in srgb, #F59E0B 8%, var(--panel)); color: #B45309; }
.day-chips span.today { background: linear-gradient(135deg, #F59E0B, #D97706); color: #fff; border-color: transparent; box-shadow: 0 4px 10px -4px rgba(217, 119, 6, .8); }
.shift { font-size: 0.86rem; padding: 7px 12px; border-radius: 10px; }
.shift.am { background: color-mix(in srgb, #F59E0B 10%, var(--panel)); border: 1px solid #FDE68A; color: #92400E; }
.shift.pm { background: color-mix(in srgb, #0EA5E9 10%, var(--panel)); border: 1px solid #BAE6FD; color: #075985; }
[data-theme="dark"] .shift.am { color: #FDE68A; border-color: #78350F; } [data-theme="dark"] .shift.pm { color: #BAE6FD; border-color: #0C4A6E; }
.social-grid { display: grid; grid-template-columns: repeat(var(--so-n, 7), minmax(0, 1fr)); gap: 6px; padding: 18px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.so { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 4px 10px; border-radius: 14px; text-decoration: none; color: var(--ink); font-size: 0.82rem; font-weight: 600; transition: background .15s, transform .15s; }
.so-ico { --dot: #fff; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, var(--from), var(--to));
  box-shadow: 0 10px 20px -10px var(--to), inset 0 1px 0 rgba(255,255,255,.35); position: relative; overflow: hidden; }
.so-ico::after { content: ''; position: absolute; inset: 0 0 50% 0; background: linear-gradient(180deg, rgba(255,255,255,.22), transparent); pointer-events: none; }
.so-ico svg { width: 26px; height: 26px; position: relative; z-index: 1; }
.so-ico svg [fill="var(--dot)"] { fill: var(--to); }
.so-ico svg [stroke="var(--dot)"] { stroke: var(--to); }
a.so:hover { background: var(--paper); transform: translateY(-2px); }
a.so:hover .so-ico { box-shadow: 0 14px 24px -10px var(--to), inset 0 1px 0 rgba(255,255,255,.35); }
a.so:focus-visible { outline: 2px solid var(--to, #2563EB); }
.so.off { cursor: default; color: var(--muted); }
.so.off .so-ico { background: color-mix(in srgb, var(--from) 14%, var(--panel)); color: var(--to); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--from) 30%, transparent); }
.so.off .so-ico::after { display: none; }
.so.off .so-ico svg [fill="var(--dot)"] { fill: color-mix(in srgb, var(--from) 14%, var(--panel)); }
.so.off .so-ico svg [stroke="var(--dot)"] { stroke: color-mix(in srgb, var(--from) 14%, var(--panel)); }
[data-theme="dark"] .so.off .so-ico { color: color-mix(in srgb, var(--from) 65%, #fff); background: color-mix(in srgb, var(--from) 22%, var(--panel)); }
.home-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px 18px; flex-wrap: wrap; text-align: left; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.link-plain { font: inherit; font-size: 0.85rem; background: none; border: 0; color: var(--muted); cursor: pointer; text-decoration: none; padding: 2px 0; }
.link-plain:hover { color: var(--ink); }
@media (max-width: 900px) {
  .contact-grid { grid-template-columns: 1fr; }
  .social-grid { grid-template-columns: repeat(4, 1fr); padding: 10px 6px; }
  .so { font-size: 0.72rem; gap: 6px; } .so-ico { width: 44px; height: 44px; border-radius: 14px; } .so-ico svg { width: 22px; height: 22px; }
  .home-foot { flex-direction: column; text-align: center; }
}

/* Home admin page */
.ha-intro { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ha-tabs { margin-bottom: 16px; flex-wrap: wrap; }
.ha-thumb { width: 112px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; display: block; }
.danger-text { color: var(--gF) !important; }
.ha-preview .home-hero.mini { display: flex; min-height: 150px; padding: 24px 28px; margin: 0; }
.ha-preview .home-hero.mini h1 { font-size: 1.2rem; }
.manage-link { white-space: nowrap; }

/* ================= Work page (cards) ================= */
.ws { max-width: 1100px; margin: 0 auto; padding: 26px 28px 40px; }
.ws-hero { position: relative; overflow: hidden; isolation: isolate; border-radius: 22px; padding: 26px 32px 30px; color: #fff; min-height: 230px;
  box-shadow: 0 22px 44px -26px rgba(30, 27, 75, .9); }
.ws-sky { position: absolute; inset: 0; z-index: -2;
  background: radial-gradient(500px 220px at 58% 85%, rgba(251, 146, 60, .65), transparent 70%),
              linear-gradient(180deg, #1E1B4B 0%, #4C1D95 45%, #B45309 85%, #F59E0B 100%); }
.ws-sky::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(15, 23, 42, .78) 0%, rgba(15, 23, 42, .35) 55%, rgba(15, 23, 42, .15) 100%); }
.ws-temple { position: absolute; z-index: -1; right: 0; bottom: 0; height: 100%; width: 60%; }
.ws-hero-in { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.ws-back { display: inline-flex; align-items: center; gap: 4px; font-size: 0.84rem; font-weight: 600; color: #fff; text-decoration: none; padding: 5px 14px 5px 8px; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.35); }
.ws-back:hover { background: rgba(255,255,255,.22); }
.ws-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ws-school { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.ws-school img { width: 46px; height: 46px; border-radius: 50%; background: #fff; padding: 3px; object-fit: contain; box-shadow: 0 0 0 3px rgba(251, 191, 36, .7); }
.ws-school strong { font-family: var(--moul); font-weight: 400; font-size: 0.95rem; line-height: 1.7; color: #FEF3C7; }
.ws-hero h1 { font-family: var(--moul); font-weight: 400; font-size: 2rem; line-height: 1.8; margin: 0; text-shadow: 0 3px 12px rgba(0,0,0,.4); }
.ws-hero p { margin: 0; font-size: 0.92rem; opacity: .92; }
.ws-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.ws-card { position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; min-height: 84px; padding: 14px 16px; border-radius: 16px;
  color: #fff; text-decoration: none; background: var(--bg); box-shadow: 0 12px 22px -14px rgba(30, 27, 75, .75), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .15s, box-shadow .15s; }
.ws-card:hover { transform: translateY(-3px); box-shadow: 0 18px 28px -14px rgba(30, 27, 75, .8), inset 0 1px 0 rgba(255,255,255,.25); }
.ws-card:focus-visible { outline: 3px solid #FDE68A; outline-offset: 2px; }
.ws-ico { flex: none; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.35); }
.ws-ico svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ws-txt { flex: 1; min-width: 0; position: relative; z-index: 1; }
.ws-txt b { display: block; font-size: 1.02rem; line-height: 1.5; }
.ws-txt small { display: block; font-size: 0.8rem; opacity: .92; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-go { position: relative; z-index: 1; flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.4); }
.ws-go svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ws-ghost { position: absolute; right: -10px; bottom: -14px; width: 92px; height: 92px; fill: none; stroke: #fff; stroke-opacity: .16; stroke-width: 1.6; transform: rotate(-12deg); pointer-events: none; }
.ws-badge { display: inline-block; vertical-align: 2px; margin-left: 6px; padding: 0 9px; border-radius: 999px; background: #fff; color: #BE123C; font-style: normal; font-size: 0.7rem; font-weight: 800; line-height: 1.7; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.ws-badge.ok { color: #047857; }
.ws-badge[hidden] { display: none; }
.ws-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.ws-chips > span { font-size: 0.8rem; font-weight: 600; padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28); backdrop-filter: blur(6px); }
.ws-chips > span[hidden] { display: none; }
.ws-admin-note { margin: 14px 0 0; padding: 10px 16px; border-radius: 12px; font-size: 0.88rem; background: color-mix(in srgb, #6366F1 10%, var(--panel)); border: 1px solid color-mix(in srgb, #6366F1 35%, transparent); }
.ws-admin-note a { font-weight: 700; }
.ws-group { font-size: 0.95rem; font-weight: 700; color: var(--muted); margin: 26px 2px 10px; display: flex; align-items: center; gap: 10px; }
.ws-group::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.ws-grid { margin-top: 0 !important; }
.ws-todo { margin-top: 18px; padding: 18px 20px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); border-left: 5px solid #F97316; }
.ws-todo.all-done { border-left-color: #10B981; }
.wt-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.wt-head h2 { font-size: 1rem; }
.wt-head p { margin: 0; font-size: 0.82rem; color: var(--muted); }
.wt-ring { --p: 0; flex: none; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(#F97316 calc(var(--p) * 1%), var(--line) 0); }
.wt-ring b { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); font-size: 0.8rem; }
.wt-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.wt-item { font: inherit; display: grid; grid-template-columns: minmax(0, 1.1fr) 1fr auto auto; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 50%, var(--panel)); color: var(--ink); cursor: pointer; text-align: left; transition: border-color .15s, background .15s; }
.wt-item:hover { border-color: #FB923C; background: color-mix(in srgb, #F97316 7%, var(--panel)); }
.wt-name { min-width: 0; } .wt-name b { display: block; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wt-name small { display: block; font-size: 0.74rem; color: var(--muted); }
.wt-bar { height: 7px; border-radius: 999px; background: var(--line); overflow: hidden; }
.wt-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #F97316, #FBBF24); }
.wt-num { font-size: 0.78rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.wt-go { font-size: 0.76rem; font-weight: 700; color: #EA580C; white-space: nowrap; }
.wt-more { display: inline-block; margin-top: 10px; font-size: 0.82rem; font-weight: 700; color: #EA580C; text-decoration: none; }
.wt-done { display: flex; align-items: center; gap: 12px; font-size: 1.6rem; }
.wt-done b { display: block; font-size: 0.95rem; color: var(--gB); } .wt-done small { display: block; font-size: 0.8rem; color: var(--muted); }
.ws-foot { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 14px; margin-top: 28px; font-size: 0.82rem; color: var(--muted); }
.ws-foot img { width: 22px; height: 22px; border-radius: 6px; }
.ws-foot .link-plain { display: inline-flex; align-items: center; gap: 4px; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.ws-foot svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
@media (max-width: 900px) {
  .ws { padding: 14px 12px 96px; }
  .ws-hero { padding: 18px 18px 22px; min-height: 200px; }
  .ws-hero h1 { font-size: 1.45rem; }
  .ws-sky::after { background: linear-gradient(180deg, rgba(15, 18, 45, .35), rgba(15, 18, 45, .82)) !important; }
  /* Phones: square-ish cards, two per row */
  .ws-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .ws-card { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 10px; min-height: 148px; padding: 16px 14px 14px; border-radius: 20px; }
  .ws-card .ws-ico { width: 48px; height: 48px; border-radius: 14px; }
  .ws-card .ws-go { display: none; }
  .ws-card .ws-txt b { font-size: 1rem; line-height: 1.55; }
  .ws-card .ws-txt small { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .76rem; opacity: .9; }
  .ws-card .ws-ghost { width: 78px; height: 78px; right: -14px; bottom: -16px; }
  .ws-card:active { transform: scale(.97); }
  /* an odd card out fills the row as a wide card */
  .ws-grid > .ws-card:last-child:nth-child(odd) { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: 96px; }
  .ws-grid > .ws-card:last-child:nth-child(odd) .ws-go { display: grid; }
  .wt-list { grid-template-columns: 1fr; }
  .wt-item { grid-template-columns: minmax(0, 1fr) 70px auto; } .wt-go { display: none; }
}
@media (min-width: 901px) and (max-width: 1100px) { .ws-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- Photo backgrounds: Angkor at sunset (light), Phnom Penh at night (dark) ---- */
:root { --photo: url('../img/hero-light.webp'); --photo-pos: center 40%; }
[data-theme="dark"] { --photo: url('../img/hero-dark.webp'); --photo-pos: center 55%; }
.ws-sky { background: var(--photo) var(--photo-pos) / cover no-repeat, #1E1B4B !important; }
.ws-sky::after { background: linear-gradient(90deg, rgba(30, 16, 40, .78) 0%, rgba(30, 16, 40, .38) 45%, rgba(30, 16, 40, 0) 100%),
  linear-gradient(0deg, rgba(30, 16, 40, .35), transparent 45%) !important; }
[data-theme="dark"] .ws-sky::after { background: linear-gradient(90deg, rgba(8, 12, 30, .86) 0%, rgba(8, 12, 30, .5) 45%, rgba(8, 12, 30, .1) 100%),
  linear-gradient(0deg, rgba(8, 12, 30, .45), transparent 45%) !important; }
.home-hero:not(.has-img) {
  background:
    linear-gradient(90deg, rgba(40, 18, 40, .8) 0%, rgba(40, 18, 40, .42) 38%, rgba(40, 18, 40, .05) 62%, rgba(40, 18, 40, .38) 100%),
    linear-gradient(0deg, rgba(40, 18, 40, .4), transparent 50%),
    var(--photo) var(--photo-pos) / cover no-repeat, #0B1E3F; }
[data-theme="dark"] .home-hero:not(.has-img) {
  background:
    linear-gradient(90deg, rgba(8, 14, 34, .88) 0%, rgba(8, 14, 34, .55) 38%, rgba(8, 14, 34, .18) 62%, rgba(8, 14, 34, .55) 100%),
    linear-gradient(0deg, rgba(8, 14, 34, .5), transparent 50%),
    var(--photo) var(--photo-pos) / cover no-repeat, #0B1E3F; }
.home-hero:not(.has-img)::before { opacity: .25; }
.home-hero:not(.has-img) .ha-back { opacity: .55; }
.home-hero:not(.has-img) .hh-clock { background: rgba(10, 20, 45, .16); }

/* ---- Sidebar v2: back button, sections, folding groups ---- */
.rail .rail-back { display: flex; align-items: center; gap: 8px; margin: 12px 12px 0; padding: 9px 12px; border-radius: 12px; color: #fff !important; font-weight: 700; font-size: 0.9rem; text-decoration: none;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.22); }
.rail .rail-back:hover { background: rgba(255,255,255,.18); }
.rail-back .ico { width: 18px; height: 18px; stroke-width: 2.4; }
.rail nav { padding-top: 4px; }
.rail .nav-group { margin: 16px 6px 6px; font-size: 0.74rem; letter-spacing: .2px; }
.nav-fold-btn { font: inherit; width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin: 2px 0; border-radius: 12px; border: 1px solid transparent;
  background: none; color: #fff; font-size: 0.93rem; font-weight: 700; cursor: pointer; text-align: left; }
.nav-fold-btn:hover { background: rgba(255,255,255,.08); }
.nav-fold-btn span { flex: 1; }
.nav-fold-btn .chev { width: 16px; height: 16px; opacity: .75; transition: transform .2s; }
.nav-fold.open > .nav-fold-btn .chev { transform: rotate(180deg); }
.nav-sub { display: none; margin: 2px 0 8px 22px !important; padding: 2px 0 2px 10px !important; border-left: 1px solid rgba(255,255,255,.18); }
.nav-fold.open > .nav-sub { display: block; }
.nav-sub .nav-item { font-size: 0.86rem; padding: 7px 10px; color: rgba(255,255,255,.78); }
.nav-sub .nav-item .ico { width: 17px; height: 17px; opacity: .85; }
.rail .nav-item.is-soon { color: rgba(255,255,255,.62); }
.rail .nav-item span { flex: 1; min-width: 0; }
.soon-tag { font-style: normal; font-size: 0.62rem; font-weight: 700; padding: 0 7px; border-radius: 999px; background: rgba(251, 191, 36, .2); color: #FDE68A; border: 1px solid rgba(251, 191, 36, .4); line-height: 1.7; }
.soon { max-width: 620px; margin: 30px auto; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 36px 28px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.soon-ico { width: 74px; height: 74px; border-radius: 22px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #7C3AED, #EC4899); box-shadow: 0 14px 28px -12px rgba(124, 58, 237, .8); }
.soon-ico .ico { width: 36px; height: 36px; stroke-width: 1.8; }
.soon-pill { font-size: 0.78rem; font-weight: 700; padding: 3px 12px; border-radius: 999px; background: var(--warn-wash); color: var(--warn); }
.soon h2 { font-family: var(--moul); font-weight: 400; font-size: 1.35rem; line-height: 1.9; }
.soon p { margin: 0; max-width: 480px; }
.soon-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }

/* ================= Sidebar v3 — consistent rows, clear hierarchy ================= */
.rail { --row: 38px; --nav-fg: rgba(255,255,255,.78); --nav-fg-strong: #fff; --nav-muted: rgba(255,255,255,.5); --nav-hover: rgba(255,255,255,.07); --nav-active: rgba(255,255,255,.14); --nav-accent: #C4B5FD; }
.rail .brand { padding: 16px 16px 14px; gap: 12px; }
.rail .brand-logo { width: 40px; height: 40px; border-radius: 10px; }
.rail .brand-text strong { font-size: 0.78rem; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rail-tools { padding: 12px 12px 4px; display: flex; flex-direction: column; gap: 8px; }
.rail .rail-back { margin: 0; height: 36px; padding: 0 10px; border-radius: 9px; font-size: 0.86rem; font-weight: 600; color: var(--nav-fg) !important; background: transparent; border: 1px solid rgba(255,255,255,.16); }
.rail .rail-back:hover { background: var(--nav-hover); color: #fff !important; }
.rail-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border-radius: 9px; background: rgba(0,0,0,.18); border: 1px solid rgba(255,255,255,.1); color: var(--nav-muted); }
.rail-search:focus-within { border-color: var(--nav-accent); background: rgba(0,0,0,.26); }
.rail-search .ico { width: 16px; height: 16px; }
.rail-search input { flex: 1; min-width: 0; border: 0; padding: 0; background: transparent; color: #fff; font-size: 0.84rem; outline: none; }
.rail-search input::placeholder { color: var(--nav-muted); }
.rail-search input::-webkit-search-cancel-button { filter: invert(1); opacity: .6; }
.rail-search kbd { font: 600 0.7rem/1 var(--font); padding: 3px 6px; border-radius: 5px; border: 1px solid rgba(255,255,255,.2); color: var(--nav-muted); }
.rail-search:focus-within kbd { display: none; }

.rail .rail-nav { flex: 1; overflow-y: auto; padding: 4px 10px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.rail-nav::-webkit-scrollbar { width: 6px; } .rail-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 3px; }
.rail-nav ul { list-style: none; margin: 0; padding: 0; }
.rail-nav .nav-section { margin-top: 14px; }
.rail-nav .nav-section:first-child { margin-top: 6px; }
.rail-nav .nav-group { display: block; margin: 0 0 4px; padding: 0 10px; font-size: 0.72rem; font-weight: 600; color: var(--nav-muted); letter-spacing: .3px; }
.rail-nav .nav-group::after { display: none; }

/* one row style for links and group headers */
.rail-nav .nav-item, .rail-nav .nav-fold-btn {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: var(--row); margin: 1px 0; padding: 0 10px;
  border: 0; border-radius: 9px; background: transparent; color: var(--nav-fg); font: inherit; font-size: 0.88rem; font-weight: 500; line-height: 1.35;
  text-decoration: none; cursor: pointer; text-align: left; box-shadow: none; transition: background .12s, color .12s; }
.rail-nav .nav-item:hover, .rail-nav .nav-fold-btn:hover { background: var(--nav-hover); color: var(--nav-fg-strong); }
.rail-nav .nav-item .ico, .rail-nav .nav-fold-btn > .ico:first-child { width: 18px; height: 18px; flex: none; stroke-width: 1.8; opacity: .9; }
.rail-nav .nav-item span, .rail-nav .nav-fold-btn span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-nav .nav-fold-btn .chev { width: 16px; height: 16px; opacity: .55; transform: rotate(-90deg); transition: transform .18s; }
.rail-nav .nav-fold.open > .nav-fold-btn .chev, .rail-nav .nav-fold.searching > .nav-fold-btn .chev { transform: rotate(0); }
.rail-nav .nav-fold.open > .nav-fold-btn { color: var(--nav-fg-strong); }
.rail-nav .nav-fold:has(.nav-item[aria-current]) > .nav-fold-btn { color: var(--nav-fg-strong); font-weight: 600; }

/* active page: soft fill + accent bar, no outline box */
.rail-nav .nav-item[aria-current] { background: var(--nav-active); color: #fff; font-weight: 600; border: 0; box-shadow: none; }
.rail-nav .nav-item[aria-current]::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--nav-accent); }
.rail-nav .nav-item:focus-visible, .rail-nav .nav-fold-btn:focus-visible { outline: 2px solid var(--nav-accent); outline-offset: -2px; }

/* sub items: text only, aligned under the parent label, guide line */
.rail-nav .nav-sub { display: none; margin: 0 0 4px 19px !important; padding: 2px 0 2px 12px !important; border-left: 1px solid rgba(255,255,255,.14); }
.rail-nav .nav-fold.open > .nav-sub, .rail-nav .nav-fold.searching > .nav-sub { display: block; }
.rail-nav .nav-sub .nav-item { min-height: 34px; font-size: 0.85rem; padding: 0 10px; color: rgba(255,255,255,.7); }
.rail-nav .nav-sub .nav-item[aria-current]::before { left: -13px; }
/* 🎨 colour menu pictures: a little bigger than line icons, a soft glow on hover / current page */
.rail-nav .ico-img, .nav-sub .ico-img { width: 26px; height: 26px; flex: none; object-fit: contain; opacity: 1; filter: drop-shadow(0 2px 3px rgba(15, 8, 50, .35)); transition: transform .15s; user-select: none; }
.rail-nav .nav-sub .ico-img { width: 21px; height: 21px; }
.rail-nav .ico-img.ico-logo { border-radius: 50%; background: #fff; padding: 1px; object-fit: cover; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .55); filter: none; }
.rail-nav .nav-sub .nav-item:has(.ico-img) { gap: 9px; padding-left: 6px; }
.rail-nav .nav-item:hover .ico-img, .rail-nav .nav-fold-btn:hover .ico-img, .rail-nav .nav-item[aria-current] .ico-img { transform: scale(1.12); }
.rail-nav .nav-item.is-soon .ico-img { filter: grayscale(.5) drop-shadow(0 2px 3px rgba(15, 8, 50, .35)); opacity: .75; }
@media (prefers-reduced-motion: reduce) { .rail-nav .ico-img { transition: none; } }

.rail-nav .nav-item.is-soon { color: rgba(255,255,255,.55); }
.rail-nav .soon-tag { flex: none; font-style: normal; font-size: 0.62rem; font-weight: 600; line-height: 1; padding: 4px 7px; border-radius: 6px; background: rgba(255,255,255,.08); color: rgba(253, 230, 138, .85); border: 0; }
.rail-nav .nav-empty { padding: 16px 10px; font-size: 0.84rem; color: var(--nav-muted); text-align: center; }
.rail-nav [hidden] { display: none !important; }

.rail .rail-foot { padding: 12px; gap: 10px; border-top: 1px solid rgba(255,255,255,.1); }
.rail .rail-btn { height: 34px; border-radius: 9px; }

/* ================= Student portal ================= */
.pill-ok { background: var(--gB-bg); color: var(--gB); border-color: transparent; }
.hl-student { height: 38px; border-radius: 10px; background: linear-gradient(135deg, #F59E0B, #F97316); color: #fff; font-weight: 700; box-shadow: 0 6px 14px -8px rgba(249, 115, 22, .9); }
.hl-student:hover { filter: brightness(1.05); }
.student-shell { min-height: 100vh; }
.stp { max-width: 1200px; margin: 0 auto; padding: 16px 20px 30px; display: flex; flex-direction: column; min-height: 100vh; }
.st-menu[hidden], .sg-setup[hidden], .sg-play[hidden] { display: none !important; }
.st-svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.st-top { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 12px 18px 14px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.st-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.st-brand img { width: 40px; height: 40px; border-radius: 10px; background: #fff; object-fit: contain; box-shadow: var(--shadow); }
.st-brand strong { display: block; font-family: var(--moul); font-weight: 400; font-size: 0.9rem; line-height: 1.7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-brand small { display: block; font-size: 0.76rem; color: var(--muted); }
.st-actions { display: flex; align-items: center; gap: 10px; }
.st-round { position: relative; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.st-round .st-svg { width: 18px; height: 18px; }
.st-round i { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #EF4444; color: #fff; font-style: normal; font-size: 0.66rem; font-weight: 800; display: grid; place-items: center; }
.st-me { position: relative; }
.st-avatar { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #3B82F6; background: linear-gradient(135deg, #FBBF24, #F97316); color: #fff; font-weight: 800; cursor: pointer; }
.st-menu { position: absolute; right: 0; top: 48px; z-index: 30; min-width: 200px; padding: 10px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 18px 36px -12px rgba(15, 23, 42, .35); display: flex; flex-direction: column; gap: 2px; }
.st-menu b { padding: 2px 8px 0; } .st-menu small { padding: 0 8px 6px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.st-menu button { font: inherit; display: flex; align-items: center; gap: 8px; padding: 8px; border: 0; border-radius: 8px; background: none; color: var(--ink); cursor: pointer; text-align: left; font-size: 0.88rem; }
.st-menu button:hover { background: var(--paper); } .st-menu button.danger { color: var(--gF); }
.st-menu .st-svg { width: 16px; height: 16px; }
.st-main { flex: 1; padding-top: 18px; display: flex; flex-direction: column; gap: 16px; }
.st-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 18px 20px; }
.st-card h2 { font-size: 1.02rem; margin-bottom: 12px; }
.st-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.st-card-head h2 { margin: 0; } .st-card-head .search { max-width: 320px; }
.st-hero { position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 24px 28px; border-radius: 20px; color: #fff;
  background: linear-gradient(90deg, rgba(40, 18, 40, .78), rgba(40, 18, 40, .2)), var(--photo) var(--photo-pos) / cover no-repeat, #1E1B4B; box-shadow: 0 18px 36px -22px rgba(30, 27, 75, .9); }
.st-hero h1 { font-family: var(--moul); font-weight: 400; font-size: 1.6rem; line-height: 1.9; margin: 0; }
.st-hero p { margin: 0; opacity: .92; } .st-hi { font-weight: 700; }
.st-quote { margin-top: 10px !important; padding: 6px 12px; border-left: 3px solid #FBBF24; background: rgba(251, 191, 36, .14); border-radius: 0 10px 10px 0; font-size: 0.86rem; color: #FDE68A; }
.st-anns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.st-ann { border: 1px solid var(--line); border-left: 4px solid #3B82F6; border-radius: 12px; padding: 10px 14px; }
.st-ann-urgent { border-left-color: #EF4444; } .st-ann-exam { border-left-color: #8B5CF6; } .st-ann-event { border-left-color: #10B981; }
.st-ann div { display: flex; justify-content: space-between; font-size: 0.76rem; color: var(--muted); font-weight: 600; }
.st-ann h3 { font-size: 0.95rem; margin: 2px 0; } .st-ann p { margin: 0; font-size: 0.86rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.st-class { max-width: 400px; border-radius: 18px; overflow: hidden; border: 2px solid #8B5CF6; background: var(--panel); box-shadow: 0 16px 30px -18px rgba(139, 92, 246, .9); }
.st-class header { position: relative; display: flex; justify-content: center; align-items: center; padding: 14px 16px; color: #fff;
  background: repeating-linear-gradient(135deg, rgba(255,255,255,.08) 0 10px, transparent 10px 20px), linear-gradient(135deg, #0EA5E9, #1D4ED8); }
.st-class h2 { font-family: var(--moul); font-weight: 400; font-size: 1.1rem; line-height: 1.8; margin: 0; }
.st-mine { position: absolute; right: 10px; top: 10px; font-size: 0.72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: linear-gradient(135deg, #F59E0B, #F97316); }
.st-subjects { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 16px; }
.st-subj { font: inherit; font-weight: 700; font-size: 0.9rem; padding: 9px 8px; border-radius: 10px; border: 1.5px solid color-mix(in srgb, var(--c) 45%, var(--line)); background: none; color: var(--c); cursor: pointer; }
.st-subj:hover, .st-subj.on { background: color-mix(in srgb, var(--c) 12%, transparent); border-color: var(--c); }
.st-hint { color: var(--muted); }
.st-vids { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.st-vid { font: inherit; text-align: left; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--panel); color: var(--ink); cursor: pointer; box-shadow: var(--shadow); }
.st-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: linear-gradient(135deg, #1E3A8A, #7C3AED); }
.st-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-thumb i { position: absolute; inset: 0; margin: auto; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: rgba(220, 38, 38, .92); color: #fff; font-style: normal; }
.st-vid-t { display: block; padding: 10px 12px; } .st-vid-t b { display: block; font-size: 0.9rem; } .st-vid-t small { color: var(--muted); font-size: 0.76rem; }
.st-empty { text-align: center; padding: 30px 10px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.st-empty span { font-size: 2.2rem; } .st-empty b { color: var(--ink); }
.st-soon { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 20px; }
.st-soon-e { font-size: 3rem; } .st-soon h2 { font-family: var(--moul); font-weight: 400; font-size: 1.25rem; line-height: 1.9; margin: 0; } .st-soon p { max-width: 460px; margin: 0 0 8px; color: var(--muted); }
.st-game { max-width: 640px; }
.sg-head p { margin: 0 0 12px; color: var(--muted); }
.sg-setup { display: flex; flex-direction: column; gap: 12px; }
.sg-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; } .sg-pick > span { width: 60px; font-weight: 700; color: var(--muted); }
.sg-pick label input { position: absolute; opacity: 0; }
.sg-pick label b { display: inline-block; padding: 8px 14px; border-radius: 12px; border: 1.5px solid var(--line); cursor: pointer; font-size: 0.9rem; }
.sg-pick label input:checked + b { border-color: #7C3AED; background: color-mix(in srgb, #7C3AED 12%, var(--panel)); color: #7C3AED; }
.sg-pick label input:focus-visible + b { outline: 2px solid #7C3AED; }
.sg-start { align-self: flex-start; font-size: 1rem; padding: 10px 22px; }
.sg-best { margin: 0; font-weight: 700; color: #B45309; }
.sg-progress { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; } .sg-progress span { display: block; height: 100%; background: linear-gradient(90deg, #7C3AED, #EC4899); transition: width .3s; }
.sg-count { margin: 8px 0 0; color: var(--muted); font-size: 0.85rem; }
.sg-q { text-align: center; font-size: 2.4rem; font-weight: 800; margin: 14px 0 18px; color: #4C1D95; }
[data-theme="dark"] .sg-q { color: #DDD6FE; }
.sg-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sg-opt { font: inherit; font-size: 1.5rem; font-weight: 800; padding: 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; transition: transform .1s; }
.sg-opt:hover:not(:disabled) { border-color: #7C3AED; transform: translateY(-2px); }
.sg-opt.ok { background: var(--gB-bg); border-color: #16A34A; color: #15803D; }
.sg-opt.bad { background: var(--gF-bg); border-color: #DC2626; color: #B91C1C; }
.sg-end { text-align: center; padding: 10px; } .sg-stars { font-size: 2.6rem; letter-spacing: 6px; } .sg-end h3 { font-size: 1.3rem; margin: 6px 0; }
.st-foot { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 28px; font-size: 0.8rem; color: var(--muted); }
.st-foot img { width: 22px; height: 22px; border-radius: 6px; }

/* ---------- Score result list (two columns) ---------- */
.rs-paper { font-size: 13px; }
.rs-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.rs-org { text-align: center; }
.rs-org p, .rs-motto p { margin: 0; font-family: var(--moul); color: #1D4ED8; font-size: 13.5px; line-height: 1.9; }
.rs-motto p { font-size: 15.5px; }
.rs-motto { text-align: center; padding-right: 10px; }
.rs-org span { display: block; margin-top: 2px; font-size: 13px; color: #111; }
.rs-title, .rs-sub { margin: 14px 0 0; text-align: center; font-family: var(--moul); font-weight: 400; font-size: 15.5px; line-height: 1.9; color: #111; }
.rs-sub { margin: 0 0 10px; font-size: 14.5px; }
.rs-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.rs-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rs-table th { background: #FBCFE8; font-weight: 700; padding: 4px 3px; border: 1px solid #94A3B8; white-space: nowrap; font-size: 11.5px; }
.rs-table td { border: 1px solid #CBD5E1; padding: 3px 4px; text-align: center; white-space: nowrap; }
.rs-table td.rs-name { text-align: left; }
.rs-table td.rs-rank { color: #DC2626; font-weight: 700; }
.rs-table td.rs-avg { font-weight: 700; }
.rs-table tr.no-score td { color: #94A3B8; }
.rs-g { font-weight: 600; }
.rs-g.rs-A { color: #15803D; } .rs-g.rs-B { color: #15803D; }
.rs-g.rs-C { background: #DCFCE7; color: #166534; } .rs-g.rs-D { background: #DBEAFE; color: #1E3A8A; }
.rs-g.rs-E { background: #FEF9C3; color: #854D0E; } .rs-g.rs-F { color: #DC2626; }
.rs-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; }
.rs-legend .rs-g { padding: 1px 8px; border-radius: 6px; border: 1px solid #E2E8F0; font-size: 12px; }
/* Semester / year list — styled after the school's own table */
.rs-table.rs-3 { font-size: 13px; border: 1.5px solid #1F3864; }
.rs-table.rs-3 th { background: #BDD7EE; color: #1F3864; font-weight: 800; font-size: 12.5px; line-height: 1.15; padding: 5px 4px; border: 1px solid #4472C4; white-space: normal; }
.rs-table.rs-3 td { border: 1px solid #8EA9DB; padding: 4px 5px; }
.rs-table.rs-3 th:nth-child(2) { white-space: nowrap; }
.rs-table.rs-3 td.rs-avg { font-weight: 400; }
.rs-table.rs-3 td.rs-rank { color: #E00000; font-weight: 800; }
.rs-table.rs-3 .rs-g.rs-A { background: #E4DFEC; color: #5B2C83; }
.rs-table.rs-3 .rs-g.rs-B { background: #DDEBF7; color: #1F4E79; }
.rs-table.rs-3 .rs-g.rs-C { background: #E2EFDA; color: #375623; }
.rs-table.rs-3 .rs-g.rs-D { background: #FCE4D6; color: #833C0B; }
.rs-table.rs-3 .rs-g.rs-E { background: #FFF2CC; color: #7F6000; }
.rs-table.rs-3 .rs-g.rs-F { background: #FFE1E1; color: #C00000; }
@media print { .rs-g, .rs-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
@media screen and (max-width: 760px) { .rs-cols { grid-template-columns: 1fr; } }
@media print {
  .rs-cols { grid-template-columns: 1fr 1fr !important; gap: 3mm; }
  .rs-paper { font-size: 11px; }
  .rs-table, .rs-table.rs-3 { font-size: 10.5px; } .rs-table th, .rs-table.rs-3 th { font-size: 9.5px; padding: 2px; white-space: normal; } .rs-table td { padding: 2px 3px; } .rs-table td.rs-name { white-space: normal; }
  .rs-org p { font-size: 11.5px; } .rs-motto p { font-size: 13px; } .rs-title { font-size: 14px; } .rs-sub { font-size: 13px; }
}

/* ---------- Study report ---------- */
.sr-bar { flex-wrap: wrap; gap: 8px; }
.sr-kind { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.sr-kind button { font: inherit; font-weight: 700; font-size: 0.86rem; border: 0; background: none; padding: 7px 14px; border-radius: 9px; cursor: pointer; color: var(--muted); }
.sr-kind button[aria-pressed="true"] { background: #9333EA; color: #fff; }
.sr-bar select { font: inherit; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.sr-save { font-size: 0.82rem; color: #B45309; } .sr-save.ok { color: #15803D; }
.sr-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.sr-kpis > div { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 12px 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.sr-kpis span { grid-row: span 2; font-size: 1.4rem; } .sr-kpis b { font-size: 1.3rem; } .sr-kpis small { color: var(--muted); font-size: 0.78rem; }
.sr-kpis em { font-style: normal; font-weight: 700; margin-left: 4px; } .sr-kpis em.up { color: #15803D; } .sr-kpis em.down { color: #DC2626; } .sr-kpis em.eq { color: var(--muted); }
.sr-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.sr-wrap:not(:has(.sr-side)) { grid-template-columns: 1fr; }
.sr-scroll { padding: 12px; border-radius: 16px; background: #CBD5E1; overflow: hidden; }
.sr-zoom { transform-origin: 0 0; margin: 0 auto; }
.sr-zoom > .sr-page { box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.sr-side { position: sticky; top: 84px; max-height: calc(100vh - 110px); overflow-y: auto; padding: 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.sr-side h3 { margin: 0; } .sr-side .field { margin: 0; } .sr-side textarea { width: 100%; font: inherit; line-height: 1.6; }
.sr-drops { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; } .sr-drops label { display: flex; flex-direction: column; font-size: 0.8rem; color: var(--muted); }
.sr-drops input { font: inherit; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
@media (max-width: 1100px) { .sr-wrap { grid-template-columns: 1fr; } .sr-side { position: static; max-height: none; } .sr-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- Teaching plans ---------- */
.pl-hero { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding: 20px 24px; border-radius: 22px; margin-bottom: 14px; color: #fff;
  background: radial-gradient(circle at 90% 10%, rgba(255,255,255,.2), transparent 40%), linear-gradient(135deg, #D97706, #DB2777 60%, #7C3AED); }
.pl-hero h2 { margin: 0; font-family: var(--moul); font-weight: 400; font-size: 1.3rem; line-height: 1.9; }
.pl-hero p { margin: 0; opacity: .9; font-size: 0.88rem; }
.pl-hero .btn-primary { background: #fff !important; color: #BE185D !important; border-color: #fff !important; }
.pl-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.pl-kpi { font: inherit; color: var(--ink); display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; padding: 12px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.pl-kpi span { grid-row: span 2; font-size: 1.5rem; } .pl-kpi b { font-size: 1.4rem; } .pl-kpi small { color: var(--muted); }
.pl-kpi[aria-pressed="true"] { border: 2px solid #DB2777; }
.pl-filter { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.pl-filter select { font: inherit; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.pl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pl-card { position: relative; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); transition: transform .15s, box-shadow .15s; }
.pl-card:hover { transform: translateY(-2px); box-shadow: 0 16px 28px -22px rgba(15,23,42,.5); }
.pl-card > a { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; color: var(--ink); text-decoration: none; }
.pl-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; } .pl-card-top small { color: var(--muted); font-size: 0.78rem; }
.pl-card h3 { margin: 0; font-size: 1rem; } .pl-card p { margin: 0; font-size: 0.82rem; color: var(--muted); }
.pl-steps { display: flex; gap: 4px; } .pl-steps i { flex: 1; height: 6px; border-radius: 999px; background: var(--paper); } .pl-steps i.on { background: linear-gradient(90deg, #F59E0B, #DB2777); }
.pl-card-acts { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 4px; }
.pl-st { font-size: 0.74rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.pl-st.draft { background: #F1F5F9; color: #475569; } .pl-st.sub { background: #DBEAFE; color: #1D4ED8; } .pl-st.ok { background: #DCFCE7; color: #15803D; }
.pl-bar { position: sticky; top: 72px; z-index: 4; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 12px; border-radius: 16px; background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--line); }
.pl-save { font-size: 0.82rem; color: #B45309; } .pl-save.ok { color: #15803D; }
.pl-sp { flex: 1; }
.pl-pane { display: none; gap: 2px; padding: 3px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); }
.pl-pane button { font: inherit; font-size: 0.82rem; font-weight: 700; border: 0; background: none; padding: 6px 10px; border-radius: 9px; cursor: pointer; color: var(--muted); }
.pl-pane button[aria-pressed="true"] { background: #DB2777; color: #fff; }
.pl-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.pl-form { display: flex; flex-direction: column; gap: 12px; }
.pl-box { padding: 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.pl-box h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 1rem; }
.pl-box h3 span { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, #F59E0B, #DB2777); color: #fff; font-size: 0.84rem; }
.pl-box h3 small { margin-left: auto; font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.pl-box .field { margin-bottom: 6px; }
.pl-box textarea { width: 100%; font: inherit; line-height: 1.6; resize: vertical; }
.pl-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: -2px 0 10px; }
.pl-chips button { font: inherit; font-size: 0.76rem; padding: 3px 10px; border-radius: 999px; border: 1px dashed color-mix(in srgb, #DB2777 45%, var(--line)); background: color-mix(in srgb, #DB2777 6%, var(--panel)); color: #9D174D; cursor: pointer; }
[data-theme="dark"] .pl-chips button { color: #F9A8D4; }
.pl-stepbox { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; background: var(--paper); }
.pl-stepbox summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.92rem; list-style: none; }
.pl-stepbox summary::-webkit-details-marker { display: none; }
.pl-stepbox summary::before { content: '▸'; color: #DB2777; transition: transform .15s; } .pl-stepbox[open] summary::before { transform: rotate(90deg); }
.pl-stepbox summary b { color: #BE185D; }
.pl-min { margin-left: auto; display: flex; align-items: center; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.pl-min input { width: 56px; font: inherit; padding: 3px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.pl-dot { width: 8px; height: 8px; border-radius: 50%; background: #22C55E; }
.pl-fill { margin: 8px 0 4px; font-size: 0.82rem; }
.pl-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.pl-prev { position: sticky; top: 140px; max-height: calc(100vh - 160px); overflow: auto; padding: 4px; border-radius: 14px; background: #CBD5E1; }
.pl-scale { transform-origin: 0 0; }
.pl-scale .pl-page { box-shadow: 0 2px 10px rgba(0,0,0,.15); }
@media (max-width: 1500px) { .pl-3 { grid-template-columns: 1fr; } }
@media (max-width: 980px) {
  .pl-pane { display: inline-flex; }
  .pl-edit { grid-template-columns: 1fr; }
  .pl-edit.pane-form .pl-prev { display: none; } .pl-edit.pane-prev .pl-form { display: none; }
  .pl-prev { position: static; max-height: none; }
  .pl-bar { top: 60px; }
}

/* ---------- Lessons ---------- */
.ls-top { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.ls-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ls-kpi { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 14px 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.ls-kpi span { grid-row: span 2; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; background: #EEF2FF; }
.ls-kpi.ok span { background: #DCFCE7; } .ls-kpi.todo span { background: #F3E8FF; } .ls-kpi.month span { background: #FEF3C7; }
.ls-kpi b { font-size: 1.5rem; line-height: 1.2; } .ls-kpi small { color: var(--muted); font-size: 0.82rem; }
.ls-charts { display: grid; grid-template-columns: 1.3fr 1.3fr .8fr; gap: 12px; margin-bottom: 16px; }
.ls-charts.alt { grid-template-columns: .7fr 1.15fr 1.15fr; }
.ls-chart-card { padding: 14px 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); min-width: 0; }
.ls-chart-card h3 { margin: 0 0 8px; font-size: 0.95rem; }
.ls-chart-card.center { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ls-chart { width: 100%; height: auto; max-height: 220px; display: block; }
.ls-nochart { text-align: center; padding: 40px 0; }
.ls-legend { margin: 6px 0 0; font-size: 0.8rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.ls-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; } .ls-legend i.d { background: #10B981; } .ls-legend i.t { background: #A78BFA; }
.ls-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.ls-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); position: relative; overflow: hidden; }
.ls-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 6px; background: linear-gradient(90deg, var(--a), var(--b)); }
.ls-card header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ls-card h3 { margin: 0; font-family: var(--moul); font-weight: 400; font-size: 1.1rem; line-height: 1.9; color: var(--b); }
.ls-card header small { color: var(--muted); font-size: 0.8rem; }
.ls-ring { --p: 0; width: 60px; height: 60px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(closest-side, var(--panel) 76%, transparent 77% 100%), conic-gradient(var(--b) calc(var(--p) * 1%), color-mix(in srgb, var(--b) 14%, var(--paper)) 0); }
.ls-ring b { font-size: 0.86rem; color: var(--b); }
.ls-count { margin: 0; font-size: 0.84rem; color: var(--muted); }
.ls-subs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ls-subs li { display: grid; grid-template-columns: 10px minmax(0, 110px) 1fr auto; gap: 8px; align-items: center; font-size: 0.84rem; }
.ls-subs .dot { width: 10px; height: 10px; border-radius: 50%; }
.ls-subs b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-subs small { color: var(--muted); font-size: 0.76rem; }
.ls-bar { height: 7px; border-radius: 999px; background: var(--paper); overflow: hidden; } .ls-bar i { display: block; height: 100%; border-radius: inherit; }
.ls-card footer { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; padding-top: 6px; }
.ls-btn { text-align: center; padding: 9px; border-radius: 12px; font-weight: 700; font-size: 0.86rem; text-decoration: none; border: 1.5px solid color-mix(in srgb, var(--b) 40%, transparent); color: var(--b); }
.ls-btn.solid { background: linear-gradient(135deg, var(--a), var(--b)); color: #fff; border-color: transparent; }
.ls-bar-top select { font: inherit; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.ls-list { display: flex; flex-direction: column; gap: 8px; }
.ls-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--c); }
.ls-item.is-done { background: color-mix(in srgb, #10B981 6%, var(--panel)); }
.ls-check { width: 30px; height: 30px; flex: none; border-radius: 9px; border: 2px solid var(--c); background: var(--panel); color: #fff; font-weight: 900; cursor: pointer; margin-top: 2px; }
.ls-item.is-done .ls-check { background: #10B981; border-color: #10B981; }
.ls-check:disabled { cursor: default; opacity: .6; }
.ls-main { flex: 1; min-width: 0; }
.ls-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.76rem; }
.ls-line span { padding: 1px 8px; border-radius: 999px; background: var(--paper); color: var(--muted); }
.ls-line .ls-sub { background: color-mix(in srgb, var(--c) 14%, var(--panel)); color: var(--c); font-weight: 700; }
.ls-main h4 { margin: 4px 0 2px; font-size: 0.98rem; }
.ls-item.is-done h4 { color: var(--muted); }
.ls-main p { margin: 0 0 2px; font-size: 0.84rem; color: var(--muted); white-space: pre-wrap; }
.ls-main small { font-size: 0.76rem; color: var(--muted); }
.ls-acts { display: flex; gap: 4px; }
@media (max-width: 1100px) { .ls-charts, .ls-charts.alt { grid-template-columns: 1fr 1fr; } .ls-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .ls-charts, .ls-charts.alt { grid-template-columns: 1fr; } }
@media print { .ls-bar-top, .ls-acts { display: none !important; } }

/* ---------- Library ---------- */
.lb-hero { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 22px 24px; border-radius: 22px; color: #fff; margin-bottom: 14px;
  background: radial-gradient(circle at 85% 20%, rgba(255,255,255,.18), transparent 40%), linear-gradient(135deg, #7C3AED, #4F46E5 55%, #0EA5E9); box-shadow: 0 20px 40px -26px #4F46E5; }
.lb-hero h2 { margin: 0; font-family: var(--moul); font-weight: 400; font-size: 1.35rem; line-height: 1.9; }
.lb-hero p { margin: 2px 0 0; opacity: .88; font-size: 0.9rem; }
.lb-hero-act { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.lb-search { display: flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 14px; background: rgba(255,255,255,.95); color: #334155; min-width: 280px; }
.lb-search input { border: 0; background: none; font: inherit; padding: 11px 0; flex: 1; outline: none; color: #0F172A; }
.lb-hero .btn-primary { background: #fff !important; color: #4F46E5 !important; border-color: #fff !important; }
.lb-cats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.lb-cats button { font: inherit; font-weight: 700; font-size: 0.88rem; display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
.lb-cats button span { font-size: 1.1rem; }
.lb-cats button em { font-style: normal; font-size: 0.74rem; padding: 1px 8px; border-radius: 999px; background: var(--paper); color: var(--muted); }
.lb-cats button[aria-pressed="true"] { background: var(--a); border-color: var(--a); color: #fff; box-shadow: 0 10px 20px -14px var(--a); }
.lb-cats button[aria-pressed="true"] em { background: rgba(255,255,255,.25); color: #fff; }
.lb-filter { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.lb-filter select { font: inherit; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.lb-note { margin-left: auto; font-size: 0.82rem; color: #1D4ED8; background: #EFF6FF; padding: 4px 12px; border-radius: 999px; }
.lb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.lb-card { display: flex; flex-direction: column; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; transition: transform .15s, box-shadow .15s; }
.lb-card:hover { transform: translateY(-3px); box-shadow: 0 18px 30px -22px rgba(15,23,42,.5); }
.lb-open { border: 0; padding: 16px 16px 0; background: linear-gradient(180deg, var(--paper), var(--panel)); cursor: pointer; }
.lb-cover { position: relative; aspect-ratio: 3 / 4; border-radius: 6px 12px 12px 6px; overflow: hidden; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; padding: 18px 14px 18px 24px; text-align: center; color: #fff;
  background: radial-gradient(circle at 70% 15%, rgba(255,255,255,.25), transparent 45%), linear-gradient(160deg, var(--a), var(--b)); box-shadow: 0 12px 22px -12px rgba(15,23,42,.55), inset -6px 0 10px -6px rgba(0,0,0,.25); }
.lb-cover.has-img { padding: 0; background: #E2E8F0; }
.lb-cover img { width: 100%; height: 100%; object-fit: cover; }
.lb-spine { position: absolute; left: 0; top: 0; bottom: 0; width: 12px; background: linear-gradient(90deg, rgba(0,0,0,.28), rgba(255,255,255,.12)); }
.lb-ico { font-size: 2rem; filter: drop-shadow(0 3px 4px rgba(0,0,0,.25)); }
.lb-cover b { font-family: var(--moul); font-weight: 400; font-size: 0.95rem; line-height: 1.9; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 2px 4px rgba(0,0,0,.2); }
.lb-cover small { font-size: 0.76rem; opacity: .9; }
.lb-info { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; flex: 1; }
.lb-cat { align-self: flex-start; font-size: 0.72rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; color: var(--a); background: color-mix(in srgb, var(--a) 12%, var(--panel)); }
.lb-info h3 { margin: 2px 0 0; font-size: 0.98rem; line-height: 1.5; }
.lb-info small { color: var(--muted); font-size: 0.8rem; }
.lb-info p { margin: 2px 0; font-size: 0.8rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lb-tags { display: flex; flex-wrap: wrap; gap: 4px; } .lb-tags span { font-size: 0.72rem; padding: 1px 8px; border-radius: 8px; background: var(--paper); border: 1px solid var(--line); }
.lb-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.72rem; color: var(--muted); }
.lb-acts { display: flex; gap: 6px; margin-top: auto; padding-top: 8px; } .lb-acts .btn-primary { flex: 1; justify-content: center; }
.lb-empty { text-align: center; padding: 50px 10px; border: 1.5px dashed var(--line); border-radius: 18px; color: var(--muted); } .lb-empty span { font-size: 2.6rem; }
.lb-form { display: grid; grid-template-columns: 170px 1fr; gap: 18px; }
.lb-form-cover { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.lb-form-cover #lbPrev { width: 100%; }
.lb-reader { position: fixed; inset: 0; z-index: 210; display: flex; flex-direction: column; background: #0F172A; }
.lb-reader header { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; color: #fff; }
.lb-reader header > div { display: flex; gap: 8px; align-items: center; }
.lb-reader iframe { flex: 1; border: 0; background: #fff; }
.lb-x { width: 40px; height: 40px; border-radius: 50%; border: 0; background: #EF4444; color: #fff; font-size: 1.1rem; cursor: pointer; }
.st-books { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
@media (max-width: 640px) { .lb-form { grid-template-columns: 1fr; } .lb-form-cover #lbPrev { max-width: 160px; } .lb-search { min-width: 0; flex: 1; } .lb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }

/* ---------- Score management ---------- */
.sa-head { display: flex; gap: 20px; align-items: center; padding: 18px 20px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.sa-ring, .sa-mini { --p: 0; flex: none; display: grid; place-content: center; text-align: center; border-radius: 50%;
  background: radial-gradient(closest-side, var(--panel) 78%, transparent 79% 100%), conic-gradient(#7C3AED calc(var(--p) * 1%), color-mix(in srgb, #7C3AED 14%, var(--paper)) 0); }
.sa-ring { width: 112px; height: 112px; } .sa-ring b { font-size: 1.6rem; color: #6D28D9; line-height: 1.1; } .sa-ring small { font-size: 0.72rem; color: var(--muted); }
.sa-mini { width: 54px; height: 54px; } .sa-mini b { font-size: 0.84rem; color: #6D28D9; }
[data-theme="dark"] .sa-ring b, [data-theme="dark"] .sa-mini b { color: #C4B5FD; }
.sa-head-main { flex: 1; min-width: 280px; display: flex; flex-direction: column; gap: 10px; }
.sa-ctrl { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sa-ctrl label { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.88rem; }
.sa-ctrl select { font: inherit; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
.sa-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); }
.sa-seg button { font: inherit; font-size: 0.8rem; font-weight: 600; border: 0; background: none; padding: 6px 10px; border-radius: 9px; cursor: pointer; color: var(--muted); }
.sa-seg button[aria-pressed="true"] { background: #7C3AED; color: #fff; }
.sa-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.86rem; font-weight: 700; align-items: center; }
.sa-stats .done { color: #15803D; } .sa-stats .part { color: #B45309; } .sa-stats .none { color: #DC2626; } .sa-stats .lock { color: #475569; }
.sa-due { padding: 3px 10px; border-radius: 999px; background: var(--paper); font-weight: 600; }
.sa-due.soon { background: #FEF3C7; color: #92400E; } .sa-due.late { background: #FEE2E2; color: #B91C1C; }
.sa-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.sa-rel { display: flex; flex-direction: column; gap: 10px; padding: 14px 18px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 16px; }
.sa-rel.manual { border-color: color-mix(in srgb, #7C3AED 40%, var(--line)); }
.sa-rel-top { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.sa-rel-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 260px; }
.sa-rel-main small { color: var(--muted); font-size: 0.8rem; }
.sa-rel-now { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.sa-rel-list { display: flex; flex-wrap: wrap; gap: 2px 4px; align-items: center; }
.sa-rel-list .sa-chip { cursor: default; }
.sa-rel .sa-seg { flex-wrap: wrap; }
.sa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.sa-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); }
.sa-card header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sa-card h3 { margin: 0; font-family: var(--moul); font-weight: 400; font-size: 1.05rem; line-height: 1.9; }
.sa-card header small { color: var(--muted); font-size: 0.8rem; }
.sa-bar { height: 8px; border-radius: 999px; background: color-mix(in srgb, #7C3AED 12%, var(--paper)); overflow: hidden; }
.sa-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8B5CF6, #22C55E); }
.sa-bar.sm { height: 6px; }
.sa-card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sa-card li { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--paper); border-left: 4px solid #F87171; cursor: pointer; }
.sa-card li:hover, .sa-card li:focus-visible { outline: 2px solid #7C3AED; outline-offset: -2px; }
.sa-card li.sa-s-done { border-left-color: #22C55E; } .sa-card li.sa-s-part { border-left-color: #F59E0B; }
.sa-sub b { display: block; font-size: 0.9rem; } .sa-sub small, .sa-prog small { display: block; color: var(--muted); font-size: 0.74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-sub .sa-warn { color: #DC2626; font-weight: 700; }
.sa-prog { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sa-pill { font-size: 0.74rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.sa-pill.done { background: #DCFCE7; color: #15803D; } .sa-pill.part { background: #FEF3C7; color: #B45309; } .sa-pill.none { background: #FEE2E2; color: #DC2626; }
.sa-card footer { display: flex; gap: 6px; margin-top: auto; }
.sa-teach td { vertical-align: middle; }
.sa-chip { font: inherit; font-size: 0.76rem; margin: 2px; padding: 3px 9px; border-radius: 9px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; }
.sa-chip.sa-s-empty { border-color: #FCA5A5; } .sa-chip.sa-s-part { border-color: #FCD34D; }
.sa-dues { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
@media (max-width: 600px) { .sa-grid { grid-template-columns: 1fr; } .sa-card li { grid-template-columns: 1fr auto; } .sa-prog { grid-column: 1 / -1; } }

/* ---------- Classes ---------- */
.cl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 10px; }
.cl-sel { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.9rem; }
.cl-sel select { font: inherit; font-weight: 600; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); min-width: 200px; }
.cl-sum { margin-left: auto; color: var(--muted); font-size: 0.88rem; }
@media (max-width: 600px) { .cl-sel { flex-wrap: wrap; width: 100%; min-width: 0; } .cl-sel select { min-width: 0; flex: 1 1 180px; max-width: 100%; } .cl-sum { margin-left: 0; } }
.cl-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.cl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.cl-card { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 20px; border-radius: 24px; color: #fff; min-height: 330px;
  background: linear-gradient(150deg, var(--a), var(--b)); box-shadow: 0 20px 36px -24px var(--b); }
.cl-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.cl-top h3 { margin: 0; font-family: var(--moul); font-weight: 400; font-size: 1.35rem; line-height: 1.9; text-shadow: 0 2px 6px rgba(0,0,0,.2); }
.cl-badge { flex: none; padding: 5px 12px; border-radius: 999px; background: #fff; color: var(--b); font-weight: 800; font-size: 0.84rem; box-shadow: 0 4px 10px rgba(0,0,0,.12); }
.cl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cl-chips span { padding: 4px 10px; border-radius: 10px; background: #fff; color: #334155; font-size: 0.8rem; font-weight: 700; }
.cl-teacher { margin: 0; font-size: 0.88rem; text-shadow: 0 1px 2px rgba(0, 0, 0, .28); }
.cl-stats { display: grid; grid-template-columns: repeat(3, 1fr); padding: 12px 8px; border-radius: 18px; background: #fff; color: #334155; text-align: center; }
.cl-stats small { display: block; font-size: 0.78rem; font-weight: 700; }
.cl-stats b { font-size: 1.4rem; } .cl-stats .m { color: #D97706; } .cl-stats .b { color: #2563EB; } .cl-stats .g { color: #DB2777; }
.cl-chips { align-items: center; }
.cl-tools { margin-left: auto; display: flex; gap: 4px; }
.cl-mini { width: 30px; height: 30px; border: 0; border-radius: 9px; background: rgba(255,255,255,.92); color: #334155; cursor: pointer; display: inline-grid; place-items: center; font-size: .95rem; line-height: 1; }
.cl-mini:hover { background: #fff; transform: translateY(-1px); }
.cl-card footer { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.35); display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 6px; }
.cl-btn { font: inherit; font-weight: 700; font-size: 0.84rem; padding: 9px 4px; border-radius: 12px; border: 1.5px solid transparent; background: #fff; color: var(--b); cursor: pointer; white-space: nowrap; }
.cl-btn.green { color: #047857; border-color: #6EE7B7; } .cl-btn.blue { color: #1D4ED8; border-color: #93C5FD; }
.cl-btn:hover { transform: translateY(-1px); }
/* 🌙 Class cards in dark mode: a little less glare, a clear edge and readable chips. */
[data-theme="dark"] .cl-card { box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 14px 32px rgba(0, 0, 0, .45); }
[data-theme="dark"] .cl-card footer { border-top-color: rgba(255, 255, 255, .28); }
[data-theme="dark"] .cl-chips span, [data-theme="dark"] .cl-stats, [data-theme="dark"] .cl-btn, [data-theme="dark"] .crs-next, [data-theme="dark"] .crs-row > .crs-st { color-scheme: light; }
.cl-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px; max-height: 300px; overflow-y: auto; padding: 8px; border: 1px solid var(--line); border-radius: 12px; }
.pr-sum { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 16px; }
.pr-card { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.pr-card b { flex: 1 0 100%; }
.pr-card .up { color: #15803D; font-weight: 700; } .pr-card .stay { color: #DC2626; font-weight: 700; } .pr-card .none { color: var(--muted); }
.pr-card small { margin-left: auto; color: var(--muted); }
.pr-class { margin-bottom: 18px; } .pr-class h3 { margin: 0 0 8px; }
.pr-pill { padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.pr-pill.up { background: #DCFCE7; color: #15803D; } .pr-pill.stay { background: #FEE2E2; color: #DC2626; } .pr-pill.none { background: var(--paper); color: var(--muted); }
@media print { .pr-sum { display: none; } }

/* ---------- Teacher management ---------- */
.sf { padding: 22px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); }
.sf-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.sf-head h2 { margin: 0; font-family: var(--moul); font-weight: 400; font-size: 1.25rem; line-height: 1.9; color: #4338CA; }
[data-theme="dark"] .sf-head h2 { color: #A5B4FC; }
.sf-head p { margin: 2px 0 0; color: var(--muted); font-size: 0.88rem; }
.sf-head-act { display: flex; gap: 8px; flex-wrap: wrap; }
.sf-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.sf-tile { font: inherit; color: var(--ink); display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 16px; cursor: pointer; text-align: left;
  background: linear-gradient(135deg, color-mix(in srgb, var(--t) 10%, var(--panel)), var(--panel)); border: 1px solid color-mix(in srgb, var(--t) 25%, var(--line)); transition: transform .15s, box-shadow .15s, border-color .15s; }
.sf-tile:hover { transform: translateY(-2px); box-shadow: 0 14px 26px -18px var(--t); }
.sf-tile[aria-pressed="true"] { border: 2px solid var(--t); box-shadow: 0 0 0 3px color-mix(in srgb, var(--t) 18%, transparent); }
.sf-tile small { display: block; font-size: 0.8rem; font-weight: 700; color: var(--muted); line-height: 1.5; }
.sf-tile b { font-size: 1.6rem; line-height: 1.2; }
.sf-tile em { font-style: normal; font-size: 0.8rem; color: var(--muted); font-weight: 700; }
.sf-tile > span:last-child { min-width: 0; }
.sf-ti { width: 56px; height: 56px; flex: none; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(180deg, #FFFFFF, #F1F5F9); box-shadow: 0 6px 14px -8px rgba(15,23,42,.4), inset 0 0 0 1px rgba(15,23,42,.05); }
.sf-ti .si { width: 44px; height: 44px; }
.sf-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); }
.sf-search { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.sf-search input { flex: 1; border: 0; background: none; font: inherit; padding: 10px 0; color: var(--ink); outline: none; }
.sf-bar select { font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.sf-look { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.sf-look button { font: inherit; font-weight: 700; font-size: 0.86rem; padding: 7px 14px; border: 0; border-radius: 9px; background: none; color: var(--muted); cursor: pointer; }
.sf-look button[aria-pressed="true"] { background: #3B82F6; color: #fff; }
.sf-shown { margin: 10px 2px; font-size: 0.84rem; }
.sf-table thead th { white-space: nowrap; }
.sf-name { display: flex; align-items: center; gap: 10px; }
.sf-name small { display: block; color: var(--muted); font-size: 0.76rem; }
.sf-av { width: 64px; height: 64px; flex: none; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(180deg, #EEF2FF, #E0E7FF); }
.sf-av .si { width: 52px; height: 52px; }
.sf-av.sm { width: 40px; height: 40px; } .sf-av.sm .si { width: 32px; height: 32px; }
.sf-role { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; background: #E0E7FF; color: #3730A3; white-space: nowrap; }
.sf-role.r-owner { background: #FEF3C7; color: #92400E; } .sf-role.r-admin { background: #DBEAFE; color: #1E40AF; } .sf-role.r-teacher { background: #DCFCE7; color: #166534; }
.sf-teach { display: flex; flex-wrap: wrap; gap: 4px; }
td.sf-teach { display: table-cell; }
.sf-chip { display: inline-block; margin: 1px 2px; padding: 2px 8px; border-radius: 8px; background: var(--paper); border: 1px solid var(--line); font-size: 0.76rem; }
.sf-chip b { color: #4F46E5; }
.sf-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.sf-card { display: flex; gap: 12px; padding: 14px; border-radius: 18px; background: var(--paper); border: 1px solid var(--line); }
.sf-card.is-off { opacity: .55; }
.sf-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.sf-card-main > b { font-size: 1rem; }
.sf-card-main small { color: var(--muted); font-size: 0.8rem; }
.sf-home { font-size: 0.78rem; font-weight: 700; color: #047857; }
.sf-empty { text-align: center; padding: 40px 10px; color: var(--muted); border: 1px dashed var(--line); border-radius: 16px; }
.sf-empty .si { width: 56px; height: 56px; opacity: .6; }
.sf-guide { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.sf-guide > div { display: grid; grid-template-columns: 56px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 10px; border-radius: 14px; border: 1px solid var(--line); }
.sf-guide .sf-ti { grid-row: span 2; }
.sf-guide small { color: var(--muted); font-size: 0.78rem; }
[data-theme="dark"] .sf-ti, [data-theme="dark"] .sf-av { background: rgba(255,255,255,.9); }
@media (max-width: 1200px) { .sf-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .sf { padding: 14px; } .sf-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .sf-tile { padding: 10px; gap: 8px; } .sf-ti { width: 44px; height: 44px; } .sf-ti .si { width: 34px; height: 34px; } }

/* ---------- Attendance ---------- */
.at-choose { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin: 14px 0 22px; }
.at-big { display: flex; flex-direction: column; gap: 6px; padding: 22px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: transform .15s, box-shadow .15s, border-color .15s; }
.at-big:hover { transform: translateY(-2px); border-color: #14B8A6; box-shadow: 0 16px 30px -20px rgba(13,148,136,.6); }
.at-big b { font-size: 1.15rem; margin-top: 8px; }
.at-big small { color: var(--muted); }
.at-ico { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font-size: 1.6rem; background: #EEF2FF; }
.at-big.staff .at-ico { background: #ECFEFF; }
.at-big.scan { background: linear-gradient(135deg, #0F766E, #14B8A6); color: #fff; border-color: transparent; }
.at-big.scan small { color: rgba(255,255,255,.85); }
.at-big.scan .at-ico { background: rgba(255,255,255,.18); }
.scn-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.scn-chip { font: inherit; display: flex; flex-direction: column; align-items: flex-start; padding: 6px 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.35); color: #fff; cursor: pointer; }
.scn-chip b { font-size: 0.82rem; } .scn-chip small { font-size: 0.72rem; opacity: .8; }
.scn-chip[aria-pressed="true"] { border: 2px solid #2DD4BF; background: rgba(20,184,166,.3); }
.at-ico.sm { width: 44px; height: 44px; font-size: 1.3rem; border-radius: 12px; background: #ECFDF5; flex: none; }
.at-row-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.at-row-head h3 { margin: 0; }
.at-row-head > div { display: flex; gap: 6px; }
.at-today { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.at-tcard { padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.at-tcard:hover { border-color: #14B8A6; }
.at-sess { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 8px; }
.at-sess span { display: flex; flex-direction: column; align-items: center; padding: 4px 2px; border-radius: 8px; background: var(--paper); font-size: 0.68rem; color: var(--muted); text-align: center; }
.at-sess span em { font-style: normal; font-weight: 700; font-size: 0.82rem; color: var(--ink); }
.at-sess span.done { background: #ECFDF5; color: #047857; }
.at-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.at-head h2 { margin: 0; font-size: 1.25rem; }
.at-counts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 4px 0 0; font-size: 0.86rem; color: var(--muted); }
.at-counts .p { color: #15803D; font-weight: 700; } .at-counts .l { color: #B45309; font-weight: 700; } .at-counts .e { color: #1D4ED8; font-weight: 700; } .at-counts .a { color: #DC2626; font-weight: 700; }
.at-save { color: #B45309; } .at-save.ok { color: #15803D; }
.at-panel { padding: 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.at-ctrl { display: flex; gap: 12px; flex-wrap: wrap; }
.at-ctrl .field { margin: 0; min-width: 200px; }
.at-now { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; background: #ECFDF5; border: 2px solid #34D399; }
.at-now b { display: block; color: #065F46; font-size: 1.02rem; }
.at-now small { color: #047857; }
.at-auto { margin-left: auto; color: #059669; font-weight: 700; font-size: 0.84rem; }
[data-theme="dark"] .at-now { background: rgba(16,185,129,.12); } [data-theme="dark"] .at-now b, [data-theme="dark"] .at-now small { color: #6EE7B7; }
.at-sessions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.at-sessions button { font: inherit; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; color: var(--muted); }
.at-sessions button b { display: block; font-size: 0.9rem; }
.at-sessions button small { font-size: 0.78rem; }
.at-sessions button[aria-pressed="true"] { border: 2px solid #34D399; background: #ECFDF5; color: #065F46; }
[data-theme="dark"] .at-sessions button[aria-pressed="true"] { background: rgba(16,185,129,.12); color: #6EE7B7; }
.at-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.at-cam { background: linear-gradient(135deg, #14B8A6, #0F766E) !important; border-color: transparent !important; padding: 12px 22px !important; font-size: 1rem !important; box-shadow: 0 12px 24px -12px rgba(13,148,136,.8); }
.at-sp { flex: 1; }
.at-filter { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.at-filter button { font: inherit; font-size: 0.8rem; border: 0; background: none; padding: 6px 10px; border-radius: 9px; cursor: pointer; color: var(--muted); }
.at-filter button[aria-pressed="true"] { background: var(--paper); color: var(--ink); font-weight: 700; }
#atSearch { font: inherit; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); min-width: 160px; }
.at-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.at-card { padding: 12px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid #F87171; display: flex; flex-direction: column; gap: 10px; }
.at-card.st-p { border-left-color: #22C55E; } .at-card.st-l { border-left-color: #F59E0B; } .at-card.st-e { border-left-color: #3B82F6; }
.at-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.at-who > div { flex: 1; min-width: 0; }
.at-who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-who small { color: var(--muted); font-size: 0.78rem; }
.at-av { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: #EEF2FF; color: #4F46E5; }
.at-pill { flex: none; font-size: 0.74rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.at-pill.p { background: #DCFCE7; color: #15803D; } .at-pill.l { background: #FEF3C7; color: #B45309; } .at-pill.e { background: #DBEAFE; color: #1D4ED8; } .at-pill.a { background: #FEE2E2; color: #DC2626; }
.at-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.at-btns button { font: inherit; font-size: 0.78rem; padding: 6px 2px; border-radius: 9px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; color: var(--muted); }
.at-btns button.p[aria-pressed="true"] { background: #22C55E; border-color: #22C55E; color: #fff; }
.at-btns button.l[aria-pressed="true"] { background: #F59E0B; border-color: #F59E0B; color: #fff; }
.at-btns button.e[aria-pressed="true"] { background: #3B82F6; border-color: #3B82F6; color: #fff; }
.at-btns button.a[aria-pressed="true"] { background: #EF4444; border-color: #EF4444; color: #fff; }
.at-srow { grid-template-columns: 1.4fr 1fr 1fr !important; }
.at-legend { font-size: 0.84rem; color: var(--muted); margin: 0 0 10px; }
.at-mark { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 6px; font-size: 0.74rem; font-weight: 800; }
.at-mark.p { background: #DCFCE7; color: #15803D; } .at-mark.l { background: #FEF3C7; color: #B45309; } .at-mark.e { background: #DBEAFE; color: #1D4ED8; } .at-mark.a { background: #FEE2E2; color: #DC2626; }
.at-report th, .at-report td { padding: 4px 3px !important; text-align: center; min-width: 26px; }
.at-report th a { color: inherit; text-decoration: none; display: block; line-height: 1.2; }
.at-report th small { display: block; font-size: 0.62rem; color: var(--muted); font-weight: 400; }
.at-report th.has { background: #ECFDF5; }
.at-report .sticky { position: sticky; left: 0; background: var(--panel); text-align: left !important; white-space: nowrap; padding: 4px 10px !important; z-index: 1; }
.at-report .tot { font-weight: 700; }
.at-report .tot.p { color: #15803D; } .at-report .tot.l { color: #B45309; } .at-report .tot.e { color: #1D4ED8; } .at-report .tot.a { color: #DC2626; }
.at-report td.tot.warn { background: #FEE2E2; }
.at-report td.rate.ok { color: #15803D; } .at-report td.rate.mid { color: #B45309; } .at-report td.rate.bad { color: #DC2626; background: #FEF2F2; }
.at-report tfoot td { font-weight: 700; background: #F1F5F9; }
.at-period th.mh { background: #F8FAFC; border-bottom: 2px solid var(--line); }
.at-period th.p { color: #15803D; } .at-period th.e { color: #1D4ED8; } .at-period th.a { color: #DC2626; }
.at-period td.g0, .at-period th.p { border-left: 2px solid var(--line) !important; }
.at-period td.a { color: #DC2626; font-weight: 700; }
.at-period th.mh a { color: inherit; text-decoration: none; }
.at-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 4px 0 10px; }
.at-kpis .kp { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; display: flex; flex-direction: column; }
.at-kpis b { font-size: 1.4rem; line-height: 1.3; }
.at-kpis span { font-size: .8rem; color: var(--muted); }
.at-kpis .p b { color: #15803D; } .at-kpis .e b { color: #1D4ED8; } .at-kpis .a b { color: #DC2626; } .at-kpis .r b { color: #7C3AED; }
.at-flag { margin: 0 0 8px; padding: 8px 12px; border-radius: 12px; background: #FEF2F2; color: #991B1B; font-size: .86rem; }
@media (max-width: 700px) { .at-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .at-kpis .kp:first-child { grid-column: 1 / -1; } }
@media (max-width: 760px) { .at-sessions { grid-template-columns: 1fr 1fr; } .at-sp { display: none; } }

/* full-screen scanner */
.scn { position: fixed; inset: 0; z-index: 200; background: #000; color: #fff; font-family: var(--font); }
.scn video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scn::after { content: ''; position: absolute; inset: 0; pointer-events: none; transition: background .3s; }
.scn.flash-ok::after { animation: scn-ok .6s; } .scn.flash-bad::after { animation: scn-bad .6s; }
@keyframes scn-ok { from { background: rgba(16,185,129,.35); } to { background: transparent; } }
@keyframes scn-bad { from { background: rgba(239,68,68,.35); } to { background: transparent; } }
.scn-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; gap: 10px; padding: 14px; background: linear-gradient(rgba(0,0,0,.6), transparent); z-index: 2; }
.scn-title b { display: block; font-size: 1.05rem; } .scn-title small { opacity: .8; }
.scn-right { display: flex; gap: 8px; align-items: flex-start; }
.scn-cam { font: inherit; font-size: 0.84rem; max-width: 200px; padding: 8px 12px; border-radius: 999px; border: 0; background: rgba(255,255,255,.18); color: #fff; }
.scn-cam option { color: #000; }
.scn-x { width: 46px; height: 46px; border-radius: 50%; border: 0; background: #EF4444; color: #fff; font-size: 1.2rem; cursor: pointer; }
.scn-frame { position: absolute; left: 50%; top: 46%; width: min(62vw, 360px); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 22px; z-index: 1;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.45);
  background: linear-gradient(#2DD4BF,#2DD4BF) left top/44px 5px, linear-gradient(#2DD4BF,#2DD4BF) left top/5px 44px, linear-gradient(#2DD4BF,#2DD4BF) right top/44px 5px, linear-gradient(#2DD4BF,#2DD4BF) right top/5px 44px,
    linear-gradient(#2DD4BF,#2DD4BF) left bottom/44px 5px, linear-gradient(#2DD4BF,#2DD4BF) left bottom/5px 44px, linear-gradient(#2DD4BF,#2DD4BF) right bottom/44px 5px, linear-gradient(#2DD4BF,#2DD4BF) right bottom/5px 44px;
  background-repeat: no-repeat; }
.scn-frame i { position: absolute; left: 6%; right: 6%; top: 8%; height: 2px; background: #5EEAD4; box-shadow: 0 0 14px #2DD4BF; animation: sl-sweep 2s ease-in-out infinite alternate; }
.scn-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px; z-index: 2; background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.scn-msg { padding: 13px; border-radius: 12px; text-align: center; font-weight: 700; background: rgba(255,255,255,.15); }
.scn-msg.ready, .scn-msg.ok { background: #10B981; } .scn-msg.bad { background: #EF4444; }
.scn-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 0.86rem; }
.scn-live::before { content: '●'; color: #34D399; margin-right: 6px; }
.scn-count b { display: inline-block; padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,.16); margin-left: 4px; }
.scn-count b.ok { background: rgba(16,185,129,.4); }
.scn-recent { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.8rem; opacity: .9; }
.scn-recent li { padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,.12); }
@media (prefers-reduced-motion: reduce) { .scn-frame i { animation: none; top: 50%; } .scn.flash-ok::after, .scn.flash-bad::after { animation: none; } }

/* ---------- Timetable ---------- */
.tt-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.tt-wrap.editing { grid-template-columns: minmax(0, 1fr) 300px; }
.tt-scroll { min-width: 0; padding: 12px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.tt-zoom { transform-origin: 0 0; }
.tt-zoom > .tt-sheet { box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.editing .tt-cell { cursor: pointer; position: relative; transition: background .12s; }
.editing .tt-cell:hover, .editing .tt-cell:focus-visible { background: rgba(124,58,237,.1); outline: 2px solid #7C3AED; outline-offset: -2px; }
.editing .tt-cell.tt-empty span { color: #94A3B8; font-size: 18px; }
.tt-cell.warn { box-shadow: inset 0 0 0 2px rgba(239,68,68,.75); }
.tt-cell.warn i { color: #EF4444; }
@media print { .tt-cell.warn { box-shadow: none; } .tt-cell i, .tt-alert, .tt-cell.tt-empty span { display: none !important; } }
.tt-cell i { position: absolute; top: 1px; right: 4px; font-style: normal; font-size: 12px; }
.editing .tt-ptime, .editing .tt-edit-off { cursor: pointer; border-bottom: 1px dashed #7C3AED; }
.tt-alert p { margin: 0 0 8px; } .tt-alert-act { display: flex; flex-wrap: wrap; gap: 8px; }
.tt-alert { margin-bottom: 12px; padding: 10px 14px; border-radius: 12px; background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; font-size: 0.9rem; }
[data-theme="dark"] .tt-alert { background: rgba(239,68,68,.12); color: #FCA5A5; border-color: rgba(239,68,68,.3); }
.tt-side { position: sticky; top: 84px; max-height: calc(100vh - 110px); overflow-y: auto; padding: 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.tt-side h3 { margin: 10px 0 0; font-size: 0.92rem; }
.tt-side h3:first-child { margin-top: 0; }
.tt-side .field { margin: 0; }
.tt-side .field-label { margin: 4px 0 0; font-size: 0.82rem; color: var(--muted); }
.tt-days { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.86rem; }
.tt-days label { display: flex; align-items: center; gap: 4px; }
.tt-periods { display: flex; flex-direction: column; gap: 6px; }
.tt-prow { display: grid; grid-template-columns: 72px 1fr 1fr 28px; gap: 4px; align-items: center; }
.tt-prow select, .tt-prow input { font: inherit; font-size: 0.84rem; padding: 5px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); min-width: 0; }
.tt-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 0.84rem; }
.tt-colors label { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tt-colors input { width: 28px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; flex: none; }
.tt-pop { position: absolute; z-index: 80; padding: 12px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 20px 50px -18px rgba(15,23,42,.45); }
.tt-pop header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tt-chips button { font: inherit; font-size: 0.86rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer; color: var(--c); background: color-mix(in srgb, var(--c) 10%, var(--panel)); border: 1.5px solid color-mix(in srgb, var(--c) 35%, transparent); }
.tt-chips button:hover { background: color-mix(in srgb, var(--c) 18%, var(--panel)); }
.tt-chips button.on { background: var(--c); color: #fff; }
.tt-chips button.busy { border-style: dashed; opacity: .75; }
.tt-pop-custom { display: flex; gap: 6px; margin-top: 10px; }
.tt-pop-custom input { flex: 1; min-width: 0; font: inherit; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
.tt-pop-foot { display: flex; justify-content: space-between; gap: 6px; margin-top: 8px; }
@media (max-width: 1100px) { .tt-wrap.editing { grid-template-columns: 1fr; } .tt-side { position: static; max-height: none; } }

/* ---------- Card designer ---------- */
#view:has(> .cd) { max-width: none; padding: 16px 18px 18px; }
#view:has(.ch) { max-width: none; padding-bottom: 16px; }
.cd { --cd-bg: #0F1221; --cd-panel: #161A2E; --cd-card: #1C2138; --cd-line: #2A3050; --cd-fg: #E2E8F0; --cd-mut: #8A93B2; --cd-acc: #6366F1;
  display: grid; grid-template-rows: auto 1fr auto; height: calc(100vh - 120px); min-height: 560px; border-radius: 18px; overflow: hidden; background: var(--cd-bg); color: var(--cd-fg); border: 1px solid var(--cd-line); }
.cd button { font: inherit; color: inherit; }
.cd-bar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 6px 10px; background: var(--cd-panel); border-bottom: 1px solid var(--cd-line); }
.cd-bar button { border: 0; background: none; padding: 7px 10px; border-radius: 8px; font-size: 0.85rem; cursor: pointer; color: var(--cd-fg); white-space: nowrap; }
.cd-bar button:hover:not(:disabled) { background: rgba(255,255,255,.06); }
.cd-bar button:disabled { opacity: .35; cursor: default; }
.cd-bar button.hot { color: #FDE68A; }
.cd-bar button.accent { color: #A5B4FC; font-weight: 700; }
.cd-bar button[aria-pressed="true"] { background: rgba(99,102,241,.25); color: #C7D2FE; }
.cd-sp { flex: 1; }
.cd .cd-name { display: flex; flex-direction: row; align-items: center; gap: 6px; margin: 0 6px; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--cd-line); background: var(--cd-card); }
.cd-name input { border: 0; background: none; color: var(--cd-fg); font: inherit; font-weight: 700; font-size: 0.88rem; width: 170px; outline: none; }
.cd-body { display: grid; grid-template-columns: 64px 250px minmax(0, 1fr) 270px; min-height: 0; }
.cd-tools { display: flex; flex-direction: column; gap: 2px; padding: 8px 6px; background: var(--cd-panel); border-right: 1px solid var(--cd-line); overflow-y: auto; }
.cd-tools button { border: 0; background: none; border-radius: 10px; padding: 8px 2px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; color: var(--cd-mut); }
.cd-tools button span { font-size: 1.05rem; font-weight: 800; line-height: 1.2; }
.cd-tools button small { font-size: 0.66rem; }
.cd-tools button[aria-pressed="true"] { background: var(--cd-acc); color: #fff; }
.cd-tools button:hover:not([aria-pressed="true"]) { background: rgba(255,255,255,.06); color: var(--cd-fg); }
.cd-panel, .cd-side { overflow-y: auto; padding: 12px; background: var(--cd-panel); }
.cd-panel { border-right: 1px solid var(--cd-line); display: flex; flex-direction: column; gap: 6px; }
.cd-side { border-left: 1px solid var(--cd-line); display: flex; flex-direction: column; gap: 14px; }
.cd h3 { margin: 8px 0 2px; font-size: 0.74rem; font-weight: 700; color: var(--cd-mut); letter-spacing: .04em; display: flex; justify-content: space-between; gap: 6px; }
.cd h3 span { color: var(--cd-fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-muted { margin: 2px 0; font-size: 0.78rem; color: var(--cd-mut); line-height: 1.6; }
.cd-add { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; border: 0; border-radius: 10px; background: var(--cd-acc); color: #fff !important; font-weight: 700; font-size: 0.88rem; cursor: pointer; }
.cd-add.ghost { background: var(--cd-card); border: 1px solid var(--cd-line); color: var(--cd-fg) !important; font-weight: 600; }
.cd-add.sm { padding: 7px; font-size: 0.8rem; }
.cd-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--cd-line); background: var(--cd-card); cursor: pointer; text-align: left; }
.cd-item span { width: 18px; color: var(--cd-mut); text-align: center; flex: none; }
.cd-item b { flex: 1; min-width: 0; font-weight: 500; font-size: 0.84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-item small { font-size: 0.7rem; color: var(--cd-mut); }
.cd-item.on, .cd-item:hover { border-color: var(--cd-acc); }
.cd-seg { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--cd-card); border: 1px solid var(--cd-line); }
.cd-seg.col { flex-direction: column; }
.cd-seg button { flex: 1; border: 0; background: none; border-radius: 8px; padding: 7px 6px; font-size: 0.8rem; cursor: pointer; color: var(--cd-mut); }
.cd-seg.sm button { padding: 5px 4px; }
.cd-seg button[aria-pressed="true"] { background: var(--cd-acc); color: #fff; }
.cd-sw { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cd-sw button, .cd-pick { aspect-ratio: 1; border-radius: 8px; border: 1px solid rgba(255,255,255,.18); cursor: pointer; position: relative; overflow: hidden; }
.cd-pick input { position: absolute; inset: -6px; width: 150%; height: 150%; opacity: 0; cursor: pointer; }
.cd-pick::after { content: '＋'; position: absolute; inset: 0; display: grid; place-items: center; color: #64748B; font-weight: 800; pointer-events: none; }
.cd-gr { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cd-gr button { height: 30px; border-radius: 8px; border: 1px solid rgba(255,255,255,.18); cursor: pointer; }
.cd-shapes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cd-shapes button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border-radius: 10px; border: 1px solid var(--cd-line); background: var(--cd-card); cursor: pointer; font-size: 0.78rem; }
.cd-shapes i { display: block; width: 40px; height: 28px; background: #818CF8; }
.cd-shapes button:hover { border-color: var(--cd-acc); }
.cd-fields { display: flex; flex-direction: column; gap: 6px; }
.cd-fields button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--cd-line); background: var(--cd-card); cursor: pointer; }
.cd-fields code { font-size: 0.76rem; color: #A5B4FC; }
.cd-fields small { color: var(--cd-mut); font-size: 0.74rem; }
.cd-fields button:hover { border-color: var(--cd-acc); }
.cd-row2, .cd-row4 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cd-row4 { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cd label { display: flex; flex-direction: column; gap: 3px; font-size: 0.72rem; color: var(--cd-mut); min-width: 0; }
.cd input[type=number], .cd select, .cd textarea { font: inherit; font-size: 0.84rem; color: var(--cd-fg); background: var(--cd-card); border: 1px solid var(--cd-line); border-radius: 8px; padding: 6px 8px; width: 100%; min-width: 0; }
.cd textarea { resize: vertical; line-height: 1.5; }
.cd input:focus, .cd select:focus, .cd textarea:focus { outline: 2px solid var(--cd-acc); outline-offset: 0; }
.cd-color input { width: 100%; height: 32px; padding: 2px; border-radius: 8px; border: 1px solid var(--cd-line); background: var(--cd-card); cursor: pointer; }
.cd input[type=range] { accent-color: var(--cd-acc); }
.cd-props { display: flex; flex-direction: column; gap: 8px; }
.cd-acts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.cd-acts button { border: 1px solid var(--cd-line); background: var(--cd-card); border-radius: 8px; padding: 7px 0; cursor: pointer; }
.cd-acts button:hover { border-color: var(--cd-acc); }
.cd-acts .bad:hover { border-color: #EF4444; background: rgba(239,68,68,.15); }
.cd-layers ul { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.cd-layers li { display: flex; align-items: center; border-radius: 8px; }
.cd-layers li.on { background: rgba(99,102,241,.22); }
.cd-layers li.off { opacity: .45; }
.cd-layers li button { border: 0; background: none; cursor: pointer; padding: 6px 6px; font-size: 0.8rem; }
.cd-layers li button:first-child { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; text-align: left; }
.cd-layers li button:first-child span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-layers li button:not(:first-child) { opacity: .55; font-size: 0.72rem; }
.cd-layers li:hover button:not(:first-child), .cd-layers li.on button:not(:first-child) { opacity: 1; }
.cd-layers i { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #60A5FA; }
.cd-layers i.k-image, .cd-layers i.k-photo { background: #F59E0B; } .cd-layers i.k-qr { background: #22C55E; } .cd-layers i.k-text { background: #A78BFA; }
.cd-stage-wrap { position: relative; overflow: auto; display: flex; padding: 30px 24px 60px;
  background: radial-gradient(circle at 50% 40%, #1A1F38, var(--cd-bg) 70%); }
.cd-stage { position: relative; margin: auto; flex: none; border-radius: 14px; box-shadow: 0 24px 60px -20px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.08); }
.cd-scale { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.cd-face { position: relative; overflow: hidden; border-radius: 12px; }
.cd-face .ce { position: absolute; box-sizing: border-box; }
.cd-face .ce-text { display: flex; flex-direction: column; white-space: pre-wrap; word-break: break-word; overflow: hidden; }
.cd-face .ce-photo { display: grid; place-items: center; align-content: center; overflow: hidden; background: #EEF2FF; color: #6366F1; font-size: 11px; }
.cd-face .ce-photo small { margin-top: -6px; }
.cd-face .ce-qr { background: #fff; padding: 4%; display: grid; place-items: center; }
.cd-face .ce-qr svg { width: 100%; height: 100%; }
.cd-scale:not(.preview) [data-el] { cursor: move; }
.cd-scale:not(.preview) [data-el]:hover { outline: 1px dashed rgba(99,102,241,.8); }
.cd-scale.grid .cd-face { background-image: linear-gradient(rgba(99,102,241,.18) 1px, transparent 1px), linear-gradient(90deg, rgba(99,102,241,.18) 1px, transparent 1px) !important; background-size: 10px 10px !important; }
.cd-scale.grid .cd-face { background-color: inherit; }
.cd-sel { position: absolute; outline: calc(1.5px * var(--z)) solid #6366F1; pointer-events: none; z-index: 5; }
.cd-sel i { position: absolute; width: calc(10px * var(--z)); height: calc(10px * var(--z)); background: #fff; border: calc(1.5px * var(--z)) solid #6366F1; border-radius: 3px; pointer-events: auto; }
.cd-sel i[data-h=nw] { left: calc(-5px * var(--z)); top: calc(-5px * var(--z)); cursor: nwse-resize; }
.cd-sel i[data-h=ne] { right: calc(-5px * var(--z)); top: calc(-5px * var(--z)); cursor: nesw-resize; }
.cd-sel i[data-h=sw] { left: calc(-5px * var(--z)); bottom: calc(-5px * var(--z)); cursor: nesw-resize; }
.cd-sel i[data-h=se] { right: calc(-5px * var(--z)); bottom: calc(-5px * var(--z)); cursor: nwse-resize; }
.cd-size { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); padding: 5px 14px; border-radius: 999px; background: #fff; color: #1E293B; font-size: 0.82rem; font-weight: 600; box-shadow: 0 6px 18px rgba(0,0,0,.3); white-space: nowrap; }
.cd-size span { margin-left: 8px; padding-left: 8px; border-left: 1px solid #CBD5E1; color: #64748B; font-weight: 500; font-family: ui-monospace, monospace; }
.cd-foot { display: flex; align-items: center; gap: 8px; padding: 6px 14px; background: var(--cd-panel); border-top: 1px solid var(--cd-line); font-size: 0.78rem; color: var(--cd-mut); }
.cd-foot button { border: 0; background: none; cursor: pointer; font-size: 1rem; padding: 0 6px; color: var(--cd-fg); }
.cd-foot input { width: 150px; }
.cd-foot-hint { margin-left: auto; }
.cd-dh { margin: 6px 0 8px; font-size: 0.9rem; }
.cd-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 10px; }
.cd-tpl { position: relative; }
.cd-tpl > button:first-child { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; font: inherit; color: var(--ink); }
.cd-tpl > button:first-child:hover { border-color: #7C3AED; }
.cd-tpl small { color: var(--muted); font-size: 0.74rem; }
.cd-tpl-thumb { width: 150px; height: 190px; display: grid; place-items: center; overflow: hidden; }
.cd-tpl-thumb > div { transform-origin: center; }
.cd-tpl-thumb .cd-face { box-shadow: 0 6px 16px rgba(15,23,42,.18); }
.cd-tpl-del { position: absolute; top: 6px; right: 6px; border: 0; border-radius: 8px; background: var(--panel); padding: 4px 7px; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
@media (max-width: 1500px) { .cd-body { grid-template-columns: 58px 210px minmax(0, 1fr) 236px; } .cd-foot-hint { display: none; } .cd-bar button { padding: 7px 7px; } .cd-name input { width: 130px; } }
@media (max-width: 900px) {
  #view:has(> .cd) { padding: 8px 8px 90px; }
  .cd { height: auto; }
  .cd-body { grid-template-columns: 1fr; }
  .cd-tools { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--cd-line); }
  .cd-tools button { min-width: 58px; }
  .cd-panel, .cd-side { border: 0; max-height: none; }
  .cd-stage-wrap { order: -1; min-height: 480px; }
}

/* QR codes page */
.qr-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.qr-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.qr-tabs button { font: inherit; font-weight: 700; font-size: 0.9rem; padding: 8px 16px; border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; display: flex; align-items: center; gap: 8px; }
.qr-tabs button span { font-size: 0.75rem; padding: 1px 8px; border-radius: 999px; background: var(--paper); }
.qr-tabs button[aria-selected="true"] { background: linear-gradient(135deg, #7C3AED, #4F46E5); color: #fff; }
.qr-tabs button[aria-selected="true"] span { background: rgba(255,255,255,.22); }
.qr-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.qr-tools select, .qr-tools input { font: inherit; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); min-width: 170px; }
.qr-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; margin-bottom: 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.qr-bar p { margin: 0; }
.qr-bar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.qr-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 16px 14px 14px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.qr-img { width: 148px; height: 148px; display: grid; place-items: center; border-radius: 14px; background: #fff; border: 1px solid #EDE9FE; }
.qr-img svg { width: 132px; height: 132px; }
.qr-card.is-empty .qr-img { background: var(--paper); border-style: dashed; color: var(--muted); gap: 2px; align-content: center; }
.qr-card.is-empty .qr-img span { font-size: 1.8rem; }
.qr-who { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; width: 100%; }
.qr-who b { font-size: 0.98rem; }
.qr-who small { color: var(--muted); }
.qr-code { margin-top: 4px; font: 700 0.95rem/1.4 ui-monospace, monospace; letter-spacing: 1px; color: #5B21B6; background: #F5F3FF; padding: 2px 10px; border-radius: 8px; }
[data-theme="dark"] .qr-code { color: #DDD6FE; background: rgba(139,92,246,.2); }
.qr-mail { font-size: 0.78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.qr-who .check-line { margin-top: 4px; font-size: 0.84rem; }
.qr-look { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.qr-look button { font: inherit; font-size: 0.84rem; font-weight: 600; border: 0; background: none; padding: 6px 12px; border-radius: 9px; color: var(--muted); cursor: pointer; }
.qr-look button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(15,23,42,.1); }
.qr-bar-info { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.qr-tpl { display: flex; align-items: center; gap: 6px; font-size: 0.86rem; font-weight: 600; }
.qr-tpl select { font: inherit; font-weight: 500; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); max-width: 220px; }
.qr-grid.cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.qr-card.is-full { padding: 14px 12px 12px; gap: 8px; }
.qr-thumb { overflow: hidden; border-radius: 10px; box-shadow: 0 10px 24px -14px rgba(15,23,42,.55), 0 0 0 1px rgba(15,23,42,.06); flex: none; }
.qr-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 100%; }
.qr-acts .btn { justify-content: center; }

/* student sign-in: QR scan */
.choice-row { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 4px 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--paper); }
.dialog-student { width: min(460px, calc(100vw - 24px)); }
.sl-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 14px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); }
.sl-switch button { font: inherit; font-size: 0.86rem; font-weight: 700; padding: 9px 6px; border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; }
.sl-switch button[aria-selected="true"] { background: var(--panel); color: #6D28D9; box-shadow: 0 1px 2px rgba(15,23,42,.08), 0 4px 12px -6px rgba(109,40,217,.5); }
[data-theme="dark"] .sl-switch button[aria-selected="true"] { color: #C4B5FD; }
.sl-cam { position: relative; aspect-ratio: 4 / 3; border-radius: 18px; overflow: hidden; background: radial-gradient(circle at 50% 40%, #3B2A6B, #140C2B); }
.sl-cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.sl-cam.sl-live video { opacity: 1; }
.sl-frame { position: absolute; inset: 16% 24%; border-radius: 18px; pointer-events: none;
  background: linear-gradient(#fff, #fff) left top / 28px 4px, linear-gradient(#fff, #fff) left top / 4px 28px, linear-gradient(#fff, #fff) right top / 28px 4px, linear-gradient(#fff, #fff) right top / 4px 28px,
    linear-gradient(#fff, #fff) left bottom / 28px 4px, linear-gradient(#fff, #fff) left bottom / 4px 28px, linear-gradient(#fff, #fff) right bottom / 28px 4px, linear-gradient(#fff, #fff) right bottom / 4px 28px;
  background-repeat: no-repeat; box-shadow: 0 0 0 999px rgba(10, 6, 25, .35); }
.sl-cam.sl-live .sl-frame::after { content: ''; position: absolute; left: 8%; right: 8%; height: 2px; top: 10%; background: #A78BFA; box-shadow: 0 0 12px #A78BFA; animation: sl-sweep 2s ease-in-out infinite alternate; }
@keyframes sl-sweep { to { top: 88%; } }
.sl-cam-idle { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: rgba(255,255,255,.85); gap: 2px; }
.sl-cam-idle span { font-size: 2.2rem; } .sl-cam-idle p { margin: 0; font-size: 0.86rem; }
.sl-cam.sl-live .sl-cam-idle { display: none; }
.sl-msg { min-height: 1.5em; margin: 10px 0 6px; text-align: center; font-size: 0.86rem; color: var(--muted); }
.sl-msg.bad { color: #DC2626; }
.sl-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sl-actions .btn { justify-content: center; }
.sl-qr-mode .dialog-foot [type=submit] { display: none; }
@media (prefers-reduced-motion: reduce) { .sl-cam.sl-live .sl-frame::after { animation: none; top: 50%; } }

/* student portal v2 — calmer nav, hero stats, explore cards */
.st-tabs { grid-column: 1 / -1; display: flex; gap: 4px; margin-top: 6px; padding: 5px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); }
.st-tab { flex: 1 1 0; min-width: 0; font: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 9px 6px 8px; border: 0; border-radius: 12px; background: transparent;
  color: var(--muted); font-size: 0.8rem; font-weight: 700; line-height: 1.35; text-align: center; cursor: pointer; transition: background .15s, color .15s; }
.st-tab-ico { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--t); color: var(--c); transition: background .15s, color .15s; }
.st-tab-ico .st-svg { width: 17px; height: 17px; }
.st-tab:hover { background: var(--panel); color: var(--ink); }
.st-tab[aria-selected="true"] { background: var(--panel); color: var(--c); box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 6px 16px -8px color-mix(in srgb, var(--c) 55%, transparent); }
.st-tab[aria-selected="true"] .st-tab-ico { background: linear-gradient(140deg, color-mix(in srgb, var(--c) 70%, #fff), var(--c)); color: #fff; }
.st-tab:focus-visible { outline: 2px solid var(--c); outline-offset: 1px; }
[data-theme="dark"] .st-tab-ico { background: color-mix(in srgb, var(--c) 20%, var(--panel)); }

.st-hero { padding: 28px 30px; min-height: 210px; }
.st-hero-txt { min-width: 0; }
.st-hi { font-size: 0.9rem; letter-spacing: .02em; }
.st-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.st-chips > span { padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22); backdrop-filter: blur(6px); font-size: 0.84rem; font-weight: 600; }
.st-quote { margin-top: 14px !important; max-width: 560px; }
.st-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; border-radius: 16px; overflow: hidden; flex: none; min-width: 330px;
  background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.25); backdrop-filter: blur(10px); }
.st-stats div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 10px; background: rgba(20, 12, 30, .38); }
.st-stats b { font-size: 1.45rem; line-height: 1.3; color: #FDE68A; }
.st-stats small { font-size: 0.74rem; opacity: .9; white-space: nowrap; }

.st-home { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.st-explore h2, .st-news h2 { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; }
.st-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.st-q:first-child { grid-column: span 2; flex-direction: row; align-items: center; gap: 14px; padding: 18px; }
.st-q:first-child .st-q-ico { width: 58px; height: 58px; margin: 0; border-radius: 16px; flex: none; }
.st-q:first-child .st-q-ico .st-svg { width: 28px; height: 28px; }
.st-q:first-child b { display: block; font-size: 1.1rem; }
.st-q-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-q { position: relative; font: inherit; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 14px 13px; text-align: left; border-radius: 16px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--c) 18%, var(--line)); background: linear-gradient(160deg, var(--t), var(--panel) 70%); transition: transform .15s, box-shadow .15s, border-color .15s; }
.st-q-ico { width: 44px; height: 44px; margin-bottom: 8px; border-radius: 13px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, color-mix(in srgb, var(--c) 65%, #fff), var(--c)); box-shadow: 0 8px 14px -8px var(--c), inset 0 1px 0 rgba(255,255,255,.45); }
.st-q-ico .st-svg { width: 22px; height: 22px; }
.st-q b { font-size: 0.92rem; color: var(--ink); }
.st-q small { font-size: 0.76rem; color: var(--muted); line-height: 1.5; }
.st-q em { position: absolute; top: 12px; right: 12px; font-style: normal; font-size: 0.68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--paper); color: var(--muted); border: 1px solid var(--line); }
.st-q:hover { transform: translateY(-3px); border-color: var(--c); box-shadow: 0 14px 24px -16px var(--c); }
.st-q.is-soon .st-q-ico { filter: saturate(.75); }
[data-theme="dark"] .st-q { background: linear-gradient(160deg, color-mix(in srgb, var(--c) 14%, var(--panel)), var(--panel) 70%); }
.st-news .st-anns { grid-template-columns: 1fr; gap: 10px; }
.st-new { font-size: 0.72rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #FEE2E2; color: #B91C1C; }
.st-empty-sm { padding: 26px 10px; border: 1.5px dashed var(--line); border-radius: 14px; }
.st-empty-sm span { font-size: 1.9rem; } .st-empty-sm p { margin: 0; font-size: 0.82rem; }
@media (prefers-reduced-motion: reduce) { .st-q, .st-tab { transition: none; } .st-q:hover { transform: none; } }
@media (max-width: 900px) {
  .stp { padding: 10px 10px 24px; }
  .st-top { padding: 10px 12px; }
  .st-tabs { overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
  .st-tabs::-webkit-scrollbar { display: none; }
  .st-tab { flex: none; min-width: 78px; }
  .st-home { grid-template-columns: 1fr; }
  .st-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-q:last-child:nth-child(even) { grid-column: span 2; flex-direction: row; align-items: center; gap: 14px; }
  .st-q:last-child:nth-child(even) .st-q-ico { margin: 0; flex: none; }
  .st-hero { flex-direction: column; align-items: stretch; }
  .st-stats { width: 100%; }
  .st-anns { grid-template-columns: 1fr; }
  .st-hero { padding: 20px 18px; } .st-hero h1 { font-size: 1.3rem; }
  .st-class { max-width: none; }
  .sg-q { font-size: 2rem; }
}

/* ---------- Mobile ---------- */
.menu-btn, .rail-close { display: none; }
.top-back { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-weight: 700; font-size: 0.86rem; text-decoration: none; transition: border-color .15s, color .15s; }
.top-back:hover { border-color: #7C3AED; color: #6D28D9; }
.top-back svg { width: 16px; height: 16px; }
.topbar { justify-content: flex-start; } .topbar h1 { margin-right: auto; }
@media (max-width: 900px) { .top-back span { display: none; } .top-back { padding: 7px 9px; } }
@media (prefers-reduced-motion: reduce) { .rail { transition: none !important; } }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .rail { display: flex !important; position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; width: min(300px, 86vw); height: 100dvh;
    transform: translateX(-105%); transition: transform .25s ease; box-shadow: 0 0 40px rgba(0,0,0,.35); overflow-y: auto; visibility: hidden; }
  .menu-open .rail { transform: none; visibility: visible; }
  .app-shell.menu-open .rail { display: flex !important; }
  .topbar h1 { flex: 1; }
  .rail-close { display: grid; place-items: center; position: absolute; top: 12px; right: 10px; z-index: 2; width: 34px; height: 34px; border: 0; border-radius: 10px;
    background: rgba(255,255,255,.12); color: #fff; font-size: 1rem; cursor: pointer; }
  .rail .brand { padding-right: 52px; }
  .rail-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(15, 10, 30, .5); backdrop-filter: blur(2px); }
  .rail-scrim[hidden] { display: none; }
  .menu-btn { display: grid !important; flex: none; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .topbar h1 { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .pill-demo { display: none; }
  .c-no, .c-g { width: 36px; padding: 0 6px !important; }
  .c-score { width: 84px; }
  .c-grade { width: 52px; }
  .score-grid td, .score-grid th { padding-left: 6px; padding-right: 6px; }
  .year-pick span { display: none; }
  #view { padding: 14px 14px 96px; }
  .bottombar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
    background: var(--panel); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .bottombar a { display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 0.72rem; color: var(--muted); text-decoration: none; padding: 5px 2px; border-radius: 8px; }
  .bottombar a[aria-current] { color: var(--red); background: var(--red-wash); }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat-progress { grid-column: span 2; }
  .form-grid, .field-row { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .toolbar .field.inline { flex: 1 1 100%; justify-content: space-between; }
  .toolbar .field.inline select { flex: 1; max-width: 70%; }
  .toolbar-actions { margin-left: 0; }
  .paper { padding: 16px; }
  .grid-wrap { max-width: none; }
}


@media (max-width: 1600px) {
  .clock-pill { display: none; }
}
@media (max-width: 1100px) {
  .kpis { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .topbar { padding: 10px 14px; }
  .topbar h1 { font-size: 1.05rem; }
  .round-btn { width: 36px; height: 36px; flex: none; }
  .topbar-tools { gap: 6px; }
  .year-pick select { max-width: 128px; padding: 5px 10px; }
  .hero { padding: 20px; border-radius: 18px; }
  .hero-date { font-size: 1.15rem; }
  .rings { width: 100%; justify-content: space-between; gap: 8px; }
  .ring { width: 74px; height: 74px; }
  .ring-in { width: 60px; height: 60px; }
  .ring-in b { font-size: 1rem; }
  .ring-in small { font-size: 0.58rem; }
  .tiles { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .tile { padding: 12px 4px 10px; font-size: 0.72rem; border-radius: 14px; }
  .tile-ico { width: 46px; height: 46px; border-radius: 12px; }
  .tile-ico .ti { width: 34px; height: 34px; }
  .panel { padding: 16px; }
  .kpi { padding: 12px; }
  .kpi b { font-size: 1.1rem; }
  .bottombar { background: var(--panel); }
  .bottombar a[aria-current] { color: var(--red); background: var(--red-wash); }
}
@media (max-width: 420px) { .rings .ring:nth-child(n) { width: 68px; height: 68px; } .ring-in { width: 55px; height: 55px; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Print: only the paper ---------- */
@page { size: A4 portrait; margin: 12mm; }
@page wide { size: A4 landscape; margin: 10mm; }
@media print {
  body.print-overview #view > .view-host > *:not(#dBody), body.print-overview #dBody > *:not(.overview), body.print-overview .no-print { display: none !important; }
  body.print-overview .bc, body.print-overview .gc, body.print-overview .donut, body.print-overview .vbar-col span, body.print-overview .tag, body.print-overview .class-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.print-overview .ov-grid3 { grid-template-columns: 1fr 1fr 1fr; } body.print-overview .ov-grid2 { grid-template-columns: 2fr 1fr; }
  body { background: #fff; font-size: 12px; }
  .rail, .topbar, .bottombar, .toolbar, .no-print, #toasts, .hint { display: none !important; }
  .app-shell { display: block; }
  #view { padding: 0; max-width: none; }
  .paper { border: 0; padding: 0; max-width: none; overflow: visible; }
  .paper.landscape { page: wide; }
  .result-table { font-size: 10.5px; }
  .result-table th { background: #EEE !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .result-table tr { break-inside: avoid; }
}

/* ---- Honour roll (តារាងកិត្តិយស) ---- */
.hr-wrap { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 18px; align-items: start; }
.hr-side { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 12px; }
.hr-card { background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; box-shadow: 0 4px 14px rgba(15, 23, 42, .05); }
.hr-card h3 { margin: 0 0 8px; font-size: .95rem; }
.hr-f, .hr-3 label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: .85rem; color: var(--muted); }
.hr-lab { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.hr-sel { width: 100%; padding: 9px 10px; border-radius: 10px; border: 1.5px solid #FCD34D; background: #FFFBEB; font: inherit; font-weight: 600; color: #92400E; }
.hr-sel.blue { border-color: #93C5FD; background: #EFF6FF; color: #1D4ED8; }
.hr-periods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.hr-p { padding: 10px 6px; border-radius: 10px; font: inherit; font-weight: 700; cursor: pointer; border: 1.5px solid; transition: transform .1s; }
.hr-p-month { background: #FAF5FF; border-color: #E9D5FF; color: #7E22CE; }
.hr-p-sem1 { background: #F0FDF4; border-color: #BBF7D0; color: #047857; }
.hr-p-sem2 { background: #ECFDF5; border-color: #A7F3D0; color: #065F46; }
.hr-p-year { background: #FFFBEB; border-color: #FDE68A; color: #B45309; }
.hr-p[aria-pressed="true"] { background: linear-gradient(135deg, #059669, #10B981); border-color: #047857; color: #fff; box-shadow: 0 4px 12px rgba(5, 150, 105, .3); }
.hr-p:active { transform: scale(.97); }
.hr-year { margin: 0 0 10px; font-size: .85rem; color: var(--muted); }
.hr-year small { font-size: .75rem; }
.hr-pull, .hr-print { width: 100%; padding: 12px; border: 0; border-radius: 12px; font: inherit; font-weight: 700; color: #fff; cursor: pointer; }
.hr-pull { background: linear-gradient(135deg, #D97706, #B45309); box-shadow: 0 4px 12px rgba(180, 83, 9, .3); }
.hr-print { background: linear-gradient(135deg, #1E40AF, #2563EB); box-shadow: 0 6px 16px rgba(37, 99, 235, .3); padding: 14px; font-size: 1rem; }
.hr-pull:hover, .hr-print:hover { filter: brightness(1.07); }
.hr-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.hr-3 .hr-sel { padding: 8px 4px; font-size: .82rem; }
.hr-chk { display: flex; align-items: center; gap: 8px; font-size: .85rem; margin-top: 4px; cursor: pointer; }
.hr-note { margin: 0; font-size: .78rem; color: var(--muted); line-height: 1.7; }
.hr-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; margin-bottom: 12px; }
.hr-tools p { margin: 0; font-size: .85rem; color: var(--muted); }
.hr-zoom { display: flex; gap: 6px; }
.hr-zoom button { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface, #fff); font: inherit; font-weight: 700; font-size: .82rem; cursor: pointer; color: inherit; }
.hr-zoom button[aria-pressed="true"] { background: #1E3A8A; border-color: #1E3A8A; color: #fff; }
.hr-stage { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; overflow: auto; padding: 4px 0 20px; }
.hr-f[hidden] { display: none; }
.hr-stage .hr-page { margin: 0 auto; box-shadow: 0 10px 30px rgba(15, 23, 42, .18); flex: none; }
@media (max-width: 960px) {
  .hr-wrap { grid-template-columns: 1fr; }
  .hr-side { position: static; }
}

/* ---- Staff chat (ការពិភាក្សា) ---- */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #EF4444; color: #fff; font-size: .72rem; font-weight: 700; display: inline-grid; place-items: center; line-height: 1; }
.ch [hidden] { display: none !important; }
.ch { --chb: #7C3AED; display: grid; grid-template-columns: 320px minmax(0, 1fr); height: calc(100dvh - 128px); min-height: 460px; background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 8px 26px rgba(15, 23, 42, .07); }
.ch-side { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-height: 0; background: linear-gradient(180deg, #FAF5FF, transparent 140px); }
.ch-side-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 8px; }
.ch-side-head h2 { margin: 0; font-size: 1.05rem; }
.ch-new { display: flex; gap: 6px; }
.ch-ib { border: 0; background: transparent; min-width: 36px; height: 36px; border-radius: 10px; cursor: pointer; font-size: 1.05rem; color: inherit; display: inline-grid; place-items: center; padding: 0 6px; }
.ch-ib:hover { background: rgba(124, 58, 237, .1); }
.ch-ib.danger { color: #DC2626; }
.ch-new .ch-ib { background: #EDE9FE; font-size: .9rem; }
.ch-find { display: flex; align-items: center; gap: 6px; margin: 0 12px 8px; padding: 0 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface, #fff); }
.ch-find input { border: 0; outline: 0; background: transparent; padding: 9px 0; flex: 1; font: inherit; color: inherit; min-width: 0; }
.ch-rooms { list-style: none; margin: 0; padding: 0 6px 10px; overflow-y: auto; flex: 1; }
.ch-hint { padding: 20px; color: var(--muted); text-align: center; font-size: .88rem; line-height: 1.8; }
.ch-room { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 8px; border: 0; background: transparent; border-radius: 12px; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.ch-room:hover { background: rgba(124, 58, 237, .06); }
.ch-room.on { background: #EDE9FE; }
.ch-room-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ch-room-t b, .ch-room-t small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-room-t small { color: var(--muted); font-size: .8rem; }
.ch-room.unread .ch-room-t b, .ch-room.unread .ch-room-t small { color: var(--text, #111827); font-weight: 700; }
.ch-room-r { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; color: var(--muted); font-size: .74rem; }
.ch-dot { width: 10px; height: 10px; border-radius: 50%; background: #EF4444; }
.ch-tag { font-size: .66rem; background: #DCFCE7; color: #15803D; padding: 1px 6px; border-radius: 6px; font-weight: 600; vertical-align: middle; }
.ch-av { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 1rem; background: hsl(var(--h, 260) 62% 52%); }
.ch-av-g { border-radius: 13px; font-size: 1.2rem; }
.ch-av.lg { width: 42px; height: 42px; }
.ch-av-sp { flex: none; width: 32px; }
.ch-main { position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; background: #F7F5FC; }
.ch-blank { margin: auto; text-align: center; color: var(--muted); padding: 30px; max-width: 360px; }
.ch-blank div { font-size: 3rem; }
.ch-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface, #fff); border-bottom: 1px solid var(--line); }
.ch-head-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ch-head-t b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-head-t small { color: var(--muted); font-size: .78rem; }
.ch-back { display: none; font-size: 1.6rem; }
.ch-pin { display: flex; align-items: center; gap: 8px; padding: 6px 14px; background: #FFFBEB; border-bottom: 1px solid #FDE68A; font-size: .84rem; }
.ch-pin-t { flex: 1; min-width: 0; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-pin-t b { color: #B45309; }
.ch-searchbar { display: flex; gap: 6px; padding: 6px 12px; background: var(--surface, #fff); border-bottom: 1px solid var(--line); }
.ch-searchbar input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font: inherit; }
.ch-msgs { flex: 1; overflow-y: auto; padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 2px; }
.ch-older { text-align: center; padding: 4px 0 8px; }
.ch-chip { border: 1px solid var(--line); background: var(--surface, #fff); border-radius: 999px; padding: 5px 14px; font: inherit; font-size: .8rem; cursor: pointer; color: var(--muted); }
.ch-empty { margin: auto; text-align: center; color: var(--muted); padding: 20px; }
.ch-empty > div { font-size: 2.6rem; }
.ch-quick { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.ch-quick button, .ch-stks button { border: 0; background: none; padding: 2px; cursor: pointer; border-radius: 12px; }
.ch-quick button:hover, .ch-stks button:hover { transform: scale(1.06); }
.ch-day { text-align: center; margin: 12px 0 6px; }
.ch-day span { background: rgba(124, 58, 237, .1); color: #6D28D9; font-size: .74rem; padding: 3px 12px; border-radius: 999px; font-weight: 600; }
.ch-msg { position: relative; display: flex; align-items: flex-end; gap: 8px; margin-top: 8px; max-width: 100%; }
.ch-msg.grouped { margin-top: 2px; }
.ch-msg .ch-av { width: 32px; height: 32px; font-size: .85rem; }
.ch-msg.me { flex-direction: row-reverse; }
.ch-msg.ch-hide { display: none; }
.ch-msg.flash .ch-b { animation: chFlash 1.6s; }
@keyframes chFlash { 0%, 60% { box-shadow: 0 0 0 3px #F59E0B; } }
.ch-col { display: flex; flex-direction: column; max-width: min(72%, 520px); min-width: 0; }
.ch-msg.me .ch-col { align-items: flex-end; }
.ch-who { font-size: .74rem; color: var(--muted); margin: 0 0 2px 10px; }
.ch-b { position: relative; background: var(--surface, #fff); border-radius: 16px 16px 16px 6px; padding: 7px 11px 5px; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); overflow-wrap: anywhere; min-width: 70px; }
.ch-msg.me .ch-b { background: linear-gradient(135deg, #7C3AED, #6366F1); color: #fff; border-radius: 16px 16px 6px 16px; }
.ch-msg.grouped .ch-b { border-radius: 16px; }
.ch-b p { margin: 0; line-height: 1.65; white-space: normal; }
.ch-b a { color: inherit; text-decoration: underline; }
.ch-b .ch-big { font-size: 2.4rem; line-height: 1.25; }
.ch-b.bare { background: none !important; box-shadow: none; padding: 0; }
.ch-b.bare .ch-time { position: static; display: block; text-align: right; color: var(--muted) !important; }
.ch-b.pic { padding: 3px; }
.ch-b.pic .ch-time { position: absolute; right: 10px; bottom: 8px; background: rgba(0, 0, 0, .45); color: #fff; padding: 0 6px; border-radius: 8px; }
.ch-time { display: block; text-align: right; font-size: .66rem; opacity: .7; margin-top: 1px; }
.ch-del { font-style: italic; opacity: .7; }
.ch-quote { display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid #A78BFA; background: rgba(124, 58, 237, .08); border-radius: 8px; padding: 3px 8px; margin-bottom: 4px; font: inherit; font-size: .8rem; color: inherit; cursor: pointer; }
.ch-msg.me .ch-quote { background: rgba(255, 255, 255, .18); border-left-color: #fff; }
.ch-quote b { display: block; font-size: .74rem; }
.ch-quote span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.ch-img { display: block; border: 0; padding: 0; background: #E5E7EB; border-radius: 13px; overflow: hidden; cursor: zoom-in; width: min(300px, 62vw); max-height: 360px; }
.ch-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ch-voice { display: flex; align-items: center; gap: 10px; min-width: 210px; padding: 2px 0; }
.ch-play { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 0; background: #7C3AED; color: #fff; cursor: pointer; font-size: .95rem; }
.ch-msg.me .ch-play { background: #fff; color: #7C3AED; }
.ch-wave { flex: 1; height: 26px; border-radius: 6px; position: relative; overflow: hidden;
  background: repeating-linear-gradient(90deg, rgba(124, 58, 237, .35) 0 3px, transparent 3px 6px); -webkit-mask: linear-gradient(0deg, transparent 15%, #000 15% 85%, transparent 85%); }
.ch-msg.me .ch-wave { background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .45) 0 3px, transparent 3px 6px); }
.ch-wave i { position: absolute; inset: 0 auto 0 0; background: repeating-linear-gradient(90deg, #7C3AED 0 3px, transparent 3px 6px); }
.ch-msg.me .ch-wave i { background: repeating-linear-gradient(90deg, #fff 0 3px, transparent 3px 6px); }
.ch-voice small { font-variant-numeric: tabular-nums; font-size: .76rem; }
.ch-file { display: flex; align-items: center; gap: 10px; border: 0; background: rgba(124, 58, 237, .07); padding: 8px 10px; border-radius: 12px; cursor: pointer; font: inherit; color: inherit; text-align: left; min-width: 220px; max-width: 100%; }
.ch-msg.me .ch-file { background: rgba(255, 255, 255, .16); }
.ch-fi { width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center; font-size: 1.3rem; }
.ch-fn { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ch-fn b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .88rem; }
.ch-fn small { opacity: .75; font-size: .74rem; }
.ch-stk { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 132px; height: 132px; border-radius: 30px; background: radial-gradient(circle at 30% 25%, #fff 0 18%, var(--a) 60%); border: 4px solid #fff; box-shadow: 0 6px 16px rgba(15, 23, 42, .16), inset 0 0 0 3px var(--b); transform: rotate(-3deg); }
.ch-stk b { font-size: 3.4rem; line-height: 1.1; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .2)); }
.ch-stk i { font-style: normal; font-family: var(--moul); font-size: .8rem; color: var(--b); line-height: 1.9; text-shadow: 0 1px 0 #fff; white-space: nowrap; }
.ch-stk.sm { width: 74px; height: 74px; border-radius: 18px; border-width: 3px; }
.ch-stk.sm b { font-size: 1.9rem; }
.ch-stk.sm i { font-size: .52rem; }
.ch-reacts { display: flex; gap: 4px; flex-wrap: wrap; margin-top: -4px; padding: 0 6px; position: relative; z-index: 1; }
.ch-react { border: 1px solid var(--line); background: var(--surface, #fff); border-radius: 999px; padding: 1px 7px; font: inherit; font-size: .76rem; cursor: pointer; }
.ch-react.on { border-color: #A78BFA; background: #EDE9FE; }
.ch-tools { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; align-self: center; }
.ch-msg:hover .ch-tools, .ch-msg:focus-within .ch-tools { opacity: 1; }
.ch-tools button { border: 0; background: var(--surface, #fff); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: .85rem; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); color: inherit; }
.ch-msg.pending { opacity: .85; }
.ch-prog { display: block; height: 4px; background: rgba(255, 255, 255, .3); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.ch-prog i { display: block; height: 100%; background: #fff; transition: width .2s; }
.ch-down { position: absolute; right: 18px; bottom: 86px; border: 0; background: #7C3AED; color: #fff; padding: 7px 14px; border-radius: 999px; font: inherit; font-size: .82rem; cursor: pointer; box-shadow: 0 4px 12px rgba(124, 58, 237, .35); z-index: 3; }
.ch-drop { position: absolute; inset: 0; display: none; place-items: center; background: rgba(124, 58, 237, .12); border: 3px dashed #7C3AED; border-radius: 0 18px 18px 0; font-size: 1.1rem; font-weight: 700; color: #6D28D9; z-index: 5; pointer-events: none; }
.ch-drop.on { display: grid; }
.ch-compose { background: var(--surface, #fff); border-top: 1px solid var(--line); padding: 8px 10px; }
.ch-row, .ch-recbar { display: flex; align-items: flex-end; gap: 6px; }
.ch-row[hidden], .ch-recbar[hidden] { display: none; }
.ch-row textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 20px; padding: 9px 14px; font: inherit; line-height: 1.5; max-height: 140px; background: var(--bg, #F8FAFC); color: inherit; outline: none; }
.ch-row textarea:focus { border-color: #A78BFA; box-shadow: 0 0 0 3px rgba(167, 139, 250, .25); }
.ch-send, .ch-mic { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer; font-size: 1.1rem; color: #fff; background: linear-gradient(135deg, #7C3AED, #6366F1); box-shadow: 0 4px 10px rgba(124, 58, 237, .3); }
.ch-mic { background: linear-gradient(135deg, #EF4444, #DB2777); }
.ch-send[hidden], .ch-mic[hidden] { display: none; }
.ch-recbar { align-items: center; padding: 2px 4px; }
.ch-recdot { width: 12px; height: 12px; border-radius: 50%; background: #EF4444; animation: chBlink 1s infinite; }
@keyframes chBlink { 50% { opacity: .2; } }
.ch-recbar b { font-variant-numeric: tabular-nums; min-width: 44px; }
.ch-recbar canvas { flex: 1; min-width: 0; height: 32px; }
.ch-replybar { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin-bottom: 6px; border-left: 3px solid #7C3AED; background: #F5F3FF; border-radius: 8px; }
.ch-replybar div { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: .82rem; }
.ch-replybar small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.ch-panel { margin-bottom: 8px; border: 1px solid var(--line); border-radius: 14px; padding: 8px; max-height: 250px; overflow-y: auto; background: var(--surface, #fff); }
.ch-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.ch-tabs button { border: 0; background: #F3F4F6; border-radius: 999px; padding: 5px 12px; font: inherit; font-size: .82rem; cursor: pointer; }
.ch-tabs button.on { background: #7C3AED; color: #fff; }
.ch-stks { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 6px; justify-items: center; }
.ch-emos { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 2px; }
.ch-emos button { border: 0; background: none; font-size: 1.4rem; padding: 4px; border-radius: 8px; cursor: pointer; }
.ch-emos button:hover { background: #F3F4F6; }
.ch-attach { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ch-attach button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 4px; font: inherit; font-size: .8rem; cursor: pointer; padding: 6px; border-radius: 12px; color: inherit; }
.ch-attach button:hover { background: #F5F3FF; }
.ch-attach span { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; font-size: 1.3rem; }
.ch-small { display: block; font-size: .76rem; color: var(--muted); margin: 6px 0 4px; }
.ch-pop { position: fixed; z-index: 1000; background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(15, 23, 42, .2); padding: 4px; }
.ch-rmenu { display: flex; gap: 2px; }
.ch-rmenu button { border: 0; background: none; font-size: 1.5rem; padding: 4px 6px; border-radius: 10px; cursor: pointer; transition: transform .1s; }
.ch-rmenu button:hover { transform: scale(1.25); background: #F3F4F6; }
.ch-menu { display: flex; flex-direction: column; min-width: 170px; }
.ch-menu button { border: 0; background: none; text-align: left; padding: 8px 12px; border-radius: 9px; font: inherit; cursor: pointer; color: inherit; }
.ch-menu button:hover { background: #F5F3FF; }
.ch-menu button.danger { color: #DC2626; }
.ch-viewer { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; }
.ch-viewer::backdrop { background: rgba(0, 0, 0, .85); }
.ch-viewer img { display: block; max-width: 96vw; max-height: 86vh; object-fit: contain; border-radius: 8px; margin: auto; }
.ch-viewer-bar { display: flex; align-items: center; gap: 8px; color: #fff; padding: 8px 4px; }
.ch-viewer-bar span { flex: 1; font-size: .85rem; }
.ch-viewer-bar button { border: 0; background: rgba(255, 255, 255, .16); color: #fff; padding: 7px 14px; border-radius: 10px; cursor: pointer; font: inherit; }
.ch-pk-find { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; margin-bottom: 6px; }
.ch-pk { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.ch-pk-i { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; cursor: pointer; }
.ch-pk-i:hover { background: #F5F3FF; }
.ch-pk-i[hidden] { display: none; }
.ch-pk-i span { display: flex; flex-direction: column; }
.ch-pk-i small { color: var(--muted); font-size: .76rem; }
.ch-pk-i .ch-av { width: 34px; height: 34px; font-size: .85rem; }
.ch-icons { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-icons label { cursor: pointer; }
.ch-icons input { position: absolute; opacity: 0; pointer-events: none; }
.ch-icons span { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 1.2rem; border: 2px solid var(--line); }
.ch-icons input:checked + span { border-color: #7C3AED; box-shadow: 0 0 0 3px rgba(124, 58, 237, .25); }
.ch-mlist { margin: 0; padding-left: 20px; line-height: 2; }
[data-theme="dark"] .ch-main { background: #0F1222; }
[data-theme="dark"] .ch-side { background: none; }
[data-theme="dark"] .ch-room.on { background: rgba(124, 58, 237, .25); }
@media (max-width: 760px) {
  .ch { grid-template-columns: 1fr; height: calc(100dvh - 190px); border-radius: 14px; }
  .ch.has-room .ch-side { display: none; }
  .ch:not(.has-room) .ch-main { display: none; }
  .ch-back { display: inline-grid; }
  .ch-col { max-width: 82%; }
  .ch-tools { display: none; }
  .ch-attach { grid-template-columns: repeat(4, 1fr); }
}

/* ---- Requests / inbox (ប្រអប់សារ) ---- */
.rq [hidden], .dialog [hidden].rq-leave { display: none !important; }
.rq-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.4fr); gap: 10px; margin-bottom: 12px; }
.rq-kpi { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface, #fff); font: inherit; color: inherit; cursor: pointer; text-align: left; box-shadow: 0 4px 14px rgba(15, 23, 42, .05); }
.rq-kpi i { font-style: normal; width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 1.25rem; background: color-mix(in srgb, var(--c) 14%, transparent); }
.rq-kpi b { display: block; font-size: 1.4rem; line-height: 1.2; color: var(--c); }
.rq-kpi small { color: var(--muted); font-size: .78rem; }
.rq-kpi-from { cursor: default; flex-direction: column; align-items: flex-start; gap: 2px; font-size: .82rem; justify-content: center; }
.rq-kpi-from b { display: inline; font-size: .9rem; color: inherit; }
.rq-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.rq-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.rq-tabs button { border: 1px solid var(--line); background: var(--surface, #fff); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .82rem; cursor: pointer; color: inherit; }
.rq-tabs button[aria-pressed="true"] { background: #DB2777; border-color: #DB2777; color: #fff; }
.rq-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rq-filters select, .rq-filters input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: .85rem; background: var(--surface, #fff); color: inherit; }
.rq-filters input { min-width: 200px; }
.rq-body { display: grid; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); gap: 14px; align-items: start; }
.rq-list { list-style: none; margin: 0; padding: 6px; background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 16px; max-height: calc(100dvh - 300px); min-height: 300px; overflow-y: auto; }
.rq-none { padding: 30px 16px; text-align: center; color: var(--muted); line-height: 1.8; font-size: .9rem; }
.rq-item { width: 100%; display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 0; background: none; border-radius: 12px; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.rq-item:hover { background: #FDF2F8; }
.rq-item.on { background: #FCE7F3; }
.rq-item.unread .rq-it b { font-weight: 800; }
.rq-ic { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; }
.rq-it { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rq-it b, .rq-it small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rq-it small { font-size: .78rem; color: var(--muted); }
.rq-ir { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.rq-dot { width: 10px; height: 10px; border-radius: 50%; background: #EF4444; }
.rq-pill { display: inline-block; white-space: nowrap; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.rq-cat { display: inline-block; white-space: nowrap; font-size: .74rem; font-weight: 600; padding: 2px 9px; border-radius: 8px; color: var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); border: 1px solid color-mix(in srgb, var(--c) 25%, transparent); }
.rq-detail { background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; min-height: 300px; display: flex; flex-direction: column; gap: 12px; }
.rq-blank { margin: auto; text-align: center; color: var(--muted); }
.rq-blank div { font-size: 3rem; }
.rq-dh { display: flex; gap: 8px; align-items: flex-start; }
.rq-dh h2 { margin: 0 0 4px; font-size: 1.1rem; }
.rq-back { display: none; font-size: 1.5rem; }
.rq-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rq-small { font-size: .78rem; color: var(--muted); }
.rq-who { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; background: #FDF2F8; border-radius: 12px; padding: 10px 12px; }
.rq-who div { display: flex; flex-direction: column; min-width: 0; }
.rq-who b { overflow-wrap: anywhere; }
.rq-who a { color: #BE185D; }
.rq-who small { color: var(--muted); font-size: .78rem; }
.rq-ctl { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.rq-ctl label { display: flex; flex-direction: column; gap: 3px; font-size: .78rem; color: var(--muted); }
.rq-ctl select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: .88rem; color: inherit; background: var(--surface, #fff); }
.rq-urgent { border: 1px solid var(--line); background: var(--surface, #fff); border-radius: 10px; padding: 7px 12px; font: inherit; cursor: pointer; color: inherit; }
.rq-urgent.on { background: #FEE2E2; border-color: #F87171; color: #B91C1C; font-weight: 700; }
.rq-thread { display: flex; flex-direction: column; gap: 10px; }
.rq-msg { display: flex; gap: 10px; align-items: flex-start; }
.rq-msg > div { background: #F3F4F6; border-radius: 4px 14px 14px 14px; padding: 8px 12px; max-width: 88%; }
.rq-msg.staff { flex-direction: row-reverse; }
.rq-msg.staff > div { background: #FCE7F3; border-radius: 14px 4px 14px 14px; }
.rq-msg b { font-size: .84rem; }
.rq-msg small { margin-left: 8px; font-size: .72rem; color: var(--muted); }
.rq-msg p { margin: 3px 0 0; line-height: 1.7; overflow-wrap: anywhere; }
.rq-av { flex: none; width: 34px; height: 34px; border-radius: 50%; background: #FDF2F8; display: grid; place-items: center; font-size: 1.05rem; }
.rq-attbox { display: flex; flex-direction: column; gap: 4px; }
.rq-att-img img { max-width: 260px; max-height: 260px; border-radius: 12px; border: 1px solid var(--line); display: block; }
.rq-att { display: inline-flex; gap: 6px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; width: fit-content; color: inherit; text-decoration: none; }
.rq-reply { display: flex; flex-direction: column; gap: 8px; border-top: 1px dashed var(--line); padding-top: 10px; }
.rq-reply textarea, .rq-note textarea, .rq-follow textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; font: inherit; resize: vertical; background: var(--bg, #F8FAFC); color: inherit; box-sizing: border-box; }
.rq-tpl { display: flex; flex-wrap: wrap; gap: 6px; }
.rq-tpl button { border: 1px dashed #F9A8D4; background: #FDF2F8; color: #9D174D; border-radius: 999px; padding: 3px 10px; font: inherit; font-size: .76rem; cursor: pointer; }
.rq-ract { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.rq-note { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: #92400E; background: #FFFBEB; border-radius: 12px; padding: 8px 10px; }
.rq-note textarea { background: #fff; }
.rq-foot { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.rq-foot .danger { color: #DC2626; }
/* form & tracking dialogs (also used on the public page) */
.rq-intro { margin: 0; font-size: .9rem; background: #FDF2F8; border-radius: 10px; padding: 8px 12px; }
.rq-lab { font-size: .85rem; font-weight: 600; }
.rq-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 6px; }
.rq-cats input { position: absolute; opacity: 0; pointer-events: none; }
.rq-cats span { display: block; padding: 8px 10px; border-radius: 10px; border: 1.5px solid var(--line); font-size: .84rem; cursor: pointer; }
.rq-cats input:checked + span { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); color: var(--c); font-weight: 700; }
.rq-cats input:focus-visible + span { outline: 2px solid var(--c); }
.rq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.rq-anon { display: flex; gap: 8px; align-items: center; font-size: .84rem; }
.rq-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.rq-receipt { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.rq-code { font-size: 2rem; font-weight: 800; letter-spacing: .15em; color: #BE185D; background: #FDF2F8; border: 2px dashed #F472B6; border-radius: 14px; padding: 8px 22px; font-family: ui-monospace, monospace; }
.rq-qr svg { display: block; width: 170px; height: 170px; }
.rq-find { display: flex; gap: 8px; }
.rq-find input { flex: 1; padding: 10px 12px; font: inherit; font-size: 1.1rem; letter-spacing: .1em; text-transform: uppercase; border: 1.5px solid var(--line); border-radius: 12px; }
.rq-mine { display: flex; flex-wrap: wrap; gap: 6px; }
.rq-chip { border: 1px solid #F9A8D4; background: #FDF2F8; color: #9D174D; border-radius: 999px; padding: 4px 12px; font: inherit; font-family: ui-monospace, monospace; cursor: pointer; }
.rq-steps { list-style: none; display: flex; margin: 4px 0; padding: 0; }
.rq-steps li { flex: 1; text-align: center; position: relative; font-size: .78rem; color: var(--muted); }
.rq-steps li::before { content: ''; position: absolute; top: 17px; left: -50%; right: 50%; height: 3px; background: var(--line); z-index: 0; }
.rq-steps li:first-child::before { display: none; }
.rq-steps li.on::before { background: #16A34A; }
.rq-steps i { position: relative; z-index: 1; font-style: normal; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 4px; background: #F3F4F6; filter: grayscale(1); }
.rq-steps li.on { color: #15803D; font-weight: 700; }
.rq-steps li.on i { background: #DCFCE7; filter: none; }
.rq-follow { display: flex; gap: 8px; align-items: flex-end; }
.hl-ask { background: #FDF2F8; color: #BE185D; border: 1px solid #F9A8D4; }
.st-sec-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.st-sec-head h2 { margin: 0; }
.st-reqs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.st-req { width: 100%; display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "c t s" "c w s"; gap: 2px 10px; align-items: center; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface, #fff); font: inherit; color: inherit; cursor: pointer; }
.st-req .rq-cat { grid-area: c; }
.st-req b { grid-area: t; }
.st-req small { grid-area: w; color: var(--muted); font-size: .78rem; }
.st-req .rq-pill { grid-area: s; }
@media (max-width: 960px) { .rq-kpis { grid-template-columns: repeat(2, 1fr); } .rq-kpi-from { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 10px; } }
@media (max-width: 760px) {
  .rq-body { grid-template-columns: 1fr; }
  .rq.has-sel .rq-list, .rq.has-sel .rq-kpis, .rq.has-sel .rq-bar { display: none; }
  .rq:not(.has-sel) .rq-detail { display: none; }
  .rq-back { display: inline-grid; }
  .rq-filters input { min-width: 0; flex: 1; }
  .rq-list { max-height: none; }
}

/* Accounts page (#staff?view=accounts) */
.lg-pw { display: flex; gap: 6px; align-items: center; } .lg-pw input { flex: 1; min-width: 0; }
.sf-del { color: #B91C1C; } .sf-del:hover { background: #FEF2F2; }
.sf-del-warn { background: #FEF2F2; color: #B91C1C; border-radius: 12px; padding: 10px 12px; font-weight: 700; }
[data-theme="dark"] .sf-del-warn { background: #450a0a; color: #FCA5A5; }
.sf-heir { border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px 4px; margin: 10px 0; display: grid; gap: 8px; }
.sf-heir legend { font-weight: 700; padding: 0 6px; }
.sf-heir-work { display: flex; flex-wrap: wrap; gap: 6px; }
.sf-heir select { max-width: 100%; }
.sf-del-list { margin: 8px 0; padding-left: 18px; display: grid; gap: 4px; } .sf-del-list code { font-size: .82rem; }
.sf-acc-sum { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.sf-acc-sum span { background: #EEF2FF; color: #3730A3; border-radius: 12px; padding: 8px 14px; font-size: .88rem; }
.sf-acc-sum span.off { background: #FEF2F2; color: #B91C1C; }
.sf-acc-sum b { font-size: 1.05rem; margin-left: 4px; }
.sf-mail { font-size: .82rem; background: #F3F4F6; padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.sf-st { font-size: .8rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.sf-st.on { background: #DCFCE7; color: #15803D; }
.sf-st.off { background: #FEE2E2; color: #B91C1C; }

/* ---- Live attendance board (dashboard) ---- */
.ab { --ab-track: #EEF2F7; position: relative; background: var(--surface, #fff); border: 1px solid #E6E9F2; border-radius: 24px; padding: 0 0 16px; margin-bottom: 20px; box-shadow: 0 12px 32px rgba(30, 41, 99, .07); overflow: hidden; }
.ab [hidden] { display: none !important; }
.ab-hero { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; padding: 18px 20px 16px;
  background: radial-gradient(circle at 92% -40%, rgba(255, 255, 255, .25), transparent 45%), linear-gradient(120deg, #0F766E 0%, #0E7490 45%, #4338CA 100%); color: #fff; }
.ab-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ab-logo { width: 48px; height: 48px; flex: none; border-radius: 15px; display: grid; place-items: center; font-size: 1.5rem; background: rgba(255, 255, 255, .18); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3); }
.ab-title h2 { margin: 0; font-size: 1.15rem; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: #fff; }
.ab-title p { margin: 2px 0 0; font-size: .82rem; color: rgba(255, 255, 255, .82); }
.ab-live { font-size: .68rem; font-weight: 800; letter-spacing: .06em; color: #065F46; background: #A7F3D0; padding: 3px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; }
.ab-live i { width: 7px; height: 7px; border-radius: 50%; background: #059669; animation: abPulse 1.4s infinite; }
.ab-live.off { color: #334155; background: #E2E8F0; }
.ab-live.off i { background: #94A3B8; animation: none; }
@keyframes abPulse { 0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, .7); } 70% { box-shadow: 0 0 0 8px rgba(5, 150, 105, 0); } 100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); } }
.ab-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.ab-in { display: flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .96); border-radius: 12px; padding: 0 10px; box-shadow: 0 2px 8px rgba(15, 23, 42, .12); }
.ab-in span { font-size: .9rem; }
.ab-in input, .ab-in select { border: 0; outline: 0; background: transparent; padding: 9px 2px; font: inherit; font-size: .86rem; color: #1E293B; min-width: 0; }
.ab-in input[type=search] { width: 170px; }
.ab-seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; padding: 14px 20px 4px; }
.ab-seg button { position: relative; display: flex; align-items: center; gap: 10px; text-align: left; padding: 9px 12px; border-radius: 14px; border: 1.5px solid #E6E9F2; background: #F8FAFC; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s; }
.ab-seg button:hover { border-color: #99F6E4; }
.ab-seg-i { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .08); }
.ab-seg-t { display: flex; flex-direction: column; min-width: 0; }
.ab-seg-t b { font-size: .88rem; }
.ab-seg-t small { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ab-seg-st { position: absolute; top: -8px; right: 10px; font-style: normal; font-size: .64rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: #E2E8F0; color: #475569; }
.ab-seg-st:empty { display: none; }
.ab-seg button[data-state="now"] .ab-seg-st { background: #10B981; color: #fff; }
.ab-seg button[data-state="past"] .ab-seg-st { background: #E0E7FF; color: #4338CA; }
.ab-seg button[aria-pressed="true"] { border-color: #0D9488; background: linear-gradient(135deg, #F0FDFA, #ECFEFF); box-shadow: 0 6px 16px rgba(13, 148, 136, .18); }
.ab-seg button[aria-pressed="true"] .ab-seg-i { background: #0D9488; }
.ab-seg button[aria-pressed="true"] .ab-seg-t b { color: #0F766E; }
.ab-top { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: center; padding: 14px 20px 6px; }
.ab-main-ring { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; border-radius: 20px; background: linear-gradient(180deg, #F0FDFA, #fff); border: 1px solid #CCFBF1; }
.ab-ring { display: block; overflow: visible; }
.ab-ring circle { transition: stroke-dasharray .6s ease, stroke-dashoffset .6s ease; }
.ab-rt { font-size: 19px; font-weight: 800; fill: #0F172A; font-family: inherit; }
.ab-rt.sm { font-size: 17px; }
.ab-rs { font-size: 7.5px; fill: #64748B; font-family: inherit; }
.ab-ring-cap { font-size: .8rem; color: var(--muted); }
.ab-ring-cap b { color: #0F766E; font-size: 1rem; }
.ab-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ab-kpi { position: relative; display: flex; gap: 10px; align-items: center; padding: 12px 14px 16px; border-radius: 16px; background: color-mix(in srgb, var(--c) 6%, #fff); border: 1px solid color-mix(in srgb, var(--c) 18%, transparent); overflow: hidden; }
.ab-kpi-i { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; background: #fff; box-shadow: 0 2px 6px color-mix(in srgb, var(--c) 25%, transparent); }
.ab-kpi small { display: block; font-size: .76rem; color: #475569; }
.ab-kpi b { display: block; font-size: 1.45rem; line-height: 1.2; color: var(--c); font-variant-numeric: tabular-nums; }
.ab-kpi em { font-style: normal; font-size: .72rem; color: #64748B; }
.ab-kpi-bar { position: absolute; left: 14px; right: 14px; bottom: 7px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--c) 14%, transparent); }
.ab-kpi-bar i { display: block; height: 100%; border-radius: 2px; background: var(--c); transition: width .6s ease; }
.ab-alert { display: flex; gap: 12px; align-items: flex-start; margin: 10px 20px 4px; padding: 12px 14px; border-radius: 16px; background: linear-gradient(135deg, #FFFBEB, #FEF3C7); border: 1px solid #FCD34D; color: #78350F; font-size: .88rem; }
.ab-alert-i { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; background: #fff; }
.ab-alert-l { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ab-alert-l a { background: #fff; color: #B45309; font-weight: 700; padding: 3px 12px; border-radius: 999px; text-decoration: none; border: 1px solid #FDE68A; font-size: .82rem; }
.ab-alert-l a:hover { background: #F59E0B; color: #fff; }
.ab-rows { display: flex; flex-direction: column; gap: 8px; padding: 12px 20px 4px; }
.ab-row { display: grid; grid-template-columns: 44px 200px minmax(0, 1fr) 82px 18px; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 16px; border: 1px solid #EEF0F6; background: #fff; color: inherit; text-decoration: none; transition: transform .12s, box-shadow .12s, border-color .12s; }
.ab-row:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(30, 41, 99, .08); border-color: #C7D2FE; }
.ab-badge { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 1.05rem; color: #fff; background: linear-gradient(135deg, hsl(var(--h) 75% 58%), hsl(calc(var(--h) + 30) 70% 46%)); box-shadow: 0 4px 10px hsl(var(--h) 70% 50% / .3); }
.ab-name { display: flex; flex-direction: column; min-width: 0; }
.ab-name b { font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-name small { color: var(--muted); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-bar { display: flex; gap: 2px; height: 14px; border-radius: 999px; overflow: hidden; background: var(--ab-track); }
.ab-bar i { display: block; height: 100%; transition: width .6s ease; }
.ab-bar i:first-child { border-radius: 999px 0 0 999px; } .ab-bar i:last-child { border-radius: 0 999px 999px 0; } .ab-bar i:only-child { border-radius: 999px; }
.ab-bar .s-P { background: linear-gradient(90deg, #6EE7B7, #10B981); }
.ab-bar .s-L { background: linear-gradient(90deg, #FDE68A, #F59E0B); }
.ab-bar .s-E { background: linear-gradient(90deg, #DDD6FE, #8B5CF6); }
.ab-bar .s-A { background: linear-gradient(90deg, #FECACA, #EF4444); }
.ab-sub { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; }
.ab-sub em { font-style: normal; font-size: .75rem; color: #475569; display: inline-flex; align-items: center; gap: 5px; }
.ab-sub em i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.ab-sub .ab-wait { color: #94A3B8; }
.ab-pct { justify-self: end; text-align: center; padding: 6px 10px; border-radius: 12px; min-width: 74px; }
.ab-pct b { display: block; font-size: 1.3rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.ab-pct small { font-size: .68rem; color: var(--muted); }
.ab-row.good .ab-pct { background: #ECFDF5; } .ab-row.good .ab-pct b { color: #059669; }
.ab-row.mid .ab-pct { background: #FFFBEB; } .ab-row.mid .ab-pct b { color: #D97706; }
.ab-row.bad .ab-pct { background: #FEF2F2; } .ab-row.bad .ab-pct b { color: #DC2626; }
.ab-row.none .ab-pct { background: #F1F5F9; } .ab-row.none .ab-pct b { color: #94A3B8; }
.ab-go { color: #CBD5E1; font-size: 1.4rem; }
.ab-row:hover .ab-go { color: #6366F1; }
.ab-none { padding: 20px; text-align: center; color: var(--muted); }
.ab-pies { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; padding: 14px 20px 0; }
.ab-pie { border: 1px solid #EEF0F6; border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(180deg, #FCFCFF, #fff); }
.ab-pie h3 { margin: 0; font-size: .95rem; display: flex; align-items: center; gap: 8px; }
.ab-pie h3 i { width: 4px; height: 20px; border-radius: 2px; }
.ab-pie-b { display: flex; align-items: center; gap: 16px; }
.ab-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ab-legend li { display: grid; grid-template-columns: 104px minmax(30px, 1fr) 30px 38px; gap: 8px; align-items: center; font-size: .8rem; }
.ab-legend li.zero { opacity: .45; }
.ab-lk { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ab-lk i { width: 10px; height: 10px; border-radius: 3px; }
.ab-lbar { height: 6px; border-radius: 3px; background: var(--ab-track); overflow: hidden; }
.ab-lbar i { display: block; height: 100%; border-radius: 3px; transition: width .6s ease; }
.ab-legend b { text-align: right; font-variant-numeric: tabular-nums; }
.ab-legend small { text-align: right; color: var(--muted); font-size: .72rem; }
.ab-link { align-self: flex-end; font-size: .82rem; color: #0E7490; font-weight: 600; text-decoration: none; }
.ab-link:hover { text-decoration: underline; }
.ab-note { margin: 12px 20px 0; font-size: .76rem; color: var(--muted); }
[data-theme="dark"] .ab { --ab-track: #1E293B; border-color: #1F2937; }
[data-theme="dark"] .ab-row, [data-theme="dark"] .ab-pie, [data-theme="dark"] .ab-seg button { background: var(--surface); border-color: #263244; }
[data-theme="dark"] .ab-main-ring, [data-theme="dark"] .ab-kpi { background: rgba(255, 255, 255, .03); }
[data-theme="dark"] .ab-rt { fill: #F1F5F9; }
@media (max-width: 1100px) { .ab-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .ab-top { grid-template-columns: 1fr; }
  .ab-row { grid-template-columns: 40px minmax(0, 1fr) 70px; gap: 10px; }
  .ab-barbox { grid-column: 1 / -1; }
  .ab-go { display: none; }
  .ab-pie-b { flex-direction: column; align-items: stretch; }
  .ab-pie-b .ab-ring { align-self: center; }
  .ab-in { flex: 1; }
  .ab-in input[type=search] { width: 100%; }
}
@media print { .ab { display: none; } }

/* Staff type & duty pickers (add / edit teacher) */
.tp-sec { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; background: #FAFAFF; }
.tp-sec [hidden] { display: none !important; }
.tp-h { margin: 0 0 8px; font-weight: 700; font-size: .9rem; }
.tp-h small { font-weight: 400; color: var(--muted); }
.tp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.tp-card input, .tp-duty input { position: absolute; opacity: 0; pointer-events: none; }
.tp-card span { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 10px 6px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; height: 100%; box-sizing: border-box; transition: border-color .12s, box-shadow .12s; }
.tp-card i { font-style: normal; font-size: 1.6rem; line-height: 1.2; }
.tp-card b { font-size: .84rem; }
.tp-card small { font-size: .7rem; color: var(--muted); line-height: 1.4; }
.tp-card input:checked + span { border-color: #7C3AED; background: #F5F3FF; box-shadow: 0 0 0 3px rgba(124, 58, 237, .15); }
.tp-card input:checked + span b { color: #6D28D9; }
.tp-card input:focus-visible + span, .tp-duty input:focus-visible + span { outline: 2px solid #7C3AED; outline-offset: 2px; }
.tp-none span { opacity: .75; }
.tp-duties, .tp-classes { display: flex; flex-wrap: wrap; gap: 6px; }
.tp-duty span { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font-size: .84rem; cursor: pointer; }
.tp-duty span small { color: var(--muted); font-size: .72rem; }
.tp-duty input:checked + span { border-color: #059669; background: #ECFDF5; color: #047857; font-weight: 700; }
.tp-duty input:checked + span::before { content: '✓ '; }
.tp-more { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.tp-lab { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 6px; }
.sf-duties { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.sf-duties em { font-style: normal; font-size: .7rem; padding: 1px 7px; border-radius: 999px; background: #EEF2FF; color: #4338CA; white-space: nowrap; }
[data-theme="dark"] .tp-sec { background: rgba(255, 255, 255, .03); }
[data-theme="dark"] .tp-card span, [data-theme="dark"] .tp-duty span { background: var(--surface); }

/* Settings → grade scale editor */
.gs [hidden] { display: none !important; }
.gs-cur { font-size: .8rem; background: #EEF2FF; color: #4338CA; padding: 3px 10px; border-radius: 999px; }
.gs-lead { margin: 0 0 12px; font-size: .86rem; color: var(--muted); line-height: 1.8; }
.gs-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-bottom: 14px; }
.gs-preset { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface, #fff); font: inherit; color: inherit; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.gs-preset:hover { border-color: #A5B4FC; }
.gs-preset[aria-pressed="true"] { border-color: #6366F1; background: #EEF2FF; box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); }
.gs-preset b { font-size: .88rem; }
.gs-preset small { font-size: .74rem; color: var(--muted); }
.gs-mini { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 1px; margin-bottom: 4px; }
.gs-mini-c { height: auto; font-size: 1rem; }
.gs-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.gs-table { width: 100%; border-collapse: collapse; }
.gs-table th { text-align: left; font-size: .76rem; color: var(--muted); font-weight: 600; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.gs-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.gs-table tr.off td { opacity: .45; }
.gs-table tr.off td:first-child { opacity: 1; }
.gs-km, .gs-min, .gs-pass input, .gs-try input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--surface, #fff); color: inherit; }
.gs-km { width: 100%; min-width: 90px; box-sizing: border-box; }
.gs-min { width: 90px; }
.gs-range { font-size: .84rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gs-table input[type=checkbox] { width: 18px; height: 18px; accent-color: #6366F1; }
.gs-pass { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: #F0FDF4; border: 1px solid #BBF7D0; }
.gs-pass label { display: flex; flex-direction: column; gap: 4px; font-size: .84rem; font-weight: 600; color: #166534; }
.gs-pass input { width: 110px; }
.gs-err { margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; background: #FEF2F2; color: #B91C1C; font-size: .86rem; }
.gs-side { display: flex; flex-direction: column; gap: 12px; }
.gs-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: #FAFAFF; }
.gs-bar { position: relative; height: 34px; border-radius: 10px; background: #E5E7EB; margin-top: 18px; }
.gs-bar i { position: absolute; top: 0; bottom: 0; display: grid; place-items: center; overflow: hidden; border-right: 2px solid #fff; box-sizing: border-box; }
.gs-bar i:first-child { border-radius: 0 10px 10px 0; } .gs-bar i:last-child { border-radius: 10px 0 0 10px; }
.gs-bar i span { font-style: normal; font-size: .62rem; color: #fff; white-space: nowrap; font-weight: 700; text-shadow: 0 1px 1px rgba(0, 0, 0, .25); }
.gs-passline { position: absolute; top: -18px; bottom: -4px; width: 0; border-left: 2px dashed #166534; }
.gs-passline span { position: absolute; top: -2px; left: 4px; font-style: normal; font-size: .68rem; font-weight: 700; color: #166534; white-space: nowrap; }
.gs-ticks { position: relative; height: 14px; font-size: .68rem; color: var(--muted); }
.gs-ticks span { position: absolute; transform: translateX(-50%); }
.gs-ticks span:first-child { transform: none; } .gs-ticks span:last-child { transform: translateX(-100%); }
.gs-try { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gs-try input { width: 100px; font-size: 1.05rem; }
.gs-try .ok { color: #15803D; } .gs-try .bad { color: #B91C1C; }
.gs-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.gs-dirty { font-size: .8rem; color: #D97706; }
[data-theme="dark"] .gs-card { background: rgba(255, 255, 255, .03); }
@media (max-width: 860px) { .gs-grid { grid-template-columns: 1fr; } .gs-min { width: 70px; } }

/* Settings → school logo */
.lg-box > span { font-size: .85rem; color: var(--muted); }
.lg-row { display: flex; gap: 16px; align-items: flex-start; margin-top: 6px; }
.lg-prev { flex: none; width: 110px; height: 110px; border-radius: 18px; border: 2px dashed var(--line); display: grid; place-items: center; overflow: hidden;
  background: repeating-conic-gradient(#F1F5F9 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.lg-prev img { max-width: 92%; max-height: 92%; object-fit: contain; }
.lg-ctl { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.lg-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.lg-up { cursor: pointer; }
.lg-ctl input[name=logoUrl] { width: 100%; box-sizing: border-box; }
.lg-status { margin: 0; font-size: .82rem; min-height: 1.2em; }
.lg-status.ok { color: #15803D; } .lg-status.bad { color: #B91C1C; }
.lg-warn { display: block; margin-top: 4px; font-size: .78rem; color: #B45309; line-height: 1.6; }
@media (max-width: 600px) { .lg-row { flex-direction: column; align-items: center; } }

/* Install the app (PWA) */
.install-btn { font-size: 1.05rem; }
.ins-banner { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 900; display: flex; align-items: center; gap: 12px; width: min(520px, calc(100vw - 24px)); box-sizing: border-box;
  padding: 10px 12px; border-radius: 18px; background: var(--surface, #fff); border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(30, 27, 75, .25); animation: insUp .35s ease; }
.ins-banner img { width: 46px; height: 46px; border-radius: 12px; flex: none; }
.ins-banner div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ins-banner small { color: var(--muted); font-size: .78rem; }
.ins-x { border: 0; background: none; font-size: 1rem; cursor: pointer; color: var(--muted); padding: 6px; }
@keyframes insUp { from { transform: translate(-50%, 30px); opacity: 0; } }
.ins-steps { margin: 0; padding-left: 22px; line-height: 2.1; }
.ins-ico { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 8px; background: #EEF2FF; font-size: .9rem; }
@media (max-width: 760px) { .ins-banner { bottom: 84px; } }
@media (display-mode: standalone) { [data-install], .ins-banner { display: none !important; } }
@media print { .ins-banner { display: none !important; } }
[data-install][hidden] { display: none !important; }

/* ---- Academic years page ---- */
.yr { display: flex; flex-direction: column; gap: 16px; }
.yr-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.yr-top h1 { margin: 0; font-size: 1.35rem; }
.yr-top p { margin: 2px 0 0; color: var(--muted); font-size: .88rem; }
.yr-hero { display: grid; grid-template-columns: minmax(0, 1.5fr) auto auto; gap: 20px; align-items: center; padding: 22px 24px; border-radius: 24px; color: #fff;
  background: radial-gradient(circle at 90% -30%, rgba(255, 255, 255, .28), transparent 45%), linear-gradient(125deg, #4C1D95, #6D28D9 50%, #2563EB); box-shadow: 0 14px 36px rgba(76, 29, 149, .28); }
.yr-hero-empty { grid-template-columns: 1fr auto; }
.yr-hero h2 { margin: 4px 0; font-size: 2rem; color: #fff; }
.yr-hero p { margin: 0; color: rgba(255, 255, 255, .85); font-size: .9rem; }
.yr-hero-tag { display: inline-block; font-size: .74rem; font-weight: 700; background: rgba(255, 255, 255, .18); padding: 3px 10px; border-radius: 999px; }
.yr-prog { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; font-size: .8rem; color: rgba(255, 255, 255, .9); }
.yr-prog-bar { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.yr-prog-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #FDE68A, #F59E0B); }
.yr-prog-bar.sm { height: 6px; background: #EDE9FE; margin: 2px 0 4px; }
.yr-hero-stats { display: flex; gap: 10px; }
.yr-hero-stats div { min-width: 84px; text-align: center; padding: 10px 12px; border-radius: 16px; background: rgba(255, 255, 255, .14); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); }
.yr-hero-stats b { display: block; font-size: 1.6rem; line-height: 1.2; }
.yr-hero-stats small { font-size: .74rem; opacity: .85; }
.yr-hero-act { display: flex; flex-direction: column; gap: 8px; }
.yr-hero-act .btn { background: rgba(255, 255, 255, .95); color: #4C1D95; border: 0; }
.yr-h { margin: 6px 0 0; font-size: 1.02rem; }
.yr-h small { color: var(--muted); font-weight: 400; }
.yr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.yr-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(30, 27, 75, .05); position: relative; overflow: hidden; }
.yr-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 5px; background: #CBD5E1; }
.yr-current::before { background: linear-gradient(90deg, #7C3AED, #2563EB); }
.yr-next::before { background: #10B981; }
.yr-past { opacity: .92; }
.yr-card header { display: flex; justify-content: space-between; gap: 6px; }
.yr-st { font-size: .74rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: #F1F5F9; color: #475569; }
.yr-current .yr-st { background: #EDE9FE; color: #6D28D9; }
.yr-next .yr-st { background: #DCFCE7; color: #15803D; }
.yr-view { font-size: .72rem; color: #2563EB; }
.yr-card h3 { margin: 2px 0 0; font-size: 1.35rem; }
.yr-dates { margin: 0; font-size: .82rem; color: var(--muted); }
.yr-nums { display: flex; gap: 14px; font-size: .86rem; }
.yr-nums b { font-size: 1.05rem; }
.yr-cls { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0; }
.yr-cls em { font-style: normal; font-size: .74rem; padding: 2px 8px; border-radius: 8px; background: #F5F3FF; color: #5B21B6; }
.yr-note { margin: 0; font-size: .8rem; color: #92400E; }
.yr-card footer { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--line); }
.yr-card .danger { color: #DC2626; }
.yr-copy { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; background: #F5F3FF; border: 1px solid #DDD6FE; }
.yr-copy select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.yr-tips { padding: 12px 16px; border-radius: 16px; background: #FFFBEB; border: 1px solid #FDE68A; font-size: .84rem; color: #78350F; }
.yr-tips p { margin: 4px 0; line-height: 1.8; }
[data-theme="dark"] .yr-cls em { background: rgba(124, 58, 237, .22); color: #DDD6FE; }
/* 🌙 Year cards in dark mode: dark card, bright year, readable chips and badges. */
[data-theme="dark"] .yr-card { background: linear-gradient(180deg, #211E45, #1A1838); border-color: #34306A; box-shadow: 0 10px 26px rgba(0, 0, 0, .35); }
[data-theme="dark"] .yr-current { border-color: rgba(167, 139, 250, .55); box-shadow: 0 0 0 1px rgba(167, 139, 250, .25), 0 12px 30px rgba(76, 29, 149, .35); }
[data-theme="dark"] .yr-card h3 { color: #F5F3FF; }
[data-theme="dark"] .yr-past { opacity: 1; }
[data-theme="dark"] .yr-past h3 { color: #C4C2E8; }
[data-theme="dark"] .yr-st { background: rgba(148, 163, 184, .16); color: #CBD5E1; }
[data-theme="dark"] .yr-current .yr-st { background: rgba(167, 139, 250, .2); color: #DDD6FE; }
[data-theme="dark"] .yr-next .yr-st { background: rgba(16, 185, 129, .18); color: #6EE7B7; }
[data-theme="dark"] .yr-view { color: #93C5FD; }
[data-theme="dark"] .yr-prog-bar.sm { background: rgba(167, 139, 250, .18); }
[data-theme="dark"] .yr-nums { color: #E8E7FF; }
[data-theme="dark"] .yr-note { color: #FCD34D; }
[data-theme="dark"] .yr-copy { background: rgba(124, 58, 237, .12); border-color: rgba(167, 139, 250, .3); }
[data-theme="dark"] .yr-copy select { background: #14122E; color: var(--ink); }
[data-theme="dark"] .yr-card footer { border-top-color: #34306A; }
[data-theme="dark"] .yr-card footer .btn-ghost { background: rgba(255, 255, 255, .06); color: #E8E7FF; border-color: #403D6E; }
[data-theme="dark"] .yr-card .danger { color: #FCA5A5; }
[data-theme="dark"] .yr-tips { background: rgba(245, 158, 11, .08); color: #FDE68A; border-color: rgba(245, 158, 11, .3); }
@media (max-width: 900px) { .yr-hero { grid-template-columns: 1fr; } .yr-hero-act { flex-direction: row; } }
.ab-row.empty { background: #FAFAFB; border-style: dashed; }
.ab-row.empty .ab-pct { background: #F1F5F9; } .ab-row.empty .ab-pct b { color: #CBD5E1; }
.ab-row.empty .ab-badge { filter: saturate(.55); }
[data-theme="dark"] .ab-row.empty { background: transparent; }

/* ---- Home on phones: compact, fits one screen ---- */
.hh-quick { display: none; }
@media (max-width: 600px) {
  .home-top { flex-wrap: nowrap; gap: 8px; padding: 8px 10px; }
  .home-brand { flex: 1; gap: 8px; }
  .home-brand img { width: 38px; height: 38px; border-radius: 9px; }
  .home-brand > span { min-width: 0; }
  .home-brand strong, .home-brand small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .home-brand strong { font-size: .8rem; line-height: 1.6; }
  .home-brand small { font-size: .68rem; }
  .home-actions { flex: none; gap: 6px; flex-wrap: nowrap; }
  .home-actions .lbl { display: none; }
  .home-actions .btn-sm { min-width: 38px; height: 38px; padding: 0 10px; justify-content: center; }
  .public-shell .home-actions { flex-wrap: wrap; }
  .public-shell .hl-ask, .public-shell .hl-track { display: none; }
  .home-wrap { padding: 10px 10px 90px; }
  .home-hero { padding: 0 14px 14px; border-radius: 22px; gap: 10px; }
  .hh-art { min-height: 0; height: 170px; margin: 0 -14px -6px; }
  .ha-buddha { height: 100%; bottom: 0; }
  .ha-quill { height: 52%; bottom: 6%; left: 3%; }
  .ha-monks { width: 34%; bottom: 8%; right: 2%; }
  .ha-monks figcaption { font-size: .56rem; padding: 10px 4px 2px; }
  .hh-chips { margin-bottom: 6px; gap: 6px; }
  .hh-chip { font-size: .74rem; padding: 3px 10px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hh-chip-school { display: none; }
  .home-hero h1 { font-size: 1rem; line-height: 1.75; margin: 0 0 2px; }
  .hh-motto { font-size: .8rem; }
  .hh-quote { margin: 8px 0 0; padding: 6px 10px 6px 12px; }
  .hh-quote blockquote { font-size: .76rem; line-height: 1.8; }
  .hh-quote figcaption { font-size: .74rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .hh-clock { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: 'row' 'date'; align-items: center; gap: 6px 10px; padding: 10px 14px; border-radius: 16px; }
  .hh-clock .hh-row { grid-area: row; padding: 0 0 6px; justify-content: space-between; flex-wrap: nowrap; gap: 8px; font-size: .7rem; min-width: 0; }
  .hh-clock .hh-row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .hh-clock .hh-time { grid-area: time; margin: 0; font-size: 1.3rem; text-align: left; line-height: 1.3; }
  .hh-clock .hh-date { grid-area: date; border: 0; padding: 0; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; min-width: 0; }
  .hh-clock .hh-be { display: none; }
  .hh-clock .hh-status { display: none; }
  .hh-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; position: relative; z-index: 1; }
  .hh-quick a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 2px 7px; border-radius: 14px; text-decoration: none; color: #fff;
    background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .25); backdrop-filter: blur(8px); font-size: .72rem; font-weight: 600; text-align: center; line-height: 1.4; }
  .hh-quick a:active { transform: scale(.96); background: rgba(255, 255, 255, .24); }
  .hh-quick i { font-style: normal; font-size: 1.35rem; line-height: 1; }
}
@media (max-width: 360px) { .hh-quick a { font-size: .66rem; } .hh-clock .hh-time { font-size: 1.35rem; } }

/* Student QR sign-in: camera buttons, success flash, tips */
.sl-msg.ok { color: #15803D; font-weight: 700; }
.sl-cam-btns { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 8px; z-index: 3; }
.sl-cam-btns button { width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .45); color: #fff; font-size: 1.15rem; cursor: pointer; backdrop-filter: blur(6px); }
.sl-cam-btns button.on { background: #FBBF24; }
.sl-cam:not(.sl-live) .sl-cam-btns { display: none; }
.sl-cam.hit .sl-frame { box-shadow: 0 0 0 9999px rgba(16, 185, 129, .25), inset 0 0 0 4px #10B981; }
.sl-tip { margin: 8px 0 0; font-size: .76rem; color: var(--muted); text-align: center; line-height: 1.7; }
.qr-warn { display: block; margin-top: 4px; font-size: .72rem; color: #B45309; background: #FFFBEB; border: 1px solid #FDE68A; border-radius: 8px; padding: 2px 8px; }

/* ---- Animated logo splash (សាលាពុទ្ធិកៈ) ---- */
.splash:has(.sp-video) { background: #000; }
.sp-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.sp-square { -webkit-mask-image: radial-gradient(closest-side, #000 78%, transparent 100%); mask-image: radial-gradient(closest-side, #000 78%, transparent 100%); }
.sp-wide { -webkit-mask-image: radial-gradient(ellipse 60% 62% at 50% 50%, #000 70%, transparent 100%); mask-image: radial-gradient(ellipse 60% 62% at 50% 50%, #000 70%, transparent 100%); }
.splash [hidden] { display: none !important; }
.splash:has(.sp-video) .sp-skip { color: rgba(255,255,255,.35); }
.splash { position: fixed; inset: 0; z-index: 10000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; cursor: pointer; overflow: hidden;
  background: radial-gradient(circle at 50% 42%, #33476B 0%, #1E2A42 55%, #121A2B 100%); animation: spIn .35s ease; }
.splash.out { animation: spOut .45s ease forwards; }
.sp-stage { position: relative; width: min(82vw, 56vh, 460px); aspect-ratio: 1; }
.sp-logo { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; filter: drop-shadow(0 18px 40px rgba(0,0,0,.45));
  animation: spLogo 1.3s cubic-bezier(.2,.9,.25,1.15) both; }
.sp-rays { position: absolute; inset: -18%; border-radius: 50%; pointer-events: none; opacity: 0;
  background: repeating-conic-gradient(from 0deg, rgba(251,191,36,.16) 0deg 6deg, transparent 6deg 18deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 45%, transparent 100%); mask-image: radial-gradient(closest-side, #000 45%, transparent 100%);
  animation: spRays 1s ease .6s forwards, spSpin 24s linear infinite; }
.sp-shine { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; pointer-events: none; }
.sp-shine::before { content: ''; position: absolute; top: -20%; bottom: -20%; width: 32%; left: -50%; transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255,240,200,.55), transparent); animation: spSweep 1.1s ease-in-out 1.3s forwards; }
.sp-text { display: flex; flex-direction: column; align-items: center; text-align: center; opacity: 0; animation: spText .7s ease 1.4s forwards; padding: 0 20px; margin-top: 10px; }
.sp-text b { font-family: var(--moul); font-weight: 400; font-size: clamp(1rem, 4vw, 1.4rem); line-height: 1.9; color: #FCD58A; }
.sp-text small { font-size: .86rem; letter-spacing: .12em; color: #CBD5E1; }
.sp-bar { width: min(200px, 56vw); height: 3px; border-radius: 2px; background: rgba(255,255,255,.14); overflow: hidden; margin-top: 12px; }
.sp-bar i { display: block; height: 100%; width: 0; border-radius: 2px; background: linear-gradient(90deg, #F59E0B, #FCD34D); animation: spBar 3.2s linear forwards; }
.sp-skip { position: absolute; bottom: max(18px, env(safe-area-inset-bottom)); margin: 0; font-size: .74rem; color: rgba(255,255,255,.45); }
@keyframes spIn { from { opacity: 0; } }
@keyframes spOut { to { opacity: 0; transform: scale(1.04); visibility: hidden; } }
@keyframes spLogo { 0% { opacity: 0; transform: scale(.55) rotate(-25deg); } 60% { opacity: 1; } 100% { opacity: 1; transform: none; } }
@keyframes spRays { to { opacity: 1; } }
@keyframes spSpin { to { rotate: 360deg; } }
@keyframes spSweep { to { left: 120%; } }
@keyframes spText { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes spBar { to { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .splash, .sp-logo, .sp-text, .sp-bar i, .sp-rays, .sp-shine::before { animation-duration: .01s; animation-delay: 0s; } .sp-text { opacity: 1; } }

/* ---- School promotion banner (home page, public) ---- */
.promo { --pr-h: clamp(210px, 24vw, 340px); position: relative; height: var(--pr-h); border-radius: 20px; overflow: hidden; background: #1E2A42; margin: 18px auto; max-width: 1180px; box-shadow: 0 10px 28px rgba(15, 23, 42, .16); isolation: isolate; }
.promo [hidden] { display: none !important; }
.pr-track { position: absolute; inset: 0; }
.pr-slide { position: absolute; inset: 0; display: flex; opacity: 0; visibility: hidden; transition: opacity .6s ease, visibility .6s; }
.pr-slide.on { opacity: 1; visibility: visible; }
.pr-bg { position: absolute; inset: -30px; background-size: cover; background-position: center; filter: blur(26px) brightness(.55) saturate(1.2); z-index: -1; }
.pr-bg-plain { inset: 0; filter: none; background: radial-gradient(circle at 30% 30%, #33476B, #1E2A42 60%, #121A2B); }
/* the picture / video keeps its own 16:9 shape; the caption sits beside it */
.pr-box { position: relative; height: 100%; flex: 1; overflow: hidden; }
.pr-split .pr-box, .pr-box-vid { flex: none; aspect-ratio: 16 / 9; max-width: 64%; }
.pr-slide:not(.pr-split) .pr-box-vid { margin: 0 auto; max-width: 100%; }
.pr-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.pr-box-vid .pr-img, .pr-split .pr-img { object-fit: cover; }
.pr-slide.on .pr-img { animation: prKen 9s ease-out both; }
@keyframes prKen { from { transform: scale(1.04); } to { transform: scale(1); } }
.pr-cap { position: relative; flex: 1; min-width: 0; padding: 22px 28px 40px; color: #fff; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 6px;
  background: linear-gradient(90deg, rgba(20, 28, 48, .55), rgba(20, 28, 48, .85)); }
.pr-cap h3 { margin: 0; font-family: var(--moul); font-weight: 400; font-size: clamp(1rem, 1.9vw, 1.45rem); line-height: 1.75; color: #FCE7B2; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pr-cap p { margin: 0; font-size: clamp(.84rem, 1.2vw, .98rem); opacity: .9; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pr-cta { margin-top: 8px; border: 0; border-radius: 999px; padding: 9px 20px; font: inherit; font-weight: 700; cursor: pointer; color: #1E2A42; background: linear-gradient(90deg, #F59E0B, #FCD34D); box-shadow: 0 6px 18px rgba(245, 158, 11, .35); }
.pr-cta:hover { filter: brightness(1.06); }
.pr-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 1; border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; color: #fff; }
.pr-play span { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; padding-left: 5px; background: rgba(255, 255, 255, .2); backdrop-filter: blur(6px); border: 2px solid rgba(255,255,255,.8); animation: prPulse 2s infinite; }
.pr-play small { font-size: .72rem; background: rgba(0,0,0,.45); padding: 2px 10px; border-radius: 999px; }
@keyframes prPulse { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.45); } 70% { box-shadow: 0 0 0 16px rgba(255,255,255,0); } 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); } }
.pr-media { position: absolute; inset: 0; z-index: 2; background: #000; display: grid; place-items: center; }
.pr-media.loading { background: transparent; }
.pr-media video, .pr-media iframe { width: 100%; height: 100%; border: 0; object-fit: cover; }
.has-sound .pr-media video { object-fit: contain; }
.pr-media.tall iframe { width: min(100%, 340px); }
.pr-snd { position: absolute; right: 10px; bottom: 10px; z-index: 3; border: 0; border-radius: 999px; padding: 6px 12px; cursor: pointer; font: inherit; font-size: .9rem; color: #fff; background: rgba(0,0,0,.6); }
.pr-snd::after { content: ' បើកសំឡេង'; font-size: .78rem; }
.pr-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 4; width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer; font-size: 1.5rem; line-height: 1; color: #fff; background: rgba(15, 23, 42, .4); backdrop-filter: blur(4px); opacity: 0; transition: opacity .2s; }
.promo:hover .pr-nav, .pr-nav:focus-visible { opacity: 1; }
.pr-prev { left: 10px; } .pr-next { right: 10px; }
.pr-dots { position: absolute; right: 18px; bottom: 14px; z-index: 4; display: flex; gap: 6px; }
.pr-dots button { width: 8px; height: 8px; border-radius: 999px; border: 0; padding: 0; cursor: pointer; background: rgba(255,255,255,.45); transition: width .3s, background .3s; }
.pr-dots button.on { width: 22px; background: #FCD34D; }
.pr-timer { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; z-index: 4; background: rgba(255,255,255,.1); }
.pr-timer i { display: block; height: 100%; width: 0; background: #FCD34D; }
@keyframes prBar { to { width: 100%; } }
.pr-manage { position: absolute; top: 10px; left: 10px; z-index: 4; border: 0; border-radius: 999px; padding: 5px 12px; font: inherit; font-size: .76rem; cursor: pointer; color: #fff; background: rgba(15, 23, 42, .55); backdrop-filter: blur(4px); opacity: .75; }
.pr-manage:hover { opacity: 1; }
.promo-empty { height: auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 16px 20px; color: #E2E8F0; background: linear-gradient(120deg, #1E2A42, #33476B); }
.promo-empty div { display: flex; flex-direction: column; gap: 2px; }
.promo-empty span { font-size: .84rem; opacity: .8; }
@media (max-width: 700px) {
  .promo { --pr-h: auto; height: auto; border-radius: 16px; }
  .pr-track { position: relative; display: grid; }
  .pr-slide { position: relative; grid-area: 1 / 1; flex-direction: column; }
  .pr-box, .pr-split .pr-box, .pr-box-vid { flex: none; width: 100%; max-width: none; height: auto; aspect-ratio: 16 / 9; }
  .pr-cap { padding: 12px 16px 26px; background: rgba(20, 28, 48, .88); gap: 2px; }
  .pr-cap h3 { font-size: 1rem; line-height: 1.6; -webkit-line-clamp: 2; }
  .pr-cap p { font-size: .82rem; -webkit-line-clamp: 2; }
  .pr-cta { padding: 7px 16px; font-size: .86rem; margin-top: 6px; }
  .pr-nav { display: none; }
  .pr-dots { right: 50%; transform: translateX(50%); bottom: 9px; }
  .pr-play span { width: 54px; height: 54px; font-size: 1.35rem; }
}
@media (prefers-reduced-motion: reduce) { .pr-slide, .pr-slide.on .pr-img, .pr-play span { animation: none; transition: none; } }
/* pop-up for first-time visitors */
.pr-pop { padding: 0; width: min(92vw, 900px); max-width: none; border-radius: 22px; overflow: hidden; background: #1E2A42; }
.pr-pop .promo { --pr-h: min(56vh, 460px); margin: 0; max-width: none; border-radius: 0; box-shadow: none; }
.pr-pop-x { position: absolute; top: 10px; right: 10px; z-index: 5; background: rgba(0,0,0,.55); color: #fff; border-radius: 50%; }
/* admin */
.pr-hint { margin: 0 0 12px; font-size: .86rem; color: var(--muted, #64748B); }
.pr-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pr-list li { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--line, #E2E8F0); border-radius: 14px; flex-wrap: wrap; }
.pr-th { position: relative; width: 112px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #1E2A42; display: grid; place-items: center; color: #fff; flex: none; }
.pr-th img { width: 100%; height: 100%; object-fit: cover; }
.pr-th i { position: absolute; font-style: normal; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.55); font-size: .7rem; }
.pr-meta { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 2px; }
.pr-meta small { color: var(--muted, #64748B); font-size: .78rem; }
.pr-st { font-style: normal; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.pr-st-on { background: #DCFCE7; color: #166534; } .pr-st-off { background: #F1F5F9; color: #475569; }
.pr-st-soon { background: #DBEAFE; color: #1E40AF; } .pr-st-past { background: #FEE2E2; color: #991B1B; }
.pr-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pr-acts .switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.pr-acts .switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; z-index: 1; }
.pr-acts .switch span { position: absolute; inset: 0; border-radius: 999px; background: #CBD5E1; transition: background .2s; }
.pr-acts .switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.pr-acts .switch input:checked + span { background: #16A34A; }
.pr-acts .switch input:checked + span::after { transform: translateX(18px); }
.pr-acts .switch input:focus-visible + span { outline: 2px solid #2563EB; outline-offset: 2px; }
.pr-none { text-align: center; padding: 24px; color: var(--muted, #64748B); }
.pr-ed { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.pr-ed [hidden] { display: none !important; }
.pr-ed-prev { position: sticky; top: 0; }
.pr-ed-prev .promo { --pr-h: 200px; margin: 6px 0; }
.pr-size { font-size: .8rem; color: var(--muted, #64748B); margin: 0; }
.pr-kinds { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.pr-kinds label { cursor: pointer; }
.pr-kinds input { position: absolute; opacity: 0; }
.pr-kinds span { display: block; padding: 8px 12px; border: 1.5px solid var(--line, #E2E8F0); border-radius: 12px; font-size: .9rem; }
.pr-kinds input:checked + span { border-color: #C98A1E; background: #FEF6E4; font-weight: 700; }
.pr-kinds input:focus-visible + span { outline: 2px solid #2563EB; }
@media (max-width: 760px) { .pr-ed { grid-template-columns: 1fr; } .pr-ed-prev { position: static; order: -1; } }

/* ---- Platform: all schools (super admin) ---- */
.pf-hero { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; padding: 22px 26px; border-radius: 20px; margin-bottom: 16px; color: #F8FAFC; background: radial-gradient(circle at 15% 20%, #33476B, #1E2A42 60%, #121A2B); }
.pf-hero h2 { margin: 0 0 4px; font-size: 1.3rem; color: #FCE7B2; }
.pf-hero p { margin: 0; max-width: 640px; opacity: .85; font-size: .9rem; }
.pf-kpis { display: flex; gap: 10px; }
.pf-kpis span { display: flex; flex-direction: column; align-items: center; min-width: 78px; padding: 8px 12px; border-radius: 14px; background: rgba(255,255,255,.08); font-size: .78rem; }
.pf-kpis b { font-size: 1.5rem; color: #FCD34D; line-height: 1.3; }
.pf-migrate { border: 2px dashed #C98A1E; background: #FFFBEB; }
.pf-migrate h3 { margin-top: 0; }
.pf-prog { font-weight: 700; }
.pf-table td { vertical-align: top; }
.pf-table tr.off { opacity: .6; }
.pf-st { font-size: .8rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.pf-st.on { background: #DCFCE7; color: #166534; } .pf-st.off { background: #FEE2E2; color: #991B1B; }
.pf-acts { white-space: nowrap; }
.pf-msg { white-space: pre-wrap; background: var(--bg, #F1F5F9); padding: 12px 14px; border-radius: 12px; font-family: inherit; font-size: .9rem; user-select: all; }
.pf-intro { max-width: 640px; }
.platform-only { max-width: 1200px; margin: 0 auto; padding: 16px; }
.po-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 4px 18px; }
.empty.suspended { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.platform-login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 30% 20%, #33476B, #1E2A42 55%, #121A2B); }
.pl-card { width: min(420px, 100%); background: #fff; border-radius: 24px; padding: 32px 28px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.35); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pl-card h1 { margin: 6px 0 0; font-size: 1.25rem; color: #1E2A42; }
.pl-card p { margin: 0; color: #64748B; font-size: .9rem; }
.pl-err { color: #B91C1C !important; background: #FEF2F2; padding: 8px 12px; border-radius: 10px; }
.pl-google { margin-top: 10px; display: inline-flex; align-items: center; gap: 10px; padding: 11px 22px; border: 1px solid #DADCE0; border-radius: 999px; background: #fff; color: #3C4043; font-weight: 600; cursor: pointer; }
.pl-google:hover { background: #F8FAFC; }
.pl-back { font-size: .85rem; color: #64748B; margin-top: 6px; }
.po-me { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--muted); }
.foot-super { color: inherit; opacity: .7; text-decoration: none; white-space: nowrap; }
.foot-super:hover { opacity: 1; text-decoration: underline; }
.pf-sup-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pf-sup-list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; }
.pf-sup-list li b { flex: 1; }
.pf-sup-add { display: flex; gap: 8px; flex-wrap: wrap; }
.pf-sup-add input { flex: 1; min-width: 220px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }

/* ---- Welcome banner art for general-stream (អាណាចក្រ) schools: book of knowledge ---- */
.hh-art-edu .he-stage { position: absolute; z-index: 3; left: 50%; bottom: 3%; height: 90%; aspect-ratio: 589 / 425; max-width: 104%; transform: translateX(-50%); animation: heFloat 6s ease-in-out infinite; }
.hh-art-edu .he-book { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 10px 22px rgba(0,0,0,.35)) drop-shadow(0 0 18px rgba(253, 224, 71, .25)); }
.hh-art-edu .he-rays { position: absolute; z-index: 1; left: 50%; top: 52%; width: 120%; aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(253, 230, 138, .20) 0deg 5deg, transparent 5deg 16deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 20%, transparent 72%); mask-image: radial-gradient(closest-side, #000 20%, transparent 72%);
  animation: heSpin 50s linear infinite; }
.hh-art-edu .he-rise { position: absolute; inset: 0; pointer-events: none; }
.hh-art-edu .he-rise span { position: absolute; left: var(--x); bottom: 30%; font-family: var(--moul); font-size: clamp(.9rem, 1.6vw, 1.35rem); color: #FDE68A; opacity: 0;
  text-shadow: 0 0 10px rgba(251, 191, 36, .9), 0 2px 4px rgba(0,0,0,.4); animation: heRise 6.4s ease-out var(--d) infinite; }
.hh-art-edu .he-stars { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.hh-art-edu .he-stars i { position: absolute; left: var(--x); top: var(--y); font-style: normal; color: #FEF3C7; font-size: .9rem; text-shadow: 0 0 8px #FDE68A; animation: heTw 3.4s ease-in-out var(--d) infinite; }
@keyframes heFloat { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-8px); } }
@keyframes heSpin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes heRise { 0% { opacity: 0; transform: translateY(0) scale(.6) rotate(-8deg); } 15% { opacity: 1; } 70% { opacity: .9; } 100% { opacity: 0; transform: translateY(-150%) translateY(-90px) scale(1.15) rotate(8deg); } }
@keyframes heTw { 0%, 100% { opacity: .15; transform: scale(.6); } 50% { opacity: 1; transform: scale(1.2); } }
@media (prefers-reduced-motion: reduce) { .hh-art-edu .he-stage, .hh-art-edu .he-rays, .hh-art-edu .he-rise span, .hh-art-edu .he-stars i { animation: none; } .hh-art-edu .he-rise span { display: none; } .hh-art-edu .he-stars i { opacity: .7; } }
@media (max-width: 600px) { .hh-art-edu .he-stage { height: 88%; bottom: 2%; } }
.hero-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hero-kinds label { cursor: pointer; }
.hero-kinds input { position: absolute; opacity: 0; }
.hero-kinds span { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 14px; font-weight: 700; }
.hero-kinds small { font-weight: 400; color: var(--muted); font-size: .8rem; }
.hero-kinds input:checked + span { border-color: #7C3AED; background: #F5F3FF; }
.hero-kinds input:focus-visible + span { outline: 2px solid #2563EB; }
@media (max-width: 600px) { .hero-kinds { grid-template-columns: 1fr; } }
.pf-splash { padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: .82rem; background: var(--panel); }
.sl-link { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; border: 2px solid #DDD6FE; background: linear-gradient(135deg, #F5F3FF, #fff); }
.sl-link-qr { padding: 10px; background: #fff; border-radius: 16px; border: 1px solid var(--line); line-height: 0; }
.sl-link-txt { flex: 1; min-width: 240px; }
.sl-link-txt h2 { margin: 0 0 4px; }
.sl-link-row { display: flex; gap: 8px; margin: 10px 0; }
.sl-link-row input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-weight: 700; color: #6D28D9; background: #fff; }
.sl-link-acts { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 600px) { .sl-link { flex-direction: column; align-items: stretch; text-align: center; } .sl-link-qr { align-self: center; } }

/* Teacher QR sign-in */
.sq-panel .sq-on { margin: 4px 0 8px; font-weight: 600; color: #15803D; }
.sq-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.sq-card-dlg { width: min(380px, 94vw); }
.sq-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px; border: 2px solid #7C3AED; border-radius: 16px; background: #fff; color: #1E293B; text-align: center; }
.sq-card .sq-school { color: #4C1D95; font-size: .95rem; }
.sq-card .sq-qr svg { width: 220px; height: 220px; display: block; }
.sq-card .sq-name { font-size: 1.1rem; }
.sq-card .sq-role { font-size: .82rem; color: #64748B; }
.sl-switch[hidden] { display: none; }

/* ---- Public header: three clear doors (staff · student · parent) + small icons ---- */
.home-actions { gap: 10px; flex-wrap: nowrap; }
.hl-pop { position: relative; }
.home-actions > .btn, .hl-pop > .btn { height: 40px; padding: 0 16px; border-radius: 12px; font-weight: 700; font-size: .9rem; gap: 6px; }
.hl-toggle { display: inline-flex; align-items: center; background: #12325E; color: #fff; border: 0; box-shadow: 0 6px 14px -8px rgba(18, 50, 94, .9); }
.hl-toggle:hover, .hl-pop.open .hl-toggle { background: #0B1E3F; }
.hl-parent { display: inline-flex; align-items: center; background: var(--panel); color: #BE185D; border: 1px solid #F9A8D4; }
.hl-parent:hover, .hl-pop.open .hl-parent { background: #FDF2F8; }
.hl-caret { width: 0; height: 0; margin-left: 2px; border: 4px solid transparent; border-top-color: currentColor; border-bottom: 0; transition: transform .15s; }
.hl-pop.open .hl-caret { transform: rotate(180deg); }
.hl-sep { width: 1px; height: 26px; background: var(--line-strong); margin: 0 2px; }
.hl-icon { width: 40px; height: 40px; border-radius: 12px; font-size: 1.05rem; }
.hl-icon[hidden] { display: none; }

.hl-panel { display: none; position: absolute; top: calc(100% + 10px); right: 0; z-index: 30; width: 320px; box-sizing: border-box; padding: 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 44px -12px rgba(15, 23, 42, .35); }
.hl-pop.open .hl-panel { display: block; animation: hlDrop .16s ease-out; }
@keyframes hlDrop { from { opacity: 0; transform: translateY(-6px); } }
.hl-panel-title { margin: 0 0 12px; font-weight: 700; color: var(--ink); }
.hl-form { display: flex; flex-direction: column; gap: 10px; }
.hl-field { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 42px; border-radius: 11px; border: 1px solid var(--line-strong); background: var(--input); color: var(--muted); }
.hl-field:focus-within { border-color: #2563EB; box-shadow: 0 0 0 3px color-mix(in srgb, #2563EB 18%, transparent); }
.hl-field input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; padding: 0; font-size: .92rem; }
.hl-eye { border: 0; background: none; cursor: pointer; padding: 0 2px; font-size: .95rem; opacity: .7; }
.hl-submit { height: 42px; justify-content: center; background: #12325E !important; box-shadow: none !important; border-radius: 11px; }
.hl-submit:hover { background: #0B1E3F !important; }
.hl-or { display: flex; align-items: center; gap: 10px; font-size: .78rem; color: var(--muted); }
.hl-or::before, .hl-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.hl-qrlogin { height: 42px; justify-content: center; border-radius: 11px; border: 1px dashed var(--line-strong); }
.hl-error { margin: 0; font-size: .82rem; color: #B91C1C; background: color-mix(in srgb, #EF4444 10%, var(--panel)); padding: 6px 10px; border-radius: 8px; }
.hl-error[hidden] { display: none; }

.hl-menu { width: 260px; padding: 6px; }
.hl-menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none; cursor: pointer; text-align: left; font: inherit; color: var(--ink); }
.hl-menu button:hover, .hl-menu button:focus-visible { background: color-mix(in srgb, #EC4899 8%, var(--panel)); }
.hl-menu b { font-size: .9rem; }
.hl-menu small { font-size: .76rem; color: var(--muted); }

@media (max-width: 900px) {
  .home-actions > .btn, .hl-pop > .btn { padding: 0 12px; }
  .hl-sep { display: none; }
}
@media (max-width: 600px) {
  .public-shell .home-actions { flex-wrap: nowrap; gap: 6px; }
  .home-actions > .btn, .hl-pop > .btn { width: 40px; min-width: 40px; padding: 0; justify-content: center; font-size: 1.05rem; }
  .hl-caret { display: none; }
  .hl-pop { position: static; }
  .hl-panel { position: absolute; left: 10px; right: 10px; width: auto; top: calc(100% + 6px); }
  .hl-icon.hl-qr { display: none; }
}
@media (max-width: 600px) {
  .public-shell .home-top { flex-wrap: wrap; }
  .public-shell .home-brand { flex: 1 1 0; }
}
.hl-forget { border: 0; background: none; padding: 0; font: inherit; font-size: .74rem; color: var(--muted); text-decoration: underline; cursor: pointer; text-align: left; }
.hl-forget[hidden] { display: none; }

/* ---- Signed-in header: one work button + an account menu ---- */
.hu-work { height: 40px; padding: 0 18px; border-radius: 12px; font-weight: 700; background: #12325E; color: #fff; border: 0; display: inline-flex; align-items: center; gap: 6px; box-shadow: 0 6px 14px -8px rgba(18, 50, 94, .9); }
.hu-work:hover { background: #0B1E3F; color: #fff; }
.hu-me { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px 0 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font: inherit; color: var(--ink); }
.hu-me:hover, .hu-pop.open .hu-me { border-color: var(--line-strong); background: color-mix(in srgb, #2563EB 5%, var(--panel)); }
.hu-avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #2563EB, #7C3AED); color: #fff; font-weight: 700; font-size: 1rem; line-height: 1; }
.hu-avatar.big { width: 44px; height: 44px; font-size: 1.25rem; }
.hu-who { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; text-align: left; }
.hu-who b { font-size: .88rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hu-who small { font-size: .72rem; color: var(--muted); }
.hu-menu { width: 280px; }
.hu-menu a { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.hu-menu a:hover, .hu-menu a:focus-visible { background: color-mix(in srgb, #2563EB 8%, var(--panel)); }
.hu-menu a small { font-size: .76rem; color: var(--muted); }
.hu-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
.hu-card { display: flex; gap: 12px; align-items: center; padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.hu-card > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.hu-card b { font-size: .95rem; }
.hu-card small { font-size: .76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.hu-card em { font-style: normal; font-size: .72rem; color: #1D4ED8; background: color-mix(in srgb, #3B82F6 12%, var(--panel)); padding: 1px 8px; border-radius: 999px; align-self: flex-start; margin-top: 3px; }
.hu-menu .hu-out b { color: #DC2626; }
.hu-menu .hu-out:hover { background: color-mix(in srgb, #EF4444 8%, var(--panel)); }
@media (max-width: 600px) {
  .hu-who, .hu-me .hl-caret { display: none; }
  .hu-me { padding: 0 4px; }
  .hu-work { width: auto; padding: 0 14px; }
  .hu-work .lbl { display: none; }
  .hu-menu { width: auto; }
}

/* Student header: the school name keeps its own space and never slides under the bell/avatar */
.st-top { grid-template-columns: minmax(0, 1fr) auto; }
.st-brand > span { min-width: 0; }
.st-brand img { flex: none; }
.st-actions { align-self: start; }
@media (max-width: 600px) {
  .st-brand { align-items: flex-start; gap: 8px; }
  .st-brand img { width: 36px; height: 36px; margin-top: 2px; }
  .st-brand strong { white-space: normal; font-size: .8rem; line-height: 1.75; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .st-brand small { font-size: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .st-actions { gap: 6px; }
}

/* Student greeting card: compact on phones */
@media (max-width: 600px) {
  .st-hero { min-height: 0; padding: 14px 16px; gap: 12px; border-radius: 18px; }
  .st-hi { font-size: .78rem; }
  .st-hero h1 { font-size: 1.12rem; line-height: 1.75; }
  .st-chips { gap: 5px 6px; margin-top: 2px; }
  .st-chips > span { padding: 2px 9px; font-size: .72rem; white-space: nowrap; }
  .st-quote { margin-top: 8px !important; padding: 4px 10px; font-size: .72rem; line-height: 1.7; }
  .st-stats { min-width: 0; border-radius: 12px; }
  .st-stats div { padding: 7px 4px; gap: 0; }
  .st-stats b { font-size: 1.05rem; }
  .st-stats small { font-size: .66rem; }
}

/* Student "what do you want to do today?" — an even grid: 4 per row on wide screens, 2 per row on phones */
.st-quick { grid-auto-rows: 1fr; }
.st-q:first-child { grid-column: auto; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 14px 13px; }
.st-q:first-child .st-q-ico { width: 44px; height: 44px; margin: 0 0 8px; border-radius: 13px; }
.st-q:first-child .st-q-ico .st-svg { width: 22px; height: 22px; }
.st-q:first-child b { font-size: .92rem; }
.st-q small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 900px) {
  .st-q:last-child:nth-child(even) { grid-column: auto; flex-direction: column; align-items: flex-start; gap: 2px; }
  .st-q:last-child:nth-child(even) .st-q-ico { margin: 0 0 8px; }
}
@media (max-width: 600px) {
  .st-quick { gap: 10px; }
  .st-q, .st-q:first-child { padding: 12px 12px 11px; border-radius: 14px; }
  .st-q-ico, .st-q:first-child .st-q-ico { width: 40px; height: 40px; margin-bottom: 6px; border-radius: 12px; }
  .st-q b { font-size: .86rem; }
  .st-q small { font-size: .7rem; }
  .st-q em { top: 10px; right: 10px; font-size: .62rem; padding: 1px 7px; }
}

/* Student quick cards: icon and text centred in the card */
.st-q, .st-q:first-child, .st-q:last-child:nth-child(even) { align-items: center; justify-content: flex-start; text-align: center; }
.st-q .st-q-txt { align-items: center; }
.st-q-ico, .st-q:first-child .st-q-ico, .st-q:last-child:nth-child(even) .st-q-ico { margin-left: auto; margin-right: auto; }
.st-q, .st-q:first-child { padding-top: 18px; }

/* Public home hero: tighter on phones so it feels light and open */
@media (max-width: 600px) {
  .home-hero { padding: 0 12px 12px; gap: 8px; border-radius: 20px; }
  .hh-art { height: 132px; margin: 0 -12px -4px; }
  .ha-monks { width: 30%; }
  .hh-chips { margin-bottom: 4px; }
  .hh-chip { font-size: .7rem; padding: 2px 9px; }
  .home-hero h1 { font-size: .92rem; line-height: 1.7; }
  .hh-motto { font-size: .74rem; }
  .hh-quote { margin-top: 6px; padding: 4px 10px; }
  .hh-quote blockquote { font-size: .72rem; line-height: 1.7; }
  .hh-quote figcaption { font-size: .68rem; -webkit-line-clamp: 1; }
  .hh-clock { padding: 7px 12px; gap: 2px 10px; border-radius: 14px; }
  .hh-clock .hh-row { padding: 0 0 3px; font-size: .66rem; }
  .hh-clock .hh-date { font-size: .8rem; }
  .hh-quick { gap: 6px; }
  .hh-quick a { padding: 7px 2px 5px; gap: 2px; border-radius: 12px; font-size: .66rem; }
  .hh-quick i { font-size: 1.1rem; }
}

/* ---- Homework (teacher page + student tab share the same card) ---- */
.ws-badge.warn { color: #B45309; }
.hw-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.hw-classes { display: flex; gap: 8px; flex-wrap: wrap; }
.hw-class { font: inherit; font-weight: 600; padding: 7px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
.hw-class[aria-selected="true"] { background: #16A34A; border-color: #16A34A; color: #fff; }
.hw-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.hw-kpi { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.hw-kpi span { grid-row: span 2; font-size: 1.4rem; }
.hw-kpi b { font-size: 1.3rem; line-height: 1.3; }
.hw-kpi small { color: var(--muted); font-size: .78rem; }
.hw-kpi.check b { color: #B45309; } .hw-kpi.open b { color: #2563EB; }
.hw-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.hw-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--c); box-shadow: var(--shadow); }
.hw-card header { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.hw-card h3 { margin: 2px 0 0; font-size: 1rem; line-height: 1.6; }
.hw-subj { font-size: .74rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--panel)); }
.hw-due { font-size: .74rem; font-weight: 600; color: var(--muted); }
.hw-due.hw-k-soon { color: #B45309; } .hw-due.hw-k-today { color: #EA580C; } .hw-due.hw-k-late { color: #DC2626; } .hw-due.hw-k-ok { color: #15803D; }
.hw-body { margin: 0; font-size: .86rem; color: var(--ink); white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.hw-meta { margin: 0; font-size: .76rem; color: var(--muted); }
.hw-wait { color: #B45309; }
.hw-prog { height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--c) 12%, var(--panel)); overflow: hidden; }
.hw-prog span { display: block; height: 100%; background: var(--c); border-radius: inherit; }
.hw-card footer { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.hw-note { margin: 0; font-size: .82rem; padding: 6px 10px; border-radius: 10px; background: var(--paper); white-space: pre-line; overflow-wrap: anywhere; }
.hw-feedback { margin: 0; font-size: .84rem; font-weight: 600; padding: 6px 10px; border-radius: 10px; color: #15803D; background: color-mix(in srgb, #22C55E 12%, var(--panel)); }
.st-hw.is-checked { border-top-color: #22C55E; }
.hw-dlg { width: min(620px, 96vw); }
.hw-subs { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow: auto; }
.hw-subs li { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.hw-subs li.is-in { border-color: #FCD34D; background: color-mix(in srgb, #FBBF24 7%, var(--panel)); }
.hw-subs li.is-checked { border-color: #86EFAC; }
.hw-subs li.is-out { opacity: .7; }
.hw-sub-head { display: flex; justify-content: space-between; gap: 8px; font-size: .88rem; }
.hw-sub-head span { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.hw-fb { display: flex; gap: 8px; }
.hw-fb input { flex: 1; min-width: 0; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--input); font: inherit; font-size: .84rem; }
.st-q-count { background: #DC2626 !important; color: #fff !important; border: 0 !important; }
.st-hw-next .st-sec-head { margin-bottom: 8px; }
.st-hw-mini { display: grid; grid-template-columns: auto 1fr; grid-template-areas: 'subj due' 'title title'; gap: 2px 8px; align-items: center; width: 100%; text-align: left; font: inherit; padding: 10px 12px; margin-top: 8px; border-radius: 12px; border: 1px solid var(--line); border-left: 4px solid var(--c); background: var(--panel); cursor: pointer; color: var(--ink); }
.st-hw-mini .hw-subj { grid-area: subj; justify-self: start; }
.st-hw-mini .hw-due { grid-area: due; justify-self: end; }
.st-hw-mini b { grid-area: title; font-size: .9rem; }
@media (max-width: 700px) {
  .hw-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .hw-list { grid-template-columns: 1fr; }
  .hw-top .btn { width: 100%; justify-content: center; }
}

/* Teacher work page: account in the hero's top-right corner */
.ws-head { position: relative; }
.ws-me { position: absolute; top: 22px; right: 24px; z-index: 6; }
.ws-me-btn { display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px 0 5px; border-radius: 999px; cursor: pointer; font: inherit; color: #fff;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .35); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.ws-me-btn:hover, .ws-me.open .ws-me-btn { background: rgba(255, 255, 255, .24); }
.ws-me-btn .hu-avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }
.ws-me-who { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.3; text-align: left; }
.ws-me-who b { font-size: .88rem; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-me-who small { font-size: .72rem; opacity: .85; }
.ws-me.open .hl-caret { transform: rotate(180deg); }
.ws-me-menu { position: absolute; top: calc(100% + 8px); right: 0; width: 290px; padding: 6px; border-radius: 16px; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 18px 44px -12px rgba(15, 23, 42, .35); animation: hlDrop .16s ease-out; }
.ws-me-menu[hidden] { display: none; }
.ws-me-menu a, .ws-me-menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none; font: inherit; color: var(--ink); text-decoration: none; text-align: left; cursor: pointer; }
.ws-me-menu a:hover, .ws-me-menu button:hover { background: color-mix(in srgb, #2563EB 8%, var(--panel)); }
.ws-me-menu a small { font-size: .76rem; color: var(--muted); }
.ws-me-menu b { font-size: .9rem; }
.ws-me-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
.ws-me-menu .hu-out b { color: #DC2626; }
@media (max-width: 700px) {
  .ws-me { top: 16px; right: 16px; }
  .ws-me-who, .ws-me .hl-caret { display: none; }
  .ws-me-btn { padding: 0 4px; height: 44px; }
  .ws-me-menu { width: min(290px, calc(100vw - 32px)); }
}
/* Profile in the hero: picture only */
.ws-me-btn { position: relative; width: 50px; height: 50px; padding: 0; justify-content: center; border-radius: 50%; }
.ws-me-btn .hu-avatar { width: 40px; height: 40px; font-size: 1.1rem; }
.ws-me-dot { position: absolute; top: 1px; right: 1px; width: 12px; height: 12px; border-radius: 50%; background: #EF4444; box-shadow: 0 0 0 2px #fff; }
.ws-me-dot[hidden] { display: none; }
.ws-me-menu .ws-me-hw b { color: #B45309; }
.ws-me-menu .ws-me-hw[hidden] { display: none; }
@media (max-width: 700px) { .ws-me-btn { width: 46px; height: 46px; padding: 0; } }

/* Scanner: title row on top, sessions as one even row of buttons under it (never over the frame) */
.scn-top { flex-direction: column; justify-content: flex-start; gap: 10px; padding: 14px 14px 22px; background: linear-gradient(rgba(0,0,0,.72), rgba(0,0,0,.35) 75%, transparent); }
.scn-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.scn-title { min-width: 0; }
.scn-title b, .scn-title small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scn-title small { display: block; font-size: .78rem; }
.scn-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; margin: 0; }
.scn-chip { align-items: center; text-align: center; padding: 6px 4px; border-radius: 12px; min-width: 0; backdrop-filter: blur(6px); }
.scn-chip b { font-size: .8rem; white-space: nowrap; }
.scn-chip small { font-size: .66rem; white-space: nowrap; }
.scn-cam { max-width: 150px; text-overflow: ellipsis; }
@media (max-width: 600px) {
  .scn-title b { font-size: .95rem; }
  .scn-cam { max-width: 108px; font-size: .74rem; padding: 7px 10px; }
  .scn-x { width: 40px; height: 40px; font-size: 1.05rem; }
  .scn-frame { top: 52%; }
  .scn-chips { gap: 5px; }
  .scn-chip { padding: 5px 2px; overflow: hidden; }
  .scn-chip b { font-size: .74rem; }
  .scn-chip small { font-size: .58rem; letter-spacing: -.02em; }
}

/* Attendance board: the number cards open the list of students behind them */
button.ab-kpi { font: inherit; color: inherit; text-align: left; width: 100%; cursor: pointer; transition: transform .15s, box-shadow .15s; }
button.ab-kpi:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -14px var(--c); border-color: color-mix(in srgb, var(--c) 45%, transparent); }
button.ab-kpi:focus-visible { outline: 3px solid color-mix(in srgb, var(--c) 45%, transparent); outline-offset: 2px; }
.ab-kpi-go { margin-left: auto; align-self: center; width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: var(--c); background: #fff; opacity: .55; transition: opacity .15s; }
button.ab-kpi:hover .ab-kpi-go { opacity: 1; }
.ab-dlg { width: min(640px, 96vw); }
.ab-dlg-sub { margin: 0 0 10px; }
.ab-dlg-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.ab-dlg-tabs button { flex: none; font: inherit; font-size: .8rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.ab-dlg-tabs button b { margin-left: 2px; }
.ab-dlg-tabs button[aria-selected="true"] { background: var(--c); border-color: var(--c); color: #fff; }
.ab-dlg-q { display: flex; align-items: center; gap: 8px; margin: 10px 0; padding: 0 12px; height: 40px; border-radius: 11px; border: 1px solid var(--line-strong); background: var(--input); }
.ab-dlg-q input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; }
.ab-dlg-list { max-height: 55vh; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.ab-dlg-list h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: .9rem; position: sticky; top: 0; background: var(--panel); padding: 4px 0; }
.ab-dlg-list h3 small { color: var(--muted); font-weight: 500; }
.ab-dlg-list h3 a { margin-left: auto; font-size: .76rem; font-weight: 600; }
.ab-dlg-list ol { margin: 0; padding-left: 26px; }
.ab-dlg-list li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: .88rem; }
.ab-dlg-list li small { color: var(--muted); font-size: .72rem; }
.ab-st { margin-left: auto; font-size: .74rem; font-weight: 700; color: var(--c); white-space: nowrap; }
.ab-dlg-empty { text-align: center; color: var(--muted); padding: 24px 0; }
/* Sidebar: "home" button (the top bar keeps the only "back" button) */
.rail .rail-home[aria-current] { background: rgba(255, 255, 255, .2); border-color: rgba(255, 255, 255, .35); color: #fff !important; }

/* ---- Hourly teachers ---- */
.hr-tabs { display: flex; gap: 6px; padding: 4px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.hr-tab { flex: 1; text-align: center; white-space: nowrap; padding: 9px 14px; border-radius: 10px; font-weight: 600; color: var(--muted); text-decoration: none; }
.hr-tab:hover { color: var(--ink); background: var(--paper); }
.hr-tab[aria-current] { background: #4F46E5; color: #fff; }
.hr-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.hr-kpi { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 14px 16px; border-radius: 16px; background: color-mix(in srgb, var(--c) 7%, var(--panel)); border: 1px solid color-mix(in srgb, var(--c) 22%, transparent); }
.hr-kpi span { grid-row: span 2; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--panel); font-size: 1.3rem; }
.hr-kpi b { font-size: 1.3rem; color: var(--c); line-height: 1.4; overflow-wrap: anywhere; }
.hr-kpi small { color: var(--muted); font-size: .78rem; }
.hr-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.hr-bar h2 { margin: 0; font-size: 1.05rem; } .hr-bar h2 small { color: var(--muted); font-weight: 500; font-size: .8rem; }
.hr-bar-r { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hr-month { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; height: 40px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--input); }
.hr-month input { border: 0; background: transparent; font: inherit; outline: 0; }
.hr-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.hr-card { padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; gap: 10px; }
.hr-card.off { opacity: .6; }
.hr-card-top { display: flex; gap: 10px; align-items: center; }
.hr-card-top div { display: flex; flex-direction: column; min-width: 0; } .hr-card-top small { color: var(--muted); font-size: .78rem; }
.hr-av { width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; background: linear-gradient(135deg, #4F46E5, #0EA5E9); }
.hr-off { margin-left: auto; font-style: normal; font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: var(--paper); color: var(--muted); }
.hr-card dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0; padding: 8px; border-radius: 12px; background: var(--paper); }
.hr-card dl div { text-align: center; } .hr-card dt { font-size: .7rem; color: var(--muted); } .hr-card dd { margin: 0; font-weight: 700; font-size: .86rem; }
.hr-pay { color: #15803D; font-weight: 700; }
.hr-phone { font-size: .84rem; }
.hr-card footer { display: flex; gap: 8px; }
.hr-table .hr-h { font-weight: 700; } .hr-acts { white-space: nowrap; text-align: right; }
.hr-report tfoot td { font-weight: 700; background: var(--paper); }
.hr-report td:nth-child(n+4), .hr-report th:nth-child(n+4) { text-align: right; }
.hr-note { margin: 10px 0 0; font-size: .8rem; }
.hr-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.hr-quick button { font: inherit; font-size: .8rem; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--panel); cursor: pointer; }
.hr-quick button:hover { border-color: #4F46E5; color: #4F46E5; }
@media (max-width: 700px) {
  .hr-kpis { grid-template-columns: 1fr; gap: 8px; }
  .hr-tab { padding: 8px 10px; font-size: .84rem; }
}
.hr-table { width: 100%; border-collapse: collapse; } .hr-table th, .hr-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; } .hr-table th { font-size: .8rem; color: var(--muted); background: var(--paper); }
.hr-src { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hr-src label { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line); cursor: pointer; }
.hr-src label:has(input:checked) { border-color: #4F46E5; background: color-mix(in srgb, #4F46E5 6%, var(--panel)); }
.hr-src label:has(input:disabled) { opacity: .55; cursor: default; }
.hr-src input { margin-top: 5px; accent-color: #4F46E5; }
.hr-src span { display: flex; flex-direction: column; } .hr-src small { font-size: .74rem; color: var(--muted); line-height: 1.5; }
.hr-pick[hidden] { display: none; }
.hr-pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 40vh; overflow: auto; margin: 8px 0 12px; padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.hr-pick-list label { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; cursor: pointer; }
.hr-pick-list label:hover { background: var(--paper); }
.hr-pick-list label:has(input:checked) { background: color-mix(in srgb, #4F46E5 8%, var(--panel)); }
.hr-pick-list input { accent-color: #4F46E5; width: 18px; height: 18px; }
.hr-pick-list span:last-child { display: flex; flex-direction: column; } .hr-pick-list small { font-size: .74rem; color: var(--muted); }
.hr-av.sm { width: 32px; height: 32px; font-size: .9rem; }
@media (max-width: 560px) { .hr-src { grid-template-columns: 1fr; } }

/* Hourly teachers: settings, marks, penalties */
.hr-kpis { grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); }
.hr-tabs .hr-tab { min-width: max-content; }
.hr-sets { display: flex; flex-direction: column; gap: 14px; }
.hr-set { padding: 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; gap: 12px; }
.hr-set > header { display: flex; gap: 12px; align-items: flex-start; }
.hr-set > header > span { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--paper); font-size: 1.2rem; }
.hr-set h3 { margin: 0; font-size: .98rem; } .hr-set header p { margin: 2px 0 0; font-size: .8rem; color: var(--muted); }
.hr-save { position: sticky; bottom: 10px; display: flex; justify-content: flex-end; }
.hr-save .btn { box-shadow: 0 10px 24px -10px rgba(79, 70, 229, .7); }
.hr-late-opts.off { opacity: .45; pointer-events: none; }
.hr-rate { display: inline-flex; align-items: center; gap: 4px; } .hr-rate input { width: 110px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--input); font: inherit; } .hr-rate em { font-style: normal; color: var(--muted); }
.hr-sw { position: relative; display: inline-block; width: 42px; height: 24px; cursor: pointer; }
.hr-sw input { opacity: 0; width: 0; height: 0; }
.hr-sw i { position: absolute; inset: 0; border-radius: 999px; background: #CBD5E1; transition: background .15s; }
.hr-sw i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.hr-sw input:checked + i { background: #16A34A; } .hr-sw input:checked + i::after { transform: translateX(18px); }
.hr-sw input:focus-visible + i { outline: 3px solid color-mix(in srgb, #16A34A 40%, transparent); }
.hr-kpick { display: flex; flex-wrap: wrap; gap: 8px; }
.hr-kpick label { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1.5px solid var(--line); cursor: pointer; font-size: .84rem; }
.hr-kpick label:has(input:checked) { border-color: var(--c); background: color-mix(in srgb, var(--c) 9%, var(--panel)); }
.hr-kpick input { accent-color: var(--c); }
.hr-warn { margin-left: auto; font-style: normal; font-size: .74rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #B91C1C; background: color-mix(in srgb, #EF4444 12%, var(--panel)); }
.hr-tset .hr-warn { margin-left: 0; }
.hr-late { color: #B45309; font-weight: 600; font-size: .82rem; }
.hr-minus { color: #B91C1C; font-weight: 600; }
.hr-sub { display: block; font-size: .72rem; color: var(--muted); font-weight: 400; }
.hr-remark { font-size: .78rem; color: var(--muted); max-width: 220px; }
.hr-marks-dlg { width: min(560px, 96vw); }
.hr-mark-add { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 14px; background: var(--paper); }
.hr-kind { display: flex; gap: 8px; }
.hr-kind label { flex: 1; } .hr-kind input { position: absolute; opacity: 0; }
.hr-kind span { display: block; text-align: center; padding: 8px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 600; }
.hr-kind input:checked + span { border-color: #DC2626; color: #B91C1C; }
.hr-kind label:last-child input:checked + span { border-color: #16A34A; color: #15803D; }
.hr-marks { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow: auto; }
.hr-marks li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); }
.hr-marks li.warn { border-color: #FCA5A5; } .hr-marks li.good { border-color: #86EFAC; }
.hr-marks li div { flex: 1; display: flex; flex-direction: column; } .hr-marks small { color: var(--muted); font-size: .74rem; }
@media (max-width: 700px) { .hr-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.hr-src3 { grid-template-columns: repeat(3, 1fr); }
.hr-scan-opts { display: flex; flex-direction: column; gap: 10px; }
.hr-scan-opts.off { opacity: .45; pointer-events: none; }
.hr-pairs { display: flex; flex-wrap: wrap; gap: 8px; }
.hr-pairs label { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); }
.hr-pairs label > span { display: flex; flex-direction: column; font-weight: 600; font-size: .86rem; } .hr-pairs small { font-weight: 400; color: var(--muted); font-size: .72rem; }
.hr-pairs input { width: 70px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--input); font: inherit; }
.hr-pairs em { font-style: normal; color: var(--muted); font-size: .8rem; }
.hr-mode { margin: -4px 0 12px; font-size: .84rem; color: var(--muted); }
.hr-h3 { margin: 16px 0 8px; font-size: .95rem; } .hr-h3 small { color: var(--muted); font-weight: 500; font-size: .78rem; margin-left: 6px; }
.hr-flag { background: color-mix(in srgb, #F59E0B 7%, var(--panel)); }
.hr-ok { color: #16A34A; font-weight: 700; }
.hr-unlinked { margin: 0; font-size: .76rem; color: #B45309; }
@media (max-width: 700px) { .hr-src3 { grid-template-columns: 1fr; } }
/* Hourly teacher card: tidy, even footer */
.hr-card { gap: 12px; padding: 16px; }
.hr-card dl { padding: 10px 6px; align-items: start; }
.hr-card dt { white-space: nowrap; margin-bottom: 2px; }
.hr-card dd { white-space: nowrap; font-size: .9rem; }
.hr-card footer { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: auto; }
.hr-card footer .btn { min-width: 0; padding: 0 6px; height: 36px; justify-content: center; font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hr-card .hr-unlinked { padding: 6px 10px; border-radius: 10px; background: color-mix(in srgb, #F59E0B 10%, var(--panel)); }
.hr-diag { list-style: none; margin: 10px auto 6px; padding: 0; max-width: 620px; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.hr-diag li { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 10px; background: var(--paper); font-size: .84rem; }
.hr-diag li span { color: var(--muted); font-size: .8rem; }

/* ⏰ Scan times dialog */
.st-rows { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.st-row { padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); }
.st-row[hidden] { display: none; }
.st-row.st-bad { border-color: #DC2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, .18); }
.st-shifts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 4px; }
.st-shifts > span { font-weight: 700; margin-right: 4px; }
.st-shift { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 112px; padding: 8px 14px; border-radius: 14px; border: 1.5px solid var(--line-strong); background: var(--panel); color: inherit; font: inherit; cursor: pointer; }
.st-shift b { font-size: 1rem; }
.st-shift small { font-size: .78rem; color: var(--muted); }
.st-shift[aria-pressed="true"] { border-color: #7C3AED; background: #F5F3FF; color: #5B21B6; box-shadow: 0 0 0 3px rgba(124, 58, 237, .15); }
[data-theme="dark"] .st-shift[aria-pressed="true"] { background: #2E1065; color: #DDD6FE; }
@media (max-width: 600px) { .st-shift { flex: 1; min-width: 0; padding: 8px 10px; } .st-shifts > span { width: 100%; } }
.st-row-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.st-name { flex: 1; min-width: 0; font: inherit; font-weight: 700; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--input); }
.st-row-head select { font: inherit; padding: 7px 8px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--input); }
.st-times { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.st-times label { display: flex; flex-direction: column; gap: 3px; font-size: .76rem; color: var(--muted); }
.st-times label[hidden] { display: none; }
.st-times input { font: inherit; padding: 7px 8px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--input); color: var(--ink); }
.st-say { margin: 8px 0 0; padding: 6px 10px; border-radius: 10px; font-size: .8rem; background: var(--paper); }
@media (max-width: 600px) { .st-times { grid-template-columns: 1fr 1fr; } .st-times .st-staff { grid-column: span 2; } }
/* Scanner: late / early results look different too */
.scn-msg.ok.warn { background: #F59E0B; color: #111; }
.scn.flash-warn::after { animation: scn-warn .7s; }
@keyframes scn-warn { from { box-shadow: inset 0 0 0 14px rgba(245, 158, 11, .85); } to { box-shadow: inset 0 0 0 0 rgba(245, 158, 11, 0); } }
.scn-sound { position: absolute; }
.scn-snd { width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.14); color: #fff; font-size: 1.1rem; cursor: pointer; }
@media (max-width: 600px) { .scn-snd { width: 40px; height: 40px; font-size: 1rem; } }

/* Days off + lateness report */
.at-off { background: color-mix(in srgb, #10B981 10%, var(--panel)); border-left: 4px solid #10B981; }
.ab-alert.ab-off { background: color-mix(in srgb, #10B981 10%, var(--panel)); border-color: #6EE7B7; }
.at-report th.off, .at-report td.off { background: repeating-linear-gradient(45deg, color-mix(in srgb, #94A3B8 14%, transparent) 0 4px, transparent 4px 8px); }
.at-report th.off a { color: var(--muted); }
.hol h2 { font-size: 1rem; margin: 18px 0 6px; } .hol h2:first-child { margin-top: 0; } .hol h2 small { color: var(--muted); font-weight: 500; }
.hol-week { display: flex; flex-wrap: wrap; gap: 8px; }
.hol-week label { cursor: pointer; } .hol-week input { position: absolute; opacity: 0; }
.hol-week span { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); font-weight: 600; }
.hol-week input:checked + span { background: #10B981; border-color: #10B981; color: #fff; }
.hol-week input:focus-visible + span { outline: 3px solid color-mix(in srgb, #10B981 40%, transparent); }
.hol-add { display: grid; grid-template-columns: 160px 160px 1fr auto; gap: 10px; align-items: end; margin-top: 8px; }
.hol-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; font-size: .8rem; }
.hol-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hol-list li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); }
.hol-list li.past { opacity: .55; } .hol-list li b { flex: 1; }
.hol-date { font-size: .82rem; color: #047857; font-weight: 700; white-space: nowrap; min-width: 110px; }
.hol-next { margin: 12px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--paper); }
.late-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
.late-kpis > div { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--c) 22%, transparent); background: color-mix(in srgb, var(--c) 7%, var(--panel)); }
.late-kpis span { grid-row: span 2; font-size: 1.4rem; } .late-kpis b { font-size: 1.3rem; color: var(--c); } .late-kpis small { color: var(--muted); font-size: .76rem; }
.late-h { font-size: 1rem; margin: 0 0 10px; }
.late-table tr.top td { background: color-mix(in srgb, #F59E0B 7%, var(--panel)); }
.late-n { font-weight: 700; color: #B45309; }
.late-days { font-size: .78rem; color: var(--muted); }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); }
.seg a { padding: 6px 12px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .86rem; }
.seg a.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
@media (max-width: 700px) { .hol-add { grid-template-columns: 1fr 1fr; } .hol-add .hol-name, .hol-add .btn { grid-column: span 2; } .late-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 📥 Import students */
.imp-dlg { width: min(880px, 96vw); }
.imp-src { display: flex; gap: 6px; padding: 4px; border-radius: 14px; background: var(--paper); margin-bottom: 14px; flex-wrap: wrap; }
.imp-src button { flex: 1; font: inherit; font-weight: 600; padding: 9px 12px; border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; white-space: nowrap; }
.imp-src button[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.imp-pane { display: flex; flex-direction: column; gap: 10px; }
.imp-pane[hidden] { display: none; }
.imp-pane textarea { width: 100%; font: inherit; padding: 10px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--input); }
.imp-pane .btn { align-self: flex-start; }
.imp-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 32px 16px; border-radius: 16px; border: 2px dashed var(--line-strong); text-align: center; cursor: pointer; transition: background .15s, border-color .15s; }
.imp-drop:hover, .imp-drop.over { border-color: #7C3AED; background: color-mix(in srgb, #7C3AED 6%, var(--panel)); }
.imp-drop span { font-size: 2rem; } .imp-drop small { color: var(--muted); font-size: .78rem; }
.imp-tpl { margin: 14px 0 0; font-size: .84rem; color: var(--muted); }
.imp-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.imp-map { margin: 10px 0; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.imp-map summary { cursor: pointer; font-weight: 600; font-size: .88rem; }
.imp-map-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin-top: 10px; }
.imp-sum { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.imp-sum span { font-size: .8rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.imp-sum .new { background: color-mix(in srgb, #22C55E 14%, var(--panel)); color: #15803D; }
.imp-sum .upd { background: color-mix(in srgb, #3B82F6 14%, var(--panel)); color: #1D4ED8; }
.imp-sum .skip { background: var(--paper); color: var(--muted); }
.imp-sum .warn { background: color-mix(in srgb, #F59E0B 16%, var(--panel)); color: #B45309; }
.imp-prev { max-height: 42vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.imp-prev tr.imp-skip td { opacity: .5; }
.imp-prev tr.imp-upd td:last-child { color: #1D4ED8; }
.imp-prev tr.imp-new td:last-child { color: #15803D; font-weight: 600; }
.imp-miss { color: #B45309; }
/* «វិភាគសិស្ស» page: small links above the analysis */
.an-links { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.an-links a { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; font-size: .85rem; text-decoration: none; color: var(--ink); }
.an-links a:hover { border-color: #7C3AED; color: #7C3AED; }

/* ---------- Attendance regularity ---------- */
.rg-levels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.rg-levels a { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; padding: 11px 13px; border-radius: 14px; text-decoration: none; color: inherit;
  border: 1.5px solid color-mix(in srgb, var(--c) 22%, transparent); background: color-mix(in srgb, var(--c) 7%, var(--panel)); transition: transform .12s; }
.rg-levels a:hover { transform: translateY(-1px); }
.rg-levels a.on { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.rg-levels span { grid-row: span 2; font-size: 1.4rem; } .rg-levels b { font-size: 1.3rem; color: var(--c); } .rg-levels small { color: var(--muted); font-size: .76rem; }
.rg-alert { border-left: 4px solid #DC2626; } .rg-alert h3 { margin: 0 0 6px; font-size: .98rem; color: #B91C1C; }
.rg-alert ul { margin: 0; padding-left: 20px; display: grid; gap: 3px; font-size: .88rem; }
.rg-honor { padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, #7C3AED 8%, var(--panel)); border: 1px solid color-mix(in srgb, #7C3AED 22%, transparent); font-size: .88rem; }
.rg-table td, .rg-table th { text-align: center; } .rg-table td { white-space: nowrap; } .rg-table td:nth-child(2) { text-align: left; }
.rg-table tr.rg-risk td { background: color-mix(in srgb, #DC2626 6%, var(--panel)); }
.rg-table tr.rg-watch td { background: color-mix(in srgb, #D97706 6%, var(--panel)); }
.rg-a { color: #DC2626; font-weight: 700; }
.rg-bar { position: relative; min-width: 74px; height: 18px; border-radius: 9px; background: color-mix(in srgb, var(--c) 12%, transparent); overflow: hidden; }
.rg-bar span { position: absolute; inset: 0 auto 0 0; width: var(--p); background: color-mix(in srgb, var(--c) 45%, transparent); }
.rg-bar b { position: relative; font-size: .74rem; line-height: 18px; }
.rg-pill { display: inline-block; white-space: nowrap; padding: 1px 8px; border-radius: 999px; font-size: .76rem; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.rg-days { text-align: left !important; min-width: 150px; line-height: 1; }
.rg-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin: 1px; background: #22C55E; }
.rg-dot.l { background: #F59E0B; } .rg-dot.e { background: #3B82F6; } .rg-dot.a { background: #EF4444; }
.rg-dot.auto { background: repeating-linear-gradient(45deg, #EF4444 0 2px, #FECACA 2px 4px); }
@media (max-width: 800px) { .rg-levels { grid-template-columns: repeat(2, minmax(0, 1fr)); } .rg-levels a:first-child { grid-column: span 2; } .rg-days-h, .rg-days { display: none; } }
.rg-rules fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 12px; margin: 0 0 12px; }
.rg-rules legend { font-weight: 700; padding: 0 6px; }
.rg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 12px; }
.rg-f > div { display: flex; align-items: center; gap: 6px; } .rg-f input { width: 80px; } .rg-f em { font-style: normal; color: var(--muted); font-size: .8rem; }
.rg-radio { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; cursor: pointer; } .rg-radio small { display: block; color: var(--muted); font-size: .78rem; }
.rg-note { font-size: .8rem; margin: 0 0 8px; }

/* ---------- Certificates (បណ្ណសរសើរ) ---------- */
.ct-kinds .hr-p { background: #EFF6FF; border-color: #BFDBFE; color: #1E3A8A; }
.ct-kinds .hr-p[aria-pressed="true"] { background: linear-gradient(135deg, #1E3A8A, #2563EB); border-color: #1E3A8A; color: #fff; box-shadow: 0 4px 12px rgba(30, 58, 138, .3); }
.ct-wrap [hidden] { display: none !important; }
.ct-frames { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.ct-fbtn { position: relative; display: flex; flex-direction: column; gap: 4px; align-items: stretch; padding: 5px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface, #fff); cursor: pointer; font: inherit; color: inherit; }
.ct-fbtn[aria-pressed="true"] { border-color: #1E3A8A; box-shadow: 0 0 0 3px rgba(30, 58, 138, .18); }
.ct-fbtn small { font-size: .68rem; line-height: 1.3; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-fbtn i { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: #DC2626; color: #fff; font-style: normal; font-size: 11px; line-height: 20px; text-align: center; }
.ct-fthumb { display: block; aspect-ratio: 297 / 210; border-radius: 4px; background: #FFFDF7 center / 100% 100% no-repeat; }
.ct-t-kbach { box-shadow: inset 0 0 0 3px #C9962B, inset 0 0 0 7px #FFFDF7, inset 0 0 0 8.5px #1E3A8A; }
.ct-t-classic { box-shadow: inset 0 0 0 4px #FFFDF7, inset 0 0 0 6px #1E3A8A, inset 0 0 0 8px #FFFDF7, inset 0 0 0 9px #1E3A8A; }
.ct-t-ribbon { box-shadow: inset 0 0 0 3px #FFFDF7, inset 0 0 0 9px #1E3A8A, inset 0 0 0 10px #D4A537; }
.ct-t-plain { box-shadow: inset 0 0 0 1px #CBD5E1; }
.ct-up { width: 100%; justify-content: center; margin-bottom: 6px; }
.hr-stage .ct-page { margin: 0 auto; box-shadow: 0 10px 30px rgba(15, 23, 42, .18); flex: none; }
textarea.hr-sel { resize: vertical; font-weight: 500; }
.hr-f input.hr-sel + input.hr-sel { margin-top: 4px; }
.ct-fthumb.ct-own { background-size: 100% 100%, 10px 10px; background-repeat: no-repeat, repeat; }
.ct-logo-pos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 6px 0 10px; }
.ct-logo-pos button { padding: 7px 4px; border-radius: 9px; border: 1.5px solid #BFDBFE; background: #EFF6FF; color: #1E3A8A; font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; }
.ct-logo-pos button:hover { background: #DBEAFE; }
.ct-lay input[type=range], .hr-card input[type=range] { width: 100%; accent-color: #1E3A8A; }

/* ---------- Subjects: school study system ---------- */
.sb-sys { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.sb-sys h2 { margin: 0 0 2px; }
.sb-choices { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 8px; flex: 1; max-width: 760px; }
.sb-choice { text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--paper); font: inherit; color: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.sb-choice b { font-size: .98rem; } .sb-choice small { color: var(--muted); font-size: .74rem; line-height: 1.4; }
.sb-choice:hover:not(:disabled) { border-color: var(--red); }
.sb-choice[aria-checked="true"] { border-color: var(--red); background: color-mix(in srgb, var(--red) 7%, var(--panel)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 14%, transparent); }
.sb-choice[aria-checked="true"] b { color: var(--red); }
.sb-choice:disabled { cursor: default; opacity: .8; }
.sb-hidden { border-left: 4px solid #F59E0B; } .sb-hidden p { margin: 0 0 6px; }
@media (max-width: 700px) { .sb-choices { grid-template-columns: 1fr; } }

/* ---------- Subject summary ---------- */
.sbs-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.sbs-head h2 { margin: 0 0 2px; }
.sbs-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sbs-sel { font: inherit; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: inherit; }
.sbs-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.sbs-kpis > div { padding: 10px 14px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.sbs-kpis b { font-size: 1.15rem; } .sbs-kpis small { color: var(--muted); font-size: .76rem; }
.sbs-kpis .good { background: color-mix(in srgb, #16A34A 8%, var(--panel)); border-color: color-mix(in srgb, #16A34A 30%, transparent); } .sbs-kpis .good b { color: #15803D; font-size: 1rem; }
.sbs-kpis .warn { background: color-mix(in srgb, #F59E0B 9%, var(--panel)); border-color: color-mix(in srgb, #F59E0B 35%, transparent); } .sbs-kpis .warn b { color: #B45309; font-size: 1rem; }
.sbs-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.sbs-table th { text-align: center; font-weight: 600; color: var(--muted); font-size: .8rem; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sbs-table td { text-align: center; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sbs-table .sbs-name { text-align: left; font-weight: 700; }
.sbs-table .sbs-avg { font-weight: 700; color: var(--ink, inherit); }
.sbs-table tr.sbs-empty td { color: var(--muted); }
.sbs-tag { font-size: .8rem; }
.sbs-prog { position: relative; min-width: 84px; height: 18px; border-radius: 9px; background: color-mix(in srgb, #F59E0B 16%, transparent); overflow: hidden; }
.sbs-prog span { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, #F59E0B 55%, transparent); }
.sbs-prog.full span { background: color-mix(in srgb, #22C55E 55%, transparent); } .sbs-prog.full { background: color-mix(in srgb, #22C55E 14%, transparent); }
.sbs-prog b { position: relative; font-size: .72rem; line-height: 18px; }
.sbs-dist { display: flex; min-width: 120px; height: 14px; border-radius: 7px; overflow: hidden; background: var(--line); }
.sbs-grid td.sbs-heat { background: color-mix(in srgb, var(--c) 14%, var(--panel)); color: var(--c); font-weight: 700; }
.sbs-grid td.sbs-na { color: var(--muted); }
.sbs-note { font-size: .78rem; margin: 10px 0 0; }
.sbs-note i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 3px 0 10px; vertical-align: middle; }

/* ---------- Timetable: អាណាចក្រ layout options ---------- */
.tt-style { width: 100%; margin-bottom: 10px; } .tt-style button { flex: 1; }
.tt-prow .tt-plabel { grid-column: 1 / -1; margin-bottom: 4px; border-color: #FCA5A5; color: #B91C1C; }
.tt-prow.brk select { color: #B91C1C; border-color: #FCA5A5; background: #FEF2F2; }
.tt-addp { display: flex; flex-wrap: wrap; gap: 6px; }
.tt-side textarea { font: inherit; font-size: .86rem; width: 100%; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); resize: vertical; }
.tt-auto-btn { border-color: color-mix(in srgb, var(--red) 40%, var(--line)); color: var(--red); font-weight: 700; }
.tta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 10px; margin-bottom: 10px; }
.tta-q { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.tta-q span { font-weight: 700; font-size: .9rem; }
.tta-q input { width: 64px; font: inherit; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); text-align: center; background: var(--panel); color: var(--ink); }
#ttaSum.bad { color: #DC2626; }
.tta-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .tta-head .btn { margin-left: auto; }

/* ---------- Photos of teachers and students ---------- */
.pf { display: flex; align-items: center; gap: 16px; padding: 12px 14px; margin-bottom: 12px; border-radius: 16px; border: 1px dashed color-mix(in srgb, var(--red) 35%, var(--line)); background: color-mix(in srgb, var(--red) 4%, var(--paper)); }
.pf-pic { width: 92px; height: 92px; flex: none; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--panel); box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px color-mix(in srgb, var(--red) 40%, transparent); font-size: 40px; }
.pf-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pf-side small { color: var(--muted); font-size: .76rem; line-height: 1.5; }
.pf-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.pf-btns label { cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .pf-cam { display: none; } }
.pf-name { display: flex; align-items: center; gap: 10px; }
.pf-av { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--line); }
.pf-av.pf-none { display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: var(--muted); background: var(--paper); }
.sf-av img.sf-photo { width: 100%; height: 100%; border-radius: inherit; box-shadow: none; }
.avatar.has-photo, .hu-avatar.has-photo { overflow: hidden; padding: 0; background: #fff; } .avatar.has-photo img, .hu-avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.sf-av:has(img) { overflow: hidden; }
.pf [hidden] { display: none !important; }
.pf-url { display: flex; gap: 6px; } .pf-url input { flex: 1; min-width: 0; font: inherit; font-size: .86rem; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.pf-msg { color: #15803D !important; font-weight: 600; } .pf-msg.bad { color: #B91C1C !important; }

/* ---------- Administrative letters ---------- */
.lt-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.lt-type { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; text-decoration: none; color: inherit;
  border: 1.5px solid color-mix(in srgb, var(--c) 25%, var(--line)); background: color-mix(in srgb, var(--c) 6%, var(--panel)); transition: transform .12s, box-shadow .12s; }
.lt-type:hover { transform: translateY(-2px); box-shadow: 0 8px 20px color-mix(in srgb, var(--c) 18%, transparent); border-color: var(--c); }
.lt-type span { grid-row: span 2; font-size: 1.7rem; } .lt-type b { color: var(--c); font-size: .95rem; } .lt-type small { color: var(--muted); font-size: .74rem; line-height: 1.45; }
.lt-list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; } .lt-list-head h2 { margin: 0; }
.lt-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.lt-filters select, .lt-filters input { font: inherit; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
.lt-filters input { min-width: 240px; }
.lt-list { display: grid; gap: 8px; }
.lt-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); border-left: 4px solid var(--c); text-decoration: none; color: inherit; background: var(--panel); }
.lt-item:hover { background: color-mix(in srgb, var(--c) 5%, var(--panel)); }
.lt-ic { font-size: 1.4rem; } .lt-item b { display: block; } .lt-item small { color: var(--muted); font-size: .78rem; }
.lt-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-align: right; }
.lt-meta em { font-style: normal; font-weight: 700; color: var(--c); font-size: .84rem; } .lt-meta em.draft { color: #B45309; }
.lt-wrap { display: grid; grid-template-columns: 290px 1fr; gap: 16px; align-items: start; }
.lt-side { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); max-height: calc(100vh - 100px); overflow: auto; }
.lt-side h3 { margin: 4px 0 0; }
.lt-var { width: 100%; } .lt-var button { flex: 1; }
.lt-num { display: grid; grid-template-columns: 1fr 90px; gap: 6px; }
.lt-side input, .lt-side select { font: inherit; width: 100%; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
.lt-tb { display: flex; flex-wrap: wrap; gap: 4px; }
.lt-tb button { min-width: 34px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; font-size: .85rem; cursor: pointer; }
.lt-tb button:hover { border-color: var(--red); color: var(--red); }
.lt-acts { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.lt-del { color: #B91C1C; }
.lt-stage { min-width: 0; padding: 12px; border-radius: 18px; background: #CBD5E1; overflow: auto; }
.lt-zoom .lt-sheet { margin: 0 auto; box-shadow: 0 8px 26px rgba(15, 23, 42, .22); }
.lt-sheet [contenteditable]:hover { outline: 1px dashed #F59E0B; outline-offset: 3px; }
.lt-sheet [contenteditable]:focus { outline: 2px solid #F59E0B; outline-offset: 3px; }
.lt-sheet [contenteditable]:empty::before { content: '…'; color: #94A3B8; }
@media (max-width: 900px) { .lt-wrap { grid-template-columns: 1fr; } .lt-side { position: static; max-height: none; } }
.lt-side input[type=checkbox] { width: auto; padding: 0; }

/* ---------- Live attendance board: dark mode ---------- */
[data-theme="dark"] .ab { background: var(--panel); border-color: var(--line); box-shadow: 0 12px 32px rgba(0, 0, 0, .35); --ab-track: #2A2850; }
[data-theme="dark"] .ab-hero { background: radial-gradient(circle at 92% -40%, rgba(255, 255, 255, .12), transparent 45%), linear-gradient(120deg, #0B4F4A 0%, #0B4A5E 45%, #2E2A7A 100%); }
[data-theme="dark"] .ab-in { background: var(--input); box-shadow: 0 0 0 1px var(--line); }
[data-theme="dark"] .ab-in input, [data-theme="dark"] .ab-in select { color: var(--ink); background: transparent; }
[data-theme="dark"] .ab-in select option { background: var(--panel); color: var(--ink); }
[data-theme="dark"] .ab-seg button { background: var(--paper); border-color: var(--line); color: var(--ink); }
[data-theme="dark"] .ab-seg button[aria-pressed="true"] { background: linear-gradient(135deg, #0F3B38, #12304A); border-color: #2DD4BF; box-shadow: 0 6px 16px rgba(45, 212, 191, .15); }
[data-theme="dark"] .ab-seg-i, [data-theme="dark"] .ab-kpi-i, [data-theme="dark"] .ab-alert-i, [data-theme="dark"] .ab-kpi-go { background: var(--input); box-shadow: 0 0 0 1px var(--line); }
[data-theme="dark"] .ab-main-ring { background: linear-gradient(180deg, #102B2D, var(--paper)); border-color: #1F4D4A; }
[data-theme="dark"] .ab-kpi { background: color-mix(in srgb, var(--c) 9%, var(--paper)); border-color: color-mix(in srgb, var(--c) 28%, var(--line)); }
[data-theme="dark"] .ab-alert { background: linear-gradient(135deg, #3A2A0C, #2E2208); border-color: #7C5A12; color: #FCD34D; }
[data-theme="dark"] .ab-alert-l a { background: var(--input); color: #FBBF24; border-color: #7C5A12; }
[data-theme="dark"] .ab-alert-l a:hover { background: #F59E0B; color: #1A1838; }
[data-theme="dark"] .ab-row { background: var(--paper); border-color: var(--line); }
[data-theme="dark"] .ab-row.empty { background: var(--paper); }
[data-theme="dark"] .ab-pct { background: var(--input); }
[data-theme="dark"] .ab-row.mid .ab-pct { background: #3A2A0C; } [data-theme="dark"] .ab-row.mid .ab-pct b { color: #FBBF24; }
[data-theme="dark"] .ab-row.bad .ab-pct { background: #3D1414; } [data-theme="dark"] .ab-row.bad .ab-pct b { color: #F87171; }
[data-theme="dark"] .ab-row.none .ab-pct, [data-theme="dark"] .ab-row.empty .ab-pct { background: var(--input); } [data-theme="dark"] .ab-row.none .ab-pct b { color: #64748B; }
[data-theme="dark"] .ab-bar { background: var(--ab-track); }
[data-theme="dark"] .ab-pie { background: var(--paper); border-color: var(--line); }
[data-theme="dark"] .ab-link { color: #5EEAD4; }
[data-theme="dark"] .ab-ring-bg, [data-theme="dark"] .ab-ring circle:first-child { stroke: var(--ab-track); }
.lang-btn { font-weight: 800; font-size: .8rem; letter-spacing: .02em; }
html[data-lang="en"] .lang-btn { font-family: 'Kantumruy Pro', sans-serif; }

/* ---------- Attendance board: calm, solid rows (no stripes) ---------- */
.ab-row.none { background: linear-gradient(90deg, color-mix(in srgb, #EF4444 6%, var(--panel, #fff)), var(--panel, #fff) 55%); border-color: color-mix(in srgb, #EF4444 18%, #EEF0F6); box-shadow: inset 4px 0 0 #F87171; }
.ab-row.empty { background: var(--panel, #fff); box-shadow: inset 4px 0 0 #CBD5E1; }
.ab-bar .s-N { background: #CBD5E1; }
.ab-row.none .ab-pct { background: color-mix(in srgb, #EF4444 8%, #fff); } .ab-row.none .ab-pct b { color: #F87171; }
[data-theme="dark"] .ab-row.none { background: linear-gradient(90deg, rgba(239, 68, 68, .10), var(--paper) 55%); border-color: rgba(248, 113, 113, .22); box-shadow: inset 4px 0 0 #F87171; }
[data-theme="dark"] .ab-row.empty { background: var(--paper); box-shadow: inset 4px 0 0 #475569; }
[data-theme="dark"] .ab-bar .s-N { background: #3F4A63; }
[data-theme="dark"] .ab-row.none .ab-pct { background: rgba(239, 68, 68, .12); } [data-theme="dark"] .ab-row.none .ab-pct b { color: #FCA5A5; }

/* ---------- Letters: one page per letter type ---------- */
.lt-hero { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--c) 12%, var(--panel, #fff)), var(--panel, #fff) 70%); border-color: color-mix(in srgb, var(--c) 30%, var(--line, #E5E7EB)); }
.lt-back { position: absolute; top: 12px; right: 16px; font-size: .8rem; color: var(--muted); text-decoration: none; }
.lt-back:hover { color: var(--c); }
.lt-hero-main { display: flex; align-items: center; gap: 16px; min-width: 0; }
.lt-hero-ic { font-size: 2.4rem; width: 72px; height: 72px; display: grid; place-items: center; border-radius: 20px; background: color-mix(in srgb, var(--c) 14%, transparent); flex: none; }
.lt-hero h2 { margin: 0; color: var(--c); font-size: 1.35rem; }
.lt-hero p { margin: 2px 0 8px; }
.lt-hero-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.lt-hero-stats span { font-size: .78rem; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--c) 10%, transparent); color: var(--muted); }
.lt-hero-stats b { color: var(--c); }
.lt-hero-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.lt-hero-acts .btn-primary { background: var(--c); border-color: var(--c); }
[data-theme="dark"] .lt-hero { background: linear-gradient(120deg, color-mix(in srgb, var(--c) 22%, var(--paper)), var(--paper) 70%); }
[data-theme="dark"] .lt-hero h2, [data-theme="dark"] .lt-hero-stats b { color: color-mix(in srgb, var(--c) 55%, #fff); }

/* ---------- Letters: change the logo of one letter ---------- */
.lt-logo-box { display: grid; gap: 8px; padding: 10px 12px; border: 1px dashed var(--line, #E5E7EB); border-radius: 12px; margin: -2px 0 6px; }
.lt-logo-row { display: flex; align-items: center; gap: 10px; }
.lt-logo-row img { width: 52px; height: 52px; object-fit: contain; border-radius: 10px; background: #fff; border: 1px solid var(--line, #E5E7EB); padding: 3px; flex: none; }
.lt-logo-row > div { display: flex; flex-wrap: wrap; gap: 6px; }
.lt-logo-size button { flex: 1; }
.lt-logo-recent { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .78rem; }
.lt-logo-recent:empty { display: none; }
.lt-logo-recent button { width: 34px; height: 34px; padding: 2px; border-radius: 8px; border: 1px solid var(--line, #E5E7EB); background: #fff; cursor: pointer; }
.lt-logo-recent button:hover { border-color: var(--brand, #7C3AED); }
.lt-logo-recent img { width: 100%; height: 100%; object-fit: contain; }
.lt-logo-box small { font-size: .74rem; line-height: 1.5; }
[data-theme="dark"] .lt-logo-box { border-color: rgba(255,255,255,.14); }

/* ---------- Letters: leave request ---------- */
.lt-var4 { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.lt-var4 button { font-size: .8rem; }
.lt-lv { display: grid; gap: 8px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, #C2410C 6%, transparent); border: 1px solid color-mix(in srgb, #C2410C 22%, transparent); }
.lt-lv .field-label { margin: 0; font-weight: 700; }
.lt-lv .lt-num { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lt-lv .lt-num-2 { grid-template-columns: 90px 1fr; }
.lt-lv .field { margin: 0; }
.lt-lv small { font-size: .74rem; line-height: 1.5; }
.lt-lv input, .lt-lv select { width: 100%; min-width: 0; box-sizing: border-box; }
.lt-lv .lt-num > .field { min-width: 0; }

/* ---------- School structure (org chart) ---------- */
#ocEditor { margin-top: 16px; }
.oc-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.oc-bar .oc-tabs { flex-wrap: wrap; }
.oc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.oc-box.oc-edit { border: 1px dashed var(--line, #E5E7EB); border-radius: 14px; padding: 14px 6px; background: var(--paper, #F8FAFC); }
.oc-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.oc-count { margin-left: auto; font-size: .82rem; } .oc-dirty { color: #C2410C; }
.oc-form { display: grid; gap: 10px; }
.oc-photo { display: flex; gap: 12px; align-items: flex-start; }
.oc-photo > div:last-child { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.oc-ph { width: 76px; height: 76px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--paper, #F1F5F9); border: 2px solid var(--line, #E5E7EB); font-size: 2rem; flex: none; }
.oc-ph img { width: 100%; height: 100%; object-fit: cover; }
.oc-url { display: flex; gap: 6px; width: 100%; } .oc-url input { flex: 1; min-width: 0; }
.oc-msg { width: 100%; }
.oc-person { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 6px 0 10px; }
.oc-person img { width: 180px; height: 180px; border-radius: 50%; object-fit: cover; border: 4px solid #B91C1C; }
.oc-person b { font-size: 1.1rem; }
#orgchart .oc-tabs { margin-bottom: 10px; flex-wrap: wrap; }
#orgchart .oc-box { padding: 16px 8px; }
[data-theme="dark"] .oc-node { background: var(--paper); }
[data-theme="dark"] .oc-tree { --oc-line: #475569; }
[data-theme="dark"] .oc-d0 { --oc-c: #F87171; } [data-theme="dark"] .oc-d1 { --oc-c: #FB923C; } [data-theme="dark"] .oc-d2 { --oc-c: #60A5FA; } [data-theme="dark"] .oc-d3 { --oc-c: #2DD4BF; }
[data-theme="dark"] .oc-title b { color: #FCA5A5; }
@media (max-width: 640px) { .oc-meta { grid-template-columns: 1fr; } }
#orgchart[hidden], #orgchart .oc-tabs[hidden] { display: none !important; }

/* ---------- About the school ---------- */
.abt-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.abt-hero { display: flex; gap: 18px; align-items: center; padding: 18px 20px; border-radius: 18px; background: linear-gradient(120deg, color-mix(in srgb, #B91C1C 10%, var(--panel, #fff)), var(--panel, #fff) 75%); border: 1px solid color-mix(in srgb, #B91C1C 22%, var(--line, #E5E7EB)); }
.abt-hero img { width: 84px; height: 84px; object-fit: contain; flex: none; }
.abt-hero h2 { margin: 0; font-family: Moul, serif; font-weight: 400; color: #B91C1C; font-size: 1.25rem; line-height: 1.9; }
.abt-hero p { margin: 0; }
.abt-min { font-family: Moul, serif; font-size: .82rem; color: var(--muted, #64748B); }
.abt-motto { font-style: italic; color: #9A3412; margin-top: 2px !important; }
.abt-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 14px 0; }
.abt-stats div { display: grid; justify-items: center; padding: 12px; border-radius: 14px; background: var(--paper, #F8FAFC); border: 1px solid var(--line, #E5E7EB); text-align: center; }
.abt-stats span { font-size: 1.4rem; } .abt-stats b { font-size: 1.25rem; color: #B91C1C; } .abt-stats small { color: var(--muted, #64748B); font-size: .78rem; }
.abt-sec { margin: 18px 0 6px; }
.abt-sec h3, .abt-vmv h4 { margin: 0 0 8px; font-family: Moul, serif; font-weight: 400; font-size: 1rem; color: #9A3412; }
.abt-hist p { text-indent: 2em; text-align: justify; line-height: 2; margin: 0 0 8px; }
.abt-vmv { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 16px 0; }
.abt-vmv > div { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line, #E5E7EB); background: var(--panel, #fff); position: relative; }
.abt-vmv > div > span { font-size: 1.5rem; }
.abt-v { border-top: 4px solid #1D4ED8 !important; } .abt-m { border-top: 4px solid #B91C1C !important; } .abt-val { border-top: 4px solid #CA8A04 !important; }
.abt-vmv p { margin: 0; line-height: 1.9; } .abt-vmv ul { margin: 0; padding-left: 18px; line-height: 1.9; }
.abt-tl { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 3px solid color-mix(in srgb, #B91C1C 35%, transparent); }
.abt-tl li { position: relative; padding: 0 0 12px 14px; }
.abt-tl li::before { content: ''; position: absolute; left: -26px; top: 6px; width: 13px; height: 13px; border-radius: 50%; background: #B91C1C; border: 3px solid var(--panel, #fff); }
.abt-tl b { color: #B91C1C; } .abt-tl p { margin: 2px 0 0; line-height: 1.8; }
.abt-pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.abt-pics figure { margin: 0; border-radius: 12px; overflow: hidden; background: var(--paper, #F8FAFC); border: 1px solid var(--line, #E5E7EB); position: relative; }
.abt-pics img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; cursor: zoom-in; }
.abt-pics figcaption { padding: 6px 10px; font-size: .8rem; }
.abt-zoom { padding: 0; max-width: 94vw; background: #000; } .abt-zoom img { max-width: 94vw; max-height: 88vh; display: block; } .abt-zoom .icon-btn { position: absolute; top: 8px; right: 8px; background: #fff; }
.abt-form { display: grid; gap: 12px; }
.abt-form textarea { width: 100%; box-sizing: border-box; line-height: 1.8; }
.abt-edsec { padding: 12px; border: 1px dashed var(--line, #E5E7EB); border-radius: 12px; display: grid; gap: 8px; }
.abt-edsec .field-label { margin: 0; font-weight: 700; }
.abt-tlrow { display: grid; grid-template-columns: 110px 1fr auto; gap: 6px; }
.abt-pics-ed img { cursor: default; } .abt-pics-ed input { width: 100%; box-sizing: border-box; border: 0; border-top: 1px solid var(--line, #E5E7EB); padding: 6px 8px; background: transparent; color: inherit; }
.abt-pics-ed .icon-btn { position: absolute; top: 6px; right: 6px; background: rgba(255, 255, 255, .9); }
.abt-picadd { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } .abt-picadd input { flex: 1; min-width: 180px; }
.abt-acts { display: flex; gap: 8px; }
#aboutSec[hidden] { display: none !important; }
#aboutSec .abt-box { padding: 16px; }
[data-theme="dark"] .abt-hero { background: linear-gradient(120deg, rgba(239, 68, 68, .14), var(--paper) 75%); border-color: rgba(248, 113, 113, .25); }
[data-theme="dark"] .abt-hero h2, [data-theme="dark"] .abt-stats b, [data-theme="dark"] .abt-tl b { color: #FCA5A5; }
[data-theme="dark"] .abt-sec h3, [data-theme="dark"] .abt-vmv h4, [data-theme="dark"] .abt-motto { color: #FDBA74; }
[data-theme="dark"] .abt-vmv > div { background: var(--paper); }
@media (max-width: 640px) { .abt-hero { flex-direction: column; text-align: center; } .abt-tlrow { grid-template-columns: 80px 1fr auto; } }
/* Kiosk scan: auto chip + the session the clock is in */
.scn-chip.is-now:not([aria-pressed="true"]) { border: 2px dashed #2DD4BF; }
.scn-chip.is-now small::after { content: ' ●'; color: #2DD4BF; }
.scn-auto[aria-pressed="true"] { border-color: #FBBF24 !important; background: rgba(251, 191, 36, .25) !important; }

/* ---------- Student progress booklet ---------- */
.bk-bar { display: grid; gap: 12px; }
.bk-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.bk-tools .field { margin: 0; }
.bk-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bk-hint { font-size: .78rem; }
.bk-stage { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; padding: 16px 0 30px; }
.bk-stage .bk-page { box-shadow: 0 6px 22px rgba(15, 23, 42, .14); border-radius: 4px; }
@media (max-width: 640px) { .bk-stage { zoom: .62; } }
.bk-logo-tools { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 4px 8px; border: 1px dashed var(--line, #E5E7EB); border-radius: 12px; }
.bk-logo-tools img { width: 32px; height: 32px; object-fit: contain; background: #fff; border-radius: 8px; padding: 2px; }
.bk-logo-tools img.off { opacity: .25; }
.bk-logo-tools select { width: auto; padding: 4px 8px; }
.bk-nav { display: flex; flex-wrap: wrap; gap: 10px 18px; justify-content: center; align-items: center; margin: 16px auto 4px; padding: 10px 14px; width: fit-content; max-width: 100%; border-radius: 16px; background: var(--panel, #fff); border: 1px solid var(--line, #E5E7EB); box-shadow: 0 4px 14px rgba(15, 23, 42, .08); }
.bk-nav-g { display: flex; align-items: center; gap: 8px; }
.bk-nav-l { min-width: 150px; text-align: center; white-space: nowrap; } .bk-nav-l small { color: var(--muted, #64748B); font-weight: 400; }
.bk-nav-s { font-size: .82rem; color: var(--muted, #64748B); max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) {
  .bk-nav { width: 100%; box-sizing: border-box; gap: 8px; padding: 8px 10px; }
  .bk-nav-g { width: 100%; flex-wrap: nowrap; gap: 6px; }
  .bk-nav-l, .bk-nav-s { flex: 1; min-width: 0; max-width: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
  .bk-nav .bk-t { display: none; }
  .bk-nav .btn { flex: none; min-width: 44px; padding-inline: 12px; justify-content: center; }
}
/* Booklet print dialog */
.bkp { display: grid; gap: 12px; }
.bkp fieldset { border: 1px solid var(--line, #E5E7EB); border-radius: 12px; padding: 8px 12px 10px; margin: 0; display: grid; gap: 4px; }
.bkp legend { font-weight: 700; padding: 0 6px; }
.bkp-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.bkp-pages, .bkp-stu { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 10px; }
.bkp-stu { max-height: 180px; overflow: auto; padding: 4px; border-radius: 8px; background: var(--paper, #F8FAFC); }
.bkp-sum { margin: 0; font-weight: 600; }

/* ---------- Teacher page: tiles from the sidebar (two columns, icon box + title + one line) ---------- */
.ws-find { margin: 18px 0 4px; }
.ws-find input { width: 100%; box-sizing: border-box; padding: 12px 16px; border-radius: 14px; font-size: 1rem; }
.ws-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (min-width: 1100px) { .ws-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ws-tiles[hidden], .ws-group[hidden] { display: none; }
.ws-tile { position: relative; display: flex; align-items: center; gap: 14px; min-height: 96px; padding: 14px 16px; border-radius: 22px; color: #fff; text-decoration: none;
  background: var(--bg); box-shadow: 0 10px 22px -12px rgba(30, 27, 75, .55), inset 0 1px 0 rgba(255,255,255,.25); transition: transform .15s, box-shadow .15s; }
.ws-tile[hidden] { display: none; }
.ws-tile:hover { transform: translateY(-2px); box-shadow: 0 16px 26px -12px rgba(30, 27, 75, .6), inset 0 1px 0 rgba(255,255,255,.3); }
.ws-tile:active { transform: scale(.98); }
.ws-tile:focus-visible { outline: 3px solid #FDE68A; outline-offset: 2px; }
.ws-tile .ws-ico { width: 58px; height: 58px; border-radius: 18px; background: rgba(255,255,255,.2); border: 1.5px solid rgba(255,255,255,.4); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 4px 10px rgba(0,0,0,.08); }
.ws-tile .ws-ico svg { width: 28px; height: 28px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ws-tile .ws-txt b { font-size: 1.05rem; line-height: 1.55; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 26px; }
.ws-tile .ws-txt small { font-size: .82rem; opacity: .95; }
.ws-bubble { position: absolute; top: 10px; right: 12px; margin: 0; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center; font-size: .78rem; line-height: 1; box-sizing: border-box; }
@media (max-width: 640px) {
  .ws-tiles { gap: 10px; }
  .ws-tile { min-height: 84px; gap: 10px; padding: 12px 10px; border-radius: 18px; }
  .ws-tile .ws-ico { width: 46px; height: 46px; border-radius: 14px; }
  .ws-tile .ws-ico svg { width: 23px; height: 23px; }
  .ws-tile .ws-txt b { font-size: .95rem; padding-right: 18px; }
  .ws-tile .ws-txt small { font-size: .74rem; }
  .ws-bubble { top: 6px; right: 6px; min-width: 22px; height: 22px; font-size: .7rem; }
}
@media (max-width: 640px) {
  .ws-tile .ws-ico { width: 42px; height: 42px; border-radius: 13px; }
  .ws-tile .ws-txt b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.45; }
  .ws-hero .ws-chips { display: none; }
}

/* Registers: pop-up form */
.rgs-pop { display: grid; gap: 10px; }
.rgs-pob { border: 1px solid var(--line, #E5E7EB); border-radius: 12px; padding: 8px 12px 10px; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.rgs-pob legend { font-weight: 700; padding: 0 6px; }
.rgs-pob .field { margin: 0; }
@media (max-width: 640px) { .rgs-pob { grid-template-columns: 1fr; } }
.rgs-bar { display: grid; gap: 12px; }
.rgs-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.rgs-tools .field { margin: 0; min-width: 190px; }
.rgs-stage { overflow-x: auto; padding: 16px 0 30px; }
.rgs-ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rgs-btn, .rgs-tabs button { display: inline-flex; align-items: center; gap: 7px; }
.rgs-tabs .rgs-ic { width: 16px; height: 16px; opacity: .85; }
.rgs-xls { color: #15803D; border-color: color-mix(in srgb, #15803D 35%, var(--line, #E5E7EB)); }
[data-theme="dark"] .rgs-xls { color: #4ADE80; }
.rgs-sort button { display: inline-flex; align-items: center; gap: 6px; }
.rgs-sort .rgs-ic { width: 16px; height: 16px; }
.pf-stamp { margin: 6px 0 0; font-size: .82rem; color: var(--muted, #64748B); } .pf-stamp b { color: inherit; }
/* gender: missing-gender warning, bulk change bar, group-by-gender on the score sheet */
.g-warn { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 10px 0; padding: 10px 14px; border-radius: 12px; background: #FFFBEB; border: 1px solid #FCD34D; color: #92400E; font-size: .92rem; }
.g-warn b { color: #B45309; }
.g-bulk { position: sticky; top: 8px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; padding: 10px 14px; border-radius: 14px; background: var(--panel, #fff); border: 1.5px solid color-mix(in srgb, var(--accent, #7C3AED) 40%, transparent); box-shadow: 0 6px 20px rgba(76, 29, 149, .12); }
.g-bulk[hidden] { display: none; }
.g-bulk > span { color: var(--muted); font-size: .9rem; }
.g-bulk .g-b { background: var(--panel, #fff); border: 1.5px solid currentColor; font-weight: 700; }
.c-pick { width: 36px; text-align: center; }
.c-pick input { width: 18px; height: 18px; accent-color: var(--accent, #7C3AED); cursor: pointer; }
tr.g-miss > td { background: #FFFBEB; }
.g-sort { all: unset; cursor: pointer; font-weight: inherit; color: inherit; padding: 2px 6px; border-radius: 8px; white-space: nowrap; }
.g-sort:hover, .g-sort.on { background: rgba(255, 255, 255, .18); }
.g-sort:focus-visible { outline: 2px solid #fff; }
.score-grid tr.g-sep td { background: color-mix(in srgb, var(--accent, #7C3AED) 8%, var(--panel, #fff)); font-weight: 700; font-size: .85rem; color: var(--ink, #1F1442); padding: 6px 12px; }
.g-note { color: #B45309; font-weight: 600; }
@media print { .g-warn, .g-bulk, .c-pick { display: none !important; } }
.g-div { width: 1px; align-self: stretch; background: var(--line, #E5E7EB); margin: 0 4px; } .g-bulk select { min-height: 32px; border-radius: 10px; padding: 0 8px; }
.st-avatar.has-photo { padding: 0; overflow: hidden; background: #fff; } .st-avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
/* phones: the year is shown (and switched) on the dashboard hero, so drop it from the top bar */
@media (max-width: 700px) { .topbar .year-pick { display: none; } }
button.hero-pill { font: inherit; cursor: pointer; }
.yp-list { display: grid; gap: 8px; }
.yp-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line, #E5E7EB); border-radius: 12px; cursor: pointer; }
.yp-item:has(input:checked) { border-color: var(--accent, #7C3AED); background: color-mix(in srgb, var(--accent, #7C3AED) 6%, transparent); }
.yp-item input { width: 18px; height: 18px; accent-color: var(--accent, #7C3AED); }
.yp-cur { color: #15803D; font-weight: 600; margin-left: 6px; }
/* phone: account avatar in the top bar (replaces the year picker there) */
.top-me { position: relative; display: none; }
@media (max-width: 700px) { .top-me { display: block; margin-left: auto; } }
.top-me-btn { width: 40px; height: 40px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 2px var(--accent, #7C3AED), 0 4px 12px rgba(76, 29, 149, .2); cursor: pointer; padding: 0; font-weight: 800; display: grid; place-items: center; overflow: hidden; }
.top-me-btn.has-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.top-me-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 70; min-width: 220px; padding: 8px; border-radius: 16px; background: var(--panel, #fff); border: 1px solid var(--line, #E5E7EB); box-shadow: 0 14px 40px rgba(31, 20, 66, .18); display: grid; gap: 2px; }
.top-me-menu[hidden] { display: none; }
.top-me-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line, #E5E7EB); margin-bottom: 4px; display: grid; }
.top-me-who small { color: var(--muted); }
.top-me-menu a, .top-me-menu button { all: unset; display: block; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: .95rem; color: var(--ink, #1F1442); }
.top-me-menu a:hover, .top-me-menu button:hover, .top-me-menu a:focus-visible, .top-me-menu button:focus-visible { background: color-mix(in srgb, var(--accent, #7C3AED) 8%, transparent); }
.top-me-menu #topMeOut { color: #DC2626; }
@media (max-width: 700px) { .topbar-tools > [data-theme-toggle], .topbar-tools > #btnReload, .topbar-tools > .lang-btn { display: none; } .topbar h1 { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; } }
@media (min-width: 701px) { .top-me-theme, .top-me-lang, #topMeReload { display: none !important; } }
.top-me-theme { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin: 2px 0; border-radius: 12px; background: color-mix(in srgb, var(--accent, #7C3AED) 6%, transparent); }
.top-me-menu .top-me-theme button { padding: 8px 4px; text-align: center; font-size: .8rem; border-radius: 9px; }
.top-me-menu .top-me-theme button[aria-pressed="true"] { background: var(--panel, #fff); box-shadow: 0 1px 4px rgba(31, 20, 66, .15); font-weight: 700; color: var(--accent, #7C3AED); }

/* ---------- Phone tab bar: floating glass pill, raised «ពិន្ទុ» button ---------- */
@media (max-width: 900px) {
  #view { padding-bottom: calc(118px + env(safe-area-inset-bottom)); }
  .bottombar {
    grid-template-columns: repeat(5, 1fr); align-items: end;
    left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
    padding: 6px 6px 7px; border-radius: 24px;
    background: color-mix(in srgb, var(--panel) 86%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
    border: 1px solid color-mix(in srgb, var(--line-strong) 60%, transparent);
    box-shadow: 0 10px 30px -8px rgba(46, 16, 101, .28), 0 2px 6px rgba(46, 16, 101, .08);
  }
  .bottombar .bb-item {
    all: unset; box-sizing: border-box; cursor: pointer; -webkit-tap-highlight-color: transparent;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px;
    min-height: 54px; padding: 4px 2px 2px; border-radius: 16px; color: var(--muted); text-align: center;
  }
  .bottombar .bb-ic { display: grid; place-items: center; width: 46px; height: 30px; border-radius: 999px; transition: background .2s, color .2s, transform .2s; }
  .bottombar .bb-ic svg { width: 22px; height: 22px; }
  .bottombar .bb-lb { font-size: .7rem; line-height: 1.15; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .bottombar .bb-item[aria-current] { color: var(--red); background: none; }
  .bottombar .bb-item[aria-current] .bb-ic { background: var(--red-wash); }
  .bottombar .bb-item[aria-current] .bb-lb { font-weight: 700; }
  .bottombar .bb-item:active .bb-ic { transform: scale(.92); }
  .bottombar .bb-item:focus-visible .bb-ic { outline: 2px solid var(--red); outline-offset: 2px; }
  /* raised centre button */
  .bottombar .bb-fab .bb-ic {
    width: 56px; height: 56px; margin-top: -30px; border-radius: 50%; color: #fff;
    background: linear-gradient(140deg, #8B5CF6 0%, #6D28D9 55%, #C026D3 100%);
    border: 4px solid var(--paper);
    box-shadow: 0 10px 20px -6px rgba(109, 40, 217, .6);
  }
  .bottombar .bb-fab .bb-ic svg { width: 24px; height: 24px; }
  .bottombar .bb-fab[aria-current] .bb-ic { background: linear-gradient(140deg, #A78BFA 0%, #7C3AED 55%, #DB2777 100%); }
  .bottombar .bb-fab .bb-lb { color: var(--ink); font-weight: 700; }
  [data-theme="dark"] .bottombar { background: color-mix(in srgb, var(--panel) 80%, transparent); box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .6); }
  [data-theme="dark"] .bottombar .bb-fab .bb-ic { border-color: var(--paper); }
}
@media (prefers-reduced-motion: reduce) { .bottombar .bb-ic { transition: none; } }
@media (max-width: 900px) {
  .bottombar .bb-fab.bb-att .bb-ic { background: linear-gradient(140deg, #34D399 0%, #059669 55%, #0D9488 100%); box-shadow: 0 10px 20px -6px rgba(5, 150, 105, .6); animation: bb-pulse 2.4s ease-in-out infinite; }
}
@keyframes bb-pulse { 0%, 100% { box-shadow: 0 10px 20px -6px rgba(5, 150, 105, .6), 0 0 0 0 rgba(16, 185, 129, .45); } 50% { box-shadow: 0 10px 20px -6px rgba(5, 150, 105, .6), 0 0 0 8px rgba(16, 185, 129, 0); } }
@media (prefers-reduced-motion: reduce) { .bottombar .bb-fab.bb-att .bb-ic { animation: none; } }
/* scanner: «who was just scanned» card with photo and name */
.scn-who { position: absolute; z-index: 3; left: 50%; top: 46%; width: min(300px, 84vw); transform: translate(-50%, -50%) scale(.85); opacity: 0;
  display: grid; justify-items: center; gap: 4px; padding: 22px 18px 18px; border-radius: 26px; text-align: center;
  background: rgba(255, 255, 255, .96); color: #1E1B4B; box-shadow: 0 24px 60px rgba(0, 0, 0, .45); transition: transform .22s cubic-bezier(.2, 1.4, .4, 1), opacity .18s; pointer-events: none; }
.scn-who.in { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.scn-who[hidden] { display: none; }
.scn-who-pic { width: 148px; height: 148px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; margin-bottom: 8px;
  background: linear-gradient(135deg, #C4B5FD, #F0ABFC); border: 6px solid #10B981; box-shadow: 0 0 0 6px rgba(16, 185, 129, .18); }
.scn-who-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scn-who-pic span { font-size: 3.6rem; font-weight: 800; color: #fff; }
.scn-who-name { font-size: 1.45rem; line-height: 1.3; }
.scn-who-sub { color: #64648A; font-size: .95rem; }
.scn-who-st { margin-top: 8px; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: .95rem; background: #D1FAE5; color: #065F46; }
.scn-who.t-late .scn-who-pic, .scn-who.t-early .scn-who-pic { border-color: #F59E0B; box-shadow: 0 0 0 6px rgba(245, 158, 11, .2); }
.scn-who.t-late .scn-who-st, .scn-who.t-early .scn-who-st { background: #FEF3C7; color: #92400E; }
.scn-who.t-dup .scn-who-pic { border-color: #60A5FA; box-shadow: 0 0 0 6px rgba(96, 165, 250, .2); }
.scn-who.t-dup .scn-who-st { background: #DBEAFE; color: #1E40AF; }
@media (prefers-reduced-motion: reduce) { .scn-who { transition: none; } }
.scn-voice { width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.14); color: #fff; font-size: 1.1rem; cursor: pointer; margin-left: 6px; }
.scn-voice.off { opacity: .45; text-decoration: line-through; }
@media (max-width: 600px) { .scn-voice { width: 40px; height: 40px; font-size: 1rem; } }
/* settings: about the app (version lives here, not in the sidebar) */
.app-about .aa-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.app-about .aa-logo { width: 56px; height: 56px; border-radius: 14px; box-shadow: 0 4px 12px rgba(46, 16, 101, .15); }
.app-about .aa-text { display: grid; gap: 2px; flex: 1; min-width: 180px; }
.app-about .aa-ver { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--red); }
.app-about #appUpd { margin-left: auto; }
/* new version available: red dot on the profile avatar + a small bar */
.has-update { position: relative; }
.has-update::after { content: ''; position: absolute; top: -1px; right: -1px; width: 12px; height: 12px; border-radius: 50%; background: #EF4444; border: 2px solid var(--panel, #fff); box-shadow: 0 0 0 2px rgba(239, 68, 68, .25); pointer-events: none; }
.who.has-update::after { top: 4px; left: 30px; right: auto; }
.upd-bar { position: fixed; z-index: 90; left: 50%; transform: translateX(-50%); top: calc(12px + env(safe-area-inset-top)); display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 10px; border-radius: 18px; width: max-content; max-width: min(460px, calc(100vw - 24px));
  background: #1E1B4B; color: #fff; box-shadow: 0 12px 30px rgba(30, 27, 75, .35); animation: upd-in .3s ease-out; }
.upd-bar .upd-ico { flex: none; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-size: 1.1rem; background: rgba(196, 181, 253, .18); }
.upd-bar .upd-txt { display: grid; min-width: 0; line-height: 1.35; margin-right: 4px; }
.upd-bar .upd-txt b { font-size: .92rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upd-bar .upd-txt small { font-size: .76rem; color: #C4B5FD; font-weight: 600; }
.upd-bar .upd-go { flex: none; border: 0; border-radius: 12px; padding: 9px 16px; font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; background: linear-gradient(135deg, #8B5CF6, #C026D3); color: #fff; white-space: nowrap; }
.upd-bar .upd-go:disabled { opacity: .7; cursor: progress; }
.upd-bar .upd-x { flex: none; border: 0; background: transparent; color: #A5A3D0; font-size: 1rem; cursor: pointer; width: 34px; height: 34px; border-radius: 10px; }
.upd-bar .upd-x:hover { background: rgba(255, 255, 255, .08); }
@media (max-width: 600px) {
  .upd-bar { left: 12px; right: 12px; transform: none; width: auto; max-width: none; animation-name: upd-in-m; }
  .upd-bar .upd-txt { flex: 1; }
}
@keyframes upd-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes upd-in-m { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .upd-bar { animation: none; } }
@media print { .upd-bar { display: none !important; } }
/* offline / syncing pill */
.sync-pill { position: fixed; z-index: 85; left: 16px; bottom: 16px; padding: 8px 14px; border-radius: 999px; font-size: .86rem; font-weight: 600;
  box-shadow: 0 8px 24px rgba(30, 27, 75, .25); max-width: calc(100vw - 32px); }
.sync-pill[hidden] { display: none; }
.sync-pill.off { background: #78350F; color: #FEF3C7; }
.sync-pill.busy { background: #1E1B4B; color: #E0E7FF; }
.sync-pill.done { background: #065F46; color: #D1FAE5; }
@media (max-width: 900px) { .sync-pill { left: 50%; transform: translateX(-50%); bottom: calc(150px + env(safe-area-inset-bottom)); white-space: nowrap; } }
@media print { .sync-pill { display: none !important; } }
.pf-acts .pf-del { color: #DC2626; } .pf-acts .pf-del:hover { background: #FEF2F2; } .pf-del-warn ul { margin: 6px 0 10px 18px; } .pf-del-warn p b { color: #B91C1C; }
.pf-trash { border: 1px dashed #FCA5A5; } .pf-left { font-weight: 700; color: #92400E; } .pf-left.soon { color: #DC2626; }

/* School in the super admin's trash: the wipe date for its admins */
.suspended .sp-trash { font-size: 1.02rem; }
.suspended .sp-left { color: var(--muted, #888); white-space: nowrap; }
.suspended .sp-left.soon { color: #E5484D; font-weight: 600; }

/* Restore request: admin button and the super admin's tag */
.suspended .sp-ask { margin: .4rem 0 .8rem; }
.suspended .sp-asked { color: #1F9D55; font-weight: 600; }
.pf-ask { display: inline-block; margin-top: .25rem; padding: .1rem .5rem; border-radius: 999px; background: #FFF4D6; color: #8A5A00; font-size: .82rem; font-weight: 600; }
[data-theme="dark"] .pf-ask { background: #3A2E10; color: #FFD27A; }

/* Restore request note */
.suspended .sp-note-in { display: flex; flex-direction: column; gap: .3rem; max-width: 340px; margin: 0 auto .6rem; text-align: left; font-size: .9rem; }
.suspended .sp-note-in input { width: 100%; }
.suspended .sp-note { font-style: italic; color: var(--muted, #888); }
.pf-note { display: inline-block; margin-top: .2rem; padding: .15rem .5rem; border-left: 3px solid #E0A400; background: rgba(224,164,0,.08); font-size: .85rem; max-width: 280px; white-space: normal; }

/* Restore request refused */
.suspended .sp-rejected { color: #E5484D; font-weight: 600; }
.pf-rej { font-size: .82rem; }

/* School or training centre */
.pf-kind-pick { border: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; align-items: center; }
.pf-kind-pick > span { width: 100%; }
.pf-kind-pick label { display: inline-flex; gap: .35rem; align-items: center; cursor: pointer; }

/* Training-centre courses on class cards */
.crs-info { display: flex; flex-direction: column; gap: 6px; }
.crs-row { display: flex; flex-wrap: wrap; gap: 6px; }
.crs-row > span { padding: 3px 9px; border-radius: 10px; background: rgba(15, 23, 42, .24); color: #fff; font-size: .78rem; font-weight: 700; text-shadow: 0 1px 1px rgba(0, 0, 0, .25); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); }
.crs-row > .crs-st { background: #fff; text-shadow: none; box-shadow: none; }
.crs-st.up { color: #B45309; } .crs-st.run { color: #047857; } .crs-st.end { color: #475569; }
.crs-bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,.3); overflow: hidden; }
.crs-bar i { display: block; height: 100%; background: #fff; border-radius: inherit; }
.crs-form { border: 1px solid var(--line, #E2E8F0); border-radius: 14px; padding: 10px 12px 4px; margin: 4px 0 10px; }
.crs-form legend { padding: 0 6px; font-weight: 700; }
.crs-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 10px; }
.crs-grid .field { min-width: 0; }
.crs-grid input, .crs-grid select { width: 100%; }
@media (max-width: 560px) { .crs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Next course */
.crs-next { align-self: flex-start; border: 0; border-radius: 12px; padding: 7px 12px; background: #fff; color: #4F46E5; font: inherit; font-weight: 700; font-size: .85rem; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.crs-next:hover { transform: translateY(-1px); }
.crs-next-done { margin: 0; font-size: .82rem; color: #fff; opacity: .95; }
.crs-same { margin: 2px 0 10px; padding: 8px 10px; border-radius: 10px; background: var(--soft, #F1F5F9); font-size: .88rem; }

/* Course trail: Level 1 → Level 2 → … */
.ct-btn { margin-left: 6px; border: 0; background: transparent; cursor: pointer; font-size: 1rem; padding: 2px 4px; border-radius: 8px; }
.ct-btn:hover { background: var(--soft, #F1F5F9); }
.ct-trail { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.ct-step { display: flex; flex-direction: column; gap: 3px; min-width: 120px; padding: 10px 12px; border-radius: 14px; background: var(--soft, #F1F5F9); border: 1px solid var(--line, #E2E8F0); }
.ct-step.is-now { border-color: #4F46E5; box-shadow: 0 0 0 2px rgba(79,70,229,.15); }
.ct-step small { color: var(--muted, #64748B); font-size: .75rem; }
.ct-avg { font-size: 1.25rem; font-weight: 800; }
.ct-g { font-style: normal; font-size: .8rem; padding: 1px 7px; border-radius: 99px; background: #4F46E5; color: #fff; vertical-align: middle; }
.ct-up { color: #059669; font-weight: 700; font-size: .8rem; } .ct-down { color: #DC2626; font-weight: 700; font-size: .8rem; } .ct-same { color: #64748B; font-size: .8rem; }
.ct-now { align-self: flex-start; font-size: .72rem; font-weight: 700; color: #4F46E5; background: #EEF2FF; padding: 1px 8px; border-radius: 99px; }
.ct-arrow { align-self: center; font-size: 1.2rem; color: var(--muted, #94A3B8); }
.st-trail .ct-trail { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
[data-theme="dark"] .ct-now { background: #312E81; color: #C7D2FE; }

/* Next course: who reached the mark */
.np-pass { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 4px 0 6px; padding: 8px 10px; border-radius: 10px; background: var(--soft, #F1F5F9); }
.np-pass input { width: 72px; margin-left: 4px; }
.np-low { color: #B45309; font-weight: 700; }
.np-picks .check-line { display: flex; align-items: center; gap: 6px; }
.np-tag { margin-left: auto; font-size: .78rem; font-weight: 700; padding: 1px 8px; border-radius: 99px; white-space: nowrap; }
.np-tag.ok { color: #047857; background: #ECFDF5; } .np-tag.low { color: #B45309; background: #FFFBEB; } .np-tag.none { color: #64748B; background: #F1F5F9; }
[data-theme="dark"] .np-tag.ok { background: #064E3B; color: #6EE7B7; } [data-theme="dark"] .np-tag.low { background: #451A03; color: #FCD34D; } [data-theme="dark"] .np-tag.none { background: #1E293B; color: #94A3B8; }
.cl-picks.np-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 4px 14px; }
.np-picks .check-line { min-width: 0; }

/* Retake */
.crs-retake { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,.2); color: #fff; font-size: .85rem; }
.crs-retake .crs-next { color: #B45309; }
.rt-where { border: 1px solid var(--line, #E2E8F0); border-radius: 12px; padding: 8px 12px; margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }
.rt-new.is-off { opacity: .45; }
.rt-old { max-width: 100%; }
.ct-step.is-retake { border-style: dashed; border-color: #F59E0B; }
.ct-retake { align-self: flex-start; font-size: .72rem; font-weight: 700; color: #B45309; background: #FFFBEB; padding: 1px 8px; border-radius: 99px; }
[data-theme="dark"] .ct-retake { background: #451A03; color: #FCD34D; }

/* Centre report */
.cr-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 10px; margin-bottom: 12px; }
.cr-head h2 { margin: 0 0 4px; }
.cr-pass input { width: 64px; }
.cr-tools { display: flex; gap: 8px; }
.cr-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.cr-kpi { padding: 14px 16px; border-radius: 16px; background: var(--card, #fff); border: 1px solid var(--line, #E2E8F0); display: flex; flex-direction: column; gap: 2px; }
.cr-kpi b { font-size: 1.8rem; line-height: 1.1; }
.cr-kpi small { color: var(--muted, #64748B); font-weight: 600; }
.cr-kpi.run b { color: #047857; } .cr-kpi.up b { color: #B45309; } .cr-kpi.end b { color: #475569; } .cr-kpi.stu b { color: #4F46E5; }
.cr-kpi.bad { border-color: #FCA5A5; background: #FEF2F2; } .cr-kpi.bad b { color: #DC2626; } .cr-kpi.good b { color: #059669; }
.cr-shift { display: grid; grid-template-columns: 130px 1fr auto auto; gap: 10px; align-items: center; padding: 6px 0; }
.cr-bar { height: 12px; border-radius: 99px; background: var(--soft, #F1F5F9); overflow: hidden; }
.cr-bar i { display: block; height: 100%; background: linear-gradient(90deg, #818CF8, #4F46E5); border-radius: inherit; }
.cr-rate { position: relative; display: inline-flex; align-items: center; min-width: 120px; height: 22px; border-radius: 99px; background: var(--soft, #F1F5F9); overflow: hidden; }
.cr-rate i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; }
.cr-rate b { position: relative; padding: 0 8px; font-size: .82rem; }
.cr-rate.good i { background: #A7F3D0; } .cr-rate.mid i { background: #FDE68A; } .cr-rate.bad i { background: #FECACA; }
.cr-table tr.cr-bad td:first-child { box-shadow: inset 3px 0 0 #DC2626; }
.cr-table tr.cr-mid td:first-child { box-shadow: inset 3px 0 0 #F59E0B; }
[data-theme="dark"] .cr-kpi.bad { background: #450A0A; border-color: #7F1D1D; }
[data-theme="dark"] .cr-rate.good i { background: #065F46; } [data-theme="dark"] .cr-rate.mid i { background: #78350F; } [data-theme="dark"] .cr-rate.bad i { background: #7F1D1D; }
@media (max-width: 560px) { .cr-shift { grid-template-columns: 100px 1fr auto; } .cr-shift small { display: none; } }
@media print { .cr-tools, .cr-pass input { display: none; } .cr-kpi, .panel { break-inside: avoid; } }

/* Centre report: course detail */
.cr-click { cursor: pointer; }
.cr-click:hover td, .cr-click:focus-visible td { background: var(--soft, #F1F5F9); }
.cd-meta { margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; background: var(--soft, #F1F5F9); font-size: .9rem; }
.cd-h { margin: 14px 0 6px; font-size: 1rem; }
.cd-table td { vertical-align: middle; }
.cd-ok { color: #047857; font-weight: 700; }
.cd-weak td { background: #FEF2F2; }
.cd-flag { font-size: .72rem; font-weight: 700; color: #B91C1C; background: #FEE2E2; padding: 1px 8px; border-radius: 99px; }
[data-theme="dark"] .cd-weak td { background: #450A0A; } [data-theme="dark"] .cd-flag { background: #7F1D1D; color: #FECACA; }

/* 📌 Follow-up pin */
.pin-watch { display: inline-block; margin-left: 4px; font-size: .9em; cursor: help; filter: drop-shadow(0 1px 1px rgba(0,0,0,.15)); }
.cd-watch { margin-top: 8px; }
.cd-table .c-pick { width: 34px; }

/* 🤝 Help log */
.pin-watch[data-sid] { cursor: pointer; border-radius: 6px; }
.pin-watch[data-sid]:hover, .pin-watch[data-sid]:focus-visible { background: #FEF3C7; outline: none; }
.hl-watch { padding: 10px 12px; border-radius: 12px; background: #FFFBEB; border: 1px solid #FDE68A; margin-bottom: 10px; }
.hl-watch p { margin: 4px 0; font-style: italic; }
.hlog-form { display: grid; grid-template-columns: minmax(120px, 160px) 1fr; gap: 10px; align-items: end; }
.hl-res-pick { border: 0; padding: 0; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.hl-res-pick legend { font-size: .85rem; color: var(--muted, #64748B); margin-bottom: 4px; }
.hl-res-pick label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.hl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hl-item { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; padding: 6px 10px; border-radius: 10px; background: var(--soft, #F1F5F9); font-size: .88rem; }
.hl-item time { font-weight: 700; color: var(--muted, #64748B); }
.hl-min { font-weight: 600; }
.hl-res { font-size: .78rem; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.hl-res.better { color: #047857; background: #ECFDF5; } .hl-res.same { color: #475569; background: #E2E8F0; } .hl-res.worse { color: #B91C1C; background: #FEE2E2; }
.hl-sum { color: #047857; font-weight: 700; }
[data-theme="dark"] .hl-watch { background: #422006; border-color: #78350F; }
@media (max-width: 520px) { .hlog-form { grid-template-columns: 1fr; } }

/* ✅ Improved */
.pin-watch.is-better:hover { background: #D1FAE5; }
.hl-watch.is-better { background: #ECFDF5; border-color: #A7F3D0; }
.cr-better { border: 1px solid #A7F3D0; background: linear-gradient(180deg, #ECFDF5, transparent 70%); }
.cr-better-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cr-better-list li { display: grid; grid-template-columns: 1fr 140px auto auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line, #E2E8F0); }
[data-theme="dark"] .cr-better { background: linear-gradient(180deg, #064E3B, transparent 70%); border-color: #065F46; }
[data-theme="dark"] .hl-watch.is-better { background: #064E3B; border-color: #065F46; }
@media (max-width: 600px) { .cr-better-list li { grid-template-columns: 1fr auto; } }

/* 📌 Follow-up list on the teacher's home */
.ws-watch { margin: 0 0 16px; padding: 14px 16px; border-radius: 20px; background: var(--card, #fff); border: 1px solid #FDE68A; box-shadow: 0 6px 18px rgba(245,158,11,.10); }
.wsw-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; margin-bottom: 8px; }
.wsw-head h2 { margin: 0; font-size: 1.05rem; } .wsw-head h2 small { color: var(--muted, #64748B); font-weight: 600; font-size: .85rem; }
.wsw-sum { display: flex; flex-wrap: wrap; gap: 6px; }
.wsw-stale, .wsw-ok, .wsw-tag { font-size: .78rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; font-style: normal; white-space: nowrap; }
.wsw-stale, .wsw-tag { color: #B45309; background: #FEF3C7; } .wsw-ok { color: #047857; background: #D1FAE5; }
.wsw-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wsw-item { width: 100%; display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 14px; border: 1px solid var(--line, #E2E8F0); background: var(--soft, #F8FAFC); font: inherit; color: inherit; text-align: left; cursor: pointer; }
.wsw-item:hover { border-color: #F59E0B; }
.is-stale .wsw-item { border-color: #FCD34D; background: #FFFBEB; }
.is-better .wsw-item { border-color: #A7F3D0; background: #F0FDF4; }
.wsw-pin { font-size: 1.2rem; }
.wsw-txt { display: flex; flex-direction: column; min-width: 0; } .wsw-txt small { color: var(--muted, #64748B); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wsw-when small { color: var(--muted, #64748B); }
.wsw-go { font-size: .8rem; font-weight: 700; color: #4F46E5; white-space: nowrap; }
[data-theme="dark"] .ws-watch { border-color: #78350F; }
[data-theme="dark"] .is-stale .wsw-item { background: #422006; border-color: #78350F; }
[data-theme="dark"] .is-better .wsw-item { background: #064E3B; border-color: #065F46; }
[data-theme="dark"] .wsw-stale, [data-theme="dark"] .wsw-tag { background: #78350F; color: #FDE68A; }
@media (max-width: 560px) { .wsw-item { grid-template-columns: auto 1fr; } .wsw-when, .wsw-go { grid-column: 2; } .wsw-go { display: none; } }

/* ⏰ Follow-up due: red dot on my avatar (like a new version) */
html[data-due] :is(.who, .top-me, .hu-me, .ws-me, .st-me) { position: relative; }
html[data-due] :is(.top-me, .hu-me, .ws-me)::after,
html[data-due] .who::after { content: ''; position: absolute; top: -1px; right: -1px; width: 12px; height: 12px; border-radius: 50%; background: #EF4444; border: 2px solid var(--panel, #fff); box-shadow: 0 0 0 2px rgba(239, 68, 68, .25); pointer-events: none; }
html[data-due] .who::after { top: 4px; left: 30px; right: auto; }
.top-me-due { color: #B45309 !important; font-weight: 700; }
.top-me-due b { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 99px; background: #EF4444; color: #fff; font-size: .78rem; text-align: center; }

/* Centre letterhead: logo, name, address, phone */
.co-head { display: flex; align-items: center; gap: 10px; text-align: left; }
.co-logo { width: 58px; height: 58px; object-fit: contain; flex: none; }
.co-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.co-name { font-family: var(--moul, inherit); font-size: 15px; color: #1E3A8A; line-height: 1.6; }
.co-txt small { font-size: 12px; color: #334155; line-height: 1.5; }
.rgs-org .co-head, .rs-org .co-head { justify-content: flex-start; }
.lt-org .co-head, .ct-org .co-head { display: inline-flex; }
/* Name under the logo (default): a centred block that keeps its place on the left of the page. */
.co-head.co-stack { display: inline-flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.co-stack .co-logo { width: 64px; height: 64px; }
.co-stack .co-txt { align-items: center; }
.rgs-org .co-head.co-stack, .rs-org .co-head.co-stack { justify-content: center; }

/* Set many staff genders */
.sg-list { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow: auto; }
.sg-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 14px; padding: 8px 10px; border-radius: 12px; background: var(--soft, #F1F5F9); }
.sg-name { display: flex; flex-direction: column; min-width: 0; } .sg-name small { color: var(--muted, #64748B); }
.sg-opts { display: flex; gap: 10px; flex-wrap: wrap; }
.sg-opt { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font-weight: 600; }

/* Staff records completeness */
.sf-complete { margin: 0 0 12px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line, #E2E8F0); background: var(--card, #fff); display: flex; flex-direction: column; gap: 8px; }
.sfc-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; align-items: baseline; }
.sfc-top b { font-size: 1.02rem; }
.sfc-bar { height: 10px; border-radius: 99px; background: var(--soft, #F1F5F9); overflow: hidden; }
.sfc-bar i { display: block; height: 100%; border-radius: inherit; }
.sf-complete.good .sfc-bar i { background: linear-gradient(90deg, #34D399, #059669); } .sf-complete.good .sfc-top b { color: #047857; }
.sf-complete.mid .sfc-bar i { background: linear-gradient(90deg, #FCD34D, #F59E0B); } .sf-complete.mid .sfc-top b { color: #B45309; }
.sf-complete.bad .sfc-bar i { background: linear-gradient(90deg, #FCA5A5, #DC2626); } .sf-complete.bad .sfc-top b { color: #B91C1C; }
.sfc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sfc-chip { border: 1px solid #FDE68A; background: #FFFBEB; color: #92400E; border-radius: 99px; padding: 4px 12px; font: inherit; font-size: .85rem; cursor: pointer; }
.sfc-chip b { margin-left: 2px; }
.sfc-chip.on { background: #F59E0B; border-color: #F59E0B; color: #fff; }
.sfc-chip.clear { background: transparent; border-color: var(--line, #E2E8F0); color: var(--muted, #64748B); }
.sfc-act { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.sfc-ok { margin: 0; color: #047857; font-weight: 700; }
[data-theme="dark"] .sfc-chip { background: #422006; border-color: #78350F; color: #FDE68A; }

/* 📋 Fill in my details: a slim strip above the page (does not cover anything) */
.info-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 10px clamp(12px, 3vw, 28px) 0; padding: 8px 10px 8px 14px; border-radius: 14px; background: #ECFDF5; border: 1px solid #A7F3D0; color: #065F46; font-size: .92rem; }
.info-bar span { flex: 1 1 220px; } .info-bar b { margin: 0 4px; }
.info-bar .upd-go { border-radius: 999px; padding: 6px 14px; font-weight: 700; background: linear-gradient(135deg, #10B981, #0D9488); color: #fff; text-decoration: none; }
.info-bar .upd-x { border: 0; background: transparent; color: #047857; font-size: 1rem; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
[data-theme="dark"] .info-bar { background: #064E3B; border-color: #065F46; color: #D1FAE5; }

/* 📋 Data completeness on the director's dashboard */
.dq { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: 0 0 16px; padding: 10px 14px; border-radius: 18px; background: var(--card, #fff); border: 1px solid var(--line, #E2E8F0); }
.dq-title { font-weight: 700; color: var(--muted, #64748B); font-size: .9rem; }
.dq-item { display: inline-flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 99px; text-decoration: none; color: inherit; }
.dq-item:hover { background: var(--soft, #F1F5F9); }
.dq-ring { --p: 0; --c: #10B981; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--soft, #E2E8F0) 0); flex: none; }
.dq-ring b { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--card, #fff); font-size: .74rem; }
.dq-txt { display: flex; flex-direction: column; line-height: 1.35; } .dq-txt small { color: var(--muted, #64748B); font-size: .78rem; }

/* Centre: six staff cards, three per row on wide screens */
@media (min-width: 1100px) { .staff-cards.sc-six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.st-course-note { margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: #EEF2FF; color: #3730A3; font-size: .9rem; }
[data-theme="dark"] .st-course-note { background: #1E1B4B; color: #C7D2FE; }

/* Course days */
.crs-days { margin: 4px 0 6px; }
.crs-day-pick { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.crs-day { position: relative; cursor: pointer; }
.crs-day input { position: absolute; opacity: 0; inset: 0; }
.crs-day span { display: inline-grid; place-items: center; min-width: 40px; height: 34px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--line, #E2E8F0); background: var(--card, #fff); font-weight: 700; }
.crs-day input:checked + span { background: #4F46E5; border-color: #4F46E5; color: #fff; }
.crs-day input:focus-visible + span { outline: 2px solid #818CF8; outline-offset: 2px; }
.crs-day-presets { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .85rem; }

/* 🪧 Wall QR for staff check-in */
.ci-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 360px); gap: 18px; align-items: start; }
.ci-poster { background: #fff; color: #1E1B4B; border-radius: 20px; border: 1px solid var(--line, #E2E8F0); padding: 28px 24px; text-align: center; aspect-ratio: 210 / 297; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.ci-logo { width: 84px; height: 84px; object-fit: contain; }
.ci-poster h1 { margin: 0; font-family: var(--moul, inherit); font-size: 1.4rem; color: #1E3A8A; }
.ci-poster h2 { margin: 4px 0; font-size: 2rem; }
.ci-qr svg { width: min(100%, 360px); height: auto; }
.ci-steps { text-align: left; margin: 6px auto; padding-left: 1.4em; font-size: 1rem; line-height: 1.9; }
.ci-foot { color: #64748B; font-size: .85rem; margin: 0; }
.ci-opts { display: flex; flex-direction: column; gap: 12px; }
.ci-geo, .ci-rot { padding: 10px 12px; border-radius: 12px; background: var(--soft, #F1F5F9); }
.ci-geo p, .ci-rot p { margin: 0 0 6px; }
.ci-geo-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ci-on { color: #047857; font-weight: 700; }
.ci-result { max-width: 460px; margin: 6vh auto; text-align: center; padding: 28px 22px; border-radius: 24px; background: var(--card, #fff); border: 2px solid var(--line, #E2E8F0); }
.ci-result .ci-ic { font-size: 3.4rem; display: block; }
.ci-result h2 { margin: 8px 0 4px; }
.ci-result.ok { border-color: #34D399; background: #ECFDF5; } .ci-result.late { border-color: #FBBF24; background: #FFFBEB; } .ci-result.bad { border-color: #FCA5A5; background: #FEF2F2; }
.ci-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
[data-theme="dark"] .ci-result.ok { background: #064E3B; } [data-theme="dark"] .ci-result.late { background: #451A03; } [data-theme="dark"] .ci-result.bad { background: #450A0A; }
@media (max-width: 860px) { .ci-layout { grid-template-columns: 1fr; } }
@media print {
  body * { visibility: hidden !important; }
  .ci-poster, .ci-poster * { visibility: visible !important; }
  .ci-poster { position: fixed; inset: 0; border: 0; border-radius: 0; aspect-ratio: auto; padding: 18mm; }
  .ci-qr svg { width: 120mm; }
}

/* ⏰ Not checked in yet */
html[data-noscan] :is(.who, .top-me, .hu-me, .ws-me) { position: relative; }
html[data-noscan] :is(.top-me, .hu-me, .ws-me)::after,
html[data-noscan] .who::after { content: ''; position: absolute; top: -1px; right: -1px; width: 12px; height: 12px; border-radius: 50%; background: #EF4444; border: 2px solid var(--panel, #fff); box-shadow: 0 0 0 2px rgba(239, 68, 68, .25); pointer-events: none; }
html[data-noscan] .who::after { top: 4px; left: 30px; right: auto; }
.scan-bar { background: #FFF7ED; border-color: #FDBA74; color: #9A3412; }
.scan-bar .upd-go { background: linear-gradient(135deg, #F97316, #EA580C); }
.scan-bar .upd-x { color: #C2410C; }
[data-theme="dark"] .scan-bar { background: #431407; border-color: #9A3412; color: #FED7AA; }
.ns { margin: 0 0 14px; padding: 12px 14px; border-radius: 18px; background: #FFF7ED; border: 1px solid #FDBA74; }
.ns-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.ns-head b span { display: inline-block; min-width: 24px; padding: 0 7px; border-radius: 99px; background: #EA580C; color: #fff; text-align: center; font-size: .82rem; }
.ns-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.ns-list li { display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 6px 10px; border-radius: 12px; background: var(--card, #fff); }
.ns-list small { grid-column: 1; color: var(--muted, #64748B); }
.ns-call { grid-row: 1 / span 2; grid-column: 2; text-decoration: none; font-size: 1.1rem; padding: 4px 8px; border-radius: 10px; }
.ns-call:hover { background: #FFEDD5; }
[data-theme="dark"] .ns { background: #431407; border-color: #9A3412; }

/* 🔔 Push on this phone */
.push-state { margin: 6px 0 10px; font-weight: 700; } .push-state.ok { color: #047857; } .push-state.bad { color: #B91C1C; }
.push-acts { display: flex; flex-wrap: wrap; gap: 8px; }

.push-kid { display: flex; flex-direction: column; gap: 4px; margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--soft, #F1F5F9); }

/* Unread counts on shortcut tiles (dashboard + teacher page) */
.tile { position: relative; }
.tile .nav-badge, .ws-tile .nav-badge { position: absolute; top: 8px; right: 8px; margin: 0; min-width: 24px; height: 24px; font-size: .78rem; box-shadow: 0 0 0 3px var(--panel, #fff); animation: mpPop .3s ease-out; }
.ws-tile .nav-badge { box-shadow: 0 0 0 2px rgba(255,255,255,.85); }
.tile.has-new { border-color: #FCA5A5; box-shadow: 0 10px 24px -14px rgba(225, 29, 72, .55); }
@keyframes mpPop { from { transform: scale(.4); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .tile .nav-badge, .ws-tile .nav-badge { animation: none; } }

/* «📨 សារថ្មី» peek */
.mp { margin: 0 0 18px; padding: 14px 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.mp[hidden] { display: none; }
.mp header { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.mp header b { font-size: 1rem; }
.mp header em { font-style: normal; display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; margin-left: 4px; border-radius: 11px; background: #EF4444; color: #fff; font-size: .75rem; }
.mp header small { color: var(--muted); font-size: .78rem; }
.mp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mp-col h4 { display: flex; justify-content: space-between; align-items: center; margin: 0 0 6px; font-size: .88rem; }
.mp-col h4 a { color: var(--ink); text-decoration: none; }
.mp-col h4 span { color: var(--muted); font-weight: 600; font-size: .8rem; }
.mp-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.mp-col li a { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 12px; text-decoration: none; color: var(--ink); background: color-mix(in srgb, var(--red, #7C3AED) 4%, transparent); }
.mp-col li a:hover, .mp-col li a:focus-visible { background: color-mix(in srgb, var(--red, #7C3AED) 10%, transparent); }
.mp-av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; font-weight: 700; font-size: .95rem; }
.mp-t { min-width: 0; display: flex; flex-direction: column; }
.mp-t b, .mp-t small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-t b { font-size: .86rem; } .mp-t small { color: var(--muted); font-size: .78rem; }
.mp-col time { color: var(--muted); font-size: .72rem; align-self: start; padding-top: 3px; }
.mp-col p { margin: 6px 0; color: var(--muted); font-size: .84rem; }
.mp-more { display: inline-block; margin-top: 6px; font-size: .8rem; font-weight: 600; }
.mp-calm { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 16px; font-size: .86rem; color: var(--muted); }
.mp-calm a { font-weight: 600; text-decoration: none; }
.ws .mp { margin: 0 auto 18px; max-width: 1100px; }
@media (max-width: 720px) { .mp-cols { grid-template-columns: 1fr; } }

/* Quick reply inside the «📨 សារថ្មី» box */
.mp-col li { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; }
.mp-rbtn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 10px; padding: 6px 10px; font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.mp-rbtn:hover, .mp-rbtn:focus-visible { border-color: #7C3AED; color: #6D28D9; }
.mp-form { grid-column: 1 / -1; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 4px 0 6px 46px; }
.mp-form input[name=text] { flex: 1 1 180px; min-width: 0; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-size: .86rem; }
.mp-form .btn { padding: 7px 12px; font-size: .82rem; }
.mp-done { font-size: .8rem; display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.mp-sound { margin-left: auto; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .78rem; cursor: pointer; padding: 2px 6px; border-radius: 8px; }
.mp-sound:hover, .mp-sound:focus-visible { background: color-mix(in srgb, var(--ink) 6%, transparent); }
@media (max-width: 720px) { .mp-form { padding-left: 0; } }

#langForm textarea { width: 100%; font: inherit; font-size: .9rem; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); resize: vertical; }
.lang-acts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.hr-p-quarter { background: #EFF6FF; border-color: #BFDBFE; color: #1D4ED8; }
.hr-periods .hr-p-year { grid-column: 1 / -1; }
.hr-hint { display: block; margin-top: 4px; color: var(--muted); font-size: .76rem; }
.ct-kinds .hr-p:last-child { grid-column: 1 / -1; }

.sl-link-who { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; flex-wrap: wrap; }
.sl-link-who img { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; }

.pf-alias { font-size: .78rem; margin-left: 4px; }
.pf-alias-row { display: flex; align-items: center; gap: 4px; }
.pf-alias-row input { flex: 1; min-width: 80px; }

/* Layout safety (found by tests/visual.py): long option texts and button rows must never push a page
   wider than the screen. */
select { max-width: 100%; }
.field, .form-grid > *, .panel, .hr-side, .hr-card, .hr-f, .sl-link-txt { min-width: 0; }
.field > select, .field > input, .hr-sel { max-width: 100%; min-width: 0; }
.at-row-head > div { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 960px) { .hr-wrap { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .sl-link-txt { min-width: 0; width: 100%; }
}
.gs-grid > * { min-width: 0; }
.gs-grid > div:first-child { overflow-x: auto; }
@media (max-width: 600px) { .lg-row { align-items: stretch; } .lg-prev { align-self: center; } }
.lg-btns .btn { white-space: normal; max-width: 100%; text-align: center; }

/* 📊 Results and attendance (student / parent) */
.rc .rc-chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.rc .rc-chips::-webkit-scrollbar { display: none; }
.rc-chips button { flex: none; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 99px; padding: 6px 12px; font: inherit; font-size: .85rem; cursor: pointer; }
.rc-chips button[aria-selected="true"] { background: #0EA5E9; border-color: #0EA5E9; color: #fff; font-weight: 700; }
.rc-big { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-radius: 16px; background: linear-gradient(135deg, #E0F2FE, #F0FDF4); }
.rc-big.low { background: linear-gradient(135deg, #FEF3C7, #FEE2E2); }
.rc-avg { display: flex; flex-direction: column; align-items: center; min-width: 84px; }
.rc-avg b { font-size: 2.1rem; line-height: 1.1; color: #0369A1; }
.rc-big.low .rc-avg b { color: #B45309; }
.rc-avg small { color: var(--muted); }
.rc-facts { display: flex; flex-direction: column; gap: 4px; font-size: .92rem; color: #0F172A; min-width: 0; }
.rc-rank b { font-size: 1.15rem; }
.rc-subs { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rc-subs li { display: grid; grid-template-columns: minmax(0, 7.5em) 1fr 2.6em; align-items: center; gap: 8px; font-size: .88rem; }
.rc-subs li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-subs li i { height: 8px; border-radius: 6px; background: linear-gradient(90deg, #38BDF8 var(--w), color-mix(in srgb, var(--ink) 10%, transparent) var(--w)); }
.rc-subs li b { text-align: right; }
.rc-trend { display: flex; align-items: flex-end; gap: 6px; height: 92px; margin-top: 14px; padding-top: 6px; border-top: 1px dashed var(--line); }
.rc-trend span { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; min-width: 0; }
.rc-trend i { width: 70%; max-width: 26px; height: var(--h); border-radius: 6px 6px 2px 2px; background: #BAE6FD; }
.rc-trend span.on i { background: #0EA5E9; }
.rc-trend small { font-size: .66rem; color: var(--muted); white-space: nowrap; }
.rc-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.rc-nav { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 1.2rem; cursor: pointer; }
.rc-nav:disabled { opacity: .35; cursor: default; }
.rc-tally { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; font-size: .82rem; }
.rc-tally span { padding: 3px 9px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.rc-tally .p { background: #DCFCE7; color: #166534; } .rc-tally .l { background: #FEF3C7; color: #92400E; } .rc-tally .a { background: #FEE2E2; color: #991B1B; } .rc-tally .e { background: #DBEAFE; color: #1E40AF; }
.rc-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.rc-w { text-align: center; font-size: .72rem; color: var(--muted); padding-bottom: 2px; }
.rc-d { aspect-ratio: 1; border-radius: 10px; background: color-mix(in srgb, var(--ink) 4%, transparent); display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; }
.rc-d.empty { background: none; }
.rc-d small { font-size: .7rem; color: var(--muted); line-height: 1; }
.rc-d em { font-style: normal; font-size: .95rem; line-height: 1.1; }
.rc-d.p { background: #DCFCE7; } .rc-d.l { background: #FEF3C7; } .rc-d.a { background: #FEE2E2; } .rc-d.e { background: #DBEAFE; }
.rc-d.today { outline: 2px solid #0EA5E9; outline-offset: -2px; }
[data-theme="dark"] .rc-big { background: linear-gradient(135deg, #0C4A6E, #064E3B); }
[data-theme="dark"] .rc-big.low { background: linear-gradient(135deg, #78350F, #7F1D1D); }
[data-theme="dark"] .rc-facts { color: #F1F5F9; } [data-theme="dark"] .rc-avg b { color: #7DD3FC; } [data-theme="dark"] .rc-big.low .rc-avg b { color: #FCD34D; }
[data-theme="dark"] .rc-d.p { background: #14532D; } [data-theme="dark"] .rc-d.l { background: #713F12; } [data-theme="dark"] .rc-d.a { background: #7F1D1D; } [data-theme="dark"] .rc-d.e { background: #1E3A8A; }
[data-theme="dark"] .rc-tally .p { background: #14532D; color: #BBF7D0; } [data-theme="dark"] .rc-tally .l { background: #713F12; color: #FDE68A; } [data-theme="dark"] .rc-tally .a { background: #7F1D1D; color: #FECACA; } [data-theme="dark"] .rc-tally .e { background: #1E3A8A; color: #BFDBFE; }

.rc-cal { max-width: 460px; margin: 0 auto; }
.rc-cal-head, .rc-tally { max-width: 460px; margin-left: auto; margin-right: auto; }
.rc-home { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer; border: 1px solid #BAE6FD; background: linear-gradient(135deg, #F0F9FF, #fff); font: inherit; color: var(--ink); }
.rc-home-ico { font-size: 1.8rem; }
.rc-home-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rc-home-txt small { color: var(--muted); }
.rc-home-go { font-size: 1.6rem; color: #0EA5E9; }
[data-theme="dark"] .rc-home { background: linear-gradient(135deg, #0C4A6E, transparent); border-color: #075985; }

.rc-busy { background: linear-gradient(135deg, #F1F5F9, #E0F2FE); }
.rc-busy-ico { font-size: 2.2rem; }
.rc-busy .rc-facts b { font-size: 1rem; }
.rc-busy .rc-facts span { font-size: .84rem; color: var(--muted); }
.rc-prog { display: block; height: 8px; border-radius: 6px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: hidden; margin-top: 4px; }
.rc-prog i { display: block; height: 100%; width: var(--w); background: #38BDF8; border-radius: 6px; }
[data-theme="dark"] .rc-busy { background: linear-gradient(135deg, #1E293B, #0C4A6E); }
.st-enrol { white-space: nowrap; } .st-enrol small { display: block; color: var(--muted); font-size: .74rem; }

/* ===================== 🌙 Dark-mode contrast fixes (found by tests/contrast.py) ===================== */
[data-theme="dark"] .info-bar .upd-x { color: #6EE7B7; }
[data-theme="dark"] .pill-demo { color: #FCD34D; border-color: #6B4E14; }
[data-theme="dark"] .at-kpis .p b, [data-theme="dark"] .at-report .tot.p { color: #4ADE80; }
[data-theme="dark"] .at-kpis .e b, [data-theme="dark"] .at-report .tot.e, [data-theme="dark"] .at-counts .e { color: #93C5FD; }
[data-theme="dark"] .at-kpis .a b, [data-theme="dark"] .at-report .tot.a { color: #FCA5A5; }
[data-theme="dark"] .at-kpis .r b, [data-theme="dark"] .tag-a { color: #C4B5FD; }
[data-theme="dark"] .at-report .tot.l { color: #FCD34D; }
[data-theme="dark"] .ab-kpi small { color: #CBD5E1; } [data-theme="dark"] .ab-kpi em { color: #A3A3C8; }
[data-theme="dark"] .ab-kpi b { color: color-mix(in srgb, var(--c) 55%, #fff); }
[data-theme="dark"] .ab-seg button { background: #211E45; border-color: #34306A; }
[data-theme="dark"] .ab-seg-i { background: #2A2756; }
[data-theme="dark"] .ab-seg button[aria-pressed="true"] .ab-seg-t b { color: #5EEAD4; }
[data-theme="dark"] .ab-seg button[data-state="now"] .ab-seg-st { background: #047857; }
[data-theme="dark"] .ab-seg button[data-state="past"] .ab-seg-st { background: #312E81; color: #C7D2FE; }
[data-theme="dark"] .ch-room.on { background: #2E2A5E; }
[data-theme="dark"] .ch-new .ch-ib { background: #2E2A5E; }
[data-theme="dark"] .ch-tag { background: rgba(16, 185, 129, .2); color: #6EE7B7; }
[data-theme="dark"] .ci-result.info { background: var(--panel); }
[data-theme="dark"] .sf-mail { background: #24214A; color: #E8E7FF; }
[data-theme="dark"] .sl-link { border-color: #3B3575; background: linear-gradient(135deg, #24214A, #1A1838); }
[data-theme="dark"] .sl-link-row input { background: #13122C; color: #C4B5FD; }
[data-theme="dark"] .gs-preset[aria-pressed="true"] { background: #25235A; }
[data-theme="dark"] .ls-card h3, [data-theme="dark"] .ls-btn, [data-theme="dark"] .ls-ring b { color: color-mix(in srgb, var(--b) 45%, #fff); }
[data-theme="dark"] .sa-stats .lock { color: #CBD5E1; } [data-theme="dark"] .sa-stats .done { color: #4ADE80; } [data-theme="dark"] .sa-stats .part { color: #FCD34D; } [data-theme="dark"] .sa-stats .none { color: #FCA5A5; }
[data-theme="dark"] .lt-type b, [data-theme="dark"] .lt-hero h2 { color: color-mix(in srgb, var(--c) 45%, #fff); }
[data-theme="dark"] .lt-hero-acts .btn-primary, [data-theme="dark"] .promo .btn-primary { color: #fff; }
[data-theme="dark"] .danger-text { color: #FCA5A5; }
[data-theme="dark"] .sf-complete.bad .sfc-top b { color: #FCA5A5; } [data-theme="dark"] .sf-complete.mid .sfc-top b { color: #FCD34D; } [data-theme="dark"] .sf-complete.good .sfc-top b { color: #6EE7B7; }
/* Bright gradient tiles keep white text; a soft shadow keeps it readable on the lighter end. */
.ws-tile .ws-txt, .cl-card .cl-top h3, .cp-badge, .bc-ico, .mini-ring i, .day-chips span.today, .hol-week input:checked + span { text-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.hr-ph span { color: #64748B; }
[data-theme="dark"] .at-report tfoot td { background: #24214A; }
[data-theme="dark"] .hl-parent { color: #F9A8D4; }
.hl-student, .ha-monks figcaption { text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.cl-badge, .cl-btn:not(.green):not(.blue) { color: color-mix(in srgb, var(--b) 78%, #000); }
.ch-stk i { color: color-mix(in srgb, var(--b) 80%, #000); }
.ni-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.ni-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; cursor: pointer; text-align: left; }
.ni-opt[aria-checked="true"] { border-color: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent); }
.ni-prev { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px; background: linear-gradient(135deg, #3B1A8A, #5B21B6); color: #fff; }
.ni-prev img { width: 28px; height: 28px; filter: drop-shadow(0 2px 3px rgba(15, 8, 50, .35)); }
.ni-prev svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ws-tile .ws-ico-img { background: rgba(255, 255, 255, .92); border-color: rgba(255, 255, 255, .9); }
.ws-ico-img img { width: 42px; height: 42px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(15, 8, 50, .25)); }
[data-theme="dark"] .ws-tile .ws-ico-img { background: rgba(255, 255, 255, .88); }
.ni-credit { margin: 10px 0 0; font-size: .78rem; } .ni-credit a { color: inherit; }
/* 🎨 the menu's colour pictures on dashboard shortcuts and the student page */
.tile-ico .ti-pic { width: 50px; height: 50px; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(15, 23, 42, .18)); }
@media (max-width: 700px) { .tile-ico .ti-pic { width: 36px; height: 36px; } }
.st-q-ico.has-pic { background: linear-gradient(160deg, #fff, var(--t)); box-shadow: 0 8px 14px -10px var(--c), inset 0 0 0 1px color-mix(in srgb, var(--c) 18%, transparent); }
.st-q-ico.has-pic .st-pic { width: 78%; height: 78%; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(15, 23, 42, .2)); transition: transform .15s; }
.st-q:hover .st-q-ico.has-pic .st-pic { transform: scale(1.08); }
.st-tab-ico.has-pic .st-pic { width: 24px; height: 24px; object-fit: contain; }
.st-tab[aria-selected="true"] .st-tab-ico.has-pic { background: linear-gradient(160deg, #fff, color-mix(in srgb, var(--c) 25%, #fff)); box-shadow: 0 0 0 2px var(--c); }
[data-theme="dark"] .st-q-ico.has-pic, [data-theme="dark"] .st-tab-ico.has-pic { background: rgba(255, 255, 255, .9); }

/* ===================== 🎮 Learning games ===================== */
.gh { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.gh-hero { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: center; justify-content: space-between; padding: 22px 24px; border-radius: 24px;
  color: #fff; background: radial-gradient(circle at 92% 10%, rgba(255, 255, 255, .25), transparent 40%), linear-gradient(120deg, #6D28D9, #DB2777 55%, #F59E0B); box-shadow: 0 16px 34px -18px rgba(109, 40, 217, .7); }
.gh-hero h2 { margin: 0 0 4px; font-size: 1.5rem; } .gh-hero p { margin: 0; opacity: .92; max-width: 62ch; }
.gh-hero-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.gh-hero .btn-ghost { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .45); }
.gh-hero .btn-primary { background: #fff; color: #6D28D9; }
.gh-bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.gh-search { display: flex; align-items: center; gap: 8px; flex: 1 1 220px; max-width: 360px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); }
.gh-search input { border: 0; background: transparent; padding: 10px 0; width: 100%; font: inherit; color: var(--ink); outline: none; }
.gh-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; max-width: 100%; }
.gh-chip { flex: none; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-size: .86rem; cursor: pointer; }
.gh-chip[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.gh-showall { font-size: .85rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.gh-sec { margin: 8px 0 0; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; } .gh-sec small { color: var(--muted); font-weight: 500; }
.gh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.gh-empty { margin: 0; } .gh-note { font-size: .76rem; margin: 6px 0 0; }
.gmc { --gc: #7C3AED; position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 20px; background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--gc) 22%, var(--line)); box-shadow: 0 10px 22px -18px color-mix(in srgb, var(--gc) 80%, transparent); transition: transform .15s, box-shadow .15s; }
.gmc:hover { transform: translateY(-2px); box-shadow: 0 16px 28px -18px color-mix(in srgb, var(--gc) 90%, transparent); }
.gmc::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; border-radius: 20px 20px 0 0; background: var(--gc); }
.gmc.is-hidden { opacity: .55; } .gmc.is-pinned { border-color: color-mix(in srgb, var(--gc) 55%, var(--line)); }
.gmc-top { display: flex; align-items: center; gap: 10px; }
.gmc-emoji { width: 52px; height: 52px; flex: none; display: grid; place-items: center; font-size: 1.7rem; border-radius: 16px; background: color-mix(in srgb, var(--gc) 14%, var(--panel)); }
.gmc-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gmc-subj { font-size: .78rem; font-weight: 700; color: color-mix(in srgb, var(--gc) 85%, var(--ink)); } .gmc-level { font-size: .74rem; color: var(--muted); }
.gmc-pin { margin-left: auto; }
.gmc h4 { margin: 4px 0 0; font-size: 1.02rem; line-height: 1.45; } .gmc p { margin: 0; font-size: .86rem; color: var(--muted); line-height: 1.55; }
.gmc-tag { align-self: flex-start; font-size: .72rem; padding: 3px 9px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.gmc-tag.off { background: color-mix(in srgb, #0369A1 12%, var(--panel)); color: #0369A1; font-weight: 700; }
[data-theme="dark"] .gmc-tag.off { color: #7DD3FC; } [data-theme="dark"] .gmc-subj { color: color-mix(in srgb, var(--gc) 45%, #fff); }
.gmc-best { font-size: .78rem !important; color: #B45309 !important; font-weight: 700; } [data-theme="dark"] .gmc-best { color: #FCD34D !important; }
.gmc-acts { margin-top: auto; padding-top: 6px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gmc-acts .btn-primary { background: var(--gc); border-color: var(--gc); color: #fff; }
.gmc-manage { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.gmc-mini { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-size: .9rem; color: var(--ink); }
.gmc-mini:hover { border-color: var(--gc); }
/* Play sheet */
body.gp-open { overflow: hidden; }
.gp { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 16px; background: rgba(15, 10, 40, .55); backdrop-filter: blur(3px); }
.gp-sheet { --gc: #7C3AED; width: min(980px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; border-radius: 24px; background: var(--panel); color: var(--ink); overflow: hidden; box-shadow: 0 30px 60px rgba(0, 0, 0, .35); }
.gp-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--gc) 10%, var(--panel)); }
.gp-head h3 { margin: 0; font-size: 1.05rem; flex: 1; min-width: 0; } .gp-emoji { font-size: 1.5rem; }
.gp-body { padding: 20px; overflow: auto; flex: 1; min-height: 0; }
.gp-frame { width: 100%; height: min(70dvh, 640px); border: 0; border-radius: 14px; background: #fff; display: block; }
.gp-body:has(.gp-frame) { padding: 0; }
.gp-intro { text-align: center; color: var(--muted); margin: 0 0 12px; }
.gp-setup { display: grid; gap: 14px; justify-items: center; }
.gp-pick { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.gp-pick > span { font-weight: 700; margin-right: 4px; }
.gp-pick label input { position: absolute; opacity: 0; }
.gp-pick label b { display: inline-block; padding: 8px 14px; border-radius: 12px; border: 2px solid var(--line); cursor: pointer; font-weight: 600; }
.gp-pick label input:checked + b { border-color: var(--gc); background: color-mix(in srgb, var(--gc) 14%, var(--panel)); }
.gp-pick label input:focus-visible + b { outline: 3px solid color-mix(in srgb, var(--gc) 50%, transparent); }
.gp-start { font-size: 1.05rem; padding: 12px 26px; background: var(--gc); border-color: var(--gc); }
.gp-progress { height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; } .gp-progress span { display: block; height: 100%; background: var(--gc); transition: width .3s; }
.gp-count { text-align: center; color: var(--muted); margin: 10px 0; font-size: .9rem; }
.gp-q { display: grid; justify-items: center; gap: 6px; text-align: center; font-size: 2.1rem; font-weight: 800; margin: 10px 0 20px; }
.gp-q small { font-size: .95rem; font-weight: 600; color: var(--muted); }
.gp-big { font-size: 3rem; line-height: 1.3; } .gp-qtext { font-size: 1.35rem; line-height: 1.6; font-weight: 700; max-width: 40ch; }
.gp-things { font-size: 2.1rem; letter-spacing: 4px; max-width: 12em; line-height: 1.4; }
.kh { font-family: 'Kantumruy Pro', 'Noto Sans Khmer', 'Khmer OS', sans-serif; }
.gp-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; max-width: 640px; margin: 0 auto; }
.gp-opt { padding: 16px 10px; font: inherit; font-size: 1.5rem; font-weight: 800; border-radius: 16px; border: 2px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; transition: transform .1s; min-height: 64px; }
.gp-opt:hover:not([disabled]) { border-color: var(--gc); transform: translateY(-2px); }
.gp-opt.ok { background: #DCFCE7; border-color: #16A34A; color: #14532D; } .gp-opt.bad { background: #FEE2E2; border-color: #DC2626; color: #7F1D1D; }
.gp-end { text-align: center; padding: 18px 0; display: grid; gap: 6px; justify-items: center; }
.gp-stars { font-size: 2.6rem; letter-spacing: 6px; } .gp-end h3 { margin: 0; font-size: 1.5rem; }
.gp-mem { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 620px; margin: 0 auto; }
.gp-card { position: relative; aspect-ratio: 1 / 1; border-radius: 16px; border: 2px solid var(--line); background: linear-gradient(135deg, var(--gc), color-mix(in srgb, var(--gc) 60%, #fff)); cursor: pointer; padding: 6px; font: inherit; color: var(--ink); }
.gp-card-back { font-size: 1.8rem; color: #fff; } .gp-card-face { display: none; }
.gp-card.open, .gp-card.done { background: var(--panel); border-color: var(--gc); }
.gp-card.open .gp-card-back, .gp-card.done .gp-card-back { display: none; }
.gp-card.open .gp-card-face, .gp-card.done .gp-card-face { display: grid; justify-items: center; gap: 2px; font-size: 1rem; }
.gp-card.done { background: #DCFCE7; border-color: #16A34A; } [data-theme="dark"] .gp-card.done { background: #064E3B; }
.gp-card-e { font-size: 1.6rem; }
@media (max-width: 600px) {
  .gp { padding: 0; } .gp-sheet { max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .gp-mem { grid-template-columns: repeat(3, 1fr); } .gp-q { font-size: 1.7rem; } .gp-big { font-size: 2.4rem; }
  .gp-frame { height: calc(100dvh - 70px); border-radius: 0; }
  .gh-hero { padding: 18px; } .gh-search { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .gmc, .gp-opt, .gp-progress span { transition: none; } }
/* Quiz editor */
.gq-emo { flex: 0 0 90px; }
.gq-list { display: grid; gap: 10px; max-height: 46vh; overflow: auto; padding-right: 4px; }
.gq-row { border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px 12px; display: grid; gap: 8px; margin: 0; }
.gq-row legend { font-weight: 700; font-size: .86rem; padding: 0 6px; display: flex; gap: 8px; align-items: center; }
.gq-del { border: 0; background: none; color: #DC2626; cursor: pointer; font-size: .9rem; }
.gq-q, .gq-ci { width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--input); color: var(--ink); font: inherit; min-width: 0; }
.gq-cs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.gq-c { display: flex; align-items: center; gap: 6px; padding: 2px 4px 2px 8px; border-radius: 10px; border: 1px solid transparent; }
.gq-c.ok { border-color: #16A34A; background: color-mix(in srgb, #16A34A 10%, transparent); }
.gq-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; margin-top: 8px; }
.gq-bulk { flex: 1 1 260px; } .gq-bulk summary { cursor: pointer; font-weight: 600; } .gq-bulk textarea { width: 100%; margin: 6px 0; }
.gq-classes { display: flex; flex-wrap: wrap; gap: 6px 14px; }
@media (max-width: 600px) { .gq-cs { grid-template-columns: 1fr; } }
/* 🏆 game scores */
.gm-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.gm-tabs a { padding: 9px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); text-decoration: none; font-weight: 600; }
.gm-tabs a[aria-current] { background: var(--red); border-color: var(--red); color: #fff; }
.gb { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.gb-bar { display: flex; flex-wrap: wrap; gap: 12px; } .gb-bar .field { min-width: 200px; }
.gb-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.gb-kpis > div { padding: 12px 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); display: grid; gap: 2px; }
.gb-kpis b { font-size: 1.5rem; } .gb-kpis small { color: var(--muted); }
.gb-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: start; }
.gb-grid > .panel:last-child { grid-column: 1 / -1; }
.gb-grid h3, .gb-card h2 { margin: 0 0 10px; } .gb-card h2 small { font-size: .8rem; color: var(--muted); font-weight: 500; }
@media (max-width: 900px) { .gb-grid { grid-template-columns: minmax(0, 1fr); } }
.gb-podium { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 8px; align-items: end; }
.gb-podium li { display: grid; justify-items: center; gap: 2px; text-align: center; padding: 12px 6px; border-radius: 16px; background: var(--soft); min-width: 0; }
.gb-podium li b { font-size: .92rem; overflow-wrap: anywhere; } .gb-podium li small { color: var(--muted); }
.gb-podium .gb-p1 { order: 2; padding-top: 20px; background: linear-gradient(180deg, #FEF3C7, #FDE68A); color: #78350F; }
.gb-podium .gb-p2 { order: 1; background: linear-gradient(180deg, #F1F5F9, #E2E8F0); color: #1E293B; }
.gb-podium .gb-p3 { order: 3; background: linear-gradient(180deg, #FFEDD5, #FED7AA); color: #7C2D12; }
.gb-podium li small { color: inherit; opacity: .8; }
.gb-podium li.me, .gb-rest li.me { outline: 3px solid var(--red); }
.gb-medal { font-size: 2rem; }
.gb-rest { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.gb-rest li { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 10px; background: var(--soft); }
.gb-rest li span { color: var(--muted); font-weight: 700; }
.gb-mine { margin: 10px 0 0; text-align: center; font-weight: 600; } .gb-how { font-size: .8rem; color: var(--muted); margin: 8px 0 0; }
.gb-empty { color: var(--muted); text-align: center; margin: 6px 0; }
.gb-bar-pct { display: inline-block; width: 60px; height: 6px; border-radius: 9px; background: var(--soft); vertical-align: middle; overflow: hidden; }
.gb-bar-pct i { display: block; height: 100%; background: #16A34A; }
.gb-idle { margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.gb-idle span { padding: 3px 9px; border-radius: 999px; background: var(--soft); font-size: .82rem; }
.gb-recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.gb-recent li { display: grid; grid-template-columns: 90px minmax(0, 1fr) minmax(0, 1.4fr) 60px 70px; gap: 8px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line); font-size: .88rem; }
.gb-recent .gb-when, .gb-recent small { color: var(--muted); }
.gb-score { font-weight: 800; text-align: center; border-radius: 8px; padding: 2px 6px; }
.gb-score.hi { background: #DCFCE7; color: #166534; } .gb-score.mid { background: #FEF9C3; color: #854D0E; } .gb-score.lo { background: #FEE2E2; color: #991B1B; }
[data-theme="dark"] .gb-score.hi { background: #064E3B; color: #6EE7B7; } [data-theme="dark"] .gb-score.mid { background: #422006; color: #FCD34D; } [data-theme="dark"] .gb-score.lo { background: #450A0A; color: #FCA5A5; }
@media (max-width: 600px) { .gb-recent li { grid-template-columns: minmax(0, 1fr) auto; } .gb-recent li > span:nth-child(3), .gb-recent small { grid-column: 1; } }
/* 🏫 class cup */
.gc-cup { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.gc-cup li { display: grid; grid-template-columns: 44px minmax(0, 1fr) 64px; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--soft); border: 1px solid var(--line); }
.gc-cup li:nth-child(1):not(.idle) { background: linear-gradient(90deg, #FEF3C7, var(--soft)); }
[data-theme="dark"] .gc-cup li:nth-child(1):not(.idle) { background: linear-gradient(90deg, #422006, var(--soft)); }
.gc-cup li.me { outline: 3px solid var(--red); }
.gc-cup li.idle { opacity: .7; }
.gc-rank { font-size: 1.6rem; font-weight: 800; text-align: center; color: var(--muted); }
.gc-main { display: grid; gap: 4px; min-width: 0; } .gc-main b { overflow-wrap: anywhere; }
.gc-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) 70px; gap: 8px; align-items: center; font-size: .8rem; }
.gc-row small { color: var(--muted); } .gc-row small:last-child { text-align: right; }
.gc-track { height: 8px; border-radius: 9px; background: var(--line); overflow: hidden; }
.gc-track i { display: block; height: 100%; background: #6366F1; border-radius: 9px; } .gc-track.ok i { background: #16A34A; }
.gc-score { display: grid; justify-items: center; line-height: 1.1; } .gc-score b { font-size: 1.6rem; color: var(--red); } .gc-score small { color: var(--muted); font-size: .75rem; }
@media (max-width: 520px) { .gc-cup li { grid-template-columns: 32px minmax(0, 1fr) 52px; gap: 8px; } .gc-row { grid-template-columns: 70px minmax(0, 1fr) 56px; } }
.gb > .panel h3, #gcBody .panel h3 { margin: 0 0 12px; }
/* 🏆 monthly cup */
.gc-champ { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: linear-gradient(135deg, #FDE68A, #F59E0B); color: #78350F; box-shadow: 0 2px 6px rgba(245, 158, 11, .35); width: max-content; max-width: 100%; }
.cl-card > .gc-champ { margin-bottom: 6px; }
.gc-weeks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.gc-weeks small { padding: 1px 7px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-size: .72rem; color: var(--muted); }
.gc-groups { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.gc-group h3 small { font-size: .78rem; color: var(--muted); font-weight: 500; }
.gc-champs { padding: 14px 16px; border-radius: 18px; background: linear-gradient(135deg, #FEF3C7, #FDE68A); color: #78350F; }
.gc-champs h3 { margin: 0 0 8px; } .gc-champs div { display: flex; flex-wrap: wrap; gap: 8px; }
.gc-champs span { display: grid; padding: 6px 12px; border-radius: 12px; background: rgba(255, 255, 255, .7); } .gc-champs small { opacity: .8; }
[data-theme="dark"] .gc-champs { background: linear-gradient(135deg, #422006, #78350F); color: #FDE68A; } [data-theme="dark"] .gc-champs span { background: rgba(0, 0, 0, .25); }
.gc-win { display: flex; gap: 14px; align-items: center; background: linear-gradient(135deg, #FEF3C7, #FDE68A); color: #78350F; }
.gc-win > span { font-size: 2.6rem; } .gc-win p { margin: 2px 0 0; }
[data-theme="dark"] .gc-win { background: linear-gradient(135deg, #422006, #78350F); color: #FDE68A; }
.gc-home { margin: 0 0 16px; padding: 14px 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.gc-home header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.gc-home h2 { margin: 0; font-size: 1.05rem; } .gc-home h2 small { color: var(--muted); font-weight: 500; font-size: .8rem; }
.gc-home-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.gc-home-card { display: grid; gap: 4px; padding: 12px; border-radius: 14px; background: var(--soft); border: 1px solid #F59E0B55; }
.gc-home-card small { color: var(--muted); }
.gc-champ.gc-up { background: linear-gradient(135deg, #A7F3D0, #10B981); color: #064E3B; box-shadow: 0 2px 6px rgba(16, 185, 129, .35); }
.cl-card > .gc-champ + .gc-champ { margin-left: 4px; }
.gc-home-card .gc-champ + .gc-champ { margin-top: 2px; }
.gc-champs header { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.gc-champs header h3 { margin: 0; }
.gc-print { background: #fff; color: #78350F; border: 1px solid #F59E0B; }
[data-theme="dark"] .gc-print { background: #1C1917; color: #FDE68A; }
.gc-home-acts { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.gc-win-up { background: linear-gradient(135deg, #D1FAE5, #A7F3D0); color: #064E3B; }
[data-theme="dark"] .gc-win-up { background: linear-gradient(135deg, #022C22, #065F46); color: #A7F3D0; }
/* 🌐 Sala Puthika front page (bare address) */
.spf-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 32px; align-items: center; padding: 36px 32px; border-radius: 28px; margin: 18px 0;
  background: radial-gradient(circle at 18% 30%, rgba(245, 179, 66, .28), transparent 45%), linear-gradient(135deg, #14213D, #1E3A6E 60%, #24477F); color: #F8FAFC; overflow: hidden; }
.spf-logo { width: 220px; height: 220px; border-radius: 50%; box-shadow: 0 0 0 6px rgba(245, 179, 66, .25), 0 18px 40px rgba(0, 0, 0, .35); animation: spf-glow 4s ease-in-out infinite; }
@keyframes spf-glow { 50% { box-shadow: 0 0 0 10px rgba(245, 179, 66, .18), 0 18px 48px rgba(245, 179, 66, .25); } }
@media (prefers-reduced-motion: reduce) { .spf-logo { animation: none; } }
.spf-text h1 { font-family: Moul, 'Kantumruy Pro', serif; font-weight: 400; font-size: clamp(1.8rem, 4vw, 2.8rem); margin: 0; color: #FCD34D; line-height: 1.6; }
.spf-en { margin: 0; letter-spacing: .04em; color: #CBD5E1; font-weight: 600; }
.spf-lead { margin: 14px 0 0; font-size: 1.05rem; line-height: 1.8; max-width: 60ch; color: #E2E8F0; }
.spf-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.spf-cta .btn-primary { background: #F5B342; border-color: #F5B342; color: #1E1B4B; }
.spf-cta .btn-ghost { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .35); }
@media (max-width: 720px) { .spf-hero { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding: 26px 18px; } .spf-logo { width: 160px; height: 160px; } .spf-cta { justify-content: center; } }
.spf-search { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--panel); max-width: 560px; }
.spf-search:focus-within { border-color: #F5B342; }
.spf-search input { border: 0; outline: 0; background: transparent; font: inherit; font-size: 1.05rem; flex: 1; min-width: 0; color: var(--ink); }
.spf-list { display: grid; gap: 8px; margin-top: 12px; max-width: 560px; }
.spf-school { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.spf-school:hover, .spf-school:focus-visible { border-color: #F5B342; }
.spf-school i { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 700; background: #14213D; color: #FCD34D; }
.spf-school span { display: grid; min-width: 0; } .spf-school b { overflow-wrap: anywhere; } .spf-school small { color: var(--muted); }
.spf-school em { font-style: normal; font-weight: 700; color: var(--red); }
.spf-note { padding-left: 20px; margin: 14px 0 0; font-size: .9rem; color: var(--muted); max-width: 70ch; line-height: 1.8; }
.spf-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.spf-grid article { padding: 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); display: grid; gap: 4px; }
.spf-grid article span { font-size: 1.8rem; } .spf-grid article p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.7; }
.so.so-set { position: relative; text-decoration: none; border: 1px dashed var(--line); }
.so.so-set:hover, .so.so-set:focus-visible { opacity: 1; border-color: #8B5CF6; }
.so-add { display: block; font-size: .7rem; color: #7C3AED; font-weight: 600; margin-top: 2px; }
.so.so-set { cursor: pointer; }
/* 🔗 extra contact links */
.so-ico.so-emoji { font-size: 1.6rem; line-height: 1; }
.so-label { text-align: center; overflow-wrap: anywhere; }
.xl-box { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 10px; }
.xl-box legend { font-weight: 700; padding: 0 6px; } .xl-box legend small { font-weight: 500; color: var(--muted); }
.xl-rows { display: grid; gap: 8px; }
.xl-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) minmax(0, 2fr) auto auto; gap: 6px; align-items: center; }
.xl-row input { min-width: 0; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; }
.xl-row .xl-icon { text-align: center; font-size: 1.2rem; }
.xl-presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.xl-presets .chip { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--soft); color: var(--ink); cursor: pointer; font: inherit; font-size: .85rem; }
.xl-presets .chip:hover { border-color: #8B5CF6; }
.xl-help { margin: 0; font-size: .82rem; }
@media (max-width: 600px) { .xl-row { grid-template-columns: 48px minmax(0, 1fr) auto auto; } .xl-row [name=xlUrl] { grid-column: 1 / -1; grid-row: 2; } }
/* 📊 contact button clicks */
.ck-panel { margin-top: 16px; }
.ck-panel .panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.ck-month { min-width: 200px; }
.ck-total { margin: 0 0 10px; }
.ck-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ck-list li { display: grid; grid-template-columns: 32px minmax(90px, 160px) minmax(0, 1fr) 80px 56px; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--soft); }
.ck-ico { font-size: 1.3rem; text-align: center; }
.ck-list b { overflow-wrap: anywhere; }
.ck-bar { height: 10px; border-radius: 9px; background: var(--line); overflow: hidden; }
.ck-bar i { display: block; height: 100%; border-radius: 9px; background: linear-gradient(90deg, #A78BFA, #7C3AED); }
.ck-n { font-weight: 700; text-align: right; }
.ck-d { text-align: right; color: var(--muted); } .ck-d.up { color: #16A34A; } .ck-d.down { color: #DC2626; }
[data-theme="dark"] .ck-d.up { color: #4ADE80; } [data-theme="dark"] .ck-d.down { color: #F87171; }
.ck-how, .ck-cmp { font-size: .82rem; margin: 8px 0 0; }
@media (max-width: 600px) { .ck-list li { grid-template-columns: 28px minmax(0, 1fr) 64px 44px; } .ck-bar { grid-column: 2 / -1; grid-row: 2; } }
/* 📝 online registration + ⏰ seasonal links */
.so.so-sleep { opacity: .55; border: 1px dashed var(--line); }
.so-when { display: block; font-size: .66rem; color: var(--muted); margin-top: 2px; text-align: center; }
.en-intro { margin: 0 0 10px; }
.en-set { border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px 4px; margin: 0 0 12px; }
.en-set legend { font-weight: 700; padding: 0 6px; }
.en-done { text-align: center; } .en-done > span { font-size: 3rem; } .en-ref { font-size: 1.1rem; } .en-ref b { letter-spacing: .12em; color: var(--red); }
.en-box .check { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.en-state { margin: 0; font-size: .85rem; }
.en-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.en-list { display: grid; gap: 12px; }
.en-card { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; background: var(--panel); display: grid; gap: 8px; }
.en-card header { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; } .en-card header b { font-size: 1.05rem; } .en-card header small { color: var(--muted); }
.en-grade { margin-left: auto; padding: 2px 10px; border-radius: 999px; background: #FFEDD5; color: #9A3412; font-weight: 700; font-size: .82rem; }
[data-theme="dark"] .en-grade { background: #431407; color: #FDBA74; }
.en-card dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 4px 14px; }
.en-card dl div { display: grid; } .en-card dt { font-size: .75rem; color: var(--muted); } .en-card dd { margin: 0; overflow-wrap: anywhere; }
.en-card footer { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.en-card footer select { min-width: 180px; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; }
.en-card.en-ok { border-color: #16A34A; background: color-mix(in srgb, #16A34A 8%, var(--panel)); }
.en-card.en-no { opacity: .6; }
.en-msg { margin: 0; font-weight: 600; }
.en-empty { text-align: center; padding: 20px; }
.en-bar { display: flex; gap: 10px; align-items: center; width: 100%; margin: 0 0 14px; padding: 12px 16px; border-radius: 16px; border: 1px solid #FDBA74; background: linear-gradient(90deg, #FFF7ED, var(--panel)); color: var(--ink); font: inherit; cursor: pointer; text-align: left; }
.en-bar span { font-size: 1.5rem; } .en-bar em { margin-left: auto; font-style: normal; color: #C2410C; font-weight: 600; }
[data-theme="dark"] .en-bar { background: linear-gradient(90deg, #431407, var(--panel)); border-color: #9A3412; } [data-theme="dark"] .en-bar em { color: #FDBA74; }
.xl-when { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .82rem; color: var(--muted); padding: 0 0 6px; border-bottom: 1px dashed var(--line); }
.xl-when input { padding: 5px 8px; font-size: .82rem; }
#btnEnrolWait[hidden] { display: none; }
.en-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 0 12px; }
.en-grid.en-g3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); }
.en-done .btn { margin-top: 10px; }
/* 📷 4×6 registration photo */
.en-photo { display: flex; gap: 14px; align-items: center; padding: 10px 12px; margin-bottom: 12px; border-radius: 14px; border: 1px dashed #FDBA74; background: color-mix(in srgb, #F97316 5%, var(--panel)); }
.en-photo p { margin: 2px 0 6px; font-size: .82rem; }
.en-ph { width: 80px; height: 120px; flex: none; border-radius: 8px; border: 2px solid var(--line); background: var(--panel); display: grid; place-items: center; align-content: center; overflow: hidden; font-size: 1.8rem; color: var(--muted); }
.en-ph small { font-size: .7rem; }
.en-ph img { width: 100%; height: 100%; object-fit: cover; }
.en-ph-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.en-card.en-has-ph { grid-template-columns: 72px minmax(0, 1fr); }
.en-card.en-has-ph > :not(.en-card-ph) { grid-column: 2; }
.en-card-ph { grid-row: 1 / span 3; width: 72px; height: 108px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
@media (max-width: 520px) { .en-photo { flex-direction: column; text-align: center; } .en-ph-btns { justify-content: center; } }
.en-qc { margin-top: 8px; padding: 8px 12px; border-radius: 12px; font-size: .85rem; background: var(--soft); }
.en-qc.ok { background: color-mix(in srgb, #16A34A 12%, var(--panel)); color: #166534; }
.en-qc.bad { background: color-mix(in srgb, #F59E0B 14%, var(--panel)); border: 1px solid #F59E0B; }
[data-theme="dark"] .en-qc.ok { color: #86EFAC; }
.en-qc ul { margin: 4px 0; padding-left: 18px; }
.en-qc-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.en-bg { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; font-size: .85rem; }
.en-bg button { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; cursor: pointer; }
.en-bg button[aria-pressed="true"] { border-color: #F97316; background: #FFEDD5; color: #9A3412; font-weight: 700; }
[data-theme="dark"] .en-bg button[aria-pressed="true"] { background: #431407; color: #FDBA74; }
.en-bg.busy button { opacity: .5; pointer-events: none; }
.en-bg small { flex-basis: 100%; color: var(--muted); }
/* 🎯 in-app camera with a face guide */
.pk-cam { width: min(96vw, 520px); padding: 0; border: 0; border-radius: 20px; background: #0B1220; color: #fff; }
.pk-cam::backdrop { background: rgba(0, 0, 0, .7); }
.pk-cam .dialog-head { padding: 10px 14px; } .pk-cam .dialog-head h2 { color: #fff; font-size: 1rem; } .pk-cam .icon-btn { color: #fff; }
.pk-view { position: relative; width: 100%; max-height: 70vh; margin: 0 auto; overflow: hidden; background: #000; }
.pk-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.pk-view video.mirror { transform: scaleX(-1); }
.pk-guide { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pk-oval, .pk-shoulders { fill: none; stroke: rgba(255, 255, 255, .85); stroke-width: .8; stroke-dasharray: 2.5 1.6; vector-effect: non-scaling-stroke; }
.pk-view .pk-oval, .pk-view .pk-shoulders { stroke-width: 3px; }
.pk-view.ok .pk-oval, .pk-view.ok .pk-shoulders { stroke: #4ADE80; stroke-dasharray: none; }
.pk-tip { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); margin: 0; padding: 6px 14px; border-radius: 999px; background: rgba(0, 0, 0, .62); color: #fff; font-size: .9rem; white-space: nowrap; max-width: 94%; overflow: hidden; text-overflow: ellipsis; }
.pk-view.ok .pk-tip { background: rgba(22, 163, 74, .85); }
.pk-foot { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 14px; }
.pk-foot [data-flip] { justify-self: start; color: #fff; border-color: rgba(255, 255, 255, .35); background: transparent; }
.pk-foot [data-anyway] { justify-self: end; color: #fff; border-color: rgba(255, 255, 255, .35); background: transparent; }
.pk-shutter { width: 70px; height: 70px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .5); background: transparent; padding: 5px; cursor: pointer; }
.pk-shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: rgba(255, 255, 255, .3); transition: background .2s; }
.pk-shutter.on { border-color: #fff; } .pk-shutter.on span { background: #fff; box-shadow: 0 0 0 4px #4ADE80; }
.pk-shutter:disabled { cursor: not-allowed; }
.pk-tools { margin-top: 6px; }
.en-bg button[data-pk-light][aria-pressed="true"] { border-color: #EAB308; background: #FEF9C3; color: #854D0E; }
.btn[hidden], label.btn[hidden] { display: none !important; }
.pk-who { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 0 14px 10px; }
.pk-who div { display: grid; text-align: center; min-width: 0; } .pk-who b { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .pk-who small { opacity: .7; font-size: .78rem; }
.pk-who .btn { color: #fff; border-color: rgba(255, 255, 255, .35); background: transparent; }
.pk-count { position: absolute; inset: 0; display: grid; place-items: center; font-size: 7rem; font-weight: 800; color: #fff; text-shadow: 0 4px 20px rgba(0, 0, 0, .6); pointer-events: none; }
.pk-count[hidden], .pk-flash[hidden] { display: none; }
.pk-flash { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); padding: 6px 16px; border-radius: 999px; background: #16A34A; color: #fff; font-weight: 700; }
.pk-left { display: grid; gap: 6px; justify-items: start; }
.pk-auto { display: flex; gap: 6px; align-items: center; font-size: .8rem; color: #fff; cursor: pointer; }
.pk-foot [data-flip] { justify-self: auto; }
/* 🔁 re-background + 📋 photo coverage */
.rb-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; }
.rb-prog { margin: 0; font-weight: 600; } .rb-acts { display: flex; gap: 6px; } .rb-hint { margin: 6px 0 10px; font-size: .85rem; }
.rb-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.rb-item { display: grid; gap: 6px; padding: 8px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.rb-item:has(input:checked) { border-color: #16A34A; box-shadow: 0 0 0 2px color-mix(in srgb, #16A34A 30%, transparent); }
.rb-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.rb-pair img, .rb-after { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: grid; place-items: center; background: var(--soft); font-style: normal; }
.rb-after img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.rb-name { display: flex; gap: 6px; align-items: center; font-size: .88rem; overflow-wrap: anywhere; }
.ph-cov { margin: 0 0 14px; padding: 12px 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.ph-cov summary { display: grid; grid-template-columns: auto auto minmax(60px, 1fr) auto; gap: 12px; align-items: center; cursor: pointer; list-style: none; }
.ph-cov summary::-webkit-details-marker { display: none; }
.ph-cov summary em { font-style: normal; color: var(--muted); font-size: .85rem; }
.ph-bar { height: 8px; border-radius: 9px; background: var(--line); overflow: hidden; } .ph-bar i { display: block; height: 100%; background: linear-gradient(90deg, #F59E0B, #16A34A); }
.ph-cov ol { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.ph-cov li { display: grid; grid-template-columns: minmax(90px, 180px) minmax(0, 1fr) 70px auto; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 12px; background: var(--soft); }
.ph-cov li.done { opacity: .7; } .ph-n { text-align: right; font-weight: 700; } .ph-ok { text-align: center; }
@media (max-width: 600px) { .ph-cov summary { grid-template-columns: 1fr auto; } .ph-cov summary .ph-bar, .ph-cov summary em { grid-column: 1 / -1; } .ph-cov li { grid-template-columns: minmax(0, 1fr) auto; } .ph-cov li .ph-bar { grid-column: 1 / -1; grid-row: 2; } }
