/* The NextFound Academics platform console: the operations app NextFound's own staff run the platform from.
 *
 * Layout: a navy sidebar (sections: Overview, Administration, Resources) beside the app, which has a white top
 * bar (find a school, the environment badge, "New school", the account menu) above the page. On narrow screens
 * the sidebar slides in over the page (body.nav-open, toggled by interactions.js's data-toggle-class).
 *
 * Colour: navy #0F1A2B carries structure, red #E23B2E marks what matters (where you are, the main call to
 * action, anything needing attention); status colours are reserved for status and always come with a word.
 * Type: Outfit for headings and figures, Inter for interface text, JetBrains Mono for codes and addresses,
 * all self-hosted (static/fonts/nextfound.css) because the Content-Security-Policy allows no outside font.
 *
 * docs.css builds on this file and re-declares a few of these custom properties, and console templates read
 * some of them inline, so keep the token names stable.
 */
:root {
  --navy: #0F1A2B;
  --navy-2: #16233A;
  --navy-3: #22314B;
  --brand-red: #E23B2E;
  --red-deep: #C12E22;
  --red-soft: #FDECEA;
  --paper: #F4F5F7;        /* app ground: a cool, quiet grey so cards and data lead */
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --ink: #0F1A2B;
  --ink-soft: #344054;
  --muted: #667085;
  --muted-mono: #7A8394;
  --rule: #E4E7EC;
  --rule-strong: #D0D5DD;
  --blue: #0F1A2B;
  --red: #E23B2E;
  --teal: #B8291E;         /* links: a deeper red that reads on white */
  --ok: #067647;
  --ok-soft: #E7F6EC;
  --warn: #93370D;
  --warn-soft: #FEF0C7;
  --bad: #C62F23;
  --bad-soft: #FEECEB;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px -6px rgba(16, 24, 40, .16), 0 4px 8px -4px rgba(16, 24, 40, .06);
  --serif: "Outfit", "Inter", "Segoe UI", system-ui, sans-serif;     /* display: headings and figures */
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --rail-w: 264px;
  --top-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 14.5px/1.55 var(--sans); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.02em; margin: 0; color: var(--ink); }
h2 { font-size: 1.22rem; margin: 2.2rem 0 .8rem; }
h3 { font-size: 1.04rem; }
code, .mono { font-family: var(--mono); font-size: .85em; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ================================================================ the shell */
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }

/* ---------- the sidebar ---------- */
.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  padding: 0 14px 18px; color: #fff; z-index: 40;
  background: linear-gradient(180deg, var(--navy) 0%, #0A1320 100%);
}
.rail-head { display: flex; align-items: center; justify-content: space-between; height: var(--top-h); padding: 0 8px; }
.rail-logo { display: block; }
.rail-logo img { display: block; height: 26px; width: auto; }
.rail-close { display: none; }
.rail-product {
  margin: 4px 8px 22px; padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .08); font: 500 .74rem/1.2 var(--mono); letter-spacing: .06em;
  text-transform: uppercase; color: rgba(255, 255, 255, .7);
}
.rail-body { display: flex; flex-direction: column; flex: 1; }
.rail-label {
  font: 600 .66rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .4);
  margin: 18px 12px 8px;
}
.rail-label:first-child { margin-top: 0; }
.rail nav { display: grid; gap: 2px; }
.rail nav a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px;
  color: rgba(255, 255, 255, .74); text-decoration: none; font: 500 .9rem/1.3 var(--sans);
  transition: background .12s, color .12s;
}
.rail nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.rail nav a[aria-current="page"] { background: rgba(255, 255, 255, .09); color: #fff; font-weight: 600; }
.rail nav a[aria-current="page"]::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--red);
}
.rail nav a[aria-current="page"] .i { stroke: var(--red); }
.rail-foot {
  margin-top: auto; padding: 16px 12px 0; border-top: 1px solid rgba(255, 255, 255, .08);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.rail-version { font-size: .74rem; color: rgba(255, 255, 255, .45); }
.scrim { display: none; }

/* ---------- the sidebar folded to its icons (html.rail-folded, static/platform-rail.js; wide screens only) ---------- */
.rail-logo-mark { display: none; }
/* the fold button: round, on the line between the sidebar and the page, near the foot */
.rail-fold {
  position: fixed; left: calc(var(--rail-w) - 15px); bottom: 22px; z-index: 45;
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0; cursor: pointer;
  border: 1px solid var(--rule-strong); border-radius: 50%; background: var(--surface); color: var(--ink-soft);
  box-shadow: 0 2px 6px rgba(16, 24, 40, .14), 0 0 0 3px var(--paper);
  transition: left .2s ease, background .12s, color .12s, border-color .12s;
}
.rail-fold:hover, .rail-fold:focus-visible { background: var(--navy); border-color: var(--navy); color: #fff; outline: none; }
.rail-fold:focus-visible { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--red); }
.rail-fold .i { width: 16px; height: 16px; transform: rotate(90deg); transition: transform .2s; }
@media (min-width: 1025px) {
  .shell { transition: grid-template-columns .2s ease; }
  .rail-folded .rail-fold { left: calc(76px - 15px); }
  .rail-folded .shell { grid-template-columns: 76px minmax(0, 1fr); }
  .rail-folded .rail { padding: 0 12px 18px; }
  .rail-folded .rail-head { justify-content: center; padding: 0; }
  .rail-folded .rail-logo-full, .rail-folded .rail-product, .rail-folded .rail-version { display: none; }
  .rail-folded .rail-logo-mark { display: block; width: 30px; height: 30px; }
  .rail-folded .rail-fold .i { transform: rotate(-90deg); }
  .rail-folded .rail-label { height: 1px; margin: 14px 6px 10px; overflow: hidden; color: transparent; background: rgba(255, 255, 255, .1); }
  .rail-folded .rail-label:first-child { margin-top: 4px; }
  .rail-folded .rail nav a { justify-content: center; padding: 10px 0; }
  .rail-folded .rail nav a[aria-current="page"]::before { left: -12px; }
  /* the name stays for screen readers; sighted people get it as a label beside the icon (below) or a tooltip */
  .rail-folded .rail nav a > span {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .rail-folded .rail-count {
    position: absolute; top: 5px; right: 12px; min-width: 0; width: 10px; height: 10px; padding: 0; font-size: 0;
    border: 2px solid var(--navy);
  }
  .rail-folded .rail-foot { justify-content: center; padding: 14px 0 0; }
  .rail-folded .rail-foot .env { width: 12px; height: 12px; padding: 0; font-size: 0; justify-content: center; }
  .rail-folded .rail-foot .env::before { width: 8px; height: 8px; }
}
/* The label beside a folded link, on hover and keyboard focus, wherever the folded sidebar is tall enough not to
   scroll: a label outside a scrolling box would be cut off, so a shorter screen keeps the link's own tooltip. */
@media (min-width: 1025px) and (min-height: 760px) {
  .rail-folded .rail { overflow: visible; }
  .rail-folded .rail nav a > span {
    left: calc(100% + 12px); top: 50%; z-index: 50; width: auto; height: auto; overflow: visible; clip: auto;
    padding: 6px 10px; border-radius: 7px; background: var(--navy-3); color: #fff; font-size: .8rem; font-weight: 500;
    box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transform: translate(-4px, -50%);
    transition: opacity .12s, transform .12s;
  }
  .rail-folded .rail nav a:hover > span, .rail-folded .rail nav a:focus-visible > span { opacity: 1; transform: translate(0, -50%); }
}
@media (max-width: 1024px) { .rail-fold { display: none; } }

/* ---------- the environment badge ---------- */
.env {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px;
  font: 600 .7rem/1.4 var(--sans); letter-spacing: .02em; white-space: nowrap;
}
.env::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.env-production { color: var(--bad); background: var(--bad-soft); }
.env-development { color: var(--warn); background: var(--warn-soft); }
.rail .env-production { color: #FFB4AE; background: rgba(226, 59, 46, .18); }
.rail .env-development { color: #FEDF89; background: rgba(254, 223, 137, .12); }

/* ---------- the app: top bar and page ---------- */
.app { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; height: var(--top-h);
  padding: 0 clamp(16px, 3vw, 36px); background: rgba(255, 255, 255, .94); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.topbar-menu {
  display: none; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--rule-strong); border-radius: 9px; background: var(--surface); color: var(--ink); cursor: pointer;
}
.topbar-search { position: relative; flex: 1; max-width: 460px; margin: 0; }
.topbar-search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 17px; height: 17px; }
.topbar-search input[type=search] { padding: 9px 12px 9px 38px; background: var(--surface-2); border-color: var(--rule); }
.topbar-search input[type=search]:focus { background: #fff; }
.topbar-end { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.topbar-create .i { width: 16px; height: 16px; }

.account { position: relative; }
.account > summary {
  display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 10px; cursor: pointer; list-style: none;
  border: 1px solid transparent;
}
.account > summary::-webkit-details-marker { display: none; }
.account > summary:hover, .account[open] > summary { background: var(--surface-2); border-color: var(--rule); }
.account > summary .i { width: 16px; height: 16px; color: var(--muted); }
.account-who { display: grid; line-height: 1.2; }
.account-who b { font-weight: 600; font-size: .86rem; }
.account-who small { margin: 0; }
.avatar {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--navy); color: #fff; font: 600 .78rem/1 var(--sans); letter-spacing: .02em; flex: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--red);
}
.avatar-lg { width: 42px; height: 42px; font-size: .9rem; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 260px; padding: 8px; z-index: 50;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.account-card { display: flex; gap: 12px; align-items: center; padding: 10px 10px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--rule); }
.account-menu a, .account-menu .linklike {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px;
  color: var(--ink-soft); text-decoration: none; font: 500 .88rem/1.2 var(--sans); text-align: left;
}
.account-menu a:hover, .account-menu .linklike:hover { background: var(--surface-2); color: var(--ink); }
.account-menu .i { width: 16px; height: 16px; color: var(--muted); }
.account-menu form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--rule); }
.me-name { font: 600 .92rem/1.25 var(--sans); color: var(--ink); }
.me-role { font: 500 .72rem/1.3 var(--sans); color: var(--muted); margin-top: 2px; }
.me-role.is-super { color: var(--red-deep); }
.linklike {
  background: none; border: 0; padding: 0; font: inherit; font-size: .88rem; color: var(--teal);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.account-menu .linklike { text-decoration: none; cursor: pointer; }

.main { padding: 32px clamp(16px, 3vw, 36px) 80px; min-width: 0; width: 100%; max-width: 1440px; }

/* ================================================================ page furniture */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 1.25rem; flex-wrap: wrap;
  margin-bottom: 26px;
}
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.eyebrow {
  display: flex; align-items: center; gap: 8px;
  font: 600 .72rem/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--red-deep); margin-bottom: 10px;
}
.eyebrow::before { content: ""; width: 14px; height: 2px; border-radius: 2px; background: var(--red); }
.page-head h1 { font-size: clamp(1.6rem, 2.6vw, 2.05rem); line-height: 1.12; font-weight: 600; letter-spacing: -.025em; }
.page-head .lede { color: var(--muted); margin: 6px 0 0; max-width: 46rem; }
.crumb { font: 500 .8rem/1 var(--sans); margin: 0 0 16px; color: var(--muted); }
.crumb a { text-decoration: none; color: var(--muted); }
.crumb a:hover { color: var(--red-deep); }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 9px;
  border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink-soft);
  font: 600 .86rem/1.25 var(--sans); cursor: pointer; text-decoration: none; box-shadow: var(--shadow-sm);
  transition: background .12s, color .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--rule-strong); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-deep); border-color: var(--red-deep); color: #fff; }
