/* ==========================================================================
   components.css — the component library.

   Every screen in both platforms is assembled from these primitives, so a
   change here propagates to the whole product. Sizes are tuned for a phone
   first; the `desktop.css` layer scales a handful of them up at >=900px.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Surfaces
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--sh-sm);
  border: 1px solid transparent;
}
/* Larger analytics panels on the admin console sit a step wider and deeper. */
.card.panel { border-radius: var(--r-xl); box-shadow: var(--sh-panel); padding: 20px; }
:root[data-theme="dark"] .card,
.card { border-color: var(--line); }

.card-flat { box-shadow: none; }
.card-pad { padding: 14px; }
.card-pad-lg { padding: 18px; }
.card-tight { padding: 10px; }

/* A card that groups rows: rows are separated, not boxed individually. */
.group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.group > * + * { border-top: 1px solid var(--divider); }
/* A run of floating cards rather than one grouped card — used wherever the
   canvases show separated rows with a 7px gutter (due soon, notices, ledger). */
.rows { display: flex; flex-direction: column; gap: 7px; }

.stack { display: flex; flex-direction: column; }
.stack-2 { gap: 2px; } .stack-4 { gap: 4px; } .stack-6 { gap: 6px; }
.stack-8 { gap: 8px; } .stack-10 { gap: 10px; } .stack-12 { gap: 12px; }
.stack-16 { gap: 16px; } .stack-20 { gap: 20px; }

.row { display: flex; align-items: center; }
.row-8 { gap: 8px; } .row-10 { gap: 10px; } .row-12 { gap: 12px; }
.spread { display: flex; align-items: center; justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }

.grid { display: grid; gap: 10px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* --------------------------------------------------------------------------
   Typography helpers
   -------------------------------------------------------------------------- */
.t-title   { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.t-h       { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.t-strong  { font-weight: 700; font-size: 12px; color: var(--text); }
.t-body    { font-size: 11.5px; color: var(--text-soft); line-height: 1.45; font-weight: 500; }
.t-sub     { font-size: 10.5px; color: var(--text-faint); font-weight: 600; }
.t-micro   { font-size: 9.5px; color: var(--text-faint); font-weight: 600; }
.t-tiny    { font-size: 9px; color: var(--ink-200); font-weight: 600; }
.t-num     { font-family: var(--font-display); font-weight: 800; font-variant-numeric: tabular-nums; }
.t-eyebrow {
  font-size: 10px; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-faint);
}
.t-link { color: var(--brand); font-weight: 700; font-size: 11.5px; }
.clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Section heading with an optional trailing action. */
.sec-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 16px 4px 8px;
}
.sec-head:first-child { margin-top: 4px; }
.sec-head .t { font-weight: 700; font-size: 13px; color: var(--text); letter-spacing: -.005em; }
.sec-head .s { font-size: 10px; color: var(--text-faint); font-weight: 600; margin-top: -1px; }
.sec-head .a {
  font-size: 10.5px; font-weight: 700; color: var(--brand);
  display: inline-flex; align-items: center; gap: 3px; white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Icon chip — the tinted rounded square used across the entire product
   -------------------------------------------------------------------------- */
/* Five sizes, each taken from a specific place in the canvases:
   xs 26 (stat strip) · sm 28 (fee breakdown) · base 30 (tiles, menu rows)
   · md 32 (list rows) · lg 34 (subject cards, KPI) · xl 40 (identity). */
.chipico {
  width: 30px; height: 30px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chipico.xs { width: 26px; height: 26px; border-radius: 8px; }
.chipico.sm { width: 28px; height: 28px; border-radius: 8px; }
.chipico.md { width: 32px; height: 32px; border-radius: 9px; }
.chipico.lg { width: 34px; height: 34px; border-radius: 10px; }
.chipico.xl { width: 40px; height: 40px; border-radius: 12px; }

/* tint utility classes — `t-<name>` sets both halves of a tint pair */
.tt-red    { background: var(--t-red-bg);    color: var(--t-red-fg); }
.tt-blue   { background: var(--t-blue-bg);   color: var(--t-blue-fg); }
.tt-green  { background: var(--t-green-bg);  color: var(--t-green-fg); }
.tt-amber  { background: var(--t-amber-bg);  color: var(--t-amber-fg); }
.tt-violet { background: var(--t-violet-bg); color: var(--t-violet-fg); }
.tt-cyan   { background: var(--t-cyan-bg);   color: var(--t-cyan-fg); }
.tt-navy   { background: var(--t-navy-bg);   color: var(--t-navy-fg); }
.tt-orange { background: var(--t-orange-bg); color: var(--t-orange-fg); }
.tt-pink   { background: var(--t-pink-bg);   color: var(--t-pink-fg); }
.tt-slate  { background: var(--t-slate-bg);  color: var(--t-slate-fg); }
.tt-brand  { background: var(--brand-soft);  color: var(--brand-dark); }

/* --------------------------------------------------------------------------
   Pills / badges
   -------------------------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9.5px; font-weight: 700; line-height: 1;
  padding: 4px 8px; border-radius: var(--r-pill);
  background: var(--fill); color: var(--text-soft);
  white-space: nowrap;
}
.pill.lg { font-size: 10.5px; padding: 5px 11px; }
/* Square-cornered variant the canvases use for grades and marks. */
.pill.sq { border-radius: 6px; font-size: 10px; font-weight: 800; padding: 2px 6px; }
.pill-good { background: var(--good-bg); color: var(--good); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad  { background: var(--bad-bg);  color: var(--bad); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-brand{ background: var(--brand-soft); color: var(--brand-dark); }
.pill-accent{ background: var(--accent-soft); color: var(--accent-dark); }
.pill-solid { background: var(--brand); color: #fff; }
.pill-outline { background: transparent; border: 1px solid var(--line-strong); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); flex-shrink: 0; }
.dot-good { background: var(--good); } .dot-warn { background: var(--warn); } .dot-bad { background: var(--bad); }

/* Notification count bubble */
.badge-count {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: var(--r-pill);
  background: var(--bad); color: #fff; font-size: 9.5px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 700; font-size: 11.5px; line-height: 1;
  padding: 11px 16px; border-radius: var(--r-btn);
  border: 1.5px solid transparent; background: var(--surface-2); color: var(--text);
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast), opacity var(--dur-fast);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap; user-select: none;
}
.btn:active { transform: scale(.965); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 18px -12px var(--brand); }
.btn-accent  { background: var(--accent); color: #fff; box-shadow: 0 8px 18px -12px var(--accent); }
.btn-dark    { background: var(--brand-deep); color: #fff; }
.btn-ghost   { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn-soft    { background: var(--brand-soft); color: var(--brand-dark); }
.btn-danger  { background: var(--bad); color: #fff; }
.btn-good    { background: var(--good); color: #fff; }
.btn-sm { padding: 8px 12px; font-size: 10.5px; border-radius: 9px; }
.btn-xs { padding: 6px 10px; font-size: 10px; border-radius: 8px; }
.btn-lg { padding: 13px 22px; font-size: 14px; border-radius: 13px; }
.btn-hero { padding: 13px; font-size: 14px; font-weight: 800; border-radius: 13px; width: 100%; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .45; pointer-events: none; }

.iconbtn {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--text-soft);
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast);
  -webkit-tap-highlight-color: transparent; position: relative;
}
.iconbtn:active { transform: scale(.9); }
.iconbtn.glass { background: rgba(255,255,255,.16); color: #fff; }
.iconbtn .badge-count { position: absolute; top: -4px; right: -4px; }
.iconbtn .ping {
  position: absolute; top: 7px; right: 8px; width: 7px; height: 7px;
  border-radius: 50%; background: #ffd23f; border: 1.5px solid var(--brand-dark);
}

/* Anything tappable gets the same press feedback. */
.tap { -webkit-tap-highlight-color: transparent; transition: transform var(--dur-fast) var(--ease-out); }
.tap:active { transform: scale(.975); }

/* --------------------------------------------------------------------------
   List rows
   -------------------------------------------------------------------------- */
.lrow {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; background: var(--surface);
  -webkit-tap-highlight-color: transparent;
  transition: background var(--dur-fast);
}
.lrow:active { background: var(--surface-2); }
.lrow .lr-t { font-weight: 700; font-size: 12px; color: var(--text); }
.lrow .lr-s { font-size: 9.5px; color: var(--text-faint); font-weight: 600; margin-top: 1px; }
.lrow .lr-v { font-family: var(--font-display); font-weight: 800; font-size: 12px; font-variant-numeric: tabular-nums; }
.lrow .chev { color: var(--ink-100); flex-shrink: 0; }

/* Standalone card-shaped row (used where rows float rather than group) */
.crow {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 11px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--sh-xs);
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out);
  width: 100%; text-align: left;
}
.crow:active { transform: scale(.985); }
.crow .lr-t { font-weight: 700; font-size: 11.5px; color: var(--text); }
.crow .lr-s { font-size: 9.5px; color: var(--text-faint); font-weight: 600; margin-top: 1px; }

/* --------------------------------------------------------------------------
   Stat tiles
   -------------------------------------------------------------------------- */
/* The 4-up quick-stat strip that overlaps a gradient hero. */
.statstrip {
  background: var(--surface); border-radius: var(--r-card); padding: 12px;
  box-shadow: var(--sh-md); border: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
}
.statstrip.n3 { grid-template-columns: repeat(3, 1fr); }
.statstrip.n2 { grid-template-columns: repeat(2, 1fr); }
.stat-cell { text-align: center; min-width: 0; }
.stat-cell .chipico { margin: 0 auto 6px; }
.stat-cell .v { font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-cell .k { font-size: 9px; color: var(--text-faint); font-weight: 600; margin-top: 1px; }

/* Tinted figure cells — the 3-up and 4-up blocks inside a white card. */
.cells { display: flex; gap: 7px; }
.cell {
  flex: 1; border-radius: var(--r-btn); padding: 9px 4px; text-align: center; min-width: 0;
}
.cell .v { font-family: var(--font-display); font-weight: 800; font-size: 14px; }
.cell .k { font-size: 8.5px; color: var(--text-soft); font-weight: 600; margin-top: 2px; }
.cell.lg { padding: 10px 6px; }
.cell.lg .v { font-size: 16px; }
.cell.lg .k { font-size: 9px; }

/* Larger standalone metric card for desktop dashboards. */
.metric {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 18px; box-shadow: var(--sh-panel); display: flex; flex-direction: column; gap: 3px;
}
.metric .k {
  font-size: 12px; font-weight: 600; letter-spacing: 0;
  text-transform: none; color: var(--text-soft);
  min-width: 0;
}
.metric .v {
  font-family: var(--font-display); font-weight: 800; font-size: 26px;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  min-width: 0; overflow-wrap: anywhere; margin-top: 7px;
}
.metric .s { font-size: 11px; color: var(--text-faint); font-weight: 600; }
.metric .top .chipico { width: 34px; height: 34px; border-radius: 10px; }
.metric .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }

/* Three metrics across a 390px phone leaves ~110px a column, so the type
   steps down rather than bursting out of the card. */
@media (max-width: 560px) {
  .metric { padding: 12px 11px; gap: 3px; }
  .metric .k { font-size: 9px; letter-spacing: .04em; }
  .metric .v { font-size: 16.5px; letter-spacing: -.03em; }
  .metric .s { font-size: 10.5px; }
  .metric .top .chipico.sm { width: 22px; height: 22px; border-radius: 7px; }
}
.trend { font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; }
.trend-up { color: var(--good); } .trend-down { color: var(--bad); } .trend-flat { color: var(--text-faint); }

/* --------------------------------------------------------------------------
   Quick-access tile grid (the 4x2 launcher on every dashboard)
   -------------------------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 10px 4px; box-shadow: var(--sh-xs);
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out);
  position: relative;
}
.tile:active { transform: scale(.94); }
.tile .l { font-size: 9px; font-weight: 700; color: var(--ink-600); text-align: center; line-height: 1.15; }
.tile .badge-count { position: absolute; top: 5px; right: 5px; transform: scale(.85); }

/* --------------------------------------------------------------------------
   Progress + gauges
   -------------------------------------------------------------------------- */
.bar { height: 5px; border-radius: var(--r-pill); background: var(--track); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--brand); transition: width var(--dur-slow) var(--ease-out); }
.bar.thin { height: 4px; }
.bar.thick { height: 9px; }

.gauge {
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; position: relative;
}
.gauge > .hole {
  background: var(--surface); border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  line-height: 1.1;
}
.gauge .g-v { font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.gauge .g-k { font-size: 9px; color: var(--text-faint); font-weight: 600; }

/* Inline sparkline / mini bar chart drawn with flex, no library needed. */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 34px; }
.spark > i { flex: 1; border-radius: 3px 3px 1px 1px; background: var(--brand-soft); min-height: 3px; }
.spark > i.on { background: var(--brand); }

/* --------------------------------------------------------------------------
   Alert banner
   -------------------------------------------------------------------------- */
.alert {
  display: flex; gap: 10px; align-items: center;
  padding: 11px 12px; border-radius: var(--r-md);
  font-size: 10.5px; font-weight: 600; line-height: 1.35;
  border: 1px solid transparent;
}
/* Soft brand-tinted note, as used under the gradebook and report card. */
.note {
  background: var(--brand-soft); border-radius: var(--r-btn); padding: 11px 12px;
}
.note .nl {
  font-size: 10px; font-weight: 800; color: var(--brand); letter-spacing: .05em;
  text-transform: uppercase; margin-bottom: 4px;
}
.note .nb { font-size: 11px; color: var(--text-soft); font-weight: 600; line-height: 1.45; }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-line); color: #8a5a20; }
.alert-bad  { background: var(--bad-bg);  border-color: var(--bad-line);  color: #9a3228; }
.alert-good { background: var(--good-bg); border-color: var(--good-line); color: #1d6b3d; }
.alert-info { background: var(--info-bg); border-color: var(--info-line); color: var(--brand-dark); }
:root[data-theme="dark"] .alert-warn { color: var(--warn); }
:root[data-theme="dark"] .alert-bad  { color: var(--bad); }
:root[data-theme="dark"] .alert-good { color: var(--good); }
:root[data-theme="dark"] .alert-info { color: var(--info); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .alert-warn { color: var(--warn); }
  :root:not([data-theme="light"]) .alert-bad  { color: var(--bad); }
  :root:not([data-theme="light"]) .alert-good { color: var(--good); }
  :root:not([data-theme="light"]) .alert-info { color: var(--info); }
}

/* --------------------------------------------------------------------------
   Segmented control / scroll tabs
   -------------------------------------------------------------------------- */
.seg {
  display: inline-flex; background: var(--surface-3); border-radius: 11px;
  padding: 3px; gap: 2px; width: 100%;
}
.seg > button {
  flex: 1; padding: 8px 10px; border-radius: 8px; font-size: 12px; font-weight: 700;
  color: var(--text-soft); transition: background var(--dur-fast), color var(--dur-fast);
  -webkit-tap-highlight-color: transparent; white-space: nowrap;
}
.seg > button.on { background: var(--surface); color: var(--text); box-shadow: var(--sh-xs); }

/* Chips that scroll horizontally — used for filters, terms, subjects. */
.chiprow {
  display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 2px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chiprow::-webkit-scrollbar { display: none; }
.chiprow > button {
  flex-shrink: 0; padding: 6px 12px; border-radius: var(--r-pill);
  font-size: 10.5px; font-weight: 700; background: var(--surface);
  border: 1px solid var(--line); color: var(--text-soft);
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out);
}
.chiprow > button:active { transform: scale(.94); }
.chiprow > button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Tabs riding directly on a coloured header. */
.headtabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.headtabs::-webkit-scrollbar { display: none; }
.headtabs > button {
  flex-shrink: 0; font-size: 10.5px; font-weight: 700; padding: 6px 12px;
  border-radius: var(--r-pill); background: rgba(255,255,255,.18); color: #fff;
  -webkit-tap-highlight-color: transparent;
}
.headtabs > button.on { background: #fff; color: var(--brand-dark); }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 11.5px; font-weight: 700; color: var(--text-soft); }
.input, .select, .textarea {
  width: 100%; padding: 12px 13px; border-radius: 11px;
  background: var(--surface); border: 1.5px solid var(--line-strong);
  font-size: 14px; color: var(--text); font-weight: 500;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  -webkit-appearance: none; appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); font-weight: 500; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--brand) 16%, transparent);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239a9aae' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}
.field-hint { font-size: 10.5px; color: var(--text-faint); font-weight: 600; }
.field-err { font-size: 10.5px; color: var(--bad); font-weight: 700; }

/* Search input with a leading glyph. */
.searchbox {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1.5px solid var(--line-strong);
  border-radius: 12px; padding: 0 12px;
}
.searchbox input {
  flex: 1; border: none; outline: none; background: none;
  padding: 11px 0; font-size: 14px; font-weight: 500;
}
.searchbox.on-header { background: rgba(0,0,0,.15); border-color: transparent; }
.searchbox.on-header input { color: #fff; }
.searchbox.on-header input::placeholder { color: rgba(255,255,255,.7); }

/* Toggle switch */
.switch {
  width: 44px; height: 26px; border-radius: var(--r-pill);
  background: var(--surface-3); position: relative; flex-shrink: 0;
  transition: background var(--dur) var(--ease-out);
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,.25);
  transition: transform var(--dur) var(--ease-spring);
}
.switch.on { background: var(--good); }
.switch.on::after { transform: translateX(18px); }

/* Radio / choice card */
.choice {
  display: flex; align-items: center; gap: 11px; padding: 12px;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); -webkit-tap-highlight-color: transparent;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.choice.on { border-color: var(--brand); background: var(--brand-soft); }
.choice .tick {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.choice.on .tick { border-color: var(--brand); background: var(--brand); color: #fff; }

/* --------------------------------------------------------------------------
   Tables — desktop keeps a table, phones get stacked cards (see mobile.css)
   -------------------------------------------------------------------------- */
.tablewrap {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sh-sm);
}
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-size: 10.5px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-faint);
  padding: 11px 13px; background: var(--surface-2); white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.data td { padding: 11px 13px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background var(--dur-fast); }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }

/* A genuine matrix (timetable, attendance grid) keeps horizontal scroll. */
.matrix { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.matrix table { min-width: 640px; }

/* --------------------------------------------------------------------------
   Avatar
   -------------------------------------------------------------------------- */
.avatar {
  border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; color: #fff; flex-shrink: 0;
  width: 38px; height: 38px; font-size: 13px; letter-spacing: -.01em;
}
.avatar.sm { width: 30px; height: 30px; font-size: 11px; border-radius: 9px; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; border-radius: 17px; }
.avatar.xl { width: 76px; height: 76px; font-size: 25px; border-radius: 22px; }
.avatar.round { border-radius: 50%; }
.avatar.glass { background: rgba(255,255,255,.2); border: 1.5px solid rgba(255,255,255,.5); }
.avatar.has-photo { overflow: hidden; background: var(--surface-2); }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Edit-profile photo picker: a big tappable circle over the current avatar. */
.photo-pick { position: relative; display: inline-flex; flex-shrink: 0; }
.photo-pick input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-pick .photo-pick-badge {
  position: absolute; right: -2px; bottom: -2px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface); pointer-events: none;
}

/* --------------------------------------------------------------------------
   Empty / loading states
   -------------------------------------------------------------------------- */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 40px 24px; text-align: center;
}
.empty .ei {
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--surface-2); color: var(--text-faint);
  display: flex; align-items: center; justify-content: center;
}
.empty .et { font-weight: 700; font-size: 14px; color: var(--text); }
.empty .es { font-size: 12.5px; color: var(--text-faint); max-width: 40ch; line-height: 1.5; }

.skel {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 260% 100%; animation: skelshift 1.15s linear infinite;
  border-radius: 8px;
}
@keyframes skelshift { from { background-position: 130% 0; } to { background-position: -130% 0; } }
.skel-line { height: 11px; }
.skel-card { height: 76px; border-radius: var(--r-md); }

/* Spinner used in payment / submit flows */
.spin {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--surface-3); border-top-color: var(--brand);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Timeline (fee ledger, audit trail, attendance history)
   -------------------------------------------------------------------------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px;
  width: 2px; background: var(--line); border-radius: 2px;
}
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ''; position: absolute; left: -22px; top: 5px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--brand);
}
.tl-item.good::before { border-color: var(--good); }
.tl-item.bad::before  { border-color: var(--bad); }
.tl-item.muted::before { border-color: var(--line-strong); }

