/* ============================================================================
 * AiduEdSuite — School Mark Sheet Manager — styles
 * Sections: 1) tokens/theme  2) app shell  3) components  4) mark sheet
 *           5) style variants  6) print
 * ==========================================================================*/

/* ---- 1. tokens ---------------------------------------------------------- */
:root {
  --bg: #eef1f6;
  --panel: #ffffff;
  --panel-2: #f6f8fb;
  --ink: #1a2230;
  --ink-soft: #5a6678;
  --line: #dde3ec;
  --line-strong: #c4cddd;
  --brand: #1f4e8c;      /* school navy */
  --brand-2: #2e6fc4;
  --accent: #c6912e;     /* crest gold */
  --good: #1c8b5a;
  --warn: #d98a1f;
  --bad: #d23b3b;
  --shadow: 0 1px 3px rgba(20,30,50,.08), 0 6px 22px rgba(20,30,50,.08);
  --radius: 10px;
  --r-sm: 7px;
}
[data-theme="dark"] {
  --bg: #0e1420;
  --panel: #161d2b;
  --panel-2: #1c2536;
  --ink: #e7ecf5;
  --ink-soft: #93a0b6;
  --line: #273248;
  --line-strong: #35435f;
  --brand: #6ea8ff;
  --brand-2: #4b86e0;
  --accent: #e2b455;
  --good: #35c98a;
  --warn: #eaa845;
  --bad: #f2685f;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 26px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-2); text-decoration: none; }
h1,h2,h3,h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }

/* kill number-input spinners everywhere (admin request) */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
/* checkboxes/radios must not stretch full width (they sit inline beside labels) */
input[type=checkbox], input[type=radio] { width: auto; flex: none; margin: 0; accent-color: var(--brand); }

