/*
 * Classnode's design: the tokens and the parts every page shares. No page
 * declares a colour (`tests/test_design.py`). Why each part is drawn as it is:
 * `docs/design.md`, "design.css, part by part". Comments here cost every page.
 */

@font-face {
  font-family: "Hanken Grotesk";
  font-weight: 400;
  font-display: swap;
  src: url("fonts/hanken-grotesk-400.2e12d49e4953.woff2") format("woff2");
  unicode-range: U+20-7E, U+A0-FF, U+131, U+152-153, U+2BC, U+2C6, U+2DA, U+2DC,
    U+300-301, U+304, U+307-308, U+323, U+1E44-1E45, U+1E62-1E63,
    U+1EB8-1EB9, U+1ECA-1ECD, U+1EE4-1EE5, U+2013-2015, U+2018-201A,
    U+201C-201E, U+2020-2023, U+2025-2026, U+2030-2031, U+2039-203A, U+2044,
    U+20A6, U+20AC, U+2122, U+2212, U+2215;
}

@font-face {
  font-family: "Hanken Grotesk";
  font-weight: 700;
  font-display: swap;
  src: url("fonts/hanken-grotesk-700.e6e539ff18ed.woff2") format("woff2");
  unicode-range: U+20-7E, U+A0-FF, U+131, U+152-153, U+2BC, U+2C6, U+2DA, U+2DC,
    U+300-301, U+304, U+307-308, U+323, U+1E44-1E45, U+1E62-1E63,
    U+1EB8-1EB9, U+1ECA-1ECD, U+1EE4-1EE5, U+2013-2015, U+2018-201A,
    U+201C-201E, U+2020-2023, U+2025-2026, U+2030-2031, U+2039-203A, U+2044,
    U+20A6, U+20AC, U+2122, U+2212, U+2215;
}

@font-face {
  font-family: "Noto Sans";
  font-weight: 400;
  font-display: swap;
  src: url("fonts/noto-sans-hausa-400.e9459688e3ff.woff2") format("woff2");
  unicode-range: U+181, U+18A, U+198-199, U+1B3-1B4, U+1F8-1F9, U+253, U+257;
  size-adjust: 92%;
  ascent-override: 108.7%;
  descent-override: 32.9%;
}

@font-face {
  font-family: "Noto Sans";
  font-weight: 700;
  font-display: swap;
  src: url("fonts/noto-sans-hausa-700.85c0dcef73d8.woff2") format("woff2");
  unicode-range: U+181, U+18A, U+198-199, U+1B3-1B4, U+1F8-1F9, U+253, U+257;
  size-adjust: 90%;
  ascent-override: 111.1%;
  descent-override: 33.7%;
}

/* == Tokens == */

:root {
  --brand: #143D8C;
  --text: #0E1726;
  --muted: #5B6475;
  --bg: #F5F6F8;
    --page: #EEF2F8;
  --card: #FFFFFF;
  --border: #E3E6EB;
  --divider: #EEF0F3;

  --ok: #16693F;
  --ok-bg: #E7F4EC;
  --warn: #8A5A00;
  --warn-bg: #FDF1DC;
  --stop: #B42318;
  --stop-bg: #FDECEA;
    --action-bg: #FFF7E8;

  /* The dashboard's three stat tiles (`home/dashboard.css`): a change for the worse, a
     change for the better, and the "needs action" tint with its label, figure and line. */
  --stat-down: #9A5B0E;
  --stat-up: #0F6B47;
  --stat-action-bg: #FFF7EA;
  --stat-action-label: #8A5410;
  --stat-action-figure: #6E420B;

  /* The public site's icon tiles only, never words. */
  --teal: #0F766E;
  --amber: #B45309;
  --coral: #C2452D;

    --brand-strong: color-mix(in srgb, var(--brand) 82%, var(--text));
  --brand-tint: color-mix(in srgb, var(--brand) 8%, var(--card));
  --brand-soft: color-mix(in srgb, var(--brand) 30%, var(--card));

    --field-border: color-mix(in srgb, var(--muted) 70%, var(--card));

  --radius: 12px;
  --radius-card: 16px;
  --radius-hero: 20px;
  --control: 44px;
  --control-lg: 48px;

    --sp-4: 4px;
  --sp-8: 8px;
  --sp-12: 12px;
  --sp-16: 16px;
  --sp-20: 20px;
  --sp-24: 24px;
  --sp-32: 32px;

  /* Short, and none under reduced motion (below). */
  --ease: 150ms ease;

  --font: "Hanken Grotesk", "Noto Sans", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;

  /* 15px: the smallest body text on a phone. */
  --small: 0.9375rem;

  --sidebar: 240px;
  --topbar: 64px;
  --tabbar: 61px;   --tabbar-gap: 12px;
    --shadow-1: 0 1px 2px color-mix(in srgb, var(--text) 6%, transparent),
    0 4px 16px -4px color-mix(in srgb, var(--text) 8%, transparent);
  --shadow-2: 0 2px 4px color-mix(in srgb, var(--text) 6%, transparent),
    0 12px 32px -6px color-mix(in srgb, var(--text) 14%, transparent);
    --hairline: 0 1px 0 color-mix(in srgb, var(--text) 8%, transparent);
}