/* --------------------------------------------------------------------------
   Attendance marking controls (teacher roster)
   -------------------------------------------------------------------------- */
.attbtns { display: flex; gap: 5px; flex-shrink: 0; }
.attbtn {
  width: 34px; height: 32px; border-radius: 9px;
  border: 1.5px solid var(--line-strong); background: var(--surface);
  font-size: 12px; font-weight: 800; color: var(--text-faint);
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast);
}
.attbtn:active { transform: scale(.88); }
.attbtn.on-P  { background: var(--good); border-color: var(--good); color: #fff; }
.attbtn.on-A  { background: var(--bad);  border-color: var(--bad);  color: #fff; }
.attbtn.on-L  { background: var(--warn); border-color: var(--warn); color: #fff; }
.attbtn.on-LV { background: var(--info); border-color: var(--info); color: #fff; }

/* Month heat grid */
.heat { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.heat-cell {
  aspect-ratio: 1; border-radius: 7px; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; background: var(--surface-3); color: var(--text-faint);
}
.heat-P { background: var(--good); color: #fff; }
.heat-A { background: var(--bad); color: #fff; }
.heat-L { background: var(--warn); color: #fff; }
.heat-LV{ background: var(--info); color: #fff; }
.heat-H { background: var(--surface-3); color: var(--text-faint); }

/* --------------------------------------------------------------------------
   Chat / AI assistant bubbles
   -------------------------------------------------------------------------- */
.bubbles { display: flex; flex-direction: column; gap: 10px; }
.bub { max-width: 84%; padding: 10px 13px; border-radius: 16px; font-size: 13px; line-height: 1.5; }
.bub-me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 5px; }
.bub-ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; box-shadow: var(--sh-xs); }
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); animation: bounce 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* --------------------------------------------------------------------------
   Money hero — the gradient balance card on every fees screen
   -------------------------------------------------------------------------- */
.moneycard {
  border-radius: var(--r-xl); padding: 16px 18px; color: #fff;
  background: var(--grad-accent);
  box-shadow: 0 26px 44px -30px var(--accent);
  position: relative; overflow: hidden;
}
.moneycard::after {
  content: ''; position: absolute; right: -34px; top: -46px;
  width: 150px; height: 150px; border-radius: 50%;
  background: rgba(255,255,255,.12);
}
.moneycard .lab { font-size: 11.5px; opacity: .9; font-weight: 600; }
.moneycard .amt { font-family: var(--font-display); font-weight: 800; font-size: 28px; letter-spacing: -.025em; margin: 3px 0 2px; }
.moneycard .due { font-size: 10.5px; opacity: .9; font-weight: 600; }

/* Receipt look for a paid invoice */
.receipt {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px; box-shadow: var(--sh-sm);
}
.receipt .r-line { display: flex; justify-content: space-between; font-size: 12.5px; padding: 5px 0; }
.receipt .r-line b { font-variant-numeric: tabular-nums; }
.receipt .r-total { border-top: 1.5px dashed var(--line-strong); margin-top: 6px; padding-top: 9px; font-weight: 800; }

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */
.divider { height: 1px; background: var(--line); margin: 14px 0; border: none; }
.hr-label { display: flex; align-items: center; gap: 10px; color: var(--text-faint); font-size: 11px; font-weight: 700; }
.hr-label::before, .hr-label::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.scrollx { display: flex; gap: 9px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.scrollx::-webkit-scrollbar { display: none; }
.snapx { scroll-snap-type: x mandatory; }
.snapx > * { scroll-snap-align: start; }

.chartbox { position: relative; width: 100%; }
.chartbox canvas { display: block; width: 100% !important; }


/* --------------------------------------------------------------------------
   Marks sheet — the fixed-column table on the report / grade card
   -------------------------------------------------------------------------- */
.marks {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 6px 12px 10px; box-shadow: var(--sh-sm);
}
.marks .mh {
  display: flex; padding: 8px 0 7px; border-bottom: 1.5px solid var(--track);
}
.marks .mh span {
  font-size: 9px; font-weight: 800; letter-spacing: .05em;
  text-transform: uppercase; color: #a0a0b4;
}
.marks .mr {
  display: flex; align-items: center; padding: 8px 0;
  border-bottom: 1px solid var(--divider-soft);
}
.marks .mr:last-child { border-bottom: none; }
.marks .c-sub { flex: 1; min-width: 0; font-size: 11px; font-weight: 700; color: var(--text); }
.marks .c-n { width: 34px; text-align: center; font-size: 11px; font-weight: 600; color: var(--text-soft); }
.marks .c-n.narrow { width: 30px; }
.marks .c-tot { width: 36px; text-align: center; font-size: 11px; font-weight: 800; color: var(--text); }
.marks .c-gr { width: 34px; text-align: center; }

/* --------------------------------------------------------------------------
   Roster row — one tappable status chip, border tinted by state
   -------------------------------------------------------------------------- */
.rrow {
  background: var(--surface); border-radius: var(--r-md); padding: 8px 10px;
  display: flex; align-items: center; gap: 9px; box-shadow: var(--sh-xs);
  border: 1.5px solid var(--line);
  -webkit-tap-highlight-color: transparent; width: 100%; text-align: left;
  transition: border-color var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
.rrow:active { transform: scale(.985); }
.rrow .rn { font-weight: 700; font-size: 12px; color: var(--text); }
.rrow .rr { font-size: 9px; color: #a0a0b4; font-weight: 600; }
.rrow .rmark {
  font-size: 9.5px; font-weight: 800; padding: 5px 9px; border-radius: 8px;
  min-width: 24px; text-align: center; flex-shrink: 0;
}
.rrow.st-P  { border-color: var(--good-line); }
.rrow.st-P  .rmark { background: var(--good-bg); color: var(--good); }
.rrow.st-A  { border-color: var(--bad-line); }
.rrow.st-A  .rmark { background: var(--bad-bg); color: var(--bad); }
.rrow.st-L  { border-color: var(--warn-line); }
.rrow.st-L  .rmark { background: var(--warn-bg); color: var(--warn); }
.rrow.st-LT { border-color: var(--warn-line); }
.rrow.st-LT .rmark { background: var(--warn-bg); color: var(--warn); }
.rrow.st-LV { border-color: var(--info-line); }
.rrow.st-LV .rmark { background: var(--info-bg); color: var(--info); }

/* Round identity avatar used in rosters and defaulter lists. */
.av-round {
  border-radius: 50%; color: #fff; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 700;
  width: 30px; height: 30px; font-size: 11px; flex-shrink: 0;
}
.av-round.lg { width: 36px; height: 36px; font-size: 12px; }

/* --------------------------------------------------------------------------
   Distribution bars — the small column chart drawn without a chart library
   -------------------------------------------------------------------------- */
.dist { display: flex; align-items: flex-end; gap: 6px; height: 56px; }
.dist > div {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  height: 100%; justify-content: flex-end;
}
.dist .db { width: 100%; border-radius: 4px 4px 0 0; min-height: 3px; }
.dist .dl { font-size: 8.5px; font-weight: 700; color: var(--text-faint); }
.dist.tall { height: 150px; gap: 14px; }
.dist.tall .dl { font-size: 10px; font-weight: 600; }

/* --------------------------------------------------------------------------
   Gateway buttons on the fee card — brand swatch + name, on white
   -------------------------------------------------------------------------- */
.paybtns { display: flex; gap: 9px; margin-top: 14px; }
.paybtn {
  flex: 1; background: #fff; color: #16161f; border-radius: var(--r-btn);
  padding: 9px; display: flex; align-items: center; justify-content: center;
  gap: 6px; font-weight: 700; font-size: 11.5px;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out);
}
.paybtn:active { transform: scale(.96); }
.paybtn .sw { width: 16px; height: 16px; border-radius: 5px; flex-shrink: 0; }

/* --------------------------------------------------------------------------
   Legend row — coloured key beside a donut
   -------------------------------------------------------------------------- */
.legend { display: flex; flex-direction: column; gap: 9px; flex: 1; }
.legend .lg-row { display: flex; align-items: center; gap: 8px; }
.legend .lg-sw { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend .lg-l { font-size: 11.5px; font-weight: 600; color: var(--text-soft); flex: 1; }
.legend .lg-v { font-size: 11.5px; font-weight: 800; color: var(--text); }


/* Static meta chips inside a subject card — grey, not interactive. */
.metachips { display: flex; gap: 6px; flex-wrap: wrap; }
.metachips > span {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9.5px; font-weight: 700; color: #6a6a80;
  background: var(--fill); padding: 4px 8px; border-radius: var(--r-pill);
}
