/* Jan School Management System — clean, modern, mobile-first */
/* Ink & Iris + RATIFIED Color System v1.0 (2026-11-02): Jan School accent
   #2864C5 (dark-mode pair #79A9FF). Dark theme is NOT applied to the portal:
   inner views hardcode light surfaces, so a token-only dark swap would break
   them; dark token values are declared for reference/future use. Semantics
   are the locked global set — never rebrand per product. */
:root {
  --bg: #FAFAF9; --bg2: #F2F1ED; --card: #ffffff; --surface2: #F6F5F1;
  --ink: #0B0C0F; --ink2: #3C4048; --muted: #6F7278;
  --line: #E7E5DF; --primary: #2864C5; --primary-d: #1E4E9C;
  --accent: #2864C5; --accent-dark: #79A9FF; --accent2: #5B8AD6; --accent-soft: #E4EDFA; --on-accent: #ffffff;
  --green: #08734F; --red: #B42318; --amber: #8A5700; --purple: #7c3aed;  /* --purple: categorical chart colour only, NOT a state */
  --success:#08734F; --warning:#8A5700; --error:#B42318; --info:#245CC5; --money-in:#08734F; --money-out:#3C4048; --success-dark:#35C991; --warning-dark:#F2B84B; --error-dark:#FF8F99; --info-dark:#8BB8FF;
  --border-functional:#686C75; --text-secondary-dark:#BDC2CC; --surface-2-dark:#17191F; --iris:#5A48F2; --iris-bright:#8B7CFF; --iris-deep:#4639BF; --focus:#5A48F2;
  --radius: 12px; --shadow: 0 1px 2px rgba(11,12,15,.05), 0 12px 32px -12px rgba(11,12,15,.12);
  --glow: 0 10px 28px -10px rgba(40,100,197,.45);
  --font-display: 'Space Grotesk','Noto Sans Ethiopic',sans-serif;
  --font-body: 'Inter','Noto Sans Ethiopic',system-ui,sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px; line-height: 1.55;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, .brand { font-family: var(--font-display); letter-spacing: -.01em; }
.muted { color: var(--muted); font-size: .88em; }
.neg { color: var(--red); }
.r { text-align: right; }

/* top bar */
.topbar { display: flex; justify-content: space-between; align-items: center;
  background: var(--ink); color: #F5F4F0; padding: .6rem 1rem; position: sticky; top: 0; z-index: 50; }
.brand { font-weight: 700; font-size: 1.25rem; cursor: pointer; display: flex; align-items: center; gap: .55rem; }
.brand-logo { width: 32px; height: 32px; display: block; flex-shrink: 0; }
.brand span { margin-left: .3rem; }
.top-actions { display: flex; gap: .5rem; align-items: center; }
.userchip { background: #23242C; padding: .3rem .7rem; border-radius: 999px; font-size: .85rem; }
.langbtn { background: var(--primary); color: #fff; border: 0; border-radius: 8px;
  padding: .4rem .8rem; font-weight: 700; cursor: pointer; }

/* layout */
.layout { display: flex; min-height: calc(100vh - 120px); }
.sidebar { width: 220px; background: #fff; border-right: 1px solid var(--line);
  padding: .8rem .6rem; flex-shrink: 0; }
.sidebar nav a { display: block; padding: .55rem .8rem; border-radius: 8px; color: var(--ink);
  margin-bottom: 2px; font-weight: 500; }
.sidebar nav a:hover { background: var(--surface2); }
.sidebar nav a.active { background: var(--accent-soft); color: var(--primary-d); font-weight: 700; }
main#view { flex: 1; padding: 1.2rem; max-width: 1180px; width: 100%; }
.footer { display: flex; gap: 1rem; align-items: center; justify-content: center;
  padding: .8rem; color: var(--muted); font-size: .85rem; background: #fff; border-top: 1px solid var(--line); }
.demobadge { background: #FBF0D3; color: var(--warning); border: 1px dashed #F2B84B;
  padding: .15rem .6rem; border-radius: 999px; font-weight: 700; }
.netbadge { background: #FBF0D3; color: var(--warning); border: 1px dashed #F2B84B;
  padding: .15rem .6rem; border-radius: 999px; font-weight: 700; font-size: .82rem; }

.pagehead { display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.pagehead h2 { margin: 0; font-size: 1.35rem; }
.rowbtns { display: flex; gap: .5rem; flex-wrap: wrap; }

/* cards, kpis */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.1rem; margin-bottom: 1rem; }
.card h3 { margin: .1rem 0 .7rem; font-size: 1.05rem; }
.card h4 { margin: .9rem 0 .4rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem; display: flex; gap: .8rem; align-items: center; }
.kpi-ic { font-size: 1.6rem; width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-v { font-size: 1.35rem; font-weight: 800; }
.kpi-l { color: var(--muted); font-size: .85rem; }
.kpi-s { font-size: .8rem; color: var(--muted); }
.bignum { font-size: 2rem; font-weight: 800; margin: .2rem 0; }
.plist { list-style: none; padding: 0; margin: 0; }
.plist li { padding: .5rem 0; border-bottom: 1px solid var(--line); }
.plist li:last-child { border-bottom: 0; }
.chart { width: 100%; height: 220px; }

/* tables */
.tablewrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .93rem; }
.tbl th, .tbl td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl thead th { background: var(--surface2); font-weight: 700; white-space: nowrap; }
.tbl tbody tr:hover { background: var(--surface2); }
.tbl tr[onclick] { cursor: pointer; }
.tbl tr.hl td { background: #f0fdf4; }

/* buttons, badges, forms */
.btn { background: var(--bg2); border: 0; border-radius: 8px; padding: .5rem .95rem;
  cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--ink); font-family: inherit; }
.btn:hover { filter: brightness(.96); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.ghost { background: transparent; color: #F5F4F0; border: 1px solid #3C4048; }
.btn.small { padding: .3rem .6rem; font-size: .82rem; }
.btn.warn { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; }
.btn.link { background: none; color: var(--primary); padding: .2rem .4rem; }
.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.b-paid { background: #dcfce7; color: #166534; }
.b-partial { background: #fef3c7; color: #92400e; }
.b-overdue { background: #fee2e2; color: #991b1b; }
.b-info { background: #dbeafe; color: #1d4ed8; }
.b-warn { background: #fef3c7; color: #92400e; }
.searchbar { width: 100%; padding: .6rem .9rem; border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: .9rem; font-size: 1rem; font-family: inherit; }
.form label { display: block; margin-bottom: .7rem; font-weight: 600; font-size: .9rem; }
.form input, .form select, .form textarea, .frow input, .frow select {
  display: block; width: 100%; margin-top: .25rem; padding: .55rem .7rem;
  border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; font-family: inherit; }
.form textarea { resize: vertical; }
.frow { display: flex; gap: .8rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: .6rem; }
.frow > * { flex: 1 1 160px; }
.frow label { font-weight: 600; font-size: .9rem; }
.check { display: flex !important; align-items: center; gap: .5rem; }
.check input { width: auto !important; }
.numin { width: 70px; padding: .35rem .4rem; border: 1px solid var(--line); border-radius: 6px; font-size: 1rem; }
.totcell { min-width: 60px; }
.locknote { background: #fef3c7; border: 1px solid #f59e0b; border-radius: 8px; padding: .5rem .9rem; }

/* login */
.loginwrap { display: flex; justify-content: center; padding: 2rem 1rem; }
.loginbox { background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
  padding: 2rem; max-width: 720px; width: 100%; text-align: center; }
.loginlogo { font-size: 3rem; }
.loginbox h1 { margin: .3rem 0; }
.rolegrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .9rem; margin-top: 1.4rem; }
.rolecard { border: 2px solid var(--line); border-radius: 12px; padding: 1.1rem .8rem; cursor: pointer; transition: .15s; }
.rolecard:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.roleicon { font-size: 2.2rem; }
.rolename { font-weight: 800; font-size: 1.05rem; margin-top: .3rem; }
.roledesc { color: var(--muted); font-size: .85rem; }
.roleuser { margin-top: .4rem; font-size: .85rem; color: var(--primary-d); font-weight: 600; }
.pinhint { margin-top: .3rem; font-size: .8rem; background: #fef3c7; border-radius: 6px; padding: .2rem; }

/* attendance */
.attbtn { width: 40px; height: 40px; border-radius: 10px; border: 2px solid var(--line);
  background: #fff; font-weight: 800; cursor: pointer; margin-right: .3rem; font-size: 1rem; }
.attbtn.sel-P { background: #dcfce7; border-color: var(--green); color: #166534; }
.attbtn.sel-A { background: #fee2e2; border-color: var(--red); color: #991b1b; }
.attbtn.sel-L { background: #fef3c7; border-color: var(--amber); color: #92400e; }
.attbtn.sel-V { background: #dbeafe; border-color: var(--primary); color: #1d4ed8; }
.attrow { white-space: nowrap; }

/* receipt + report card */
.receipt, .rcard { background: #fff; border: 2px solid var(--ink); border-radius: 6px;
  padding: 1.4rem; max-width: 700px; margin: 0 auto 1rem; }
.r-head { display: flex; gap: 1rem; align-items: center; border-bottom: 3px double var(--ink);
  padding-bottom: .8rem; margin-bottom: 1rem; }
.r-logo { font-size: 2.6rem; }
.r-head h2, .r-head h3 { margin: .1rem 0; }
.r-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .9rem; margin-bottom: 1rem; }
.r-grid span { display: block; color: var(--muted); font-size: .8rem; }
.r-amount { font-size: 1.6rem; display: flex; justify-content: space-between;
  background: #f0fdf4; border: 1px solid var(--green); border-radius: 8px; padding: .7rem 1rem; margin: .8rem 0; }
.r-bal { text-align: right; font-weight: 700; margin-bottom: .8rem; }
.r-disc, .r-late { display: flex; justify-content: space-between; font-size: .9rem; color: var(--muted); margin: .2rem 0; }
.r-qr { display: flex; align-items: center; gap: .7rem; margin: .8rem 0; padding: .5rem; border: 1px dashed var(--line); border-radius: 8px; }
.r-qr small { color: var(--muted); }
.r-sign { display: flex; justify-content: space-between; margin-top: 2rem; text-align: center; color: var(--muted); }
.rc-tbl { margin: .8rem 0; }
.childcard { cursor: pointer; }
.childcard:hover { box-shadow: 0 4px 18px rgba(90,72,242,.18); }
.childstats { display: flex; gap: 1.2rem; margin: .5rem 0; }
.childstats div { display: flex; flex-direction: column; }

/* admissions board */
.admboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem; }
.admcol { background: var(--surface2); border-radius: var(--radius); padding: .8rem; min-height: 200px; }
.admcol h4 { margin: 0 0 .6rem; }
.admcard { background: #fff; border-radius: 8px; box-shadow: var(--shadow); padding: .7rem; margin-bottom: .6rem; }
.admcard .muted { display: block; margin: .2rem 0 .5rem; }

/* notifications */
.anncard { border-left: 4px solid var(--primary); background: var(--surface2); border-radius: 0 8px 8px 0;
  padding: .6rem .9rem; margin-bottom: .6rem; }
.anncard p { margin: .3rem 0; }
.testmode { border: 2px dashed var(--amber); }
.testnote { background: #fef3c7; border-radius: 8px; padding: .5rem .8rem; font-weight: 600; }
.sublist { columns: 2; font-size: .92rem; }
.sublist li { margin-bottom: .25rem; }

/* toast */
#toast { position: fixed; bottom: 1.4rem; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--ink); color: #F5F4F0; padding: .7rem 1.3rem; border-radius: 10px;
  transition: .25s; z-index: 99; opacity: 0; font-weight: 600; }
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

#print-root { display: none; }


/* app shell: fixed sidebar, independent content scroll (desktop) */
@media (min-width: 861px) {
  html, body { height: 100%; }
  body { overflow: hidden; display: flex; flex-direction: column; }
  #app { display: flex; flex-direction: column; height: 100vh; min-height: 0; flex: 1; }
  .topbar { flex-shrink: 0; position: static; }
  .layout { flex: 1; min-height: 0; min-width: 0; }
  .sidebar { height: 100%; overflow-y: auto; overscroll-behavior: contain; }
  main#view { height: 100%; overflow-y: auto; overscroll-behavior: contain; }
  .footer { flex-shrink: 0; }
  /* sticky table headers inside the scrolling main */
  .tablewrap { overflow-x: clip; }
  .tablewrap.scrollx { overflow-x: auto; }
  .tbl thead th { position: sticky; top: 0; z-index: 5; box-shadow: 0 1px 0 var(--line); }
}

/* responsive */
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); padding: .4rem; }
  .sidebar nav { display: flex; overflow-x: auto; gap: 2px; }
  .sidebar nav a { white-space: nowrap; padding: .45rem .7rem; font-size: .88rem; }
  .grid2 { grid-template-columns: 1fr; }
  main#view { padding: .9rem; }
  .r-grid { grid-template-columns: 1fr; }
  .frow > * { flex: 1 1 130px; }
  .userchip { display: none; }
}

/* print */
@media print {
  html, body { height: auto; overflow: visible; display: block; }
  #app { display: block; height: auto; }
  .layout { display: block; }
  .sidebar, main#view { height: auto; overflow: visible; }
  .tbl thead th { position: static; box-shadow: none; }
  body.print-mode #app > header,
  body.print-mode #app > .layout,
  body.print-mode #app > footer,
  body.print-mode #app > #toast,
  body.print-mode .no-print { display: none !important; }
  body.print-mode #print-root { display: block !important; }
  body { background: #fff; font-size: 12px; }
  .receipt, .rcard { border-width: 1px; box-shadow: none; max-width: 100%; }
  .pagebreak { break-after: page; }
}

/* ID cards — realistic CR80 school ID (85.6 x 53.98mm) */
.idcard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 18px; }
.idcard { width: 360px; max-width: 100%; aspect-ratio: 1.586; border-radius: 10px; overflow: hidden;
  background: #fff; border: 1px solid #aeb9c9; box-shadow: 0 8px 22px rgba(15,76,129,.20);
  display: flex; flex-direction: column; font-family: inherit; position: relative; }
.idcard::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .045;
  background:
    radial-gradient(circle at 92% 8%, #2864C5 0 46px, transparent 47px),
    radial-gradient(circle at 4% 96%, #2864C5 0 60px, transparent 61px),
    repeating-linear-gradient(115deg, #2864C5 0 2px, transparent 2px 14px); }
.id-head { background: linear-gradient(120deg, #1E4E9C 0%, #2864C5 55%, #3A74CC 100%);
  color: #fff; padding: 9px 14px 8px; display: flex; align-items: center; justify-content: space-between;
  position: relative; z-index: 1; }
.id-brand { display: flex; align-items: center; gap: 10px; }
.id-cap { width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #2864C5;
  display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; }
.id-school { font-weight: 800; font-size: 16px; letter-spacing: .4px; line-height: 1.15; }
.id-tag { font-size: 9px; letter-spacing: 2.4px; opacity: .88; margin-top: 2px; }
.id-year { text-align: center; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.35);
  border-radius: 8px; padding: 4px 10px; font-weight: 800; font-size: 14px; line-height: 1.1; }
.id-year small { display: block; font-size: 9px; font-weight: 600; letter-spacing: 1.5px; opacity: .85; }
.id-stripe { height: 5px; background: linear-gradient(90deg, #2864C5, #79A9FF, #2864C5); position: relative; z-index: 1; }
.id-body { flex: 1; display: flex; gap: 12px; padding: 10px 14px; align-items: center; min-height: 0;
  position: relative; z-index: 1; }
.idphoto { width: 76px; height: 100px; border-radius: 6px; background: linear-gradient(135deg, #dbe4f0, #f1f5f9);
  border: 3px solid #fff; outline: 1px solid #b6c2d2; box-shadow: 0 2px 6px rgba(0,0,0,.18);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 24px; color: #2864C5; cursor: pointer; position: relative; flex-shrink: 0; overflow: hidden; }
.idphoto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.idphoto-cam { position: absolute; bottom: 2px; right: 4px; font-size: 12px; opacity: .7; }
.idphoto:hover .idphoto-cam { opacity: 1; }
.id-info { flex: 1; min-width: 0; }
.id-name { font-weight: 800; font-size: 17px; line-height: 1.2; color: #0B0C0F; }
.id-sub { font-size: 12px; color: #2864C5; font-weight: 700; margin-top: 3px; }
.id-meta { margin-top: 7px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; font-size: 11.5px; color: #334155; }
.id-meta span.lbl { display: block; font-size: 8.5px; text-transform: uppercase; letter-spacing: 1px; color: #94a3b8; }
.id-meta b { font-size: 12.5px; color: #0B0C0F; }
.id-qr { width: 66px; flex-shrink: 0; text-align: center; }
.id-qr .qrbox { width: 66px; height: 66px; background: #fff; padding: 3px; border: 1px solid #cbd5e1; border-radius: 6px; }
.id-qr svg { width: 100%; height: 100%; display: block; }
.id-qr small { display: block; font-size: 8px; letter-spacing: 1.6px; color: #64748b; margin-top: 3px; }
.id-foot { background: #0b2440; color: #dbe7f3; font-size: 9.5px; padding: 6px 14px; text-align: center;
  letter-spacing: .4px; position: relative; z-index: 1; }
/* back side */
.id-back { background: linear-gradient(180deg, #fbfdff, #eef3f9); }
.id-magstripe { height: 26px; background: linear-gradient(180deg, #1a1a1a, #000); margin: 12px 0 0; position: relative; z-index: 1; }
.id-back .id-body { align-items: flex-start; padding-top: 8px; }
.id-emerg span.lbl { display: block; font-size: 8.5px; color: #94a3b8; text-transform: uppercase; letter-spacing: 1.2px; }
.id-emerg b { font-size: 14px; color: #0B0C0F; }
.id-addr { font-size: 12px; color: #475569; margin-top: 7px; }
.id-found { font-size: 11px; color: #64748b; margin-top: 6px; font-style: italic; }
.id-dates { display: flex; gap: 18px; margin-top: 8px; font-size: 11px; color: #475569; }
.id-dates span.lbl { display: block; font-size: 8.5px; text-transform: uppercase; letter-spacing: 1.2px; color: #94a3b8; }
.id-dates b { color: #0B0C0F; }
.id-sign { margin-top: 10px; }
.id-sign .signline { width: 190px; border-top: 1.5px solid #0B0C0F; margin-bottom: 4px; }
.id-sign span { font-size: 10px; color: #64748b; }
@media print {
  .print-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .idcard { width: 85.6mm; box-shadow: none; break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .idphoto-cam { display: none; }
  .idphoto { cursor: default; }
}
/* certificates */
.cert { max-width: 700px; margin: 0 auto; padding: 40px; border: 2px solid #2864C5; background: #fff; font-family: inherit; }
.cert-head { text-align: center; border-bottom: 2px solid #2864C5; padding-bottom: 12px; margin-bottom: 20px; }
.cert-school { font-size: 22px; font-weight: 800; color: #2864C5; }
.cert-title { text-align: center; font-size: 20px; font-weight: 800; margin: 18px 0; text-decoration: underline; }
.cert-serial { text-align: right; font-size: 13px; color: #475569; margin-bottom: 16px; }
.cert-body { font-size: 16px; line-height: 2; margin: 24px 0 60px; }
.cert-sign { display: flex; justify-content: flex-end; }
.signline { width: 220px; border-top: 1px solid #000; margin-bottom: 6px; }
@media print { .cert { border-width: 3px; } }

/* ---------- polish: modal overlay ---------- */
.modal-ov { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); z-index: 200;
  display: flex; align-items: flex-start; justify-content: center; padding: 1rem; overflow-y: auto; }
.modal-box { background: #fff; border-radius: 14px; max-width: 660px; width: 100%;
  padding: 1.2rem; margin: 2rem 0; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }

/* ---------- polish: mobile card-tables (<=720px) ----------
   Tables with class "tbl resp" collapse into stacked cards on phones.
   First cell (usually the name) is emphasized as the card title. */
@media (max-width: 720px) {
  .tbl.resp thead { display: none; }
  .tbl.resp, .tbl.resp tbody { display: block; }
  .tbl.resp tr { display: block; background: var(--card); border: 1px solid var(--line);
    border-radius: 12px; margin-bottom: .7rem; padding: .55rem .85rem; box-shadow: var(--shadow); }
  .tbl.resp td { display: block; border: 0; padding: .16rem 0; }
  .tbl.resp td:first-child { font-size: 1.04rem; }
  .tbl.resp td .muted { font-size: .82rem; }
  .pagehead h2 { font-size: 1.12rem; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; }
  .kpi { padding: .8rem; }
  .kpi-v { font-size: 1.15rem; }
  .attbtn { width: 46px; height: 46px; font-size: 1.1rem; }
  .modal-box { margin: 1rem 0; padding: .9rem; }
  .btn { padding: .55rem 1rem; }
  .childstats { flex-wrap: wrap; gap: .8rem; }
}

/* ================================================================
   PRINT-DOCUMENT POLISH (Oct 2026)
   Report cards (.rcard), certificates (.cert), ID cards (.idcard).
   - Offline-safe: logo is a 🎓 glyph in a CSS circle, no external images.
   - Brand: Jan School accent #2864C5 headers — Ratified Color System v1.0 (2026-11-02).
   - Business rules untouched: fee gates, PIN gate, 402 handling unchanged.
   - Works with the existing print plumbing: .no-print + body.print-mode
     #print-root (all printable markup renders inside #print-root).
   ================================================================ */
@page { size: A4; margin: 12mm 14mm; }
@media print {
  /* ---------- shared document chrome ---------- */
  #print-root { color: #0B0C0F; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-logo { width: 58px; height: 58px; border-radius: 50%;
    border: 2.5px solid #2864C5; background: #E4EDFA;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 30px; flex-shrink: 0;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-logo-lg { width: 72px; height: 72px; font-size: 38px; margin: 0 auto 10px; }
  .doc-addr { font-size: 11px; color: #64748b; letter-spacing: .4px; }

  /* ---------- report card ---------- */
  .rcard { border: 2.5px solid #2864C5; border-radius: 8px; padding: 26px 30px;
    box-shadow: none; max-width: 100%; break-inside: avoid; background: #fff; }
  .rcard .r-head { border-bottom: 3px double #2864C5; padding-bottom: 14px; margin-bottom: 16px;
    align-items: center; gap: 1.1rem; }
  .r-head-text h2 { font-size: 21px; color: #2864C5; margin: 0 0 2px; letter-spacing: .5px; }
  .r-head-text .doc-addr { margin: 0 0 6px; }
  .r-head-text h3 { font-size: 14px; font-weight: 700; color: #0B0C0F; margin: 0;
    text-transform: uppercase; letter-spacing: 1.6px; }
  .rc-idgrid { grid-template-columns: repeat(4, 1fr); gap: .7rem 1rem; margin: 0 0 14px; }
  .rc-idgrid > div { border-left: 3px solid #2864C5; padding-left: .6rem; }
  .rc-idgrid span { font-size: 9px; text-transform: uppercase; letter-spacing: 1.2px;
    color: #94a3b8; display: block; margin-bottom: 2px; }
  .rc-idgrid b { font-size: 13px; color: #0B0C0F; }
  .rc-tbl { width: 100%; border-collapse: collapse; margin: 6px 0 14px; }
  .rc-tbl thead th { background: #2864C5; color: #fff; font-size: 11.5px;
    letter-spacing: .8px; text-transform: uppercase; padding: 8px 10px; text-align: left;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rc-tbl tbody td { padding: 7px 10px; border-bottom: 1px solid #e2e8f0; font-size: 12.5px; }
  .rc-tbl tbody tr:nth-child(even) td { background: #f4f7fb;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rc-tbl tbody tr:last-child td { border-bottom: 2px solid #2864C5; }
  .rc-sumgrid { grid-template-columns: repeat(4, 1fr); gap: .7rem; margin: 0 0 12px; }
  .rc-sumgrid > div { border: 1px solid #cbd5e1; border-radius: 6px; padding: 10px 8px;
    text-align: center; background: #fbfdff; }
  .rc-sumgrid span { font-size: 9px; text-transform: uppercase; letter-spacing: 1.2px;
    color: #94a3b8; display: block; margin-bottom: 4px; }
  .rc-sumgrid b { font-size: 13.5px; color: #0B0C0F; }
  .rc-sumgrid .rc-bignum { font-size: 20px; color: #2864C5; }
  .rc-remark { border-left: 4px solid #2864C5; background: #F2F6FC; border-radius: 0 6px 6px 0;
    padding: 10px 14px; font-size: 12.5px; line-height: 1.7; margin: 0 0 8px;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rcard .r-sign { display: flex; justify-content: space-between; margin-top: 34px;
    text-align: center; color: #64748b; font-size: 11px; }
  .rcard .r-sign .signline { width: 140px; margin: 0 auto 6px; border-top: 1.5px solid #0B0C0F; }

  /* ---------- certificates ---------- */
  .cert { max-width: 660px; margin: 0 auto; padding: 12px; border: 4px double #2864C5;
    border-radius: 6px; background: #fff; box-shadow: none; break-inside: avoid; }
  .cert-frame { border: 1.5px solid #2864C5; border-radius: 3px; padding: 46px 50px 54px;
    text-align: center;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cert-head { text-align: center; border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
  .cert-school { font-size: 25px; font-weight: 800; color: #2864C5; letter-spacing: 1px; }
  .cert-head .doc-addr { margin: 4px 0 0; font-size: 12px; }
  .cert-title { text-align: center; font-size: 21px; font-weight: 800; color: #0B0C0F;
    letter-spacing: 2.5px; text-transform: uppercase; text-decoration: none;
    margin: 30px 0 10px; }
  .cert-serial { text-align: center; font-size: 12.5px; color: #64748b; margin-bottom: 8px;
    letter-spacing: .6px; }
  .cert-body { font-size: 15.5px; line-height: 2.2; text-align: justify; color: #1e293b;
    margin: 26px 0 74px; }
  .cert-sign { display: flex; justify-content: flex-end; margin-top: 0; }
  .cert-sign > div { text-align: center; font-size: 11.5px; color: #64748b; }
  .cert-sign .signline { width: 210px; margin: 0 auto 6px; border-top: 1.5px solid #0B0C0F; }

  /* ---------- ID cards: keep brand colors in print ---------- */
  .idcard-grid.print-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .idcard { width: 85.6mm; box-shadow: none; break-inside: avoid;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .id-head, .id-stripe, .id-foot, .id-magstripe, .id-cap,
  .idcard-grid .idcard { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .idphoto-cam { display: none; }
  .idphoto { cursor: default; }
}

/* Receipt verification page */
.vrf-rows { display: grid; gap: 8px; margin: 12px 0; }
.vrf-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; background: #f8fafc; border-radius: 8px; }
.vrf-row span { color: #64748b; }

/* ================================================================
   SHARED UX INFRASTRUCTURE (Oct 2026): drawer, global search,
   preset chips, bulk action bar, smart-table pager.
   ================================================================ */

/* ---------- drawer ---------- */
.drawer-ov { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 300; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 92vw;
  background: #fff; z-index: 301; box-shadow: -8px 0 30px rgba(0, 0, 0, .18);
  display: flex; flex-direction: column; border-radius: 10px 0 0 10px; }
.drawer-head { display: flex; justify-content: space-between; align-items: center;
  padding: .9rem 1rem; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.drawer-head h3 { margin: 0; font-size: 1.05rem; }
.drawer-close { background: none; border: 0; font-size: 1.2rem; cursor: pointer;
  color: var(--muted); padding: .2rem .4rem; border-radius: 8px; }
.drawer-close:hover { background: #f1f5f9; }
.drawer-body { padding: 1rem; overflow-y: auto; flex: 1; }
@media (max-width: 640px) {
  .drawer { width: 100%; max-width: 100%; border-radius: 0; }
}

/* ---------- global search (header) ---------- */
.gsearch-wrap { position: relative; display: flex; align-items: center;
  flex: 1 1 auto; min-width: 0; max-width: 260px; }
.gsearch.searchbar { width: 100%; margin-bottom: 0; padding: .45rem .8rem; font-size: .9rem;
  background: #1e293b; border-color: #475569; color: #fff; flex: 1 1 auto; min-width: 0; }
.gsearch.searchbar::placeholder { color: #94a3b8; }
.gsearch-toggle { display: none; background: none; border: 0; color: #fff;
  font-size: 1.1rem; cursor: pointer; padding: .3rem .4rem; }
.gsdrop { position: absolute; top: calc(100% + 6px); left: 0; width: 100%; min-width: 240px;
  background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow), 0 10px 30px rgba(0, 0, 0, .15); z-index: 400;
  max-height: 320px; overflow-y: auto; }
.gsgroup { padding: .35rem .8rem; font-size: .78rem; font-weight: 700; color: var(--muted);
  background: #f8fafc; position: sticky; top: 0; }
.gsrow { padding: .5rem .8rem; cursor: pointer; }
.gsrow:hover { background: #f1f5f9; }
.gssub { font-size: .8rem; color: var(--muted); }
@media (max-width: 600px) {
  .gsearch-wrap { flex: 0 0 auto; max-width: none; }
  .gsearch.searchbar { display: none; }
  .gsearch-toggle { display: block; }
  .userchip { display: none; }
  .gsearch-wrap.gsearch-open .gsearch.searchbar { display: block; position: absolute;
    top: calc(100% + 8px); right: 0; width: min(86vw, 320px); z-index: 500;
    background: #fff; color: var(--ink); border-color: var(--line); }
  .gsearch-wrap.gsearch-open .gsearch.searchbar::placeholder { color: var(--muted); }
  .gsearch-wrap.gsearch-open .gsdrop { top: calc(100% + 52px); right: 0; left: auto;
    width: min(86vw, 320px); }
}

/* ---------- preset chips ---------- */
.chips { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .8rem; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: .35rem .9rem; font-size: .85rem; font-weight: 600; cursor: pointer;
  color: var(--ink); font-family: inherit; }
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- bulk action bar ---------- */
.bulkbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 1.2rem;
  z-index: 250; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .18); padding: .6rem .9rem;
  display: flex; gap: .6rem; align-items: center; max-width: calc(100vw - 2rem);
  flex-wrap: wrap; justify-content: center; }
.bulkbar .count { background: #dbeafe; color: var(--primary-d); border-radius: 999px;
  padding: .2rem .7rem; font-weight: 700; font-size: .85rem; white-space: nowrap; }
@media (max-width: 600px) {
  .bulkbar { bottom: .8rem; padding: .5rem .7rem; gap: .45rem; }
  .bulkbar .btn { padding: .45rem .7rem; font-size: .82rem; }
}

/* ---------- smart-table pager ---------- */
.tablepager { display: flex; gap: .6rem; align-items: center; justify-content: flex-end;
  flex-wrap: wrap; padding: .5rem 0; font-size: .88rem; color: var(--muted); }
.tablepager select { padding: .3rem .5rem; border: 1px solid var(--line);
  border-radius: 8px; font-family: inherit; font-size: .88rem; background: #fff; }
.tablepager .pager-label { font-weight: 600; color: var(--ink); white-space: nowrap; }

/* ---------- sortable column headers ---------- */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--primary-d); }
.ux-sort { color: var(--primary); margin-left: .25rem; font-size: .8em; }

/* keep overlay chrome out of print */
@media print {
  .bulkbar, .drawer-ov, .drawer, .gsdrop, .gsearch-toggle { display: none !important; }
}

/* Ratified Color System v1.0 — focus ring + functional borders (Line is decorative only) */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input, select, textarea { border-color: var(--border-functional); }