/* == Base == */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* WCAG 2.4.11: focus clear of the bars. */
html:has(.topbar) { scroll-padding-top: var(--topbar); }
@media (max-width: 639.98px) { html:has(.tabbar) { scroll-padding-bottom: calc(var(--tabbar) + var(--tabbar-gap) + 16px + env(safe-area-inset-bottom, 0px)); } }

/* Quirks-mode defaults kept (doc_open.html). */
:where(html.was-quirks) form { margin-block-end: 1em; }
:where(html.was-quirks) table { font-weight: normal; font-style: normal; font-variant: normal; font-size: medium; line-height: normal; white-space: normal; text-align: start; }

body {
  margin: 0;
  padding: 16px;
  background: var(--page);
  color: var(--text);
  font: 400 1rem/1.5 var(--font);
  overflow-wrap: break-word;
}

@media (min-width: 640px) {
  body { padding: 32px 24px; }
}

body > main {
  margin: 0 auto;
  padding: 20px 16px;
  background: var(--card);
  border-radius: var(--radius-hero);
  box-shadow: var(--shadow-1);
}

@media (min-width: 640px) {
  body > main { padding: 28px 32px; }
}

h1, h2, h3 { font-weight: 700; line-height: 1.25; color: var(--text); }
h1 { font-size: 1.5rem; margin: 0 0 8px; }
h2 { font-size: 1.125rem; margin: 24px 0 8px; }
h3 { font-size: 1rem; margin: 16px 0 6px; }

p { margin: 0 0 12px; }

a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-strong); }

strong, b, th { font-weight: 700; }

small { font-size: var(--small); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.quiet, .blank { color: var(--muted); }

/* For a screen reader only. */
.sr, .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* == Icons: inline stroke SVG, no icon pack == */

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* == Buttons == */

button, .btn {
  display: inline-block;
  min-height: var(--control);
  padding: 10px 18px;
  font: inherit;
  line-height: 1.4;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background-color var(--ease), border-color var(--ease), color var(--ease), transform var(--ease);
}

button:hover, .btn:hover { border-color: var(--field-border); }

button:not(:disabled):active, .btn:active, .press:active { transform: scale(0.98); }

button[type="submit"], button.submit, .btn-primary {
  min-height: var(--control-lg);
  color: var(--card);
  background: var(--brand);
  border-color: var(--brand);
  font-weight: 700;
}

button[type="submit"]:hover, button.submit:hover, .btn-primary:hover {
  color: var(--card);
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

button.signout, button.again, .btn-quiet {
  color: var(--muted);
  background: none;
  border-color: transparent;
}

button.signout:hover, button.again:hover, .btn-quiet:hover {
  color: var(--brand);
  border-color: transparent;
}

button:disabled, .btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.switch-door { margin: 12px 0 0; font-size: var(--small); color: var(--muted); text-align: center; }

/* == Fields == */

input:not([type="checkbox"], [type="radio"], [type="hidden"]), select, textarea {
  min-height: var(--control);
  max-width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
}

input[type="file"] { padding: 0; border: 0; background: none; min-height: 0; }
input[type="file"]::file-selector-button {
  min-height: var(--control);
  margin-right: 12px;
  padding: 10px 18px;
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover { border-color: var(--field-border); }

textarea { line-height: 1.5; }

input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 0;
  border-color: var(--brand);
}

input:disabled, select:disabled, textarea:disabled {
  color: var(--muted);
  background: var(--bg);
}

input[type="checkbox"], input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
}

fieldset {
  margin: 20px 0 8px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}

legend { padding: 0 6px; font-weight: 700; }

.field { display: grid; gap: 6px; font-weight: 700; }
.field input, .field select, .field textarea { font-weight: 400; width: 100%; }
.field .hint { color: var(--muted); font-weight: 400; }

/* == Labels: the one place status colour goes == */

.label, .tag, .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
  color: var(--muted);
  background: var(--divider);
  border: 0;
  border-radius: 999px;
  vertical-align: 0.1em;
}

