:root {
  /* Surfaces */
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-2: #fbfcfe;
  --sidebar: #0f1729;
  --sidebar-2: #1a2540;

  /* Text */
  --ink: #101828;
  --muted: #667085;
  --faint: #98a2b3;

  /* Lines */
  --line: #e4e8ee;
  --line-soft: #eef1f5;

  /* Accents */
  --brand: #2563eb;
  --brand-ink: #1d4ed8;
  --brand-soft: #eff4ff;
  --brand-2: #059669;
  --warn: #d97706;
  --danger: #dc2626;

  /* Depth — layered rather than one heavy drop shadow */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 28px rgba(16, 24, 40, .1), 0 4px 8px rgba(16, 24, 40, .04);

  --radius: 12px;
  --radius-sm: 8px;
}

/* Dark theme. Applied when the user picks it, or by system preference when
   they have not chosen. Only the tokens change - no component needs to know. */
:root[data-theme="dark"] {
  --bg: #0b1120;
  --panel: #131c2e;
  --panel-2: #18223a;
  --sidebar: #080d18;
  --sidebar-2: #131c2e;
  --ink: #e8edf5;
  --muted: #94a3b8;
  --faint: #64748b;
  --line: #26324a;
  --line-soft: #1e2942;
  --brand: #3b82f6;
  --brand-ink: #60a5fa;
  --brand-soft: #17233d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, .5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120;
    --panel: #131c2e;
    --panel-2: #18223a;
    --sidebar: #080d18;
    --sidebar-2: #131c2e;
    --ink: #e8edf5;
    --muted: #94a3b8;
    --faint: #64748b;
    --line: #26324a;
    --line-soft: #1e2942;
    --brand: #3b82f6;
    --brand-ink: #60a5fa;
    --brand-soft: #17233d;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.3em; }
.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 520px at 15% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, color-mix(in srgb, var(--brand-2) 18%, transparent), transparent 62%),
    var(--bg);
}
.login-panel {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 28px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 36px;
}
.login-panel h1 { margin: 0 0 10px; font-size: clamp(32px, 5vw, 56px); line-height: 1; }
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 7px; color: var(--ink); font-size: 13px; font-weight: 750; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  background: var(--panel);
  color: var(--ink);
  /* Below 16px, iOS Safari zooms the whole page in on focus - this
     overrides the 13px inherited from the parent <label>. */
  font-size: 16px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(24, 100, 171, 0.13);
}
.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 13px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 600;
  font-size: 13.5px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, transform .06s ease, box-shadow .12s ease;
  text-decoration: none;
}
.button:hover { background: var(--panel-2); border-color: var(--faint); }
.button:active { transform: translateY(1px); }
.button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.button.primary { border-color: var(--brand); background: var(--brand); color: #fff; }
.button.primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
.button.success { border-color: var(--brand-2); background: var(--brand-2); color: #fff; }
.button.success:hover { filter: brightness(.94); }
.button.danger { border-color: var(--danger); background: var(--danger); color: #fff; }
.button.danger:hover { filter: brightness(.94); }
.button.ghost { background: transparent; box-shadow: none; }

/* Compact icon-only button, used for the theme switch. */
.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.icon-button:hover { color: var(--ink); background: var(--panel-2); }
.icon-button svg { width: 16px; height: 16px; }
/* Only one of the two glyphs shows, depending on the active theme. */
.icon-button .icon-moon { display: none; }
:root[data-theme="dark"] .icon-button .icon-sun { display: none; }
:root[data-theme="dark"] .icon-button .icon-moon { display: block; }
.demo-grid { display: flex; flex-wrap: wrap; gap: 8px; grid-column: 1 / -1; }
.demo-grid button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  font-weight: 700;
}

.app { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px 14px;
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: #e8edf5;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .18) transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 999px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.brand { display: flex; gap: 12px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}
.brand small { display: block; color: #94a3b8; margin-top: 2px; font-size: 12px; }
nav { display: grid; gap: 2px; margin-top: 14px; }

/* ---------- Sidebar search ---------- */
.nav-search { position: relative; margin-bottom: 10px; }
.nav-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: #64748b; }
.nav-search input {
  width: 100%;
  padding: 9px 10px 9px 32px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, .09);
  background: rgba(255, 255, 255, .05);
  color: #e8edf5;
  font: inherit;
  font-size: 13px;
}
.nav-search input::placeholder { color: #64748b; }
.nav-search input:focus { outline: none; border-color: var(--brand); background: rgba(255, 255, 255, .08); }
.nav-empty { color: #64748b; font-size: 13px; padding: 12px 4px; }

/* ---------- Collapsible groups ---------- */
.nav-group + .nav-group { margin-top: 1px; }
.nav-group-head {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: 0;
  background: transparent;
  color: #94a3b8;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  text-align: left;
}
.nav-group-head:hover { background: rgba(255, 255, 255, .05); color: #e8edf5; }
.nav-group-head span { flex: 1; }
.nav-group-head em {
  font-style: normal;
  font-size: 10px;
  color: #64748b;
  background: rgba(255, 255, 255, .06);
  padding: 1px 6px;
  border-radius: 999px;
}
.nav-icon { width: 16px; height: 16px; flex: none; }
.nav-chev { width: 13px; height: 13px; flex: none; transition: transform .18s ease; }
.nav-group.open .nav-chev { transform: rotate(180deg); }

/* Collapsed groups are hidden outright so the sidebar stays short. */
.nav-items { display: none; padding: 2px 0 6px 12px; margin-left: 11px; border-left: 1px solid rgba(255, 255, 255, .07); }
.nav-group.open .nav-items { display: grid; gap: 1px; }

.nav-button {
  width: 100%;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: transparent;
  color: #b6c2d4;
  text-align: left;
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.nav-button:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-button.active {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.workspace { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.topbar h2 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.eyebrow {
  margin: 0 0 1px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--faint);
}
.top-actions { display: flex; align-items: center; gap: 10px; }
.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 750;
}
.content { padding: 24px; display: grid; gap: 18px; }
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}
.card, .table-card, .form-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card { padding: 20px; }

/* Metric cards get a subtle accent bar so a row of them reads as a unit. */
.metrics article {
  position: relative;
  overflow: hidden;
  padding: 18px 20px;
  transition: box-shadow .16s ease, transform .16s ease;
}
.metrics article::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--brand);
  opacity: .85;
}
.metrics article:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.metric-value {
  margin: 6px 0 2px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.metric-label { margin: 0; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.metrics article .metric-label:first-child {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--faint);
}

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.toolbar h3 { font-size: 17px; font-weight: 650; letter-spacing: -.01em; margin: 0; }
.toolbar h4 { font-size: 14.5px; font-weight: 650; margin: 0; }

.table-card { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
th {
  position: sticky;
  top: 0;
  background: var(--panel-2);
  color: var(--faint);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { font-size: 14px; }
tbody tr { transition: background .1s ease; }
tbody tr:hover { background: var(--panel-2); }
tr:last-child td { border-bottom: 0; }
/* Figures line up column-wise when they use tabular numerals. */
td strong { font-variant-numeric: tabular-nums; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}
/* A leading dot carries the state without relying on colour alone. */
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .8; }
.status.paid, .status.present, .status.active, .status.approved, .status.published, .status.returned, .status.graded, .status.completed { background: #ecfdf3; color: #027a48; }
.status.pending, .status.partial, .status.late, .status.draft, .status.submitted, .status.in_progress, .status.planned, .status.issued { background: #fffaeb; color: #b54708; }
.status.absent, .status.overdue, .status.inactive, .status.rejected, .status.failed, .status.closed, .status.fail { background: #fef3f2; color: #b42318; }

:root[data-theme="dark"] .status.paid, :root[data-theme="dark"] .status.present,
:root[data-theme="dark"] .status.active, :root[data-theme="dark"] .status.approved,
:root[data-theme="dark"] .status.published, :root[data-theme="dark"] .status.graded { background: #06281c; color: #6ee7b7; }
:root[data-theme="dark"] .status.pending, :root[data-theme="dark"] .status.partial,
:root[data-theme="dark"] .status.late, :root[data-theme="dark"] .status.draft,
:root[data-theme="dark"] .status.submitted { background: #2e1f05; color: #fcd34d; }
:root[data-theme="dark"] .status.absent, :root[data-theme="dark"] .status.overdue,
:root[data-theme="dark"] .status.inactive, :root[data-theme="dark"] .status.rejected { background: #300f0f; color: #fca5a5; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.list { display: grid; gap: 10px; }
.notice { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.notice h4 { margin: 0 0 6px; }
.notice p { margin: 0; color: var(--muted); }
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 25, 35, 0.5);
  /* Lets the card scroll within the overlay when a form is taller than
     the screen, instead of clipping the Save button off-screen. */
  overflow-y: auto;
}
.modal-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  display: grid;
  gap: 14px;
  background: var(--panel);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 20px 80px rgba(0,0,0,0.25);
}
.modal-card h3 { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* Separates the optional "portal login" half of a form from the record
   itself, so it reads as a distinct decision rather than more fields. */
.form-note {
  margin: 6px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.check-row { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.check-row input { width: auto; margin: 0; }

/* Read-only modal content (class history) can outgrow the viewport. */
.modal-body { max-height: 60vh; overflow: auto; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mini-table th, .mini-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mini-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

/* Rows of small buttons inside toolbars and table cells */
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.btn-row .button { padding: 7px 10px; font-size: 13px; }
a.button { display: inline-flex; align-items: center; text-decoration: none; }

/* Filter bars above reports */
.filter-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.filter-row label { flex: 1 1 180px; min-width: 150px; }
.filter-row .button { flex-shrink: 0; }

/* Profile photos */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  object-fit: cover;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line);
}
.avatar-fallback { border: 1px solid var(--line); }

.notice-warn { border-left: 4px solid var(--warn); }
.mono-cell { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; }
h4 { margin: 6px 0; }

/* Printable documents (report card, certificate, ID card) */
.doc-header { text-align: center; margin-bottom: 18px; }
.doc-header h2 { margin: 0 0 4px; }
.doc-header h3 { margin: 10px 0 0; }
.doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  margin: 16px 0;
}
.doc-body { line-height: 1.9; }
.doc-signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 46px;
  padding-top: 10px;
  color: var(--muted);
}
.doc-signatures span { border-top: 1px solid var(--ink); padding-top: 6px; min-width: 160px; text-align: center; }
.document-card { max-height: calc(100vh - 40px); overflow-y: auto; }

.id-card {
  width: 320px;
  max-width: 100%;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.id-card-header { padding: 12px; background: var(--brand); color: #fff; text-align: center; }
.id-card-header small { display: block; opacity: 0.85; }
.id-card-body { display: flex; gap: 12px; padding: 14px; }
.id-photo {
  display: grid;
  place-items: center;
  width: 84px;
  height: 96px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f2f5f8;
  font-size: 11px;
  overflow: hidden;
}
.id-photo img { width: 100%; height: 100%; object-fit: cover; }
.id-details h4 { margin: 0 0 6px; }
.id-details p { margin: 2px 0; font-size: 13px; }
.id-card-footer { padding: 8px; background: #f2f5f8; text-align: center; font-size: 12px; color: var(--muted); }

/* A sheet of ID cards for a whole class. */
.id-card-sheet { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.id-card-sheet .id-card { margin: 0; }
@media print {
  /* Keep a card from being split across two pages. */
  .id-card-sheet .id-card { break-inside: avoid; page-break-inside: avoid; }
}

/* A label wrapping its own control, used in toolbars. */
.inline-field { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.inline-field input { margin: 0; }

/* Global search in the top bar. */
.global-search { position: relative; display: flex; align-items: center; }
.global-search > svg {
  position: absolute; left: 11px; width: 16px; height: 16px;
  color: var(--faint); pointer-events: none;
}
.global-search input {
  width: 260px;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--ink);
  font-size: 14px;
}
.global-search input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.search-results {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  width: 420px;
  max-width: 90vw;
  max-height: 60vh;
  overflow-y: auto;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 60;
}
.search-group + .search-group { margin-top: 4px; border-top: 1px solid var(--line-soft); padding-top: 4px; }
.search-group-head {
  margin: 0; padding: 7px 10px 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint);
}
.search-hit {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1px 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.search-hit:hover, .search-hit:focus-visible { background: var(--brand-soft); outline: none; }
.search-hit-title { font-size: 14px; font-weight: 600; }
.search-hit-meta { grid-row: 1 / span 2; align-self: center; font-size: 12px; color: var(--muted); white-space: nowrap; }
.search-hit-sub { grid-column: 1; font-size: 12.5px; color: var(--muted); }
.search-empty { margin: 0; padding: 16px; text-align: center; color: var(--muted); font-size: 13.5px; }

@media (max-width: 900px) {
  .global-search input { width: 150px; }
  .search-results { width: 300px; }
}

/* Dashboard "needs your attention" queues. */
.attention-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.attention-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform .12s ease, box-shadow .16s ease;
}
.attention-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.attention-card.warn { border-left-color: var(--warn, #b54708); }
.attention-count { font-size: 26px; font-weight: 700; line-height: 1; color: var(--brand); }
.attention-card.warn .attention-count { color: var(--warn, #b54708); }
.attention-label { font-size: 13.5px; color: var(--muted); }
.attention-clear { color: var(--muted); }
.attention-note { margin: 10px 0 0; font-size: 13px; }

/* Birthday chips. */
.birthday-row { display: flex; flex-wrap: wrap; gap: 10px; }
.birthday-chip {
  display: flex;
  flex-direction: column;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 13px;
}
.birthday-chip small { color: var(--muted); font-size: 11.5px; }
.birthday-chip.today { border-color: var(--brand); background: var(--brand-soft); }

/* Fee receipt handed to a parent at the counter. */
.receipt { width: 640px; max-width: 100%; margin: 0 auto; padding: 4px 2px; }
.receipt-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 14px; border-bottom: 2px solid var(--ink); }
.receipt-head h3 { margin: 0 0 4px; }
.receipt-head p { margin: 1px 0; font-size: 12.5px; }
.receipt-stamp { text-align: right; flex: none; }
.receipt-stamp strong { display: block; letter-spacing: .08em; font-size: 13px; }
.receipt-stamp span { font-size: 12.5px; color: var(--muted); }

.receipt-meta { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 13.5px; }
.receipt-meta th, .receipt-meta td { padding: 5px 8px; text-align: left; vertical-align: top; }
.receipt-meta th { color: var(--muted); font-weight: 600; width: 15%; white-space: nowrap; }

.receipt-lines { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.receipt-lines th, .receipt-lines td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; }
.receipt-lines thead th { background: var(--panel-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.receipt-lines .right { text-align: right; }
.receipt-lines tfoot th, .receipt-lines tfoot td { border-bottom: none; padding: 5px 8px; }
.receipt-lines tfoot tr:first-child th { border-top: 1px solid var(--line); }
.receipt-due th { color: #b42318; border-top: 2px solid var(--ink) !important; }
.receipt-clear th { color: #027a48; border-top: 2px solid var(--ink) !important; }

.receipt-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-top: 26px; font-size: 13px; }
.receipt-foot p { margin: 2px 0; }
.receipt-sign { text-align: center; color: var(--muted); font-size: 12px; }
.receipt-sign span { display: block; width: 180px; border-top: 1px solid var(--ink); margin-bottom: 5px; }

/* Printing must not carry the app's dark theme onto paper. */
@media print {
  .receipt, .receipt * { color: #000 !important; background: transparent !important; }
  .receipt-lines thead th { background: #eee !important; }
}

@media print {
  /* Printing one document: hide everything with `visibility` (which the
     target can override even though its ancestors stay hidden) rather than
     `display`, since the print target may sit inside a modal overlay. */
  body.printing * { visibility: hidden; }
  body.printing .print-target,
  body.printing .print-target * { visibility: visible; }
  body.printing .print-target {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: var(--panel);
  }
  /* The dimmed overlay behind a modal would otherwise print as grey. */
  body.printing .modal { background: none; padding: 0; display: block; }
  .no-print { display: none !important; }
  .table-card { overflow: visible; box-shadow: none; }
  table { min-width: 0; }
}

.menu-toggle { display: none; }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.sidebar-backdrop { display: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }

  /* The nav has 20+ items - stacking it above the page content (the old
     behavior) forced mobile users to scroll past the whole menu before
     seeing anything. Instead it becomes a slide-out drawer. */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 24px 0 48px rgba(0, 0, 0, 0.3);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(16, 25, 35, 0.5);
  }
  .sidebar-backdrop.visible { display: block; }
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    color: var(--ink);
    font-size: 19px;
  }
  nav { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-panel, .two-col { grid-template-columns: 1fr; }

  /* Title + badge text were wrapping onto multiple lines and inflating
     the topbar's height - force single-line with an ellipsis instead. */
  .topbar-left { min-width: 0; flex: 1; }
  .topbar-left > div { min-width: 0; }
  .topbar h2 { font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .eyebrow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-actions { flex-shrink: 0; }
  #userBadge { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 560px) {
  .content, .topbar { padding: 16px; }
  .top-actions { gap: 8px; }
  #userBadge { display: none; }
  .metrics { grid-template-columns: 1fr; }
  .login-panel { padding: 22px; }
}

/* ---------- Report filter bar ---------- */
.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}
.inline-field select {
  width: auto;
  min-width: 130px;
  margin: 0;
}

/* A mark below the subject's passing threshold. */
.fail-mark { color: var(--danger, #c0392b); font-weight: 700; }

/* ---------- Admit card ---------- */
.admit-card .doc-meta,
.admit-card .doc-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.admit-card .doc-meta td { padding: 6px 8px; border: 1px solid var(--line, #ddd); font-size: 0.9rem; }
.admit-card .doc-table th,
.admit-card .doc-table td { padding: 7px 9px; border: 1px solid var(--line, #ddd); font-size: 0.88rem; text-align: left; }
.admit-card .doc-table th { background: rgba(0, 0, 0, 0.04); }
.doc-signature { margin-top: 34px; text-align: right; }
.doc-signature span { border-top: 1px solid var(--ink); padding-top: 6px; display: inline-block; min-width: 190px; text-align: center; font-size: 0.85rem; }

/* ---------- Settings screens ---------- */
.settings-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.settings-grid .modal-actions { grid-column: 1 / -1; }
.weekend-grid { flex-wrap: wrap; gap: 14px; }
.check-item { display: inline-flex; align-items: center; gap: 7px; font-size: 0.9rem; font-weight: 600; }
.check-item input { width: auto; margin: 0; }

/* ---------- Reports hub ---------- */
.report-picker { display: grid; gap: 14px; }
.report-group h5 { margin: 0 0 7px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.report-group .btn-row { flex-wrap: wrap; gap: 7px; }

/* ---------- Online exam ---------- */
.exam-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 5px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
}
.exam-timer.urgent { background: var(--danger, #c0392b); color: #fff; }
.exam-question .check-item { display: flex; margin: 5px 0; }
.exam-question textarea { width: 100%; }

/* ---------- Teacher workspace ---------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.class-card .toolbar { margin-bottom: 6px; }
.class-card h4 { margin: 0; }
.class-card .btn-row { margin-top: 12px; }

/* ============================================================
   Visual refresh — typography, inputs, notices, empty states
   ============================================================ */

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 15px;
}
h1, h2, h3, h4 { letter-spacing: -.015em; }
.muted { color: var(--muted); font-size: 13.5px; }

/* Inputs share one look so forms read as a set. */
input, select, textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}
label { font-size: 13px; font-weight: 600; color: var(--ink); }

/* Notices / list cards */
.notice {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .14s ease;
}
.notice:hover { box-shadow: var(--shadow); }
.notice h4 { margin: 0 0 6px; font-size: 14.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notice p { margin: 0 0 4px; color: var(--muted); font-size: 13.5px; }

/* An empty table or list should read as a calm state, not a blank gap. */
.card.muted, td.muted {
  color: var(--muted);
  font-size: 13.5px;
}
td.muted { text-align: center; padding: 28px 16px; }

/* Section headings inside a page */
.content h4 {
  margin: 6px 0 -4px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--faint);
}

/* Buttons sitting together in a table cell or toolbar */
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }

/* The user pill in the top bar */
.pill {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}

/* Modal */
.modal-card {
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  background: var(--panel);
}

/* Respect a reduced-motion preference. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ============================================================
   Filter bar & pagination
   ============================================================ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.f-search { position: relative; flex: 1 1 260px; min-width: 200px; }
.f-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--faint); }
.f-search input { width: 100%; padding-left: 34px; }
/* The browser's own clear button on type=search sits oddly with our padding. */
.f-search input::-webkit-search-cancel-button { cursor: pointer; }

.f-field { display: grid; gap: 4px; font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.f-field select, .f-field input { min-width: 130px; font-size: 13.5px; text-transform: none; letter-spacing: normal; font-weight: 500; color: var(--ink); }

.f-toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 500; padding-bottom: 8px; white-space: nowrap; }
.f-toggle input { width: auto; margin: 0; }
.f-clear { margin-left: auto; align-self: center; }

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 4px 0;
}
.pager .button { padding: 6px 11px; font-size: 12.5px; }
.pager-now { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0 6px; white-space: nowrap; }
.pager select { padding: 5px 8px; font-size: 12.5px; }

@media (max-width: 640px) {
  .filter-bar { padding: 12px; }
  .f-field select, .f-field input { min-width: 0; width: 100%; }
  .f-field { flex: 1 1 140px; }
  .f-clear { margin-left: 0; }
  .pager { justify-content: center; }
}