/* ---- 2. app shell ------------------------------------------------------- */
.app { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
.side {
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 14px 14px 12px; border-bottom: 1px solid var(--line); }
.brand img { width: 34px; height: 34px; }
.brand b { font-size: 13px; line-height: 1.1; }
.brand small { color: var(--ink-soft); font-size: 10.5px; display: block; }
.nav { padding: 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 9px; padding: 8px 11px; border-radius: var(--r-sm);
  color: var(--ink-soft); font-weight: 550; font-size: 13px; cursor: pointer;
}
.nav a .ic { width: 17px; text-align: center; opacity: .9; }
.nav a:hover { background: var(--panel-2); color: var(--ink); }
.nav a.active { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.nav-sep { height: 1px; background: var(--line); margin: 6px 10px; }
/* plan gating — locked nav items still show, with a lock, then upsell on click */
.nav a.locked { opacity: .68; }
.nav a.locked:hover { opacity: 1; }
.nav a .nav-lock { margin-left: auto; font-size: .82em; opacity: .75; }
.plan-upgrade { max-width: 460px; margin: 8vh auto 0; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md, 14px); padding: 28px 26px; }
.plan-upgrade .plan-lock-badge { font-size: 34px; }
.plan-upgrade h2 { margin: 10px 0 4px; }
.plan-perks { list-style: none; padding: 0; margin: 16px auto; max-width: 320px; text-align: left; display: grid; gap: 7px; }
.plan-perks li { color: var(--ink-soft); font-size: 13.5px; }
.plan-upgrade .btn { margin-top: 6px; }
/* referral panel progress bar */
.ref-bar { height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.ref-bar-fill { height: 100%; background: var(--brand); border-radius: 999px; transition: width .3s ease; }
.side-foot { padding: 9px; border-top: 1px solid var(--line); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.i18n-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.i18n-seg { border: 0; background: var(--panel); color: var(--ink-soft); font-weight: 700; font-size: 12px; padding: 4px 9px; cursor: pointer; }
.i18n-seg.active { background: var(--brand); color: #fff; }

/* ---- collapsed sidebar (icon-only rail) -------------------------------- */
.app.nav-collapsed { grid-template-columns: 58px 1fr; }
.app.nav-collapsed .brand { justify-content: center; padding: 14px 6px 12px; }
.app.nav-collapsed .brand > div { display: none; }
.app.nav-collapsed .nav a { justify-content: center; padding: 9px 6px; }
.app.nav-collapsed .nav a .label { display: none; }
.app.nav-collapsed .side-foot { justify-content: center; }
.app.nav-collapsed .side-foot .muted { display: none; }
.app.nav-collapsed .side-foot .btn { padding: 6px 8px; }
.nav-toggle { border: 1px solid var(--line); background: var(--panel); color: var(--ink-soft); border-radius: var(--r-sm); width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 15px; }
.nav-toggle:hover { background: var(--panel-2); color: var(--ink); }

/* ---- action-sheet menu (⋯ More) ---------------------------------------- */
.menu-list { display: flex; flex-direction: column; gap: 4px; }
.menu-item { display: flex; align-items: flex-start; gap: 11px; text-align: left; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); cursor: pointer; color: var(--ink); }
.menu-item:hover { background: var(--panel-2); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.menu-item.danger:hover { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: color-mix(in srgb, var(--bad) 7%, transparent); }
.menu-item .mi-ic { font-size: 17px; line-height: 1.3; width: 20px; text-align: center; flex: none; }
.menu-item.danger > span:last-child > div:first-child { color: var(--bad); }

/* ---- inline spreadsheet edit (Students → Edit all) --------------------- */
.data-edit td { padding: 5px 6px; vertical-align: middle; }
.data-edit input, .data-edit select { padding: 5px 7px; font-size: 12.5px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); }
.data-edit input:focus, .data-edit select:focus { border-color: var(--brand); outline: none; }
.yc-nav .cchip { cursor: pointer; }

/* ---- duplicate review groups ------------------------------------------ */
.dup-group { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 11px; margin-bottom: 8px; background: var(--panel); }
.dup-row { gap: 8px; align-items: center; padding: 4px 0; border-top: 1px dashed var(--line); }
.dup-row:first-of-type { border-top: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 18px;
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 82%, transparent);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 16px; }
.topbar .spacer { flex: 1; }
.view { padding: 16px 18px 60px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---- 3. components ------------------------------------------------------ */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 14px 16px; }
.grid { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--ink-soft); }
.small { font-size: 12px; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.tag.g { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.tag.b { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.tag.w { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.tag.n { background: var(--panel-2); color: var(--ink-soft); }

/* colour-coded chips (year / class / stream / division) */
.cchip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 32%, transparent); white-space: nowrap; }
.cchip.click { cursor: pointer; transition: .12s; }
.cchip.click:hover { background: color-mix(in srgb, var(--c) 24%, transparent); }
.cchip.active { color: #fff; background: var(--c); border-color: var(--c); }
.chip-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-yeargroup { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }

.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; transition: .12s;
}
.btn:hover { border-color: var(--brand-2); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

label.fld { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 18%, transparent); }
textarea { resize: vertical; min-height: 90px; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data th { color: var(--ink-soft); font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
table.data tr:hover td { background: var(--panel-2); }
select.stat-sel { padding: 3px 6px; font-size: 12px; width: auto; }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 12px; }
.stat { padding: 13px 15px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.stat .n { font-size: 26px; font-weight: 720; letter-spacing: -.02em; }
.stat .l { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.stat.click { cursor: pointer; transition: .12s; }
.stat.click:hover { border-color: var(--brand-2); transform: translateY(-2px); }

/* big clickable drill-down tiles (Classes browser) */
.bigtile { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 40px 20px 20px; cursor: pointer; transition: .14s; }
.bigtile:hover { border-color: var(--brand-2); transform: translateY(-2px); box-shadow: 0 8px 26px rgba(20,30,50,.14); }
.bigtile::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; border-radius: var(--radius) 0 0 var(--radius); background: var(--c, var(--brand)); }
.bt-title { font-size: 20px; font-weight: 720; letter-spacing: -.01em; color: var(--c, var(--ink)); }
.bt-sub { color: var(--ink-soft); font-size: 12.5px; margin-top: 4px; }
.bt-arrow { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 26px; color: var(--ink-soft); }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(10,16,28,.5); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); width: min(680px, 100%); max-height: 90vh; overflow: auto; border: 1px solid var(--line); }
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-body { padding: 16px 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }

/* watermark designer preview */
.wm-preview { position: relative; width: 100%; height: 150px; background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.wm-preview .sheet-watermark { color: #8fb3dd; }

/* inline edit popover */
.popover { position: absolute; z-index: 300; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 11px; width: 232px; }
.pop-title { font-weight: 700; font-size: 12.5px; margin-bottom: 3px; }
.pop-hint { color: var(--ink-soft); font-size: 11px; margin-bottom: 7px; }
.popover input[type=text], .popover input:not([type]), .popover textarea { width: 100%; }
.pop-chk { display: inline-flex; align-items: center; gap: 6px; margin-top: 9px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.pop-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 11px; }
.pop-opts { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.pop-opts .btn { min-width: 34px; font-weight: 700; }

/* toast */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--panel); border: 1px solid var(--line-strong); border-left: 4px solid var(--brand); border-radius: var(--r-sm); padding: 10px 14px; box-shadow: var(--shadow); font-size: 13px; max-width: 340px; animation: slidein .2s; }
.toast.good { border-left-color: var(--good); }
.toast.bad { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } }

/* dropzone */
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--ink-soft); cursor: pointer; transition: .12s; }
.dropzone.over { border-color: var(--brand-2); background: color-mix(in srgb, var(--brand-2) 8%, transparent); color: var(--brand); }

/* segmented / chips */
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 20px; padding: 3px; gap: 2px; }
.seg button { border: none; background: transparent; color: var(--ink-soft); padding: 5px 12px; border-radius: 18px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.seg button.active { background: var(--panel); color: var(--brand); box-shadow: var(--shadow); }

details.adv { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0; margin-top: 8px; background: var(--panel-2); }
details.adv > summary { cursor: pointer; padding: 8px 12px; font-weight: 600; font-size: 12.5px; color: var(--ink-soft); list-style: none; }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary::before { content: '▸ '; }
details.adv[open] > summary::before { content: '▾ '; }
details.adv .adv-body { padding: 12px; border-top: 1px solid var(--line); }

/* ---- 4. THE MARK SHEET (pixel-faithful to the .docx) -------------------- */
.sheet-scroll { overflow-x: auto; padding-bottom: 8px; }
/* Full A4-landscape page (29.7 x 21cm) with 1in margins — matches the .docx */
.sheet {
  position: relative;
  width: 29.7cm;
  min-height: 21cm;
  margin: 0 auto 22px;
  padding: 1in;
  background: #ffffff;
  color: #000000;
  font-family: 'Mizo Synod Times', 'Times New Roman', Georgia, serif;
  font-size: 13pt;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  overflow: hidden;
}
/* Tiled TEXT watermark: school name repeated to fill the page, pale blue,
   Mizo Synod Times 13pt — exactly like the Word watermark textbox. */
.sheet-watermark {
  position: absolute; inset: 0.12in; z-index: 0; overflow: hidden;
  color: #8fb3dd;
  font-family: 'Mizo Synod Times', 'Times New Roman', serif;
  font-size: 13pt; line-height: 1.6; letter-spacing: 0;
  text-transform: uppercase; pointer-events: none; user-select: none;
}
/* repeated-name text (classic, or overlaid on a pattern): justified so every
   line fills the full width, overflow truncated at the bottom — no white margins */
.sheet-watermark.wm-text { text-align: justify; text-align-last: justify; padding: 2pt 2pt 0; }
/* colour & opacity are set inline by App.watermark.apply per style */
.sheet > *:not(.sheet-watermark) { position: relative; z-index: 1; }
/* black bounding box around the whole statement (close to the page edge) */
.sheet::before { content: ""; position: absolute; inset: 0.1in; border: 1.5pt solid #000; z-index: 1; pointer-events: none; }
table.mk td.grade-name { text-align: center; }

.sheet-head { text-align: center; }
.sheet-school { font-family: 'Arial Black', 'Arial', sans-serif; font-size: 13pt; line-height: 1.12; }
.sheet-title { font-family: 'Arial Black', 'Arial', sans-serif; font-size: 13pt; line-height: 1.12; }
.sheet-term  { font-family: 'Arial Black', 'Arial', sans-serif; font-size: 11pt; line-height: 1.15; }
.sheet-year  { font-family: 'Arial Black', 'Arial', sans-serif; font-size: 13pt; line-height: 1.2; margin-bottom: 2pt; }

/* left + right info columns pushed to the edges; crest absolutely centred on the
   sheet so the on-screen view matches the exported/printed sheet exactly. */
.sheet-info { display: flex; align-items: center; justify-content: space-between; gap: 0; margin: 3pt 0 4pt; position: relative; }
.sheet-info .info-col:first-child { flex: none; width: 3.7in; }
.sheet-info .info-logo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; }
.sheet-info .info-logo img { width: 0.85in; height: auto; display: block; }
.sheet-info .info-col:last-child { flex: none; width: 2.9in; }
.info-row { display: flex; align-items: baseline; margin: 1pt 0; }
.info-label { width: 1.7in; flex: none; }
.info-col:last-child .info-label { width: 1.4in; }
.info-colon { width: 8px; }
.info-value { flex: 1; padding-left: 4px; }
.info-value .ph { color: #999; font-style: italic; }
.info-value.editable, .foot-dateval.editable { cursor: text; border-bottom: 1px dotted transparent; }
.info-value.editable:hover, .foot-dateval.editable:hover { border-bottom-color: var(--brand-2); background: #eef4ff; }
.foot-dateval .ph { color: #aaa; font-style: italic; }

table.mk { width: 100%; border-collapse: collapse; table-layout: fixed; margin-top: 2pt; }
table.mk th, table.mk td {
  border: 0.75pt solid #000; padding: 1pt 3pt; text-align: center;
  font-size: 12pt; line-height: 1.05; vertical-align: middle; word-wrap: break-word;
}
table.mk thead th { font-weight: 400; }
table.mk .sub-th { font-size: 10.5pt; white-space: nowrap; word-break: keep-all; }
/* "Subject Symbol" header printed vertically, on two lines, reads bottom-to-top */
table.mk th.c-symhead { writing-mode: vertical-rl; transform: rotate(180deg); white-space: pre; padding: 2pt 1pt; font-size: 9.5pt; line-height: 1.25; text-align: center; font-weight: 700; }
table.mk td.c-sym { font-weight: 700; }
table.mk td.l, table.mk th.l { text-align: left; padding-left: 5pt; }
table.mk td.b { font-weight: 700; }
table.mk .c-name { text-align: left; padding-left: 5pt; }
table.mk .c-total { font-weight: 700; }
table.mk .row-band { font-weight: 400; }
table.mk .grand-row td { font-weight: 700; }
table.mk .blank-row td { height: 20pt; }
table.mk .grade-cell { height: 18pt; }
table.mk td.over-full { color: #c00; font-weight: 700; background: #ffecec; }
table.mk tr.sub-fail .c-total { color: #c00; }
.awaited { color: #b98; font-size: 10pt; }
[data-theme] table.mk td.over-full { background: #ffecec; } /* keep on sheet regardless of theme */

.sheet-result { margin: 5pt 0 2pt; font-size: 14pt; font-weight: 700; }
.res-label { margin-right: 4px; }
.res-fail { color: #FF0000; }
.res-dropped { color: #888; }
.res-tag { font-weight: 400; font-size: 11pt; color: #666; }
.res-pending { color: #b26a00; font-weight: 600; font-size: 12pt; }
.res-pct { font-weight: 400; font-size: 11pt; color: #333; }
.sheet-foot { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 16pt; font-size: 12pt; }
.foot-sign { font-weight: 400; text-align: right; padding-right: 0.4in; white-space: nowrap; }

/* preview wrapper controls */
.sheet-tools { position: sticky; top: 52px; z-index: 15; background: var(--bg); padding: 8px 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sheet-flagbar { margin: 0 auto 8px; max-width: 9.7in; }

/* ---- 5. style variants -------------------------------------------------- */
/* modern: navy headers, zebra, rounded frame */
.sheet--modern { border-radius: 8px; }
.sheet--modern table.mk th, .sheet--modern table.mk td { border-color: #b9c4d6; }
.sheet--modern table.mk thead th { background: var(--brand); color: #fff; border-color: var(--brand); }
.sheet--modern table.mk .row-band td { background: #eef3fb; }
.sheet--modern table.mk .grand-row td { background: #f4f7fc; }
.sheet--modern .sheet-school { color: var(--brand); }
.sheet--modern table.mk .subj-row:nth-child(even) td { background: #fafcff; }

/* compact: tighter, smaller type to fit more per page */
.sheet--compact { font-size: 11.5pt; min-height: 5.6in; padding: 0.25in 0.32in; }
.sheet--compact table.mk th, .sheet--compact table.mk td { font-size: 10.5pt; padding: 0.5pt 2pt; }
.sheet--compact .sheet-school, .sheet--compact .sheet-title, .sheet--compact .sheet-year { font-size: 12pt; }
.sheet--compact .blank-row td { height: 13pt; }

/* elegant: serif headers, gold rules, refined */
.sheet--elegant { border: 1.5pt double #b58a2e; }
.sheet--elegant .sheet-school { font-family: 'Georgia', serif; letter-spacing: .04em; color: #6a4f16; }
.sheet--elegant .sheet-title { font-family: 'Georgia', serif; letter-spacing: .2em; font-size: 12pt; }
.sheet--elegant table.mk thead th { background: #f6efdd; border-color: #cbb277; }
.sheet--elegant table.mk th, .sheet--elegant table.mk td { border-color: #cbb277; }
.sheet--elegant table.mk .grand-row td { background: #faf5e8; }

/* ledger: bold navy "examination ledger" (landscape) */
.sheet--ledger .sheet-school { color: #12305e; letter-spacing: .05em; }
.sheet--ledger .sheet-title { display: inline-block; background: #12305e; color: #fff; padding: 2pt 16pt; letter-spacing: .12em; }
.sheet--ledger::before { border-color: #12305e; }
.sheet--ledger table.mk th, .sheet--ledger table.mk td { border-color: #12305e; }
.sheet--ledger table.mk thead th { background: #12305e; color: #fff; text-transform: uppercase; letter-spacing: .02em; }
.sheet--ledger table.mk th.c-symhead { color: #fff; }
.sheet--ledger table.mk .subj-row:nth-child(even) td { background: #eef2f8; }
.sheet--ledger table.mk .grand-row td { background: #dbe4f0; }
.sheet--ledger .sheet-result { color: #12305e; }

/* ---- 5b. portrait (vertical) templates --------------------------------- */
/* narrower A4-portrait page; shrink the two info columns so they fit the width */
.sheet--portrait { width: 21cm; min-height: 29.7cm; }
.sheet--portrait .sheet-info .info-col:first-child { width: 2.9in; }
.sheet--portrait .sheet-info .info-col:last-child { width: 2.5in; }
.sheet--portrait .info-label { width: 1.35in; }
.sheet--portrait .sheet-info .info-col:last-child .info-label { width: 1.05in; }
.sheet--portrait .sheet-info .info-logo img { width: 0.8in; }
.sheet--portrait table.mk th, .sheet--portrait table.mk td { font-size: 11pt; }
.sheet--portrait .sheet-foot { margin-top: 22pt; }

/* university: formal degree marksheet, serif, underlined title */
.sheet--university { border: 1pt solid #444; }
.sheet--university::before { inset: 0.16in; border: 0.75pt solid #999; }
.sheet--university .sheet-school { font-family: Georgia, 'Times New Roman', serif; font-size: 17pt; letter-spacing: .01em; }
.sheet--university .sheet-title { font-family: Georgia, serif; font-weight: 400; font-style: italic; letter-spacing: .1em; text-decoration: underline; text-underline-offset: 3pt; font-size: 12pt; }
.sheet--university .sheet-year { font-family: Georgia, serif; font-size: 11pt; }
.sheet--university table.mk thead th { background: #f2f2f2; font-style: italic; font-weight: 600; }
.sheet--university table.mk th, .sheet--university table.mk td { border-color: #666; }
.sheet--university .sheet-result { border: 0.75pt solid #666; padding: 4pt 10pt; display: inline-block; }

/* gradecard: coloured (teal) header band, rounded, no black frame */
.sheet--gradecard { border: none; }
.sheet--gradecard::before { display: none; }
.sheet--gradecard .sheet-head { background: linear-gradient(135deg, #0d7d7d, #0a5c5c); color: #fff; margin: -1in -1in 10pt; padding: 16pt 1in 12pt; }
.sheet--gradecard .sheet-school, .sheet--gradecard .sheet-title, .sheet--gradecard .sheet-year { color: #fff; }
.sheet--gradecard .sheet-title { letter-spacing: .18em; font-size: 12pt; }
.sheet--gradecard table.mk thead th { background: #0d7d7d; color: #fff; border-color: #0d7d7d; }
.sheet--gradecard table.mk th.c-symhead { color: #fff; }
.sheet--gradecard table.mk th, .sheet--gradecard table.mk td { border-color: #bcd6d6; }
.sheet--gradecard table.mk .subj-row:nth-child(even) td { background: #f0f8f8; }
.sheet--gradecard table.mk .grand-row td { background: #e2f0f0; }
.sheet--gradecard .sheet-result { color: #0a5c5c; }

/* report: school report-card look — blue band + boxed student details */
.sheet--report { border: none; }
.sheet--report::before { display: none; }
.sheet--report .sheet-head { background: #274b8e; color: #fff; margin: -1in -1in 10pt; padding: 16pt 1in 12pt; }
.sheet--report .sheet-school, .sheet--report .sheet-title, .sheet--report .sheet-year { color: #fff; }
.sheet--report .sheet-title { letter-spacing: .14em; font-size: 12pt; }
.sheet--report .sheet-info { border: 1pt solid #cdd8ec; background: #f6f9ff; padding: 8pt 12pt; border-radius: 5pt; margin-bottom: 8pt; }
.sheet--report table.mk thead th { background: #e8eefb; color: #1e3a73; border-color: #b9c8e6; }
.sheet--report table.mk th.c-symhead { color: #1e3a73; }
.sheet--report table.mk th, .sheet--report table.mk td { border-color: #c8d3e8; }
.sheet--report table.mk .subj-row:nth-child(even) td { background: #f6f9ff; }
.sheet--report table.mk .grand-row td { background: #eaf0fb; }
.sheet--report .sheet-result { color: #274b8e; }

/* certificate: ornate gold double border, serif */
.sheet--certificate { border: 3pt double #b58a2e; padding: 0.85in; }
.sheet--certificate::before { inset: 0.22in; border: 1pt solid #cbb277; }
.sheet--certificate .sheet-school { font-family: Georgia, serif; color: #7a5a12; letter-spacing: .05em; }
.sheet--certificate .sheet-title { font-family: Georgia, serif; letter-spacing: .28em; font-size: 12pt; color: #7a5a12; }
.sheet--certificate .sheet-year { font-family: Georgia, serif; }
.sheet--certificate table.mk thead th { background: #faf3e0; border-color: #cbb277; font-family: Georgia, serif; }
.sheet--certificate table.mk th, .sheet--certificate table.mk td { border-color: #cbb277; }
.sheet--certificate table.mk .grand-row td { background: #f8f1de; }
.sheet--certificate .sheet-result { font-family: Georgia, serif; color: #7a5a12; }

/* ---- 6. print ----------------------------------------------------------- */
@media print {
  @page { size: A4 landscape; margin: 0; }
  body { background: #fff; }
  .side, .topbar, .sheet-tools, .sheet-flagbar, #toasts, .modal-back, .popover, .noprint { display: none !important; }
  .app { display: block; }
  .view { padding: 0; max-width: none; }
  .sheet-scroll { overflow: visible; }
  .sheet {
    width: 29.7cm; height: 21cm; min-height: 21cm; margin: 0; box-shadow: none;
    padding: 1in; page-break-after: always;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;   /* keep pale-blue watermark */
  }
  /* vertical templates print on a portrait A4 page (@page size swapped in JS) */
  .sheet--portrait { width: 21cm; height: 29.7cm; min-height: 29.7cm; }
  .sheet:last-child { page-break-after: auto; }
  .awaited { visibility: hidden; }                 /* unfilled prints blank */
  table.mk td.over-full { background: transparent !important; }
}

/* ---- results summary infographic --------------------------------------- */
.sum-doc { background: var(--panel); }
.sum-head { display: flex; align-items: center; gap: 14px; padding: 4px 2px 16px; border-bottom: 2px solid var(--brand); margin-bottom: 16px; }
.sum-head .sum-logo { width: 54px; height: 54px; object-fit: contain; }
.sum-school { font-weight: 800; font-size: 18px; color: var(--ink); letter-spacing: .01em; }
.sum-title { font-size: 13px; color: var(--ink-soft); font-weight: 600; margin-top: 2px; }
.sum-stats { grid-template-columns: repeat(6, 1fr); }
.sum-stream { text-align: center; padding: 14px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.sum-stream-h { font-weight: 700; color: var(--c); margin-bottom: 10px; }
.sum-ring { position: relative; width: 92px; height: 92px; border-radius: 50%; margin: 0 auto; display: flex; align-items: center; justify-content: center; }
.sum-ring::before { content: ''; position: absolute; width: 66px; height: 66px; border-radius: 50%; background: var(--panel); }
.sum-ring span { position: relative; font-weight: 800; font-size: 18px; color: var(--ink); }
.sum-stack { height: 14px; border-radius: 8px; overflow: hidden; background: var(--panel-2); display: flex; }
.sum-cls { border: 1px solid var(--line); }
.sum-foot { text-align: center; padding: 16px 0 4px; margin-top: 16px; border-top: 1px solid var(--line); }
@media (max-width: 900px) { .sum-stats { grid-template-columns: repeat(3, 1fr); } .sum-charts { grid-template-columns: 1fr !important; } }

/* ---- consolidated Results Sheet (printable, paginated like the mark sheet) - */
.result-doc { }
.result-sheet { position: relative; background: #fff; color: #111; margin: 0 auto 18px; box-shadow: 0 2px 16px rgba(0,0,0,.14); box-sizing: border-box; display: flex; flex-direction: column; }
.result-sheet.rs-a4.rs-landscape { width: 29.4cm; max-width: 100%; min-height: 20.6cm; padding: 8mm 9mm; }
.result-sheet.rs-a4.rs-portrait  { width: 20.6cm; max-width: 100%; min-height: 28.8cm; padding: 9mm 10mm; }
.result-sheet.rs-a3.rs-landscape { width: 41.6cm; max-width: 100%; min-height: 28.8cm; padding: 10mm 11mm; }
.result-sheet.rs-a3.rs-portrait  { width: 28.8cm; max-width: 100%; min-height: 41.6cm; padding: 11mm 12mm; }
/* Fix top/bottom indent — uniform vertical padding across all paper sizes (leaves left/right untouched). Doubled class raises specificity to override the per-size rules above. */
.result-sheet.rs-fixv.rs-fixv { padding-top: 13mm; padding-bottom: 13mm; }
/* Stretch rows to fill the page: the table grows into the empty space above the
   footer and the body rows share the extra height evenly (header stays natural). */
.result-sheet.rs-stretch > .rs-table { flex: 1 1 auto; height: 1px; }
.result-sheet.rs-stretch > .rs-table > tbody { height: 100%; }
.result-sheet.rs-stretch > .rs-pagefoot { margin-top: 6px; }
/* watermark layer — behind the content, above the white sheet */
.rs-watermark { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.rs-wm-text { font: bold 22px/2 Arial, sans-serif; letter-spacing: 3px; word-break: break-word; padding: 6mm; }
.result-sheet > .rs-head, .result-sheet > .rs-table, .result-sheet > .rs-summary, .result-sheet > .rs-sign, .result-sheet > .rs-pagefoot { position: relative; z-index: 1; }
/* compact header — a few tight lines to leave room for rows */
.rs-head { text-align: center; margin-bottom: 7px; }
.rs-school { font-weight: 800; font-size: 13pt; line-height: 1.1; }
.rs-cls { font-weight: 700; font-size: 11pt; margin-top: 1px; }
.rs-res { font-weight: 800; letter-spacing: .06em; font-size: 10pt; color: #111; margin-top: 2px; }
.rs-logo { width: 46px; height: 46px; object-fit: contain; }
/* header arrangements */
.rs-head-2 { display: flex; justify-content: space-between; align-items: flex-end; text-align: left; gap: 14px; }
.rs-head-2 .rs-h-right { text-align: right; }
.rs-head-3 { display: flex; align-items: center; gap: 14px; text-align: left; }
.rs-head-3 .rs-h-left { flex: 0 0 auto; }
.rs-head-3 .rs-h-mid { flex: 1; text-align: center; }
.rs-head-3 .rs-h-right { flex: 0 0 auto; text-align: right; }
/* subject legend (when abbreviated) */
.rs-legend { margin-top: 6px; font-size: 8.5pt; color: #333; line-height: 1.5; }
.rs-legend-h { font-weight: 700; }
.rs-table { width: auto; border-collapse: collapse; font-size: 10pt; table-layout: fixed; margin: 0 auto; }
/* fixed indent: table fills the sheet content area → identical L/R indent for every
   class; columns share the width proportionally (manual widths ignored in this mode) */
.rs-table.rs-fill { width: 100%; table-layout: fixed; }
/* draggable logo overlay in the header */
.rs-logo-free { position: absolute; z-index: 2; object-fit: contain; }
.rs-logo-free.rs-logo-drag { cursor: move; outline: 1px dashed var(--brand, #2e6fc4); }
/* clickable cells on the on-screen results sheet (edit student / edit mark) */
.rs-table td.rs-clickable { cursor: pointer; }
.rs-table td.rs-clickable:hover { background: color-mix(in srgb, var(--brand, #2e6fc4) 14%, transparent); box-shadow: inset 0 0 0 1px var(--brand, #2e6fc4); }
/* inline header text editing */
.rs-editing { outline: 1px dashed var(--brand, #2e6fc4); outline-offset: 2px; cursor: text; min-width: 40px; border-radius: 3px; }
.rs-editing:focus { outline: 2px solid var(--brand, #2e6fc4); background: color-mix(in srgb, var(--brand, #2e6fc4) 6%, transparent); }
.rs-table th, .rs-table td { border: 1px solid #000; padding: 3px 5px; text-align: center; vertical-align: middle; overflow: hidden; word-wrap: break-word; }
.rs-table th { position: relative; }
/* drag-to-resize grip on column headers (screen only) */
.rs-col-grip { position: absolute; top: 0; right: -4px; width: 9px; height: 100%; cursor: col-resize; z-index: 6; }
.rs-col-grip:hover { background: rgba(46,111,196,.5); }
/* drag bar to set uniform row height (vertical resize) */
.rs-table tbody td { height: var(--rs-rowh, auto); }
.rs-row-grip { width: 68px; height: 9px; margin: 3px auto 0; border-radius: 5px; background: rgba(46,111,196,.28); cursor: ns-resize; }
.rs-row-grip:hover { background: rgba(46,111,196,.55); }
/* generic table resizer (mark sheets + preview/list tables) */
.tbl-col-grip { position: absolute; top: 0; right: -4px; width: 9px; cursor: col-resize; z-index: 6; }
.tbl-col-grip:hover { background: rgba(46,111,196,.5); }
.tbl-row-grip { width: 68px; height: 9px; margin: 3px auto 6px; border-radius: 5px; background: rgba(46,111,196,.28); cursor: ns-resize; }
.tbl-row-grip:hover { background: rgba(46,111,196,.55); }
table.mk tbody tr.subj-row td { height: var(--rowh, auto); }
.rs-table th.l, .rs-table td.l { text-align: left; }
.rs-table thead th { font-weight: 700; }
.rs-name { white-space: normal; }
.rs-sub { font-size: 9pt; }
.rs-total, .rs-pos { font-weight: 600; }
.rs-fail { color: #c00; font-weight: 700; }
.rs-dropped td { color: #999; text-decoration: line-through; }
.rs-dropped td.rs-div { text-decoration: none; }
.rs-empty { text-align: center; color: #666; padding: 22px; font-style: italic; }
/* class summary block (last page) */
.rs-summary { margin-top: 8mm; border: 1px solid #999; border-radius: 6px; padding: 6px 10px; max-width: 15cm; }
.rs-summary-h { font-weight: 700; font-size: 10pt; margin-bottom: 4px; }
.rs-summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 18px; }
.rs-summary-cell { display: flex; justify-content: space-between; font-size: 9pt; padding: 2px 0; border-bottom: 1px dotted #ccc; }
.rs-summary-k { color: #444; } .rs-summary-v { font-weight: 700; }
/* Principal signature — open space for a seal/stamp, last page only (no rule line) */
.rs-sign { display: flex; justify-content: flex-end; margin-top: 14mm; }
.rs-sign-box { width: 6cm; height: 2.8cm; display: flex; align-items: flex-end; justify-content: center; }
.rs-sign-label { font-size: 10pt; font-weight: 700; }
/* page-number footer, pinned to the bottom of each page */
.rs-pagefoot { margin-top: auto; padding-top: 8px; text-align: center; font-size: 8.5pt; color: #555; }

/* design: modern — accent header, soft grid */
.rs--modern .rs-table th, .rs--modern .rs-table td { border-color: #c7d0dd; }
.rs--modern .rs-table thead th { background: var(--rs-accent, #1f4e8c); color: #fff; border-color: var(--rs-accent, #1f4e8c); }
.rs--modern .rs-cls, .rs--modern .rs-res { color: var(--rs-accent, #1f4e8c); }
/* design: striped — zebra rows, accent header */
.rs--striped .rs-table th, .rs--striped .rs-table td { border-color: #dfe5ee; }
.rs--striped .rs-table thead th { background: var(--rs-accent, #2e6fc4); color: #fff; border-color: var(--rs-accent, #2e6fc4); }
.rs--striped .rs-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--rs-accent, #2e6fc4) 9%, #fff); }
/* design: minimal — hairline horizontal rules only */
.rs--minimal .rs-table th, .rs--minimal .rs-table td { border: 0; border-bottom: 1px solid #e6e6e6; }
.rs--minimal .rs-table thead th { border-bottom: 2px solid var(--rs-accent, #333); text-transform: uppercase; font-size: 8.5pt; letter-spacing: .04em; }
/* design: bold — heavy accent header, strong totals */
.rs--bold .rs-table th, .rs--bold .rs-table td { border: 1.5px solid #111; }
.rs--bold .rs-table thead th { background: var(--rs-accent, #111); color: #fff; text-transform: uppercase; font-size: 8.5pt; }
.rs--bold .rs-total, .rs--bold .rs-pos { font-weight: 800; }
.rs--bold .rs-school, .rs--bold .rs-cls, .rs--bold .rs-res { text-transform: uppercase; }
/* design: elegant — serif, accent rules */
.rs--elegant { font-family: Georgia, 'Times New Roman', serif; }
.rs--elegant .rs-table th, .rs--elegant .rs-table td { border-color: color-mix(in srgb, var(--rs-accent, #cbb277) 60%, #999); }
.rs--elegant .rs-table thead th { background: color-mix(in srgb, var(--rs-accent, #cbb277) 22%, #fff); color: var(--rs-accent, #6a4f16); }
.rs--elegant .rs-school, .rs--elegant .rs-cls, .rs--elegant .rs-res { color: var(--rs-accent, #6a4f16); letter-spacing: .04em; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background:
  radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--brand) 22%, var(--bg)), var(--bg)); }
.login-card { width: min(380px,100%); text-align: center; padding: 30px 28px; }
.login-card img { width: 64px; height: 64px; margin-bottom: 10px; }

/* pre-login marketing hero (infographics beside the sign-in card) */
.login-layout { display: flex; gap: 48px; align-items: center; width: 100%; max-width: 1010px; }
.login-layout .login-card { flex: none; }
.login-hero { flex: 1.15; min-width: 0; }
.lh-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.lh-brand img { width: 40px; height: 40px; }
.lh-brand b { font-size: 18px; color: var(--ink); letter-spacing: -.01em; line-height: 1.1; }
.lh-brand span { font-size: 12px; color: var(--ink-soft); display: block; }
.lh-head { font-size: 30px; line-height: 1.12; letter-spacing: -.02em; margin: 0 0 12px; color: var(--ink); font-weight: 760; }
.lh-head u { text-decoration-color: var(--brand-2); text-underline-offset: 3px; text-decoration-thickness: 2px; }
.lh-sub { font-size: 14px; color: var(--ink-soft); margin: 0 0 20px; max-width: 48ch; line-height: 1.5; }
.lh-stats { display: flex; gap: 12px; margin-bottom: 22px; }
.lh-stat { flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 13px 12px; box-shadow: var(--shadow); }
.lh-stat-n { font-size: 24px; font-weight: 800; letter-spacing: -.02em; color: var(--brand); }
.lh-stat-n span { font-size: 15px; margin-left: 1px; }
.lh-stat.b .lh-stat-n { color: var(--good); }
.lh-stat.c .lh-stat-n { color: var(--accent); }
.lh-stat-l { font-size: 11.5px; color: var(--ink-soft); margin-top: 3px; line-height: 1.3; }
.lh-vals { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.lh-val { display: flex; gap: 12px; align-items: flex-start; }
.lh-val-ic { width: 34px; height: 34px; flex: none; border-radius: 9px; background: color-mix(in srgb, var(--brand) 12%, transparent); display: flex; align-items: center; justify-content: center; font-size: 17px; }
.lh-val-t { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.lh-val-d { font-size: 12.5px; color: var(--ink-soft); line-height: 1.45; margin-top: 2px; }
.lh-steps { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.lh-step { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.lh-step-n { width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.lh-arrow { color: var(--ink-soft); }
.lh-note { font-size: 11.5px; color: var(--good); font-weight: 600; }
@media (max-width: 900px) {
  .login-layout { flex-direction: column-reverse; gap: 28px; max-width: 440px; }
  .login-hero { width: 100%; }
  .lh-head { font-size: 24px; }
}

/* AI Insights card (dashboard) */
.ai-card { overflow: hidden; }
.ai-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; cursor: pointer; user-select: none; }
.ai-head:hover { background: var(--panel-2); }
.ai-title { display: flex; align-items: center; gap: 8px; }
.ai-badge { background: linear-gradient(135deg, #6a5cff, #b44cff); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .05em; padding: 2px 7px; border-radius: 6px; }
.ai-title b { font-size: 14px; }
.ai-live { font-size: 10.5px; color: var(--good); font-weight: 700; }
.ai-teaser { max-width: 52%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.ai-chev { color: var(--ink-soft); font-size: 12px; width: 16px; text-align: center; }
.ai-card .ai-body { display: none; padding: 0 16px 16px; }
.ai-card.open .ai-body { display: block; }
.ai-card.open .ai-teaser { display: none; }
.ai-ins { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.45; }
.ai-ins-ic { flex: none; width: 22px; text-align: center; }
.ai-sec-h { font-weight: 700; font-size: 12px; color: var(--ink-soft); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .03em; }
.ai-chip { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; text-align: center; min-width: 84px; }
.ai-chip b { display: block; font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.ai-chip span { font-size: 11px; color: var(--ink-soft); }
.ai-clsrow:hover { background: var(--panel-2); border-radius: 8px; }
.ai-acts { margin: 0; padding-left: 18px; }
.ai-acts li { font-size: 13px; margin: 5px 0; line-height: 1.4; }

/* responsive */
/* ---- mobile: sidebar becomes a slide-in drawer, header stays uncluttered -- */
.nav-backdrop { display: none; }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; top: 0; left: 0; height: 100vh; width: 264px; max-width: 84vw;
    z-index: 60; transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 2px 0 20px rgba(0,0,0,.22); flex-direction: column;
  }
  .app.mobile-nav-open .side { transform: translateX(0); }
  .nav { flex-direction: column; flex-wrap: nowrap; }
  .nav a { font-size: 14px; padding: 11px 12px; }               /* comfortable touch targets */
  .side-foot { justify-content: flex-start; }
  /* the icon-rail collapse doesn't apply on phones — the drawer always shows labels */
  .app.nav-collapsed .side { transform: translateX(-100%); }
  .app.nav-collapsed.mobile-nav-open .side { transform: translateX(0); }
  .app.nav-collapsed .brand { justify-content: flex-start; padding: 14px 14px 12px; }
  .app.nav-collapsed .brand > div { display: block; }
  .app.nav-collapsed .nav a { justify-content: flex-start; padding: 11px 12px; }
  .app.nav-collapsed .nav a .label { display: inline; }

  .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.42); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .app.mobile-nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }

  .topbar { padding: 0 10px; gap: 6px; }
  .topbar .spacer { display: none; }
  .topbar .ttl { flex: 1; min-width: 0; }
  .topbar h1 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #pageSub { display: none; }
  #undoBtn { display: none; }
  .topbar .btn.primary.sm { display: none; }                    /* Enter marks lives in the drawer */
  .view { padding: 12px 12px 64px; }
}
@media (max-width: 420px) {
  .brand b { font-size: 12px; }
  .nav a { font-size: 13.5px; }
  .view { padding: 10px 10px 64px; }
}

/* ======================================================================
   Pre-login marketing / landing page (.lp)
   ====================================================================== */
.lp { min-height: 100vh; background: var(--bg); color: var(--ink); }
.lp * { box-sizing: border-box; }
.lp-theme { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; width: 34px; height: 34px; font-size: 16px; cursor: pointer; line-height: 1; }
.lp-theme:hover { border-color: var(--brand); }
.powered-by { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-soft); }
.powered-by img, .powered-by svg { width: 18px; height: 18px; }
.powered-by b { color: var(--ink); font-weight: 700; }
.lp u { text-decoration-color: var(--brand-2); text-underline-offset: 3px; text-decoration-thickness: 2px; }
.lp code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; font-size: .92em; }

/* nav */
.lp-nav { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 18px; padding: 11px 24px;
  background: color-mix(in srgb, var(--panel) 86%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.lp-brand { display: flex; align-items: center; gap: 9px; }
.lp-brand img { width: 34px; height: 34px; }
.lp-brand b { font-size: 16px; color: var(--ink); letter-spacing: -.01em; line-height: 1; }
.lp-brand small { display: block; font-size: 10.5px; color: var(--ink-soft); }
.lp-navlinks { display: flex; gap: 20px; margin-left: auto; }
.lp-navlinks a { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.lp-navlinks a:hover { color: var(--brand); }
.lp-nav > .btn { margin-left: 8px; }

/* hero */
.lp-hero { display: grid; grid-template-columns: 1.25fr .85fr; gap: 40px; align-items: center; max-width: 1120px; margin: 0 auto; padding: 54px 24px 40px; border-radius: 0 0 22px 22px;
  background:
    linear-gradient(color-mix(in srgb, var(--bg) 88%, transparent), color-mix(in srgb, var(--bg) 95%, transparent)),
    radial-gradient(1100px 460px at 20% -10%, color-mix(in srgb, var(--brand) 16%, var(--bg)), transparent),
    url(../assets/scenes/bg.jpg) center/cover no-repeat; }
.lp-eyebrow { display: inline-block; font-size: 12px; font-weight: 700; color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand) 26%, transparent); padding: 4px 11px; border-radius: 20px; margin-bottom: 16px; }
.lp-h1 { font-size: 40px; line-height: 1.08; letter-spacing: -.025em; font-weight: 800; margin: 0 0 16px; }
.lp-lead { font-size: 15.5px; line-height: 1.55; color: var(--ink-soft); max-width: 54ch; margin: 0 0 22px; }
.lp-cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.lp-cta-row .btn { padding: 11px 20px; font-size: 14px; }
.btn.ghost { background: transparent; border: 1px solid var(--line-strong); color: var(--ink); }
.btn.ghost:hover { background: var(--panel-2); }
.lp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.lp-chip { font-size: 12px; font-weight: 600; color: var(--ink-soft); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; }
.lp-hero-login { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.lp-login-tag { font-size: 12px; font-weight: 700; color: var(--brand); text-align: center; margin-bottom: 4px; }
.lp-login-foot { font-size: 10.5px; color: var(--ink-soft); text-align: center; margin-top: 10px; }
/* the injected sign-in card, made compact inside the hero */
.lp .login-card { width: 100%; margin: 0; padding: 18px 18px 20px; box-shadow: none; border: none; background: transparent; }
.lp .login-card img { width: 42px; height: 42px; margin-bottom: 6px; }
.lp .login-card h2 { font-size: 16px; }

/* stat band */
.lp-band { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; max-width: 1120px; margin: 8px auto; padding: 0 24px; }
.lp-band-item { text-align: center; padding: 16px 8px; }
.lp-band-item b { display: block; font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: var(--brand); }
.lp-band-item span { font-size: 12px; color: var(--ink-soft); }

/* sections */
.lp-sec { max-width: 1120px; margin: 0 auto; padding: 52px 24px; }
.lp-sec-alt { max-width: none; background: var(--panel); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.lp-sec-alt > * { max-width: 1120px; margin-left: auto; margin-right: auto; }
.lp-sec-head { text-align: center; margin-bottom: 30px; }
.lp-sec-head h2 { font-size: 27px; letter-spacing: -.02em; font-weight: 780; margin: 0 0 8px; }
.lp-sec-head p { font-size: 14px; color: var(--ink-soft); margin: 0; }

/* problem → solution cards */
.lp-prob-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.lp-prob { display: flex; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.lp-prob-ic { font-size: 26px; flex: none; }
.lp-prob-b p { font-size: 13px; line-height: 1.5; color: var(--ink-soft); margin: 3px 0 10px; }
.lp-x { font-size: 12px; font-weight: 800; color: var(--bad); text-transform: uppercase; letter-spacing: .03em; }
.lp-v { font-size: 12px; font-weight: 800; color: var(--good); text-transform: uppercase; letter-spacing: .03em; }
.lp-save { display: inline-block; font-size: 12px; font-weight: 700; color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); border-radius: 8px; padding: 5px 10px; margin-top: 2px; }

/* time table */
.lp-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.lp-table { width: 100%; border-collapse: collapse; background: var(--panel); min-width: 560px; }
.lp-table th, .lp-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.lp-table thead th { background: var(--panel-2); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-soft); }
.lp-table tbody tr:last-child td { border-bottom: none; }
.lp-table td:nth-child(2) { color: var(--bad); }
.lp-table td:nth-child(3) { color: var(--good); font-weight: 600; }
.lp-pill { display: inline-block; font-weight: 800; font-size: 12px; color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); border-radius: 20px; padding: 3px 10px; }
.lp-time-note { text-align: center; font-size: 15px; color: var(--ink); margin-top: 22px; }

/* feature suite */
.lp-feat-h { font-size: 14px; font-weight: 800; margin: 8px 0 12px; }
.lp-feat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 26px; }
.lp-feat { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px; }
.lp-feat b { font-size: 13.5px; display: block; }
.lp-feat span { font-size: 12px; color: var(--ink-soft); }
.lp-feat-soft .lp-feat { background: var(--panel-2); border-style: dashed; }

/* mizoram */
.lp-miz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.lp-miz { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 11px; padding: 15px 16px; }
.lp-miz b { font-size: 14px; }
.lp-miz p { font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; margin: 5px 0 0; }

/* white-label */
.lp-white { background: linear-gradient(120deg, color-mix(in srgb, var(--brand) 92%, #000), var(--brand-2)); color: #fff; max-width: none; }
.lp-white-in { max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.lp-white .lp-eyebrow { color: #fff; background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.3); }
.lp-white h2 { font-size: 28px; margin: 0 0 12px; letter-spacing: -.02em; }
.lp-white u { text-decoration-color: #ffd873; }
.lp-white-copy > p { font-size: 14.5px; line-height: 1.55; opacity: .95; }
.lp-white-list { margin: 14px 0 0; padding-left: 0; list-style: none; }
.lp-white-list li { font-size: 13.5px; padding: 5px 0 5px 26px; position: relative; }
.lp-white-list li::before { content: '✓'; position: absolute; left: 0; font-weight: 800; color: #ffd873; }
.lp-white code { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.3); color: #fff; }
.lp-white-card { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); border-radius: 16px; padding: 20px; }
.lp-wc-row { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.lp-wc-row img { width: 46px; height: 46px; background: #fff; border-radius: 10px; padding: 4px; }
.lp-wc-line { height: 1px; background: rgba(255,255,255,.25); margin: 16px 0; }
.lp-wc-mock { background: #fff; color: #1a2230; border-radius: 10px; padding: 16px; text-align: center; }
.lp-wc-mockhead { font-weight: 800; font-size: 15px; letter-spacing: .02em; }
.lp-wc-mocksub { font-size: 11px; color: #5a6678; margin-top: 3px; }

/* pricing */
.lp-bill { display: flex; justify-content: center; gap: 4px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 24px; padding: 4px; width: max-content; margin: 0 auto 26px; }
.lp-bill-btn { border: none; background: transparent; color: var(--ink-soft); font: inherit; font-weight: 700; font-size: 13px; padding: 8px 18px; border-radius: 20px; cursor: pointer; }
.lp-bill-btn.active { background: var(--brand); color: #fff; }
.lp-bill-btn em { font-style: normal; font-size: 11px; opacity: .85; }
.lp-price-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; max-width: 860px; margin: 0 auto; }
.lp-price-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
.lp-price-main { border: 2px solid var(--brand); }
.lp-price-tag { font-size: 12px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.lp-price-big { font-size: 40px; font-weight: 800; letter-spacing: -.02em; margin: 8px 0 2px; color: var(--brand); }
.lp-price-big span { font-size: 15px; font-weight: 600; color: var(--ink-soft); }
.lp-price-sub { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 16px; }
.lp-inc { list-style: none; padding: 0; margin: 0 0 18px; }
.lp-inc li { font-size: 13px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.lp-calc-n { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.lp-calc-n span { color: var(--brand); }
.lp-price-calc input[type=range] { width: 100%; accent-color: var(--brand); margin-bottom: 14px; }
.lp-calc-total { font-size: 34px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.lp-calc-save { margin-top: 12px; font-size: 12.5px; color: var(--good); font-weight: 600; background: color-mix(in srgb, var(--good) 10%, transparent); border-radius: 8px; padding: 8px 10px; }
.lp-calc-hint { font-size: 11px; color: var(--ink-soft); margin-top: 8px; }
.lp-2yr { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; max-width: 860px; margin: 18px auto 0; position: relative;
  background: color-mix(in srgb, var(--accent) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius: 16px; padding: 20px 24px; }
.lp-2yr-badge { position: absolute; top: -11px; left: 22px; background: var(--accent); color: #3a2b06; font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 20px; }
.lp-2yr-copy { flex: 1; min-width: 260px; }
.lp-2yr-copy b { font-size: 15px; }
.lp-2yr-copy p { font-size: 13px; color: var(--ink-soft); margin: 5px 0 0; line-height: 1.5; }
.lp-2yr .btn { flex: none; }
.lp-fineprint { max-width: 860px; margin: 16px auto 0; font-size: 11.5px; color: var(--ink-soft); text-align: center; line-height: 1.5; }

/* real-photo gallery */
.lp-gallery { max-width: 1120px; margin: 0 auto; padding: 56px 24px; }
.lp-gal-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.lp-gal { position: relative; margin: 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); aspect-ratio: 4 / 3; }
.lp-gal.g-wide { grid-column: span 2; }
.lp-gal img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.lp-gal:hover img { transform: scale(1.05); }
.lp-gal figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 14px 10px; font-size: 12.5px; font-weight: 700; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.72)); }

/* final + footer */
.lp-final { text-align: center; padding: 56px 24px; background: var(--panel); border-top: 1px solid var(--line); }
.lp-final h2 { font-size: 28px; letter-spacing: -.02em; margin: 0 0 8px; }
.lp-final p { color: var(--ink-soft); margin: 0 0 20px; }
.lp-foot { display: flex; align-items: center; gap: 12px; justify-content: center; flex-wrap: wrap; max-width: 1120px; margin: 0 auto; padding: 26px 24px 40px; }
.lp-foot img { width: 30px; height: 30px; }
.lp-foot span { font-size: 12px; color: var(--ink-soft); }
.lp-powered { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-soft); padding-left: 12px; border-left: 1px solid var(--line); }
.lp-powered svg { color: var(--brand); }
.lp-powered b { color: var(--ink); font-weight: 800; letter-spacing: .01em; }
/* AiAwt Apps company mark — swaps black↔white with the theme */
.lp-powered .aiawt-mark { width: auto; height: 16px; vertical-align: -3px; opacity: .9; }
.aiawt-dk { display: none; }
[data-theme="dark"] .aiawt-lt { display: none; }
[data-theme="dark"] .aiawt-dk { display: inline; }

/* ── Transformation carousel (landing) — mobile-first ── */
.lp-transform { padding: 44px 0; }
.lp-tf-head { text-align: center; margin: 0 auto 22px; max-width: 560px; }
.lp-tf-head h2 { font-size: 1.5rem; margin: 0 0 6px; letter-spacing: -.5px; }
.lp-tf-head p { color: var(--ink-soft); font-size: .95rem; margin: 0; }
.lp-car { display: flex; align-items: center; gap: 8px; max-width: 760px; margin: 0 auto; }
.lp-car-view { overflow: hidden; flex: 1; border-radius: var(--radius); }
.lp-car-track { display: flex; transition: transform .35s cubic-bezier(.4,0,.2,1); will-change: transform; }
.lp-slide { min-width: 100%; padding: 8px 6px; }
.lp-tf { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lp-tf-panel { width: 100%; max-width: 320px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; text-align: center; box-shadow: var(--shadow); }
.lp-tf-panel.after { border-color: var(--brand-2); }
.lp-tf-tag { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.lp-tf-tag.good { color: var(--good); }
.lp-tf-art { font-size: 2.8rem; line-height: 1.2; margin-top: 6px; }
.lp-tf-arrow { font-size: 1.5rem; color: var(--accent); transform: rotate(90deg); }
.lp-tf-cap { text-align: center; color: var(--ink-soft); font-size: .9rem; line-height: 1.5; margin: 14px auto 0; max-width: 460px; }
.lp-car-arrow { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 1.3rem; line-height: 1; cursor: pointer; display: none; }
.lp-car-arrow:hover { border-color: var(--brand-2); }
.lp-car-dots { display: flex; justify-content: center; gap: 7px; margin-top: 18px; }
.lp-car-dots button { width: 8px; height: 8px; border-radius: 50%; border: none; background: var(--line-strong); cursor: pointer; padding: 0; transition: width .3s, background .3s; }
.lp-car-dots button.on { background: var(--brand-2); width: 22px; border-radius: 4px; }
@media (min-width: 700px) {
  .lp-tf-head h2 { font-size: 2rem; }
  .lp-tf { flex-direction: row; justify-content: center; gap: 18px; }
  .lp-tf-arrow { transform: none; }
  .lp-car-arrow { display: block; }
}
@media (prefers-reduced-motion: reduce) { .lp-car-track { transition: none; } }

@media (max-width: 860px) {
  .lp-navlinks { display: none; }
  .lp-hero { grid-template-columns: 1fr; padding-top: 32px; }
  .lp-hero-login { order: -1; max-width: 380px; }
  .lp-h1 { font-size: 30px; }
  .lp-band { grid-template-columns: repeat(2, 1fr); }
  .lp-white-in, .lp-price-grid { grid-template-columns: 1fr; }
  .lp-gal-grid { grid-template-columns: repeat(2, 1fr); }
  .lp-gal.g-wide { grid-column: span 2; }
}

/* ---- Attendance module ---- */
.att-table td { vertical-align: middle; }
.att-segs { display: inline-flex; gap: 4px; }
.att-seg { width: 30px; height: 27px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-soft);
  border-radius: 6px; font-weight: 800; font-size: 12px; cursor: pointer; transition: .1s; }
.att-seg:hover { border-color: var(--brand-2); color: var(--ink); }
.att-seg.on.P { background: var(--good); color: #fff; border-color: var(--good); }
.att-seg.on.A { background: var(--bad); color: #fff; border-color: var(--bad); }
.att-seg.on.L { background: var(--warn); color: #fff; border-color: var(--warn); }

/* landing: Mizo toggle + AiEng callout */
.lp-lang { border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink-soft); font: inherit; font-weight: 800; font-size: 12px; border-radius: 8px; padding: 5px 10px; cursor: pointer; }
.lp-lang:hover, .lp-lang.on { border-color: var(--brand); color: var(--brand); }
.lp-aieng-in { max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: 260px 1fr; gap: 36px; align-items: center; }
.lp-aieng-img { width: 100%; max-width: 240px; justify-self: center; filter: drop-shadow(0 8px 22px rgba(200,120,20,.28)); }
.lp-aieng-copy h2 { font-size: 28px; letter-spacing: -.02em; margin: 6px 0 12px; }
.lp-aieng-copy > p { font-size: 14.5px; line-height: 1.55; color: var(--ink-soft); max-width: 54ch; }
.lp-aieng-mz { background: color-mix(in srgb, var(--accent) 12%, transparent); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 12px; color: var(--ink) !important; margin: 12px 0 16px; }
@media (max-width: 760px) { .lp-aieng-in { grid-template-columns: 1fr; text-align: center; } .lp-aieng-copy > p { margin-inline: auto; } }

/* dashboard: top performers card */
.tp-sub { font-weight: 700; font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; margin: 12px 0 4px; }
.tp-topper:hover, .dashboard .row[onclick]:hover { background: var(--panel-2); border-radius: 8px; }