.label-ok, .pill-ok { color: var(--ok); background: var(--ok-bg); }
.label-warn, .pill-warn { color: var(--warn); background: var(--warn-bg); }
.label-stop, .tag.held, .pill-stop { color: var(--stop); background: var(--stop-bg); }
.label-brand, .tag.revised, .pill-brand { color: var(--brand); background: var(--brand-tint); }

:is(.label-ok, .label-warn, .label-stop, .label-brand, .pill):not(:has(.icon))::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
}
.pill .icon { width: 14px; height: 14px; stroke-width: 2.25; }

.eyebrow {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.5;
  text-transform: uppercase;
}

.figure { font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }

/* == Cards == */

.card {
  min-width: 0;
  padding: var(--sp-20);
  background: var(--card);
  border: 0;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-1);
}

.card-action { background: var(--action-bg); }

a.card { display: block; color: var(--text); text-decoration: none; transition: box-shadow var(--ease), transform var(--ease); }
a.card:hover { color: var(--text); box-shadow: var(--shadow-2); }
a.card:active { transform: scale(0.99); }

.card > h2:first-child, .card > h3:first-child { margin-top: 0; }

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 0 0 12px;
}

.card-head h2 { margin: 0; }

/* == Tables == */

table {
  border-collapse: collapse;
  min-width: 100%;
  font-variant-numeric: tabular-nums;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--divider);
}

thead th {
  color: var(--muted);
  font-size: var(--small);
  white-space: nowrap;
  border-bottom-color: var(--border);
}

@media (min-width: 640px) {
  thead th { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
}

.num, td.num, th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td small { color: var(--muted); }

.scroll, .grid-scroll, .table-scroll {
  max-width: 100%;
  overflow-x: auto;
  margin: 12px 0;
  -webkit-overflow-scrolling: touch;
}

.scroll :is(th, td):first-child,
.grid-scroll :is(th, td):first-child,
.table-scroll :is(th, td):first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--card);
  box-shadow: inset -1px 0 0 var(--border);
}

.swipe-cue { display: none; }

@media (max-width: 639.98px) {
  table.stack, table.stack tbody, table.stack tfoot { display: block; min-width: 0; }
  table.stack thead { display: none; }
  table.stack tr {
    display: flex;
    flex-direction: column;
    margin: 0 0 12px;
    padding: 4px 14px;
    background: var(--card);
    border: 0;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-1);
  }
  table.stack td, table.stack tfoot th {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
        gap: 2px 0;
    padding: 8px 0;
    text-align: right;
    white-space: normal;
    border: 0;
    border-top: 1px solid var(--divider);
  }
  table.stack td[data-label]::before {
    content: attr(data-label);
    flex: 0 1 auto;
    margin-right: auto;
    padding-right: 12px;
    color: var(--muted);
    text-align: left;
    font-weight: 400;
    text-decoration: none;
  }
  table.stack td.stack-head {
    order: -1;
    border-top: 0;
    align-items: center;
    padding: 10px 0;
    text-align: left;
    font-weight: 700;
  }
  table.stack td.stack-full { display: block; text-align: left; }
    table.stack td > small { flex: 1 1 100%; }
  table.stack td.stack-full[data-label]::before { display: block; margin: 0 0 4px; }
  table.stack td.stack-hide, table.stack td[data-label]:empty, table.stack td.stack-full:empty { display: none; }
    table.stack tr > td:only-child { border-top: 0; }
    table.stack tfoot tr { flex-direction: row; justify-content: space-between; font-weight: 700; }
  table.stack tfoot :is(th, td) { display: block; padding: 10px 0; border: 0; }
  table.stack tfoot :is(th, td):empty { display: none; }
    table.stack :is(th, td):first-child {
    position: static;
    background: none;
    box-shadow: none;
  }

  .stack-list { display: grid; gap: 12px; margin: 12px 0; padding: 0; list-style: none; }
  .stack-list > li {
    margin: 0;
    padding: 12px 14px;
    background: var(--card);
    border: 0;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-1);
  }
  .stack-list [data-label] { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; flex: 1 1 100%; }
  .stack-list [data-label]::before { content: attr(data-label); color: var(--muted); }

  .swipe-cue { display: block; margin: 4px 0 0; color: var(--muted); font-size: var(--small); text-align: right; }
}