.btn-danger { border-color: #FDA29B; color: var(--bad); background: var(--surface); }
.btn-danger:hover { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: .8rem; border-radius: 8px; white-space: nowrap; }
.btn:focus-visible, .linklike:focus-visible, a:focus-visible, .chip:focus-visible, summary:focus-visible, button:focus-visible {
  outline: 2px solid var(--red); outline-offset: 2px;
}

label { display: block; margin: 1rem 0 .35rem; font-weight: 600; font-size: .85rem; color: var(--ink-soft); }
label .hint, .hint { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; margin-top: 2px; }
input[type=text], input[type=password], input[type=email], input[type=search], input[type=number], input[type=url],
input[type=tel], input[type=date], input[type=datetime-local], textarea, select {
  width: 100%; padding: 9px 12px; background: #fff; color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: 9px; font: inherit; box-shadow: var(--shadow-sm);
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: #98A2B3; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 4px rgba(226, 59, 46, .14); }
textarea { min-height: 5.5rem; resize: vertical; }
input[type=color] {
  width: 3.4rem; height: 2.5rem; padding: 3px; background: #fff; border: 1px solid var(--rule-strong);
  border-radius: 9px; cursor: pointer;
}
input[type=file] { width: 100%; padding: 10px; background: #fff; color: var(--muted); border: 1px dashed var(--rule-strong); border-radius: 9px; font: inherit; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--red); }
details summary { cursor: pointer; color: var(--muted); margin: .8rem 0; }

/* ---------- surfaces ---------- */
.panel, .card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.panel h2:first-child, .card h2:first-child { margin-top: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 1.06rem; }
.card-sub { margin: 3px 0 0; color: var(--muted); font-size: .82rem; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }
.inline { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.inline > div { flex: 1; min-width: 200px; }
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state img { display: block; margin: 0 auto 14px; }
.empty-state p { max-width: 34rem; margin-left: auto; margin-right: auto; }

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
th { font: 600 .72rem/1.3 var(--sans); letter-spacing: .02em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tbody tr { transition: background .1s; }
tbody tr:hover td { background: #FAFBFC; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); }
.table-wrap > table tr:last-child td { border-bottom: 0; }
.panel .table-wrap, .card .table-wrap { border-radius: 10px; box-shadow: none; }
.card > .table-wrap { margin: 0 -22px -20px; border-width: 1px 0 0; border-radius: 0 0 var(--radius) var(--radius); }
td.muted, td.num, td .pill { white-space: nowrap; }
.card > .table-wrap:first-child { margin-top: -20px; border-top-width: 0; border-radius: var(--radius); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 99px;
  font: 600 .74rem/1.5 var(--sans); background: #F2F4F7; color: var(--ink-soft);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-active, .pill-ok { color: var(--ok); background: var(--ok-soft); }
.pill-suspended, .pill-bad { color: var(--bad); background: var(--bad-soft); }
.pill-quiet { color: var(--muted); background: #F2F4F7; }
.pill-warn { color: var(--warn); background: var(--warn-soft); }
.tag {
  display: inline-block; white-space: nowrap; padding: 1px 8px; border: 1px solid currentColor; border-radius: 6px;
  font: 600 .7rem/1.5 var(--sans);
}
.tag-super { color: var(--red-deep); background: var(--red-soft); border-color: transparent; }
.tag-quiet { color: var(--muted); }
.tag-ok { color: var(--ok); }
.tag-warn { color: var(--warn); }
.tag-bad { color: var(--bad); }
.tag-critical { color: #fff; background: var(--bad); border-color: var(--bad); }

/* ---------- Settings: risk chips and effect badges ---------- */
.badge-restart {
  display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 600;
  color: var(--muted); text-transform: none; letter-spacing: 0;
}
.badge-restart::before { content: "\21bb"; font-size: .9em; }
.setting-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.setting-row:last-child { border-bottom: 0; }
.setting-name { font: 500 .86rem/1.3 var(--mono); color: var(--ink); }
.setting-purpose { color: var(--muted); font-size: .85rem; margin: 4px 0 0; max-width: 46rem; }
.setting-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.setting-value { text-align: right; flex: none; }
.setting-value .mono { display: block; max-width: 22rem; overflow-wrap: anywhere; }
.fact-grid { display: grid; grid-template-columns: 9.5rem 1fr; gap: 10px 18px; margin: 18px 0; }
.fact-grid dt { font: 500 .8rem/1.4 var(--sans); color: var(--muted); }
.fact-grid dd { margin: 0; }
.action-panel { padding: 18px 0; border-bottom: 1px solid var(--rule); }
.action-panel:last-child { border-bottom: 0; }
.action-panel h3 { margin: 0 0 4px; font-size: 1rem; }
.action-panel .muted { font-size: .85rem; }
.action-panel form { margin-top: 12px; display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.action-panel form > div { min-width: 200px; }
.action-panel form label { margin: 0 0 .3rem; }
.wizard-steps { counter-reset: step; list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 8px; }
.wizard-steps li { counter-increment: step; padding-left: 34px; position: relative; font-size: .88rem; color: var(--muted); min-height: 24px; line-height: 24px; }
.wizard-steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--rule-strong); color: var(--ink-soft); font: 600 .74rem/1 var(--sans); display: grid; place-items: center; background: var(--surface);
}
.wizard-steps li.done { color: var(--ink); }
.wizard-steps li.done::before { background: var(--ok); border-color: var(--ok); color: #fff; content: "\2713"; }

.flash, .errors {
  display: flex; flex-direction: column; padding: 12px 16px; border: 1px solid var(--rule); border-left-width: 4px; background: var(--surface);
  border-radius: 10px; margin-bottom: 16px; box-shadow: var(--shadow); font-size: .9rem;
}
.flash-success { border-left-color: var(--ok); }
.flash-error, .errors { border-left-color: var(--bad); background: #FFFBFA; }
.errors ul { margin: .3rem 0 0 1.1rem; padding: 0; }
.secret {
  display: block; padding: 14px 16px; margin: 12px 0; background: var(--navy); color: #fff; border-radius: 10px;
  border-left: 4px solid var(--red); font: 1.04rem/1.4 var(--mono); word-break: break-all; user-select: all;
}
.stat { display: inline-block; margin-right: 2rem; }
.stat b { display: block; font: 600 1.6rem/1.1 var(--serif); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { font: 500 .76rem var(--sans); color: var(--muted); }

/* ---------- branding controls (create a school, a school's page) ---------- */
.swatches { display: flex; gap: 26px; flex-wrap: wrap; align-items: flex-end; }
.preview { max-width: 26rem; margin-top: 14px; border: 1px solid var(--rule-strong); border-radius: 10px; overflow: hidden; }
.preview .bar { padding: 10px 14px; color: #fff; font-weight: 600; font-size: .9rem; }
.preview .body { padding: 12px 14px; background: #fff; }
.preview .body span { display: inline-block; padding: 5px 12px; border-radius: 6px; color: #fff; font-size: .82rem; font-weight: 600; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin: 10px 0; }
.thumbs figure { margin: 0; background: #fff; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.thumbs img { display: block; width: 100%; height: 90px; object-fit: cover; }
.thumbs figcaption { padding: 6px 9px; font-size: .78rem; }
.thumbs label { margin: 0; font-weight: 400; display: flex; gap: 6px; align-items: center; color: var(--muted); }

/* ================================================================ the dashboard */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi {
  display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-label { font: 500 .84rem/1.3 var(--sans); color: var(--muted); }
.kpi-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--rule); color: var(--ink-soft); }
.kpi-ico .i { width: 18px; height: 18px; }
.kpi-ico-ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.kpi-value { font: 600 2rem/1.1 var(--serif); letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--ink); margin-top: 4px; }
.kpi-value small { font-size: 1.25rem; color: var(--muted); font-weight: 500; }
.kpi-note { font-size: .8rem; color: var(--muted); }
.kpi-note em { font-style: normal; color: var(--bad); font-weight: 600; }
.kpi-lead { background: var(--navy); border-color: var(--navy); background-image: radial-gradient(circle at 100% 0%, rgba(226, 59, 46, .32), transparent 55%); }
.kpi-lead .kpi-label, .kpi-lead .kpi-note { color: rgba(255, 255, 255, .66); }
.kpi-lead .kpi-value { color: #fff; }
.kpi-lead .kpi-ico { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .12); color: #fff; }

/* the older figure strip, kept for any page still using it */
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.figure { padding: 18px 20px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); }
.figure b { display: block; font: 600 2rem/1.1 var(--serif); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.figure span { display: block; margin-top: 6px; font-size: .82rem; color: var(--muted); }
.figure em { font-style: normal; color: var(--bad); }

.dash { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.dash > *, .split > * { min-width: 0; }
.dash > .card { margin-bottom: 0; }
.dash-side { display: grid; gap: 18px; min-width: 0; }
.dash-side > * { min-width: 0; }
.dash-side .card { margin: 0; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input[type=search] { width: 260px; max-width: 100%; padding-top: 8px; padding-bottom: 8px; }
.toolbar select { width: auto; padding-top: 8px; padding-bottom: 8px; }
form.toolbar { margin: 0; }
.chips { display: inline-flex; gap: 2px; padding: 3px; background: #F2F4F7; border: 1px solid var(--rule); border-radius: 10px; }
.chip {
  background: none; border: 0; border-radius: 7px; padding: 5px 12px;
  font: 600 .8rem/1.2 var(--sans); color: var(--muted); cursor: pointer;
}
.chip:hover { color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.schools td { padding-top: 13px; padding-bottom: 13px; }
.school-cell { display: flex; align-items: center; gap: 12px; min-width: 14rem; }
.tile {
  width: 38px; height: 38px; flex: none; border-radius: 10px; display: grid; place-items: center; overflow: hidden;
  color: #fff; font: 600 .9rem var(--serif); background: var(--navy);
}
.tile img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.school-name { font-weight: 600; text-decoration: none; color: var(--ink); }
.school-name:hover { color: var(--red-deep); text-decoration: underline; }
.school-code { font-size: .76rem; color: var(--muted); }
.addr { font-family: var(--mono); font-size: .78rem; color: var(--ink-soft); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions form { margin: 0; }
.empty { padding: 44px 8px; text-align: center; color: var(--muted); }

/* portal status: one meter, and a legend that names each state in words */
.meter { display: flex; height: 10px; border-radius: 99px; background: var(--bad-soft); overflow: hidden; margin: 4px 0 16px; }
.meter-live { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.legend-list { margin: 0; display: grid; gap: 8px; }
.legend-list > div { display: flex; justify-content: space-between; align-items: center; font-size: .86rem; }
.legend-list dt { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); }
.legend-list dd { margin: 0; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-ok { background: var(--ok); }
.dot-bad { background: var(--bad); }
.dot-warn { background: #DC6803; }

/* largest schools: a single-series bar list (one hue, values in ink, the row is the hover target) */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.bars a {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 7px 8px; margin: 0 -8px; border-radius: 8px;
  text-decoration: none; color: var(--ink);
}
.bars a:hover { background: var(--surface-2); }
.bar-label { font-size: .85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-value { font-size: .85rem; font-weight: 600; color: var(--ink-soft); }
.bar-track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: #F2F4F7; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--navy); transition: background .12s; }
.bars a:hover .bar-fill { background: var(--red); }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: .86rem; }
.mini-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.mini-list a { flex: 1; min-width: 0; color: var(--ink); font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list a:hover { color: var(--red-deep); }
.mini-list .meta { color: var(--muted); font-size: .76rem; white-space: nowrap; }

section.side { margin-top: 20px; }
.side h2 { font-size: 1.06rem; margin: 0; }
aside.side h2 { font-size: 1.02rem; margin: 0 0 4px; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed-wide { columns: 2; column-gap: 40px; }
.feed-wide li { break-inside: avoid; }
.feed li { position: relative; padding: 11px 0 11px 20px; border-bottom: 1px solid var(--rule); font-size: .87rem; }
.feed li::before { content: ""; position: absolute; left: 2px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 2px var(--rule-strong); }
.feed li:last-child { border-bottom: 0; }
.feed li.muted { padding-left: 0; }
.feed li.muted::before { display: none; }
.feed .what { font-weight: 600; }
.feed .what.alert { color: var(--bad); }
.feed li:has(.what.alert)::before { box-shadow: 0 0 0 2px var(--red); background: var(--red-soft); }
.feed .meta { display: block; color: var(--muted); font: .76rem var(--mono); margin-top: 2px; }

/* ================================================================ activity */
.split { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; align-items: start; }
.picker { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.picker a {
  display: block; padding: 12px 16px; border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--ink);
  border-left: 3px solid transparent;
}
.picker a:last-child { border-bottom: 0; }
.picker a:hover { background: var(--surface-2); }
.picker a[aria-current="true"] { background: var(--red-soft); border-left-color: var(--red); }
.picker .who { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.picker .sub { display: block; font-size: .78rem; color: var(--muted); margin-top: 2px; }
.picker .removed .who { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.picker-h { font: 600 .7rem/1.3 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 22px 0 8px; }
.log-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 14px; }
.log-head h2 { margin: 0; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--rule); margin-bottom: 12px; }
.tabs a { padding: 10px 0; text-decoration: none; color: var(--muted); font: 600 .86rem/1 var(--sans); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="true"] { color: var(--ink); border-bottom-color: var(--red); }
.log td { vertical-align: top; }
.log .when { white-space: nowrap; color: var(--muted); font: .76rem var(--mono); }
.log td:nth-child(2) { min-width: 13.5rem; }
.log .what { display: block; font-weight: 600; }
.log .alert .what { color: var(--bad); }
.log .detail { color: var(--muted); font-size: .85rem; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; font-size: .88rem; color: var(--muted); }

/* ================================================================ create a school (school_new.html) */
/* The form in numbered sections on the left; a live preview and summary of what will be created on the right. */
.sn { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.sn-form { min-width: 0; }
.sn-step {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 22px 24px 24px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.sn-step-head { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 6px; }
.sn-step-head h2 { margin: 2px 0 0; font-size: 1.08rem; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.sn-step-head p { margin: 4px 0 0; color: var(--muted); font-size: .86rem; max-width: 44rem; }
.sn-num {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--navy); color: #fff; font: 600 .82rem/1 var(--serif);
}
.sn-optional {
  font: 600 .68rem/1.6 var(--sans); letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
  background: #F2F4F7; border-radius: 99px; padding: 1px 8px;
}
.sn-step > .hint, .sn-step .sn-grid .hint { margin-top: 6px; }
.sn-label { display: block; margin: 1rem 0 .35rem; font-weight: 600; font-size: .85rem; color: var(--ink-soft); }
.sn-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.sn-portal { font-size: .82em; }

/* the school code, with the portal domain it becomes part of */
.sn-affix {
  display: flex; align-items: stretch; background: #fff; border: 1px solid var(--rule-strong); border-radius: 9px;
  overflow: hidden; box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s;
}
.sn-affix:focus-within { border-color: var(--navy); box-shadow: 0 0 0 4px rgba(226, 59, 46, .14); }
.sn-affix input[type=text] { flex: 1; min-width: 8ch; border: 0; border-radius: 0; box-shadow: none; }
.sn-affix input[type=text]:focus { box-shadow: none; }
.sn-affix-end {
  display: flex; align-items: center; padding: 0 12px; max-width: 60%; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; background: var(--surface-2); border-left: 1px solid var(--rule); color: var(--muted); font-size: .84rem;
}

/* picture choosers: the native file input covers the whole box, so a click or a drop anywhere on it works */
.sn-drop {
  position: relative; display: flex; align-items: center; gap: 14px; min-height: 78px; margin: 0; padding: 14px;
  background: var(--surface-2); border: 1px dashed var(--rule-strong); border-radius: 10px; cursor: pointer;
  font-weight: 400; transition: border-color .12s, background .12s;
}
.sn-drop:hover { border-color: var(--navy); background: #fff; }
.sn-drop:focus-within { border-color: var(--navy); box-shadow: 0 0 0 4px rgba(226, 59, 46, .14); }
.sn-drop.has-file { border-style: solid; background: #fff; }
.sn-drop input[type=file] {
  position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; margin: 0; border: 0; opacity: 0; cursor: pointer;
}
.sn-drop-thumb {
  flex: none; display: grid; place-items: center; width: 48px; height: 48px; overflow: hidden;
  background: #fff; border: 1px solid var(--rule); border-radius: 8px;
}
.sn-drop-thumb:empty::before { content: "+"; font: 400 1.4rem/1 var(--sans); color: var(--muted); }
.sn-drop-thumb img { width: 100%; height: 100%; object-fit: contain; }
.sn-drop-thumb-wide:not(:empty) { display: flex; gap: 4px; width: auto; border: 0; background: none; }
.sn-drop-thumb-wide img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; border: 1px solid var(--rule); }
.sn-drop-text { display: grid; gap: 2px; min-width: 0; }
.sn-drop-text strong { font-size: .88rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn-drop-text span { font-size: .78rem; color: var(--muted); }

/* brand colours */
.sn-colours { display: flex; flex-wrap: wrap; gap: 12px; }
.sn-colour {
  display: flex; align-items: center; gap: 12px; margin: 0; padding: 8px 14px 8px 8px; cursor: pointer;
  background: #fff; border: 1px solid var(--rule); border-radius: 10px; font-weight: 400;
}
.sn-colour:hover { border-color: var(--rule-strong); }
.sn-colour input[type=color] { width: 40px; height: 40px; padding: 0; border: 0; border-radius: 8px; background: none; }
.sn-colour input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.sn-colour input[type=color]::-webkit-color-swatch { border: 1px solid rgba(15, 26, 43, .15); border-radius: 8px; }
.sn-colour span { display: grid; gap: 1px; }
.sn-colour strong { font-size: .86rem; color: var(--ink); }
.sn-colour code { font-size: .78rem; color: var(--muted); text-transform: uppercase; }
.sn-warn { margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-size: .84rem; }

/* question banks */
.sn-check {
  display: flex; gap: 12px; align-items: flex-start; margin: 14px 0 0; padding: 14px 16px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--rule); border-radius: 10px; font-weight: 400;
}
.sn-check input { margin-top: 3px; width: 16px; height: 16px; }
.sn-check strong { display: block; font-size: .9rem; color: var(--ink); }
.sn-check .hint { margin-top: 3px; }

/* advanced: where the database lives */
.sn-advanced { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow); }
.sn-advanced > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0; padding: 16px 22px;
  list-style: none; cursor: pointer; color: var(--ink);
}
.sn-advanced > summary::-webkit-details-marker { display: none; }
.sn-advanced > summary > span { display: grid; gap: 2px; }
.sn-advanced > summary strong { font-size: .95rem; }
.sn-advanced > summary .muted { font-size: .82rem; }
.sn-advanced > summary::after {
  content: ""; flex: none; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .15s; margin-right: 4px;
}
.sn-advanced[open] > summary { border-bottom: 1px solid var(--rule); }
.sn-advanced[open] > summary::after { transform: rotate(-135deg); }
.sn-advanced-body { padding: 6px 24px 24px; }
.sn-advanced-body > p { color: var(--ink-soft); font-size: .88rem; }
.sn-url { margin: 12px 0 4px; padding: 14px 16px; border-radius: 10px; background: var(--navy); color: #D5DBE5; font-size: .8rem; }
.sn-url-line { display: block; font: .84rem/1.6 var(--mono); color: #fff; overflow-wrap: anywhere; }
.sn-url ol { list-style: none; margin: 10px 0 0; padding: 10px 0 0; border-top: 1px solid rgba(255, 255, 255, .1); display: grid; gap: 4px; }
.sn-url li > span { font-weight: 600; }
.sn-url code { font-size: .78rem; }
.sn-url p { margin: 10px 0 0; color: rgba(255, 255, 255, .72); }
.sn-url p code { background: rgba(255, 255, 255, .1); color: #fff; padding: 1px 5px; border-radius: 4px; }
.sn-url .u-d { color: #98A2B3; }
.sn-url .u-u { color: #FFB4AE; }
.sn-url .u-p { color: #FEDF89; }
.sn-url .u-h { color: #9CD3FF; }
.sn-url .u-b { color: #A6E9C0; }

/* the actions stay in reach at the foot of the window while the form is long */
.sn-actions {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 8px; padding: 14px 0 16px; background: linear-gradient(180deg, rgba(244, 245, 247, 0) 0, var(--paper) 14px);
}
.sn-actions .muted { font-size: .82rem; }

/* the aside: portal preview and summary */
.sn-aside { position: sticky; top: calc(var(--top-h) + 20px); display: grid; gap: 16px; }
.sn-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.sn-card-title { font: 600 .72rem/1 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.sn-preview { max-width: none; margin: 0; border-radius: 10px; border-color: var(--rule); }
.sn-preview .bar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; font: 600 .92rem/1.2 var(--serif); min-width: 0; }
.sn-preview .bar #preview-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn-preview-logo { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: #fff; overflow: hidden; }
.sn-preview-logo[hidden] { display: none; }
.sn-preview-logo img { width: 100%; height: 100%; object-fit: contain; }
.sn-preview .body { display: grid; gap: 8px; padding: 14px; }
.sn-preview-line { display: block; height: 8px; border-radius: 4px; background: #EEF0F3; }
.sn-preview-line-short { width: 60%; }
.sn-preview .body #preview-button { justify-self: start; margin-top: 4px; }
.sn-summary { margin: 0; display: grid; gap: 12px; }
.sn-summary > div { display: grid; gap: 2px; }
.sn-summary dt { font-size: .76rem; font-weight: 600; color: var(--muted); }
.sn-summary dd { margin: 0; font-size: .86rem; color: var(--ink); overflow-wrap: anywhere; }
.sn-summary code { font-size: .8rem; }

@media (max-width: 1180px) {
  .sn { grid-template-columns: minmax(0, 1fr); }
  .sn-aside { position: static; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 640px) {
  .sn-step { padding: 18px 16px 20px; }
  .sn-step-head { gap: 12px; }
  .sn-grid { grid-template-columns: minmax(0, 1fr); }
  .sn-affix-end { max-width: 55%; font-size: .78rem; padding: 0 10px; }
  .sn-advanced-body { padding: 6px 16px 18px; }
  .sn-actions .btn { flex: 1; }
}

/* ================================================================ shared pieces of the newer pages */
.rail-count {
  margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 99px; background: var(--red); color: #fff;
  font: 700 .7rem/1.5 var(--sans); text-align: center; font-variant-numeric: tabular-nums;
}
.text-bad { color: var(--bad); font-weight: 600; }
.kpis-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-value-text { font-size: 1.3rem; line-height: 1.25; letter-spacing: -.015em; padding-top: 6px; }
.kpi-link { font: 600 .76rem/1 var(--sans); text-decoration: none; }
.kpi-link:hover { text-decoration: underline; }
.card-title-sm { font: 600 .72rem/1 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.plain-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; font-size: .88rem; }
.plain-list li { display: flex; gap: 10px; align-items: flex-start; }
.plain-list .i { width: 16px; height: 16px; margin-top: 3px; color: var(--ok); }
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.plain:disabled { opacity: .7; }
.check-line { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0; font-weight: 400; color: var(--ink-soft); }
.check-line input { margin-top: 4px; }
.check-row { display: flex; gap: 22px; flex-wrap: wrap; margin: 10px 0 14px; }
.stack-form textarea { margin-bottom: 0; }
.stack-form > p { margin: 10px 0 0; }
.form-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.form-row select { width: auto; min-width: 12rem; }
.inline-label { margin: 0; font-weight: 500; color: var(--muted); }
.spacer { flex: 1; }
.inline-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.add-block { margin-top: 14px; }
.add-block > summary { display: inline-flex; margin: 0; color: var(--ink-soft); list-style: none; }
.add-block > summary::-webkit-details-marker { display: none; }
.add-block > summary .i { width: 15px; height: 15px; }
.add-block[open] > summary { margin-bottom: 4px; }
.add-block form { padding: 4px 0 0; }
.add-row { margin-top: 18px; padding-top: 4px; border-top: 1px solid var(--rule); }
.add-row > div:last-child { display: flex; gap: 12px; align-items: center; }
.note-form { margin-bottom: 14px; }
.file-line { margin: 0 0 8px; }
.file-line a { display: inline-flex; gap: 6px; align-items: center; font-size: .86rem; }
.file-line .i { width: 15px; height: 15px; }
.logo-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.logo-box { flex: none; display: grid; place-items: center; width: 72px; height: 72px; padding: 6px; background: #fff; border: 1px solid var(--rule); border-radius: 10px; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.inline-confirm { position: relative; }
.inline-confirm > summary { list-style: none; margin: 0; display: inline-flex; }
.inline-confirm > summary::-webkit-details-marker { display: none; }
.inline-confirm form {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; width: 300px; padding: 14px; text-align: left;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; box-shadow: var(--shadow-lg);
}
.inline-confirm form label { margin: 0 0 8px; font-weight: 400; font-size: .84rem; }
.inline-confirm form input[type=text] { margin-bottom: 10px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--rule); }
.timeline li { position: relative; padding: 0 0 14px 4px; font-size: .87rem; }
.timeline li::before {
  content: ""; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 0 0 2px var(--rule-strong);
}
.timeline li.muted::before { display: none; }
.timeline li p { margin: 2px 0 0; white-space: pre-wrap; }
.timeline .meta { color: var(--muted); font: .74rem var(--mono); }
.timeline .tl-note::before { background: var(--red-soft); box-shadow: 0 0 0 2px var(--red); }
.timeline .tl-note p { padding: 8px 10px; background: #FFFBF5; border: 1px solid #F5E1C8; border-radius: 8px; margin-top: 4px; }
.meter-ink { background: #EEF0F3; margin: 0 0 14px; height: 8px; }
.meter-ink .meter-live { background: var(--navy); }
.info-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px; margin-bottom: 18px;
  background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.info-strip > div { display: grid; gap: 3px; padding: 14px 18px; background: var(--surface); min-width: 0; }
.info-strip span { font: 500 .76rem/1.3 var(--sans); color: var(--muted); }
.info-strip b { font-size: .88rem; font-weight: 600; overflow-wrap: anywhere; }
.info-strip b.mono { font-size: .8rem; font-weight: 500; }
.dash-wide-side { grid-template-columns: minmax(0, 1fr) 400px; }

/* alerts (Health, a school's overview) */
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.alert-item {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--rule);
  border-left: 3px solid var(--warn); border-radius: 10px; background: var(--surface-2);
}
.alert-critical { border-left-color: var(--bad); background: #FFFBFA; }
.alert-ico { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); }
.alert-critical .alert-ico { background: var(--bad-soft); color: var(--bad); }
.alert-ico .i { width: 16px; height: 16px; }
.alert-body { flex: 1; min-width: 0; }
.alert-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 600; font-size: .9rem; }
.alert-title a { color: var(--ink); }
.alert-body p { margin: 2px 0 4px; font-size: .86rem; color: var(--ink-soft); }
.alert-body .meta { font: .74rem var(--mono); color: var(--muted); }
.alert-item > form { margin: 0; flex: none; }

/* ---------- Team: the staff roles ---------- */
.role-guide { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.role-card {
  display: grid; gap: 4px; align-content: start; padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--rule); border-top: 3px solid var(--navy); border-radius: 10px; box-shadow: var(--shadow-sm);
}
.role-card b { font: 600 .92rem/1.25 var(--serif); }
.role-card span { font-size: .8rem; color: var(--muted); line-height: 1.45; }
.role-card-super { border-top-color: var(--red); }
.role-form { margin: 0; }
.role-form select { width: auto; min-width: 10.5rem; padding: 6px 10px; font-size: .84rem; }

/* ---------- a school's page ---------- */
.sh {
  display: flex; align-items: center; gap: 18px; margin-bottom: 20px; padding: 20px 22px; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow);
}
.sh-tile {
  flex: none; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 14px; overflow: hidden;
  background: var(--navy); color: #fff; font: 600 1.3rem/1 var(--serif); border: 1px solid var(--rule);
}
.sh-tile img { width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 6px; }
.sh-main { flex: 1; min-width: 0; }
.sh-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sh-title h1 { font-size: clamp(1.4rem, 2.3vw, 1.85rem); line-height: 1.15; letter-spacing: -.025em; }
.sh-meta { display: flex; gap: 6px 18px; flex-wrap: wrap; margin-top: 6px; font-size: .84rem; color: var(--muted); }
.sh-meta .mono { font-size: .8rem; }
.sh-actions { display: flex; gap: 10px; flex: none; }
.sh-actions form { margin: 0; }
.sh-actions .i { width: 16px; height: 16px; }
.page-tabs { margin: 0 0 20px; overflow-x: auto; scrollbar-width: none; }
.page-tabs::-webkit-scrollbar { display: none; }
.page-tabs a { white-space: nowrap; }
.danger-card { border-color: #FDA29B; }
.danger-card h2 { color: var(--bad); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; font-size: .86rem; }
.checklist li > form { margin: 0; width: 100%; }
.checklist small { display: block; font-size: .74rem; color: var(--muted); }
.ck {
  flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border-radius: 6px;
  border: 1.5px solid var(--rule-strong); background: #fff; color: #fff;
}
.ck .i { width: 13px; height: 13px; stroke-width: 2.6; }
.is-done .ck { background: var(--ok); border-color: var(--ok); }
.is-done > span:not(.ck), .is-done .ck-btn > span:not(.ck) { color: var(--ink); }
.checklist li:not(.is-done) { color: var(--ink-soft); }
.ck-btn {
  display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 0; border: 0; background: none;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.ck-btn:hover .ck { border-color: var(--navy); }

/* ---------- Activity ---------- */
.people { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); position: sticky; top: calc(var(--top-h) + 20px); max-height: calc(100vh - var(--top-h) - 40px); overflow-y: auto; }
.people .picker-h { margin: 14px 10px 6px; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; text-decoration: none; color: var(--ink); }
.person:hover { background: var(--surface-2); }
.person.is-current { background: var(--red-soft); }
.person-text { display: grid; min-width: 0; line-height: 1.3; }
.person-text b { font-size: .87rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-text small { font-size: .74rem; color: var(--muted); }
.person.is-removed b { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.avatar-sm { width: 30px; height: 30px; font-size: .7rem; box-shadow: none; }
.avatar-all { background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--rule); box-shadow: none; }
.avatar-all .i { width: 16px; height: 16px; }
.avatar-lg.avatar-all .i { width: 20px; height: 20px; }
.person.is-current .avatar-sm:not(.avatar-all) { background: var(--red); }
.log-card { padding-top: 22px; }
.log-who { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.log-who > div:not(.log-count) { flex: 1; min-width: 0; }
.log-who h2 { margin: 0; font-size: 1.15rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.log-who p { margin: 3px 0 0; font-size: .84rem; }
.log-count { flex: none; display: grid; text-align: right; line-height: 1.1; }
.log-count b { font: 600 1.6rem/1 var(--serif); letter-spacing: -.02em; }
.log-count span { font-size: .74rem; color: var(--muted); }
.daylog { list-style: none; margin: 4px 0 0; padding: 0; }
.day-head {
  position: sticky; top: var(--top-h); z-index: 2; margin: 14px 0 4px; padding: 6px 0;
  font: 600 .74rem/1.3 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  background: var(--surface); border-bottom: 1px solid var(--rule);
}
.day-head:first-child { margin-top: 0; }
.entry { display: grid; grid-template-columns: 3.4rem 14px minmax(0, 1fr); gap: 10px; padding: 8px 0; }
.entry-time { font: .76rem/1.6 var(--mono); color: var(--muted); text-align: right; }
.entry-dot { position: relative; }
.entry-dot::before { content: ""; position: absolute; left: 3px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 2px var(--rule-strong); }
.entry-dot::after { content: ""; position: absolute; left: 6px; top: 18px; bottom: -14px; width: 2px; background: var(--rule); }
.entry:has(+ .day-head) .entry-dot::after, .entry:last-child .entry-dot::after { display: none; }
.entry.is-alert .entry-dot::before { background: var(--red-soft); box-shadow: 0 0 0 2px var(--red); }
.entry.is-alert .entry-line b { color: var(--bad); }
.entry-body { min-width: 0; font-size: .87rem; }
.entry-line { display: flex; gap: 4px 10px; align-items: baseline; flex-wrap: wrap; }
.entry-school { font-size: .82rem; font-weight: 500; text-decoration: none; }
.entry-school:hover { text-decoration: underline; }
.entry-actor { font-size: .76rem; color: var(--ink-soft); background: #F2F4F7; border-radius: 6px; padding: 0 7px; }
.entry-detail { color: var(--muted); font-size: .84rem; margin-top: 1px; overflow-wrap: anywhere; }
.entry-ip { color: var(--muted-mono); font-size: .72rem; margin-top: 1px; }
.daylog .empty { list-style: none; }

/* ---------- Password ---------- */
.pw-layout { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 340px); gap: 20px; align-items: start; }
.pw-card { padding: 24px 26px 26px; }
.pw-meter { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.pw-bar { flex: 1; height: 6px; border-radius: 99px; background: #EEF0F3; overflow: hidden; }
.pw-bar > span { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--bad); transition: width .2s, background .2s; }
.pw-bar > span[data-level="fair"] { background: #DC6803; }
.pw-bar > span[data-level="strong"] { background: var(--ok); }
.pw-word { flex: none; min-width: 9rem; text-align: right; font: 500 .78rem/1 var(--sans); color: var(--muted); }
.pw-rules { list-style: none; margin: 18px 0 0; padding: 14px 16px; display: grid; gap: 7px; background: var(--surface-2); border: 1px solid var(--rule); border-radius: 10px; font-size: .84rem; color: var(--muted); }
.pw-rules li { display: flex; align-items: center; gap: 10px; }
.pw-rules li::before {
  content: ""; flex: none; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--rule-strong); background: #fff;
}
.pw-rules li.is-met { color: var(--ink); }
.pw-rules li.is-met::before {
  border-color: var(--ok); background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.3l2.2 2.2 4.8-5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.pw-aside h2 { font-size: 1rem; margin: 0; }
.pw-aside p { font-size: .86rem; margin: 6px 0 0; }

/* ---------- Analytics ---------- */
.vbars { display: flex; align-items: stretch; gap: 6px; height: 220px; padding-top: 6px; }
.vbar { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 4px; }
.vbar-track { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; min-height: 0; }
.vbar-fill { display: block; border-radius: 4px 4px 0 0; background: var(--navy-3); transition: background .12s; }
.vbar:hover .vbar-fill { background: var(--navy); }
.vbar.is-current .vbar-fill { background: repeating-linear-gradient(135deg, var(--navy-3) 0 4px, #4A5A75 4px 7px); }
.vbar-value { font: 600 .7rem/1 var(--sans); color: var(--ink-soft); text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.vbar-label { font: .68rem/1 var(--mono); color: var(--muted); text-align: center; padding-top: 6px; border-top: 1px solid var(--rule-strong); white-space: nowrap; overflow: hidden; }
a.chip { text-decoration: none; }
.spark { display: block; width: 120px; height: 28px; }
.spark polyline { stroke: var(--navy); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.adoption { display: inline-flex; gap: 3px; }
.adopt {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; border: 1px solid var(--rule);
  font: 600 .66rem/1 var(--sans); color: #98A2B3; background: var(--surface);
}
.adopt.is-on { background: var(--navy); border-color: var(--navy); color: #fff; }
.legend-note { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 0; font-size: .78rem; color: var(--muted); }
.legend-note b { color: var(--ink); }
.analytics-table td { white-space: nowrap; }
.risk-list .meta { color: var(--bad); white-space: normal; text-align: right; }

/* ---------- Announcements ---------- */
.notice-row {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; margin-bottom: 10px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid #3B82F6; border-radius: var(--radius); box-shadow: var(--shadow);
}
.notice-row:hover { border-color: var(--rule-strong); border-left-color: inherit; }
.notice-maintenance { border-left-color: #D97706; }
.notice-incident { border-left-color: var(--bad); }
.notice-row:hover.notice-info { border-left-color: #3B82F6; }
.notice-row:hover.notice-maintenance { border-left-color: #D97706; }
.notice-row:hover.notice-incident { border-left-color: var(--bad); }
.notice-kind { flex: none; width: 7.5rem; font: 600 .7rem/1.5 var(--sans); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.notice-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.notice-main b { font-size: .95rem; }
.notice-main .muted { font-size: .85rem; }
.notice-main .meta { font: .74rem var(--mono); color: var(--muted); }
.pn-preview { padding: 12px 16px; border-radius: 10px; border: 1px solid; font-size: .88rem; }
.pn-preview p { margin: 4px 0 0; white-space: pre-wrap; }
.pn-preview.pn-info { background: #EFF6FF; border-color: #BFDBFE; color: #1E3A8A; }
.pn-preview.pn-maintenance { background: #FFFBEB; border-color: #FCD34D; color: #78350F; }
.pn-preview.pn-incident { background: #FEF2F2; border-color: #FCA5A5; color: #7F1D1D; }
.pn-latest span { font-weight: 600; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-opt { position: relative; margin: 0; font-weight: 500; }
.seg-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-opt span {
  display: inline-block; padding: 7px 12px; border: 1px solid var(--rule-strong); border-radius: 9px; background: #fff;
  font-size: .82rem; color: var(--ink-soft); cursor: pointer;
}
.seg-opt input:checked + span { border-color: var(--navy); background: var(--navy); color: #fff; }
.seg-opt input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 2px; }
.seg-maintenance input:checked + span { background: #B45309; border-color: #B45309; }
.seg-incident input:checked + span { background: var(--bad); border-color: var(--bad); }
.school-picks { max-height: 220px; overflow-y: auto; margin-top: 10px; padding: 6px 12px; border: 1px solid var(--rule); border-radius: 9px; background: var(--surface-2); }
.school-picks .check-line { margin: 6px 0; }

/* ---------- Support ---------- */
.prio { font: 600 .76rem/1.4 var(--sans); white-space: nowrap; }
.prio::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 2px; background: currentColor; vertical-align: 0; }
.prio-low { color: var(--muted); }
.prio-normal { color: var(--ink-soft); }
.prio-high { color: var(--warn); }
.prio-urgent { color: var(--bad); }
.thread { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 12px; }
.msg { padding: 14px 16px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.msg-staff { border-left: 3px solid var(--navy); margin-left: 2.5rem; }
.msg-school { margin-right: 2.5rem; }
.msg-note { background: #FFFBF5; border-color: #F5E1C8; border-style: dashed; margin-left: 2.5rem; }
.msg-system { background: var(--surface-2); box-shadow: none; font-size: .84rem; color: var(--muted); }
.msg-head { display: flex; gap: 4px 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; font-size: .86rem; }
.msg-who { font-size: .76rem; color: var(--muted); }
.msg-note .msg-who { color: var(--warn); font-weight: 600; }
.msg-head .meta { margin-left: auto; font: .74rem var(--mono); color: var(--muted); }
.msg-body { white-space: pre-wrap; font-size: .9rem; line-height: 1.6; overflow-wrap: anywhere; }
.msg-shot img { display: block; margin-top: 10px; max-height: 280px; border: 1px solid var(--rule); border-radius: 8px; }

@media (max-width: 1200px) {
  .kpis-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .role-guide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .dash-wide-side { grid-template-columns: minmax(0, 1fr); }
  .people { position: static; max-height: none; }
  .pw-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .sh { flex-wrap: wrap; padding: 16px; gap: 14px; }
  .sh-tile { width: 52px; height: 52px; font-size: 1.05rem; }
  .sh-actions { width: 100%; }
  .sh-actions form, .sh-actions .btn { flex: 1; width: 100%; }
  .kpis-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .role-guide { grid-template-columns: minmax(0, 1fr); }
  .msg-staff, .msg-note { margin-left: 1rem; }
  .msg-school { margin-right: 1rem; }
  .notice-row { flex-wrap: wrap; }
  .notice-kind { width: auto; }
  .vbars { height: 170px; gap: 3px; }
  .vbar-value { display: none; }
  .entry { grid-template-columns: 2.9rem 14px minmax(0, 1fr); gap: 8px; }
  .log-who { flex-wrap: wrap; }
  .inline-confirm form { position: static; width: auto; margin-top: 8px; box-shadow: none; }
  .form-row .btn { flex: 1; }
  .form-row .spacer { display: none; }
}

/* ================================================================ the sign-in page */
.auth { display: grid; grid-template-columns: minmax(0, 11fr) minmax(0, 9fr); min-height: 100vh; }
.auth-art {
  position: relative; overflow: hidden; background: var(--navy); color: #fff;
  padding: clamp(28px, 5vw, 72px); display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
}
.auth-art::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at 85% 90%, rgba(226, 59, 46, .24), transparent 45%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .03) 0 1px, transparent 1px 80px);
}
.auth-star { position: absolute; width: min(56vw, 640px); right: -12%; bottom: -16%; pointer-events: none; }
.auth-star polygon { fill: none; stroke: rgba(255, 255, 255, .16); stroke-width: .6; }
.auth-art > :not(.auth-star) { position: relative; }
.auth-art .brand img { display: block; height: 30px; width: auto; }
.auth-art .kicker { font: 600 .74rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .62); display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.auth-art .kicker::before { content: ""; width: 28px; height: 2px; background: var(--red); }
.auth-art h2 { font: 700 clamp(2.3rem, 4.4vw, 3.8rem)/1.02 var(--serif); letter-spacing: -.035em; color: #fff; margin: 0; max-width: 13ch; }
.auth-art h2 em { font-style: normal; color: var(--red); }
.auth-art p { color: rgba(255, 255, 255, .7); max-width: 30rem; margin: 22px 0 0; font-size: 1.02rem; }
.auth-art small { color: rgba(255, 255, 255, .5); font-size: .78rem; }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: clamp(28px, 5vw, 80px); background: var(--surface); }
.auth-form .inner { width: 100%; max-width: 380px; margin: 0 auto; }
.auth-form .logo { display: block; height: 44px; width: auto; margin-bottom: 40px; }
.auth-form h1 { font-size: 2rem; font-weight: 600; letter-spacing: -.03em; }
.auth-form .lede { color: var(--muted); margin: 6px 0 26px; }
.auth-form input { padding: 11px 13px; }
.auth-form .btn { width: 100%; justify-content: space-between; padding: 13px 18px; margin-top: 24px; font-size: .95rem; border-radius: 10px; }
.auth-form .foot { margin: 30px 0 0; padding-top: 18px; border-top: 1px solid var(--rule); font-size: .82rem; color: var(--muted); }

/* ================================================================ narrow screens */
@media (max-width: 760px) {
  .table-wrap:has(.table-stack) { background: none; border: 0; box-shadow: none; border-radius: 0; margin: 0; }
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr {
    background: var(--surface); border: 1px solid var(--rule); border-radius: 10px;
    padding: 4px 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm);
  }
  .table-stack td {
    display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
    padding: 9px 0; border-bottom: 1px solid var(--rule); text-align: right;
  }
  .table-stack td:last-child { border-bottom: 0; }
  .table-stack td::before {
    content: attr(data-label); flex: none; text-align: left;
    font: 600 .7rem/1.3 var(--sans); letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
  }
  .table-stack td:not([data-label])::before, .table-stack td[data-label=""]::before { content: none; }
  .table-stack td:empty { display: none; }
  .table-stack tbody tr:hover td { background: none; }
  .card > .table-wrap:has(.table-stack) { margin: 0; }

  .setting-row { flex-direction: column; align-items: stretch; }
  .setting-value { text-align: left; }
  .setting-value .mono { max-width: none; }
  .fact-grid { grid-template-columns: 1fr; gap: 2px 0; }
  .fact-grid dt { margin-top: 10px; }
}
@media (max-width: 1200px) {
  .kpis, .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
  .dash-side { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .shell { display: block; }
  .rail {
    position: fixed; inset: 0 auto 0 0; width: min(86vw, var(--rail-w)); height: 100vh; transform: translateX(-102%);
    transition: transform .2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .3);
  }
  body.nav-open .rail { transform: none; }
  .rail-close {
    display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px;
    background: rgba(255, 255, 255, .08); color: #fff; cursor: pointer;
  }
  .scrim { position: fixed; inset: 0; z-index: 35; background: rgba(15, 26, 43, .5); }
  body.nav-open .scrim { display: block; }
  body.nav-open { overflow: hidden; }
  .topbar-menu { display: inline-flex; }
}
@media (max-width: 860px) {
  .account-who { display: none; }
  .account > summary > .i { display: none; }
  .topbar-create span { display: none; }
  .topbar-create { padding: 8px; }
  .topbar .env { display: none; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-actions .btn, .page-head > .btn, .page-head > a.btn, .page-head > form > .btn { flex: 1; }
  .feed-wide { columns: 1; }
  .card-head .toolbar { width: 100%; }
  .toolbar input[type=search] { width: 100%; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { gap: 28px; }
  .auth-star { width: 80vw; right: -24%; bottom: -26%; }
}
@media (max-width: 560px) {
  .main { padding: 22px 14px 60px; }
  .topbar { gap: 10px; padding: 0 12px; }
  .kpis, .figures { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 1.6rem; }
  .kpi-ico { display: none; }
  .panel, .card { padding: 16px; }
  .card > .table-wrap { margin: 0 -16px -16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Backups: storage used, against the limit (templates/platform/backups.html) */
.storage-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: center; }
.storage-figure b { display: block; font: 600 1.9rem/1.1 var(--serif); letter-spacing: -.03em; }
.storage-figure span { font-size: .82rem; color: var(--muted); }
.storage-meter .meter { margin: 0 0 8px; }
.storage-meter p { margin: 0; font-size: .84rem; }
.keep-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 18px 0 0; background: var(--rule); border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.keep-list > div { background: var(--surface-2); padding: 10px 14px; }
.keep-list dt { font-size: .76rem; color: var(--muted); }
.keep-list dd { margin: 2px 0 0; font: 600 1.1rem/1.2 var(--serif); }
@media (max-width: 760px) { .storage-row { grid-template-columns: 1fr; } .keep-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ================================================================ a school's page: small forms that open from a row */
/* Edit a contact (Account tab) opens as a panel under its button. */
.contact-edit { position: relative; }
.contact-edit > summary { list-style: none; }
.contact-edit > summary::-webkit-details-marker { display: none; }
.contact-edit[open] > summary { background: var(--surface-2); border-color: var(--navy); }
.contact-edit > form {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: min(440px, 86vw); padding: 4px 16px 16px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; box-shadow: var(--shadow-lg); text-align: left;
}
.billing-who { display: grid; gap: 2px; font-size: .88rem; }
.billing-who + .billing-who { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--rule); }
.billing-who a { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .contact-edit > form { position: static; width: 100%; margin-top: 8px; box-shadow: none; }
  .row-actions { flex-wrap: wrap; justify-content: flex-start; }
}

/* ---------- a pop-up over the page (<dialog class="pop">, opened by interactions.js's data-modal-open) ---------- */
dialog.pop {
  width: min(500px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; overflow: auto;
  border: 0; border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 64px -12px rgba(15, 26, 43, .45);
}
dialog.pop[open] { animation: pop-in .18s ease-out; }
dialog.pop::backdrop { background: rgba(15, 26, 43, .55); backdrop-filter: blur(2px); }
.pop-body { margin: 0; padding: 22px 24px 20px; }
.pop-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 4px; }
.pop-head > div { flex: 1; min-width: 0; }
.pop-head h2 { margin: 2px 0 4px; font-size: 1.12rem; }
.pop-sub { margin: 0; color: var(--muted); font-size: .86rem; overflow-wrap: anywhere; }
.pop-sub b { color: var(--ink); font-weight: 600; }
.pop-icon {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px;
  background: var(--red-soft); color: var(--red-deep);
}
.pop-icon .i { width: 20px; height: 20px; }
.pop-close {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; margin: -4px -6px 0 0; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
}
.pop-close:hover, .pop-close:focus-visible { background: var(--surface-2); color: var(--ink); }
.pop-body > label { margin-top: 18px; }
.pop-body input[type=email] { padding: 11px 14px; font-size: 1rem; }
.pop-body > .hint { margin-top: 6px; }
.pop-facts {
  margin: 16px 0 0; padding: 12px 14px 12px 32px; border-radius: 10px; background: var(--surface-2);
  border: 1px solid var(--rule); color: var(--ink-soft); font-size: .82rem; display: grid; gap: 4px;
}
.pop-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (max-width: 560px) {
  .pop-body { padding: 18px 16px 16px; }
  .pop-actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { dialog.pop[open] { animation: none; } }
