/* Lexend: a typeface designed to make reading easier for students —
   bundled here so it works offline. */
@font-face { font-family: 'Lexend'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/lexend-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2215; }
@font-face { font-family: 'Lexend'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/lexend-latin-500-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2215; }
@font-face { font-family: 'Lexend'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/lexend-latin-600-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2215; }
@font-face { font-family: 'Lexend'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/lexend-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2215; }
@font-face { font-family: 'Lexend'; font-style: normal; font-weight: 400 500; font-display: swap; src: url('/fonts/lexend-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Lexend'; font-style: normal; font-weight: 600 700; font-display: swap; src: url('/fonts/lexend-latin-ext-600-normal.woff2') format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* School Soft-Tech look: a Hope green band across the top with a
   marigold badge-gold marker, on a soft mint canvas with white panels.
   --moss is the primary action colour (kept as the variable name every
   page already uses; a school's own accent from Settings replaces it). */
:root {
  --ink: #15261f;
  --paper: #eef5f2;
  --panel: #ffffff;
  --line: #d3e2dc;
  --line-soft: #e4eee9;
  --moss: #1e6b58;
  --moss-dark: #154d40;
  --tint: #e6f2ee;
  --band: #0f2f28;
  --band-2: #164036;
  --gold: #f4b400;
  --clay: #c2412d;
  --ok: #157f45;
  --muted: #5a6e66;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 47, 40, 0.06), 0 2px 8px rgba(15, 47, 40, 0.04);
  --font: 'Lexend', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
}

/* University Soft-Tech: its own colours (public/js/logo.js sets the class) */
html.edition-university {
  --moss: #17594a;
  --moss-dark: #0f4337;
  --tint: #e4efe9;
  --band: #0a231d;
  --band-2: #12362d;
  --paper: #f2f5ee;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; }
b, strong { font-weight: 600; }
a { color: var(--moss); }
:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }

/* --- The navy band: brand bar + main navigation --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  background: var(--band);
  color: #fff;
}
.topbar .brand { font-size: 1.08rem; font-weight: 600; letter-spacing: -0.005em; color: #fff; }
.topbar .brand-mark { height: 26px; width: 26px; vertical-align: middle; margin-right: 10px; border-radius: 50%; position: relative; top: -1px; box-shadow: 0 0 0 2px rgba(255,255,255,0.18); }
.topbar .brand .code, .topbar .brand span { color: var(--gold); }
.topbar .who { font-size: 0.8rem; color: rgba(255,255,255,0.72); }
.topbar button {
  font-family: inherit;
  font-size: 0.82rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  color: #fff;
}
.topbar button:hover { background: rgba(255,255,255,0.16); border-color: rgba(255,255,255,0.4); color: #fff; }
.topbar a { color: #fff; }
.topbar #langToggle a, .topbar #langToggle span, .topbar #langToggle button { color: rgba(255,255,255,0.75); }

.sync-pill {
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 20px;
  display: none;
}
.sync-pill:not(:empty) { display: inline-block; }
.sync-pill.offline { background: #fde2dc; color: var(--clay); }
.sync-pill.syncing { background: #fdf0cf; color: #7a5200; }

.stale-note {
  font-size: 0.8rem;
  color: #7a5200;
  background: #fdf0cf;
  border-radius: var(--radius);
  padding: 6px 12px;
  margin: -8px 0 16px;
  display: none;
}
.stale-note.visible { display: block; }

.tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 0 24px;
  background: var(--band-2);
  box-shadow: 0 2px 0 rgba(15, 47, 40, 0.08);
}
.tabbar a {
  display: inline-block;
  padding: 11px 12px 10px;
  color: rgba(255,255,255,0.74);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
  border-bottom: 3px solid transparent;
}
.tabbar a:hover { color: #fff; background: rgba(255,255,255,0.06); }
.tabbar a.active { color: #fff; border-bottom-color: var(--gold); font-weight: 600; }

main {
  max-width: none;
  margin: 0;
  padding: 28px 32px 80px;
}

/* --- Login screen: a navy exercise-book page (ruled lines and a gold
   margin) beside the sign-in form --- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  background: var(--panel);
}
.login-hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 56px 56px 48px 96px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-color: var(--band);
  background-image:
    linear-gradient(90deg, transparent 63px, var(--gold) 63px, var(--gold) 66px, transparent 66px),
    repeating-linear-gradient(180deg, transparent 0, transparent 35px, rgba(255,255,255,0.08) 35px, rgba(255,255,255,0.08) 36px);
}
.login-hero .mark { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 1.05rem; }
.login-hero .mark img { width: 40px; height: 40px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(255,255,255,0.15); }
.login-hero h2 { color: #fff; font-size: clamp(1.9rem, 3.4vw, 2.9rem); line-height: 1.12; letter-spacing: -0.025em; max-width: 13ch; margin: 0 0 22px; }
.login-hero ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; max-width: 42ch; }
.login-hero li { font-size: 0.98rem; line-height: 36px; color: rgba(255,255,255,0.86); padding-left: 24px; text-indent: -24px; }
.login-hero li b { color: var(--gold); font-weight: 600; display: inline-block; width: 24px; text-indent: 0; }
.login-hero .foot { font-size: 0.78rem; color: rgba(255,255,255,0.55); }
.login-side { display: flex; align-items: center; justify-content: center; padding: 32px 24px; background: var(--paper); }

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 10px 30px rgba(15, 47, 40, 0.08);
}

.login-card h1 {
  font-size: 1.5rem;
  letter-spacing: -0.015em;
  margin: 0 0 4px;
}

.login-card .sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 28px;
}
@media (max-width: 860px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { padding: 28px 22px 26px 56px; background-image:
    linear-gradient(90deg, transparent 33px, var(--gold) 33px, var(--gold) 35px, transparent 35px),
    repeating-linear-gradient(180deg, transparent 0, transparent 35px, rgba(255,255,255,0.08) 35px, rgba(255,255,255,0.08) 36px); }
  .login-hero h2 { font-size: 1.7rem; margin: 18px 0 10px; }
  .login-hero ul, .login-hero .foot { display: none; }
}

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: #3e4b66;
  margin-bottom: 6px;
}

input, select {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 10px 12px;
  border: 1px solid #c9d4e6;
  border-radius: 8px;
  background: #fbfcff;
  color: var(--ink);
  margin-bottom: 18px;
}
textarea { font-size: 0.95rem; border: 1px solid #c9d4e6; border-radius: 8px; padding: 10px 12px; background: #fbfcff; color: var(--ink); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgba(30, 107, 88, 0.16);
  background: #fff;
}

.btn {
  display: inline-block;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--moss);
  color: #fff;
  border: 1px solid var(--moss);
  border-radius: 8px;
  padding: 10px 20px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 47, 40, 0.12);
}

a.btn { text-decoration: none; }
.btn:hover { background: var(--moss-dark); border-color: var(--moss-dark); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.secondary { background: #fff; color: var(--moss); border: 1px solid #bcd8cf; box-shadow: none; }
.btn.secondary:hover { background: var(--tint); border-color: var(--moss); }

.error-msg {
  color: var(--clay);
  font-size: 0.85rem;
  margin: -8px 0 16px;
  min-height: 1em;
}

/* --- Dashboard --- */
h2 { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.015em; margin: 0 0 4px; color: #101a33; }
h3 { font-weight: 600; letter-spacing: -0.005em; }
.section-note { color: var(--muted); font-size: 0.88rem; margin: 0 0 20px; }
/* Explanatory texts (page introductions, notes, step headings, role descriptions) are not shown:
   the screens speak for themselves. Status messages (with an id) stay. */
.section-note[data-i18n$="intro"]:not([id]), .section-note[data-i18n$="_note"]:not([id]), .section-note[data-i18n$=".note"]:not([id]),
.section-note > span[data-i18n$="_note"], .section-note[data-explain], .acc-role > span, .acc-step > h3, #pickBody .empty-row { display: none !important; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.9rem;
}

th {
  background: #f2f6fd;
  font-weight: 600;
  font-size: 0.78rem;
  color: #42506b;
  border-bottom: 1px solid var(--line);
}
tbody tr:hover td { background: #f8faff; }

tr:last-child td { border-bottom: none; }

.empty-row td {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 24px;
}

.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: var(--tint); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  background: var(--tint);
  color: var(--moss-dark);
}

.badge.warn { background: #fdf0cf; color: #7a5200; }
.badge.danger { background: #fde2dc; color: var(--clay); }
.badge.ok { background: #dcf3e5; color: var(--ok); }

/* --- Sub-tabs within a page (e.g. Finance: Invoices / Arrears) --- */
.subtabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 20px; padding: 4px; background: #e1e8f5; border-radius: 12px; width: fit-content; max-width: 100%; }
.subtabs button {
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  background: none;
  border: none;
  border-radius: 9px;
  padding: 7px 16px;
  cursor: pointer;
  color: #42506b;
}
.subtabs button:hover { color: var(--ink); background: rgba(255,255,255,0.6); }
.subtabs button.active { color: var(--moss-dark); background: #fff; font-weight: 600; box-shadow: 0 1px 3px rgba(15, 47, 40, 0.14); }
.subtabs a { font-size: 0.86rem; font-weight: 500; border-radius: 9px; padding: 7px 16px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.subtabs a:hover { color: var(--ink); background: rgba(255,255,255,0.6); }
.acad-pane > :first-child { margin-top: 0 !important; }
#gradingBox > .panel:first-child { margin-top: 0 !important; }
.acad-tabs { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 6px; margin: 6px 0 24px; box-shadow: 0 2px 10px rgba(15, 47, 40, 0.07); }
.acad-tabs button { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 0.85rem; font-weight: 500; color: var(--muted); background: none; border: 0; border-radius: 10px; padding: 8px 10px; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.acad-tabs button svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.acad-tabs button:hover { background: var(--tint); color: var(--ink); }
.acad-tabs button.active { background: var(--moss); color: #fff; font-weight: 600; box-shadow: 0 2px 6px rgba(30, 107, 88, 0.28); }
.acad-tabs .sep { width: 1px; align-self: stretch; margin: 6px 3px; background: var(--line); }
@media (max-width: 760px) { .acad-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .acad-tabs::-webkit-scrollbar { display: none; } }
.tsa-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 12px; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 14px; }
.tsa-pick label { display: flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; }
.tsa-pick input { width: auto; min-width: 0; margin: 0; flex: none; }
.subtabs a.active { color: var(--moss-dark); background: #fff; font-weight: 600; box-shadow: 0 1px 3px rgba(15, 47, 40, 0.14); }

.summary-strip {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
}
.summary-strip .stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 20px; box-shadow: var(--shadow); }
.summary-strip .stat .num { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; }
.summary-strip .stat .label { font-size: 0.78rem; color: var(--muted); }

/* --- Modal --- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(13, 24, 52, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
}
.modal-overlay.hidden { display: none; }
.hidden { display: none; }
.modal-box {
  background: var(--panel); border-radius: 14px; border: 1px solid var(--line);
  padding: 28px; width: 100%; max-width: 420px; box-shadow: 0 20px 50px rgba(13, 24, 52, 0.28);
  /* Long forms (e.g. "New school") scroll inside the box on any screen size,
     and the Save / Cancel buttons stay visible at the bottom. */
  max-height: calc(100vh - 40px); overflow-y: auto;
}
.modal-box > .modal-actions:last-child { position: sticky; bottom: -28px; background: var(--panel); padding: 12px 0 4px; margin-bottom: -4px; border-top: 1px solid var(--line); }
.modal-box h3 { margin: 0 0 18px; font-size: 1.05rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.modal-actions .btn.secondary { border-color: var(--line); color: var(--muted); }

/* --- Printable receipt --- */
.receipt { font-family: 'Menlo', monospace; font-size: 0.85rem; line-height: 1.6; }
.receipt hr { border: none; border-top: 1px dashed var(--line); margin: 12px 0; }
.receipt .row { display: flex; justify-content: space-between; }
.receipt .total { font-weight: 700; font-size: 1rem; }

@media print {
  body * { visibility: hidden; }
  #receiptPrintArea, #receiptPrintArea *, #reportPrintArea, #reportPrintArea * { visibility: visible; }
  #receiptPrintArea, #reportPrintArea { position: absolute; top: 0; left: 0; width: 100%; padding: 24px; }
  .modal-actions { display: none; }
  /* Consistent paper size/margins rather than leaving it to whatever the
     browser's own print defaults happen to be. */
  @page { size: A4; margin: 15mm; }
  /* A long table (a broadsheet - a whole class's scores - or a multi-year
     transcript) can genuinely span several printed pages: repeat the
     header row on each page it lands on, and never let a single row get
     sliced across a page break. */
  .report-doc table { page-break-inside: auto; }
  .report-doc thead { display: table-header-group; }
  .report-doc tr { page-break-inside: avoid; }
  /* Whole-class report cards (see reports.html's "Generate for whole
     class") are several of these concatenated into one document - each
     one after the first starts on its own fresh page rather than running
     on from wherever the previous student's report card ended. */
  .doc-page-break { page-break-before: always; }
}

/* ============================================================
   PHONE / SMALL-SCREEN LAYOUT
   Everything above this point was written with zero responsive design at
   all: no viewport meta tag on any page (added separately - see each
   page's <head>), zero @media rules besides print. On an actual phone
   that means the browser renders the whole page at desktop width
   (~980px) and scales the lot down, so every fix below only starts
   working once that tag exists too - the two changes depend on each
   other. Breakpoint chosen (640px) comfortably covers real phones in
   portrait - iPhone SE/mini at 375px up through the larger Android
   phones around 412-430px - with headroom, while leaving tablets and
   anything wider on the existing desktop layout untouched.
   ============================================================ */
@media (max-width: 640px) {
  /* Two-column forms are everywhere in this app (every "Add a ..." panel
     across academics/finance/boarding/transport/procurement/etc. all use
     .grid-2) and were never designed to fit in less than ~460px of usable
     width - at phone width each column would land under ~150px, too
     narrow for a label plus its input to read comfortably. Stacking to
     one column is the single highest-impact form fix here, and it's one
     rule reaching every form in the app at once because they all share
     this class. */
  .grid-2 { grid-template-columns: 1fr; }

  /* The main nav (<nav class="tabbar">, identical ~21-link list repeated
     on every authenticated page) is a plain flex row with no wrap and no
     scroll. At phone width that either pushes most links off-screen with
     no way to reach them, or - if it were allowed to wrap - eats most of
     the vertical viewport before any actual page content shows. Scrolling
     it horizontally keeps every link reachable via a natural swipe
     without growing the page's height at all. -webkit-overflow-scrolling
     gives it momentum/inertia on iOS Safari instead of a stiff, tick-by-
     tick scroll; scrollbar-width: none + the ::-webkit-scrollbar rule
     hide the scrollbar itself, since a swipeable strip reads more like a
     native app control without one visibly sitting under it. */
  .tabbar {
    padding: 0 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabbar::-webkit-scrollbar { display: none; }
  .tabbar a {
    flex: 0 0 auto;
    padding: 12px 12px;
    white-space: nowrap;
  }

  /* Same overflow problem, same fix, for the sub-navigation inside a page
     (e.g. Boarding's Houses & Rooms / Allocation / Attendance / Meal
     Plans / Inspections / Incidents / Reports - seven subtabs, the most
     of any page in this app, on a strip that was never going to fit
     seven text buttons in ~350px). Padding bumped slightly beyond the
     desktop 7px/16px too, since these are real tap targets on a touch
     screen, not just clickable text on a cursor-driven one. */
  .subtabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -12px 20px;
    padding: 0 12px 4px;
  }
  .subtabs::-webkit-scrollbar { display: none; }
  .subtabs button {
    flex: 0 0 auto;
    padding: 9px 16px;
  }

  /* Dashboard KPI rows (management.html alone has up to 22 of these
     stat cards across its tabs) were a flex row with no wrap, so at
     phone width they'd run off-screen exactly like the nav bars above.
     Unlike navigation, though, a stat card reads fine stacked - there's
     no ordering/adjacency meaning lost by wrapping - so wrap is the
     right fix here instead of a horizontal scroll. */
  .summary-strip { flex-wrap: wrap; gap: 12px; }
  .summary-strip .stat { flex: 1 1 calc(50% - 6px); padding: 12px 14px; }

  /* Every data table in the app (attendance rolls, fee schedules,
     student lists, the lot) is full-width with 6-14px of cell padding
     and was sized for a desktop's ~870px of usable content width - many
     have 6-8 columns. Rather than rewrite every table's markup across
     26 pages to add an individual scroll wrapper, switching the <table>
     element itself to `display: block` with `overflow-x: auto` makes
     each one independently horizontally scrollable with no HTML changes
     anywhere: every existing <table> in the app gets this for free.
     thead/tbody/tr/th/td keep their normal table-related display roles
     by default (table-header-group, table-row-group, table-row,
     table-cell) - only the outer <table> changes, so the grid itself
     still renders correctly, just inside a block-level scroll
     container instead of being forced to fit the viewport's width. */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { padding: 8px 10px; font-size: 0.86rem; }

  main { padding: 20px 12px 60px; }

  .topbar { padding: 10px 14px; flex-wrap: wrap; gap: 8px; row-gap: 4px; }
  .topbar .brand { font-size: 0.95rem; }
  .topbar button { padding: 4px 10px; font-size: 0.76rem; }
  h2 { font-size: 1.25rem; }
  .topbar .brand-mark { height: 18px; width: 18px; margin-right: 6px; }
  .topbar .who { font-size: 0.72rem; }

  .login-card { padding: 32px 22px; }

  .panel { padding: 16px; margin-bottom: 20px; }

  .modal-overlay { padding: 12px; }
  .modal-box { padding: 20px; max-height: 90vh; overflow-y: auto; }
  .modal-box > .modal-actions:last-child { bottom: -20px; }

  /* .receipt/.report-doc are read on-screen sometimes (not only printed -
     the print @media rules above only apply once an actual print job
     starts), so their fixed-width row layout gets the same treatment as
     everything above it rather than being left out because it's "print"
     content. */
  .report-doc .doc-summary { gap: 14px; }
  .report-doc table { display: block; overflow-x: auto; }
}

/* --- Printable academic reports (report card, transcript, mark sheet,
   broadsheet, academic summary) --- */
.report-doc { font-family: Georgia, serif; color: #222; }
.report-doc header.doc-head { display: flex; align-items: center; gap: 14px; border-bottom: 2px solid #333; padding-bottom: 14px; margin-bottom: 18px; }
.report-doc header.doc-head img { height: 48px; }
.report-doc header.doc-head h1 { font-size: 18px; margin: 0; }
.report-doc header.doc-head p { margin: 2px 0; font-size: 12px; color: #555; }
.report-doc h2 { font-size: 15px; margin: 0 0 4px; }
.report-doc .doc-meta { font-size: 13px; color: #444; margin-bottom: 14px; }
.report-doc .doc-meta span { margin-right: 18px; }
.report-doc table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 14px; }
.report-doc th, .report-doc td { border: 1px solid #ccc; padding: 5px 8px; text-align: left; }
.report-doc th { background: #eef5f2; }
.report-doc td.num, .report-doc th.num { text-align: right; }
.report-doc .doc-summary { display: flex; gap: 24px; flex-wrap: wrap; margin: 14px 0; font-size: 13px; }
.report-doc .doc-summary .stat b { display: block; font-size: 17px; }
.report-doc .doc-footer { margin-top: 40px; font-size: 12px; color: #666; display: flex; justify-content: space-between; }


/* ============================================================
   CLASSIC DESIGN (Settings → Appearance → Design: Classic)
   The original light look: white top bar, moss-green accent, serif text.
   ============================================================ */
html[data-design="classic"] {
  --ink: #1c2a24; --paper: #f6f5f1; --line: #dcd8ce; --line-soft: #e6e2d8;
  --moss: #2f5d4f; --moss-dark: #234438; --tint: #eef0e8; --muted: #6b7268;
  --radius: 6px; --shadow: none;
  --font: 'Iowan Old Style', Georgia, serif;
}
html[data-design="classic"] .topbar { background: var(--panel); color: var(--ink); border-bottom: 1px solid var(--line); padding: 18px 32px; }
html[data-design="classic"] .topbar .brand { color: var(--ink); }
html[data-design="classic"] .topbar .brand .code, html[data-design="classic"] .topbar .brand span { color: var(--moss); }
html[data-design="classic"] .topbar .who { color: var(--muted); font-family: Menlo, monospace; }
html[data-design="classic"] .topbar button { background: none; color: var(--ink); border-color: var(--line); border-radius: 6px; }
html[data-design="classic"] .topbar button:hover { background: none; border-color: var(--moss); color: var(--moss); }
html[data-design="classic"] .topbar a { color: var(--ink); }
html[data-design="classic"] .topbar #langToggle a, html[data-design="classic"] .topbar #langToggle span, html[data-design="classic"] .topbar #langToggle button { color: var(--muted); }
html[data-design="classic"] .topbar .brand-mark { box-shadow: none; height: 22px; width: 22px; }
html[data-design="classic"] .tabbar { background: var(--panel); border-bottom: 1px solid var(--line); box-shadow: none; }
html[data-design="classic"] .tabbar a { color: var(--muted); font-weight: 400; border-bottom-width: 2px; }
html[data-design="classic"] .tabbar a:hover { color: var(--ink); background: none; }
html[data-design="classic"] .tabbar a.active { color: var(--moss-dark); border-bottom-color: var(--moss); font-weight: 600; }
html[data-design="classic"] h2 { font-size: 1.2rem; color: var(--ink); letter-spacing: 0; }
html[data-design="classic"] .btn { border-radius: 6px; font-weight: 400; box-shadow: none; }
html[data-design="classic"] .btn.secondary { background: none; border-color: var(--moss); }
html[data-design="classic"] input, html[data-design="classic"] select, html[data-design="classic"] textarea { background: var(--paper); border-color: var(--line); border-radius: 6px; }
html[data-design="classic"] th { background: #eef0e8; color: var(--muted); }
html[data-design="classic"] tbody tr:hover td { background: transparent; }
html[data-design="classic"] .subtabs { background: none; padding: 0; gap: 6px; }
html[data-design="classic"] .subtabs button { border: 1px solid var(--line); border-radius: 6px; color: var(--muted); }
html[data-design="classic"] .subtabs button.active { border-color: var(--moss); color: var(--moss); background: #eef0e8; box-shadow: none; }
html[data-design="classic"] .panel, html[data-design="classic"] table, html[data-design="classic"] .summary-strip .stat { border-radius: 6px; box-shadow: none; }

/* --- The school's own logo (public/js/logo.js) ---
   School badges and crests are rarely round, so show the whole logo on a
   white tile instead of cropping it into the Soft-Tech circle. */
img.school-logo { object-fit: contain; background: #fff; border-radius: 6px !important; padding: 2px; box-sizing: border-box; }
.topbar .brand-mark.school-logo { height: 34px; width: 34px; top: 0; }
html[data-design="classic"] .topbar .brand-mark.school-logo { height: 30px; width: 30px; box-shadow: 0 0 0 1px var(--line); }
.login-hero .mark img.school-logo { width: 56px; height: 56px; border-radius: 10px !important; }
.login-card h1 img.school-logo { width: 44px !important; height: 44px !important; }
@media (max-width: 640px) { .topbar .brand-mark.school-logo { height: 26px; width: 26px; } }