/* == Messages and empty states == */

.msg {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin: 12px 0;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.msg > p { flex: 1 1 16rem; margin: 0; }

.problem {
  margin: 16px 0 0;
  padding: 12px 14px;
  color: var(--stop);
  background: var(--stop-bg);
  border: 0;
  border-radius: var(--radius);
}

.empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
}

.empty .icon { width: 40px; height: 40px; margin: 0 auto 12px; display: block; }
.empty h2 { margin: 0 0 6px; }
.empty p { margin: 0 auto 16px; max-width: 28rem; }

.empty-card {
  display: grid; justify-items: center; gap: 8px; margin: 16px 0; padding: 32px 16px; text-align: center;
  background: var(--card); border-radius: var(--radius-card); box-shadow: var(--shadow-1);
}
.empty-card .empty-icon {
  display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 8px;
  color: var(--brand); background: var(--brand-tint); border-radius: 50%;
}
.empty-card .empty-icon .icon { width: 28px; height: 28px; }
.empty-card h2 { margin: 0; font-size: 1.25rem; }
.empty-card p { max-width: 30rem; margin: 0 0 8px; color: var(--muted); }
.empty-card .btn-primary { width: 100%; }
@media (min-width: 640px) { .empty-card .btn-primary { width: auto; min-width: 220px; } }

/* A score out of 100 on a subject row. */
.scorebar {
  height: 6px;
  overflow: hidden;
  background: var(--divider);
  border-radius: 999px;
}

.scorebar > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }

/* == List rows: a card of rows, each a link == */

.list-rows { margin: 0 calc(-1 * var(--sp-8)); padding: 0; list-style: none; }
.list-rows > li { position: relative; }
.list-rows > li + li::before {
  content: "";
  position: absolute;
  top: 0;
  right: var(--sp-8);
  left: calc(var(--sp-8) + 40px + var(--sp-16));
  border-top: 1px solid var(--divider);
}

.list-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-4) var(--sp-16);
  min-height: 64px;
  padding: var(--sp-12) var(--sp-8);
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
  transition: background-color var(--ease), transform var(--ease);
}
a.list-row:hover { color: var(--text); background: color-mix(in srgb, var(--brand) 4%, transparent); }
a.list-row:active { transform: scale(0.99); }

.list-row-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--brand);
  background: var(--brand-tint);
  border-radius: var(--radius);
}
.list-row-icon.tone-ok { color: var(--ok); background: var(--ok-bg); }
.list-row-icon.tone-warn { color: var(--warn); background: var(--warn-bg); }
.list-row-icon.tone-stop { color: var(--stop); background: var(--stop-bg); }

.list-row-text { display: grid; gap: 2px; min-width: 0; }
.list-row-title { font-weight: 700; line-height: 1.35; }
.list-row-sub { color: var(--muted); font-size: var(--small); line-height: 1.4; }
.list-row-end { display: flex; align-items: center; gap: var(--sp-8); color: var(--muted); }
.list-row-end > .icon { transition: transform var(--ease); }
a.list-row:hover .list-row-end > .icon { color: var(--brand); transform: translateX(2px); }

/* == Skeleton: the shape of what is coming == */

.skeleton {
  display: block;
  height: 1em;
  background: var(--divider);
  border-radius: var(--sp-8);
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

.state-loading { color: var(--muted); }
.state-loading::after {
  content: "";
  display: block;
  height: 160px;
  margin-top: var(--sp-16);
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-1);
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}
@keyframes skeleton-pulse { 50% { opacity: 0.55; } }

/* == The brand bar: the family-facing pages == */

.brand-bar {
  display: flex;
  justify-content: center;
  margin: 0 0 16px;
}

.door-foot { margin: 16px 0 0; color: var(--muted); font-size: var(--small); text-align: center; }
.door-foot a { display: inline-flex; align-items: center; min-height: var(--control); color: var(--muted); }
.door-foot a:hover { color: var(--brand); }

/* == The app shell: the staff desktop == */

body.has-shell { padding: 0; }

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 12px;
  color: var(--text);
  background: var(--card);
  border: 0;
  border-right: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--control);
  padding: 0 8px;
  color: var(--brand);
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
}

.logo-mark { width: 28px; height: 28px; flex: none; }

.crest {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  overflow: hidden;
  color: var(--card);
  background: var(--brand);
  border-radius: 10px;
  font-size: var(--small);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.crest:has(img) { background: var(--card); }
.crest img { width: 100%; height: 100%; object-fit: contain; }

.logo-school { gap: 10px; color: var(--text); font-size: 1rem; line-height: 1.25; }
.logo-school:hover { color: var(--text); }
.logo-name { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.topbar-logo.logo-school { min-width: 0; padding: 0; }
.topbar-logo.logo-school .crest { width: 32px; height: 32px; border-radius: 9px; font-size: var(--small); letter-spacing: 0; }
.topbar-logo .logo-name { display: -webkit-box; font-size: 1rem; line-height: 1.2; overflow-wrap: anywhere; }

.nav { display: grid; gap: 2px; }

.nav-heading {
  margin: 12px 12px 4px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav a, .nav .nav-button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--control);
  padding: 0 12px;
  font-size: var(--small);
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
}

.nav .nav-button {
  width: 100%;
  font: inherit;
  font-weight: 400;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}

.nav a:hover, .nav .nav-button:hover { color: var(--brand); background: var(--bg); }

.nav a[aria-current="page"] {
  color: var(--brand);
  background: var(--brand-tint);
  font-weight: 700;
}

.nav a .icon, .nav .nav-button .icon { color: var(--muted); }
.nav a:hover .icon, .nav a[aria-current="page"] .icon, .nav .nav-button:hover .icon { color: var(--brand); }

.sidebar .nav-links {
  flex: 1 1 auto;
  align-content: start;
  min-height: 0;
  overflow-y: auto;
  margin: -4px;
  padding: 4px;
}
.sidebar .nav-end {
  flex: none;
  margin: auto 0 0;
  padding-top: 12px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-top: 1px solid var(--divider);
}

.nav .powered-by { gap: 8px; color: var(--muted); font-size: var(--small); }
.nav .powered-by .logo-mark { width: 16px; height: 16px; color: var(--muted); }
.nav .powered-by:hover .logo-mark { color: var(--brand); }

.nav-install[hidden], .nav-install [hidden] { display: none; }
.install-howto { margin: 0; padding: 4px 12px 8px; color: var(--muted); font-size: var(--small); }

.sidebar .nav-help { flex: none; margin: auto 0 0; padding-top: 12px; border-top: 1px solid var(--divider); }
.sidebar .nav-help + .nav-end { margin-top: 2px; padding-top: 0; border-top: 0; }

.setup-chip {
  position: relative; display: inline-flex; flex: none; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 10px; color: var(--brand); background: var(--brand-tint);
  border: 1px solid var(--brand-soft); border-radius: 999px;
  font-size: 0.8125rem; font-weight: 700; text-decoration: none; white-space: nowrap;
}
.setup-chip::after { content: ""; position: absolute; inset: -4px 0; }
.setup-chip:hover { color: var(--brand-strong); border-color: var(--brand); }
.setup-chip .icon { width: 16px; height: 16px; }
.setup-chip .chip-short { display: none; }
@media (max-width: 639.98px) { .setup-chip .icon { display: none; } }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  container-type: inline-size;
  min-height: var(--topbar);
  padding: 8px 16px;
    background: color-mix(in srgb, var(--card) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.8) blur(12px);
  backdrop-filter: saturate(1.8) blur(12px);
  box-shadow: var(--hairline);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  position: relative;
  width: var(--control);
  min-width: var(--control);
  height: var(--control);
  padding: 0;
  color: var(--muted);
  background: none;
  border-color: transparent;
}

.icon-button:hover { color: var(--brand); border-color: transparent; background: var(--bg); }

.topbar .spacer { flex: 1; }

.topbar-logo { min-height: var(--control); padding: 0 4px; font-size: 1.125rem; }
.topbar-logo .logo-mark { width: 24px; height: 24px; }
.topbar-school { display: none; }
@container (max-width: 21.8em) { .setup-chip .chip-full { display: none; } .setup-chip .chip-short { display: inline; } }
@container (max-width: 19em) { .topbar-logo .logo-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }

@media (min-width: 1024px) {
  .topbar-logo { display: none; }
  .topbar-school { display: block; min-width: 0; overflow: hidden; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
}

.account { position: relative; flex: none; }
.account > summary { list-style: none; cursor: pointer; }
.account > summary::-webkit-details-marker { display: none; }
.account[open] > summary { background: var(--bg); }

.account-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 20;
  min-width: 240px; max-width: calc(100vw - 32px); padding: 8px;
  background: var(--card); border: 0;
  border-radius: var(--radius-card); box-shadow: var(--shadow-2);
}
.account-who { display: grid; margin: 0 0 8px; padding: 8px; border-bottom: 1px solid var(--divider); }
.account-who span { color: var(--muted); font-size: var(--small); }
.account-menu .signout { display: flex; align-items: center; gap: 12px; width: 100%; padding: 0 8px; font-weight: 400; border-radius: 8px; }
.account-menu .signout:hover { background: var(--bg); }

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--card);
  background: var(--brand);
  border-radius: 50%;
  font-size: var(--small);
  font-weight: 700;
}

.content {
  min-width: 0;
  padding: 16px;
}

.content > main {
  max-width: 1200px;
  margin: 0 auto;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin: 0 0 20px;
}

.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.split { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }

@media (min-width: 1024px) {
  .split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
}

@media (max-width: 1023.98px) {
  .sidebar[popover] {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 85vw);
    height: 100%;
        height: 100dvh;
    max-height: none;
    margin: 0;
    overflow-y: auto;
    box-shadow: 0 0 0 100vmax color-mix(in srgb, var(--text) 35%, transparent);
  }

  .sidebar[popover]:not(:popover-open) { display: none; }

}

@media (min-width: 640px) {
  .content { padding: 24px; }
  .topbar { padding: 8px 24px; }
}

@media (min-width: 1024px) {
  .shell {
    position: relative;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    grid-template-rows: var(--topbar) 1fr;
  }

    .shell::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar);
    background: var(--card);
    border-right: 1px solid var(--border);
  }

  .sidebar { z-index: 1; }

    .sidebar,
  .sidebar[popover] {
    display: flex;
    position: sticky;
    top: 0;
    inset: auto;
    grid-row: 1 / -1;
    width: auto;
    height: 100vh;
    margin: 0;
    overflow-y: auto;
  }

  .topbar { grid-column: 2; }
  .content { grid-column: 2; padding: 32px; }
  .menu-button { display: none; }
}

.tabbar { display: none; }

@media (max-width: 639.98px) {
    .tabbar {
    position: fixed;
    right: var(--tabbar-gap);
    bottom: calc(var(--tabbar-gap) + env(safe-area-inset-bottom, 0px));
    left: var(--tabbar-gap);
    z-index: 10;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    padding: 0 4px;
    background: var(--card);
    border-radius: var(--radius-hero);
    box-shadow: var(--shadow-2);
  }

  .tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    min-height: var(--tabbar);
    color: var(--muted);
    text-decoration: none;
    border-radius: var(--radius-hero);
  }

    .tabbar .icon {
    width: 56px;
    height: 30px;
    padding: 5px 18px;
    border-radius: 999px;
    transition: background-color var(--ease);
  }
  .tabbar a[aria-current="page"] { color: var(--brand); }
  .tabbar a[aria-current="page"] .icon { background: var(--brand-tint); }
  .tabbar a:active .icon { background: var(--divider); }
  .tabbar .tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8125rem; font-weight: 700; }

    body.has-tabbar .content { padding-bottom: calc(var(--tabbar) + var(--sp-16)); }
  body.has-tabbar .shell { padding-bottom: calc(var(--tabbar-gap) + env(safe-area-inset-bottom, 0px)); }
}

/* == Forced colours and reduced motion == */

@media (forced-colors: active) {
  .card, body > main, .empty-card, .tabbar, .account-menu, .topbar,
  table.stack tr, .stack-list > li {
    border: 1px solid CanvasText;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  button:active, .btn:active, .press:active, a.card:active, a.list-row:active { transform: none; }
}

/* == Paper == */

@media print {
  body, body.has-shell { padding: 0; background: var(--card); }
  body > main, .content > main { max-width: none; padding: 0; border: 0; }
  .sidebar, .topbar, .tabbar, .brand-bar { display: none; }
  .shell { display: block; }
  .scroll, .grid-scroll, .table-scroll { overflow: visible; }
  .scroll :is(th, td):first-child,
  .grid-scroll :is(th, td):first-child,
  .table-scroll :is(th, td):first-child { position: static; box-shadow: none; }
}
