/* ===========================================================================
   panel.css — the three logged-in surfaces: admin, franchise, student.

   This file is a LAYER on top of site.css, never a replacement. site.css is
   loaded first and brings the tokens (:root), the reset, the type scale and the
   components the panels reuse as-is: .btn and its colour variants, .card,
   .chip, .field/.input/.select, .grid--N, .icon-btn, .seg. Only what the
   marketing site had no use for is defined here — a sidebar shell, dense data
   tables, status chips, pagination, and the empty/loading/error/locked states
   that standards §9 requires on every screen.

   THREE SURFACES, ONE SYSTEM (standards §3: "Two themes from one system ...
   same tokens, different weightings"). The weighting is set by data-panel on
   <body>, and it follows the brand board's own audience mapping rather than
   inventing new colours:

     data-panel="admin"      blue accent, tightest rows — information first
     data-panel="franchise"  yellow accent (yellow-ink as text: 4.6:1), the
                             brand board's franchise colour
     data-panel="student"    blue accent, larger radius, 44px+ targets,
                             roomier rows — "designed for a child's finger"

   WHAT THIS FILE DELIBERATELY AVOIDS, per the §7.1 ban list: no gradient
   surfaces, no frosted/translucent cards, no uniform big-radius-plus-shadow on
   everything. Separation in the dense surfaces is done with hairlines and
   background tints; shadow is reserved for things that genuinely float (the
   overflow menu, the modal, the sticky bulk bar).
   ======================================================================== */

:root {
  --aside: 264px;          /* sidebar width, desktop                        */
  --ptop-h: 64px;          /* topbar height                                 */
  --row-y: 11px;           /* table cell padding, vertical — theme overrides */
  --accent: var(--blue);
  --accent-deep: var(--blue-deep);
  --accent-tint: var(--blue-tint);
  --accent-ink: var(--blue);      /* the accent as TEXT on white            */
  --r-panel: var(--r-md);         /* the panel's working radius             */
  --z-stuck: 20; --z-drop: 40; --z-aside: 60; --z-modal: 80; --z-toast: 90;

  /* THE EIGHT LEVELS, as eight colours. Declared once, here, because the same
     level has to be the same colour in the donut, in the bars and on a chip —
     a legend that disagrees with the bar beside it is worse than no colour at
     all. All eight are existing brand tokens; none is invented for this.
     Ordered so that no two adjacent levels are close in hue, since adjacent
     donut segments are the pair a reader has to tell apart. */
  --lv1: var(--blue);
  --lv2: var(--green);
  --lv3: var(--yellow);
  --lv4: var(--icon-violet);
  --lv5: var(--icon-pink);
  --lv6: var(--icon-teal);
  --lv7: var(--orange);
  --lv8: var(--muted);
}

/* The franchise surface is the brand's yellow. Yellow cannot carry white text,
   so the accent splits: --accent paints, --accent-ink writes. */
[data-panel="franchise"] {
  --accent: var(--yellow);
  --accent-deep: var(--yellow-deep);
  --accent-tint: var(--yellow-tint);
  --accent-ink: var(--yellow-ink);
}

/* The student surface keeps the blue but loosens everything: bigger radius,
   roomier rows, larger hit areas. Same tokens, child-sized weighting. */
[data-panel="student"] {
  --row-y: 15px;
  --r-panel: var(--r-lg);
}

/* ---------------------------------------------------------------------------
   1. The shell
   Two columns on desktop; on tablet and phone the sidebar leaves the flow and
   becomes an off-canvas drawer, so the content gets the full width.
   100dvh, not 100vh — standards §2.3: bare 100vh is cut off by iOS chrome.
   ------------------------------------------------------------------------ */
.panel {
  display: grid;
  grid-template-columns: var(--aside) minmax(0, 1fr);
  min-height: 100dvh;
  background: var(--ground);
}
@supports not (height: 100dvh) { .panel { min-height: 100vh; } }

.panel__main { min-width: 0; display: flex; flex-direction: column; }

/* minmax(0,1fr) above and min-width:0 here are what stop a wide table from
   pushing the whole grid sideways. Without them a 12-column table scrolls the
   PAGE instead of scrolling itself, which §10 forbids at every width. */

/* ---------------------------------------------------------------------------
   2. Sidebar
   Navy, because it is the ink of the brand and it separates the chrome from the
   work without a border. Scrolls independently of the page.
   ------------------------------------------------------------------------ */
.paside {
  position: sticky; top: 0; align-self: start;
  height: 100dvh; display: flex; flex-direction: column;
  background: var(--navy); color: var(--on-navy);
  padding-bottom: env(safe-area-inset-bottom);
}
@supports not (height: 100dvh) { .paside { height: 100vh; } }

.paside__brand {
  display: flex; align-items: center; gap: 10px;
  height: var(--ptop-h); padding: 0 18px; flex: 0 0 auto;
  border-bottom: 1px solid var(--navy-line);
  color: inherit; text-decoration: none;
}
.paside__brand img { width: 32px; height: 32px; }
.paside__wm { display: grid; line-height: 1.05; }
.paside__wm b {
  font: 700 13.5px/1.1 var(--display); letter-spacing: .01em;
}
.paside__wm span {
  font: 600 9.5px/1.1 var(--mark); letter-spacing: .14em;
  color: var(--on-navy-4); text-transform: uppercase;
}
/* The franchise code (point 7). A reference, not a tagline: a touch larger
   than the strapline it replaces, tabular, and with the tracking pulled back
   so the hyphens read as part of the code rather than as gaps in it. */
.paside__code {
  font-size: 10.5px; letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
}

.paside__scroll { flex: 1 1 auto; overflow-y: auto; padding: 14px 12px 20px; }

.pnav { display: grid; gap: 2px; }
.pnav__label {
  font: 700 10.5px/1 var(--mark); letter-spacing: .12em; text-transform: uppercase;
  color: var(--on-navy-4); padding: 16px 10px 7px;
}
.pnav__link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--r-sm);
  color: var(--on-navy-3); text-decoration: none;
  font: 500 14.5px/1.25 var(--text);
  border-left: 3px solid transparent;
  transition: background .16s ease-out, color .16s ease-out;
}
.pnav__link .ico { flex: 0 0 auto; opacity: .85; }
.pnav__link:hover { background: var(--navy-raised); color: var(--on-navy); }
.pnav__link:focus-visible {
  outline: 2px solid var(--on-navy-2); outline-offset: 2px;
}

/* The current page is marked three ways, not one: the accent bar, a raised
   surface and a weight change. Colour is never the only signal (§3). */
.pnav__link[aria-current="page"] {
  background: var(--navy-raised); color: var(--on-navy);
  border-left-color: var(--yellow); font-weight: 600;
}
.pnav__link[aria-current="page"] .ico { opacity: 1; }

/* A count sitting on a nav item — unread leads, open tickets. */
.pnav__n {
  margin-left: auto; min-width: 21px; height: 19px; padding: 0 6px;
  display: inline-grid; place-items: center; border-radius: var(--r-pill);
  background: var(--yellow); color: var(--navy);
  font: 700 11.5px/1 var(--mark); font-variant-numeric: tabular-nums;
}
.pnav__link[data-locked] { opacity: .55; cursor: not-allowed; }

/* A section that exists in the plan but has no screen yet. It stays visible so
   the shape of the product is reviewable, and it stays unclickable so nobody
   mistakes it for something broken. */
.pnav__link--soon { color: var(--on-navy-4); cursor: default; }
.pnav__link--soon:hover { background: none; color: var(--on-navy-4); }
.pnav__link--soon .ico { opacity: .5; }
.pnav__soon {
  margin-left: auto; padding: 2px 7px; border-radius: var(--r-pill);
  border: 1px solid var(--navy-line);
  font: 600 10px/1.4 var(--mark); letter-spacing: .08em; text-transform: uppercase;
  font-style: normal; color: var(--on-navy-4);
}

.paside__foot {
  flex: 0 0 auto; padding: 12px; border-top: 1px solid var(--navy-line);
}

/* ---------------------------------------------------------------------------
   3. Off-canvas sidebar, below 1024px
   ------------------------------------------------------------------------ */
.paside__scrim {
  position: fixed; inset: 0; background: rgba(20, 38, 77, .5);
  opacity: 0; pointer-events: none; transition: opacity .2s ease-out;
  z-index: calc(var(--z-aside) - 1);
}
@media (max-width: 1023px) {
  .panel { grid-template-columns: minmax(0, 1fr); }
  .paside {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw);
    z-index: var(--z-aside);
    transform: translateX(-100%); transition: transform .22s ease-out;
    box-shadow: var(--lift-menu);
  }
  [data-aside="open"] .paside { transform: none; }
  [data-aside="open"] .paside__scrim { opacity: 1; pointer-events: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .paside, .paside__scrim, .pnav__link { transition: none; }
}

/* ---------------------------------------------------------------------------
   4. Topbar
   Sticky, white, one hairline. Carries the page title so the title is never
   duplicated in the body, search, notifications and the account menu.
   ------------------------------------------------------------------------ */
.ptop {
  position: sticky; top: 0; z-index: var(--z-stuck);
  display: flex; align-items: center; gap: 12px;
  min-height: var(--ptop-h); padding: 10px clamp(14px, 2.2vw, 26px);
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.ptop__burger { display: none; }
@media (max-width: 1023px) { .ptop__burger { display: inline-grid; } }

/* THE HEADING YIELDS FIRST. flex: 1 1 auto against a rigid right-hand group,
   so when the bar runs out of room the subtitle ellipsises rather than the
   centre name degrading to "Kharghar …" and the account name wrapping. The
   priority is deliberate: the page heading is also the highlighted item in the
   sidebar and the browser tab title, while the centre name and the academic
   year appear nowhere else and are what every figure below is scoped by. */
.ptop__title { min-width: 0; flex: 1 1 auto; }
.ptop__title h1 {
  margin: 0; font: 700 clamp(17px, 1.5vw, 20px)/1.2 var(--display); color: var(--navy);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ptop__title p {
  margin: 1px 0 0; font: 400 var(--t-xs)/1.3 var(--text); color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ptop__right { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

/* CENTRE SWITCHER + ACADEMIC YEAR (franchise topbar).
   Both are scope controls: they say which centre and which year every number
   on the screen belongs to. They sit at the far left of the right-hand group,
   ahead of search, because scope is read before anything is searched within it.

   Below 1100px the year goes first and below 900px the switcher follows — on a
   phone the burger, the bell and the account menu are what matter, and the
   scope both controls carry is repeated in the page heading beneath. */
.pswap, .pyear { display: none; }
@media (min-width: 900px)  { .pswap { display: block; } }
@media (min-width: 1100px) { .pyear { display: block; } }

.pswap__btn, .pswap--one {
  display: flex; align-items: center; gap: 9px; margin: 0;
  height: 42px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--navy);
  text-align: left; cursor: pointer;
}
.pswap--one { cursor: default; }
.pswap__btn:hover { background: var(--ground); }
.pswap__btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.pswap__ico {
  width: 28px; height: 28px; flex: 0 0 auto; border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--accent-tint); color: var(--accent-ink);
}
.pswap__text { min-width: 0; display: grid; }
.pswap__text b {
  font: 600 13.5px/1.25 var(--text); color: var(--navy);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* The franchise code, in the tabular face — it is a reference someone reads
   out over the phone, not prose. */
.pswap__text span {
  font: 500 11.5px/1.3 var(--mark); letter-spacing: .04em; color: var(--muted);
}
.pswap__item { align-items: center; }
.pswap__item-text { display: grid; min-width: 0; }
.pswap__item-text b { font: 600 14px/1.3 var(--text); }
.pswap__item-text span { font: 500 11.5px/1.3 var(--mark); letter-spacing: .04em; color: var(--muted); }

.pyear__btn {
  display: flex; align-items: center; gap: 7px;
  height: 42px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--navy);
  font: 600 13.5px/1 var(--text); cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.pyear__btn:hover { background: var(--ground); }
.pyear__btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.pyear__btn .ico { color: var(--muted); }

/* Search in the bar collapses to an icon button on small screens rather than
   squeezing into an unusable 80px field. */
.psearch { position: relative; display: none; }
@media (min-width: 900px) { .psearch { display: block; } }
.psearch .ico {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.psearch input {
  width: clamp(200px, 22vw, 300px); height: 38px;
  padding: 0 12px 0 36px; border: 1px solid var(--line);
  border-radius: var(--r-pill); background: var(--ground);
  font: 400 15px/1 var(--text); color: var(--navy);
}
.psearch input:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 1px;
  background: var(--surface); border-color: var(--accent);
}

/* A bell with a dot. The dot is accompanied by the count in the aria-label,
   because a coloured dot alone tells a screen reader nothing. */
.pbell { position: relative; color: var(--navy); text-decoration: none; }
.pbell__dot {
  position: absolute; top: 6px; right: 6px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--red);
  box-shadow: 0 0 0 2px var(--surface);
}

/* ---------------------------------------------------------------------------
   5. The account menu — and the overflow menu pattern it shares
   Shadowed, because a menu genuinely floats above the page.
   ------------------------------------------------------------------------ */
.pmenu { position: relative; }
.pmenu__btn {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px 5px 5px; border: 1px solid transparent;
  border-radius: var(--r-pill); background: none; cursor: pointer;
  font: 500 14px/1 var(--text); color: var(--navy);
}
.pmenu__btn:hover { background: var(--ground); border-color: var(--line); }
.pmenu__btn .ico:last-child { color: var(--muted); }
.pmenu__av {
  width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-tint); color: var(--accent-ink);
  font: 700 12px/1 var(--mark); letter-spacing: .02em;
}
.pmenu__who { display: none; text-align: left; line-height: 1.15; }
@media (min-width: 640px) { .pmenu__who { display: grid; } }
.pmenu__who b { font: 600 13.5px/1.2 var(--text); }
.pmenu__who span { font-size: 11.5px; color: var(--muted); }
/* A name is one line. "Bhavya Joshi" wrapping to two put the topbar's own
   height out by 14px and pushed the bar taller than the sidebar's brand block
   beside it, which is visible as a step at the top-left corner. */
.pmenu__who b, .pmenu__who span { white-space: nowrap; }

.pmenu__pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: var(--z-drop);
  min-width: 232px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-panel); box-shadow: var(--lift-menu);
}
.pmenu__pop[hidden] { display: none; }
.pmenu__head {
  padding: 9px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 5px;
}
.pmenu__head b { display: block; font: 600 14px/1.3 var(--text); color: var(--navy); }
.pmenu__head span { font-size: 12.5px; color: var(--muted); word-break: break-all; }
.pmenu__item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: var(--r-sm);
  background: none; cursor: pointer; text-align: left; text-decoration: none;
  font: 500 14px/1.2 var(--text); color: var(--navy);
}
.pmenu__item .ico { color: var(--muted); flex: 0 0 auto; }
.pmenu__item:hover { background: var(--ground); }
.pmenu__item--danger { color: var(--red); }
.pmenu__item--danger .ico { color: currentColor; }

/* ---------------------------------------------------------------------------
   6. Page body
   Capped and centred — §7.1 bans content stretched across a 2560px monitor.
   Tables may use the full width of this container, text columns may not.
   ------------------------------------------------------------------------ */
.pbody { flex: 1 1 auto; padding: clamp(16px, 2.2vw, 28px); }
.pwrap { max-width: 1600px; margin-inline: auto; }
.pbody > .pwrap > * + * { margin-top: clamp(14px, 1.6vw, 20px); }

/* ...except an overlay. A modal is a direct child of .pwrap like everything
   else, so the rule above was giving it a 20px top margin — and on a FIXED box
   with inset: 0 a top margin does not indent the content, it moves the whole
   backdrop down and shortens it by the same amount. The result was a 20px strip
   along the top of the viewport that no backdrop covered, through which the
   sticky sidebar and topbar could still be clicked while a modal was open. That
   defeats a destructive confirm, which exists precisely so that a stray click
   cannot get past it (§6). */
.pbody > .pwrap > .pmodal { margin: 0; }

/* A .grid whose cells should keep their own heights. The default stretch is
   right for two cards of comparable length and wrong for the pair at the foot
   of the student screens, where one is a worked example and the other is two
   lines — stretched, the short one becomes a card with 200px of nothing under
   its text. */
.grid--top { align-items: start; }

.phead { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.phead__text { min-width: 0; flex: 1 1 320px; }
.phead h2 { margin: 0; font: 700 var(--t-h3)/1.25 var(--display); color: var(--navy); }
.phead p {
  margin: 4px 0 0; max-width: 68ch;
  font: 400 var(--t-sm)/1.5 var(--text); color: var(--muted);
}
.phead__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

/* ---------------------------------------------------------------------------
   7. Surfaces
   A panel card is flatter than a marketing card: hairline, small radius, and
   the faintest lift. Elevation has to keep meaning something (§7.2).
   ------------------------------------------------------------------------ */
.pcard {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-panel); box-shadow: var(--lift-card);
}
.pcard__head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.pcard__head h3 {
  margin: 0; font: 700 15.5px/1.3 var(--display); color: var(--navy);
}
.pcard__head .pcard__tools { margin-left: auto; display: flex; gap: 6px; }

/* A TINTED ICON BESIDE EVERY CARD TITLE (client, 21 Oct: the whole panel is to
   feel colourful, as in the reference dashboard — which puts a coloured icon
   against every one of its card headings).

   This is the cheapest colour in the system and the best-behaved: it is 32px
   of tint in the one place on a card where nothing else competes, it leaves
   the card ground white so a screen of six cards does not become six coloured
   blocks, and it tells you what the card is about before you read the title.

   The colour comes from the same --kpi-chip/--kpi-ico pair the tiles use, so a
   card head carrying .kpi--students is the same blue as the students tile. It
   is set on the HEAD, not the card, so the tint cannot leak into the body. */
.pcard__ico {
  width: 32px; height: 32px; flex: 0 0 auto; border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--kpi-chip, var(--accent-tint));
  color: var(--kpi-ico, var(--accent-ink));
}
/* Dense admin tables do not get it: a console packs twelve cards onto a screen
   and twelve tinted squares there is noise, not hierarchy. Franchise and
   student are the surfaces this is for. */
[data-panel="admin"] .pcard__ico { display: none; }
.pcard__body { padding: 16px; }
.pcard__foot {
  padding: 12px 16px; border-top: 1px solid var(--line);
  background: var(--ground);
  border-radius: 0 0 var(--r-panel) var(--r-panel);
}

/* KPI tile. The number does the talking, so it gets real scale contrast
   against its label rather than both sitting at 16px (§7.1 #10). */
.kpi { padding: 15px 16px 16px; }
.kpi__top { display: flex; align-items: center; gap: 9px; }
.kpi__ico {
  width: 32px; height: 32px; flex: 0 0 auto; border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--accent-tint); color: var(--accent-ink);
}
.kpi__label {
  font: 600 12px/1.2 var(--mark); letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
}
.kpi__num {
  margin: 10px 0 0; font: 700 clamp(26px, 2.4vw, 32px)/1 var(--display);
  color: var(--navy); font-variant-numeric: tabular-nums;
}
.kpi__foot {
  margin: 7px 0 0; display: flex; align-items: center; gap: 6px;
  font: 400 12.5px/1.35 var(--text); color: var(--muted);
}
.kpi__delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.kpi__delta--up { color: var(--green); }
.kpi__delta--down { color: var(--red); }

/* A COLOUR PER METRIC, NOT PER POSITION.
   These are named after what they count, not after the colour they are, and
   that naming is the rule enforcing itself: students are blue on the dashboard,
   blue in Reports and blue on the student page, because the class says
   "students" and there is no way to write "the third tile". Rotating colour by
   position is the thing that makes a row of tiles decorative. */
.kpi__ico { background: var(--kpi-chip, var(--accent-tint)); color: var(--kpi-ico, var(--accent-ink)); }
.kpi--students     { --kpi-chip: var(--blue-chip);   --kpi-ico: var(--blue); }
.kpi--batches      { --kpi-chip: var(--green-chip);  --kpi-ico: var(--green); }
.kpi--revenue      { --kpi-chip: var(--yellow-chip); --kpi-ico: var(--yellow-ink); }
.kpi--staff        { --kpi-chip: var(--orange-chip); --kpi-ico: var(--orange); }
.kpi--certificates { --kpi-chip: var(--chip-violet); --kpi-ico: var(--icon-violet); }
.kpi--attendance   { --kpi-chip: var(--chip-teal);   --kpi-ico: var(--icon-teal); }
.kpi--orders       { --kpi-chip: var(--chip-pink);   --kpi-ico: var(--icon-pink); }
.kpi--practice     { --kpi-chip: var(--green-chip);  --kpi-ico: var(--green); }
.kpi--accuracy     { --kpi-chip: var(--blue-chip);   --kpi-ico: var(--blue); }
/* Fees owed is the one metric that is a problem by definition — there is no
   good number of students who have not paid. It gets the red of the overdue
   chip rather than another pastel, and it is the only red tile on the row. */
.kpi--fees         { --kpi-chip: #FDE7E8;            --kpi-ico: #B4181D; }

/* THE GUARANTEE IS "the same metric is always the same colour", not "every
   metric has a colour no other metric uses" — there are more things worth
   counting than there are chip tokens, and inventing a ninth and tenth hue
   would cost more than it buys. What IS enforced: no two metrics that appear
   ON THE SAME SCREEN share a colour. Practice green and accuracy blue sit
   beside attendance teal and certificates violet on the student page; batches
   green and students blue never appear on it. */

/* The three the admin screens already use, kept working. */
.kpi--warn { --kpi-chip: var(--yellow-chip); --kpi-ico: var(--yellow-ink); }
.kpi--bad  { --kpi-chip: var(--orange-chip); --kpi-ico: var(--orange); }
.kpi--good { --kpi-chip: var(--green-chip);  --kpi-ico: var(--green); }

/* THE FRANCHISE WEIGHTING of the same tile: the icon moves out to the left as
   a 44px square and the number sits beside it rather than under it. Scoped to
   the franchise surface on purpose — admin is the dense, information-first
   surface (§"THREE SURFACES"), and a partner glancing at six numbers between
   classes is not doing the same job as somebody working a console all day.
   Same tokens, different weighting.

   display:contents on __top lets the existing markup — icon and label wrapped
   together — lay out as four grid children without a single screen changing. */
[data-panel="franchise"] .kpi {
  display: grid; grid-template-columns: 44px minmax(0, 1fr);
  grid-template-areas: "ico label" "ico num" "ico foot";
  column-gap: 13px; align-content: start; padding: 16px;
}
[data-panel="franchise"] .kpi__top { display: contents; }
[data-panel="franchise"] .kpi__ico {
  grid-area: ico; align-self: start;
  width: 44px; height: 44px; border-radius: var(--r-md);
}
[data-panel="franchise"] .kpi__label { grid-area: label; align-self: center; }
[data-panel="franchise"] .kpi__num   { grid-area: num; margin: 1px 0 0; }
[data-panel="franchise"] .kpi__foot  { grid-area: foot; margin: 5px 0 0; }

/* ---------------------------------------------------------------------------
   8. Status chips
   Fixed meanings, standards §3: pending amber, active green, rejected red,
   neutral grey/blue. Always icon + text — never colour alone.
   ------------------------------------------------------------------------ */
.st {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px 3px 7px; border-radius: var(--r-pill);
  font: 600 12.5px/1.45 var(--text); white-space: nowrap;
  border: 1px solid transparent;
}
.st .ico { flex: 0 0 auto; }
.st--pending  { background: var(--yellow-chip); color: var(--yellow-ink); border-color: #F0DFAE; }
.st--active   { background: var(--green-chip);  color: var(--green-deep); border-color: #BFE3CD; }
.st--bad      { background: #FDE7E8;            color: #B4181D;          border-color: #F4C3C5; }
.st--info     { background: var(--blue-chip);   color: var(--blue-deep);  border-color: #C3DCF6; }
.st--muted    { background: var(--ground);      color: var(--muted);      border-color: var(--line); }
.st--locked   { background: #FDE7E8;            color: #B4181D;          border-color: #F4C3C5; }

/* THE STUDENT LIFECYCLE, as five chips (client note 20 Oct, points 4–6).
   A student's standing is read off a list of eighty-odd rows at a glance, so
   each state gets its own colour AND its own icon — never colour alone (§8),
   and never a bare dot, because "what does the purple one mean" is a question
   a list should not raise.

     active    green    attending normally
     paused    amber    a temporary break, still enrolled
     moved     violet   changed batch this academic year  (point 4)
     left      grey     no longer attending               (point 5)
     rejoined  blue     a reactivated profile             (point 6)

   'moved' is violet rather than another amber because it is NOT a warning —
   nothing is wrong with a child who changed batch, and the centre simply has
   to see it when reading an attendance sheet. 'left' is deliberately the
   quietest of the five: a former student is a record, not an alert. */
.st--paused   { background: var(--yellow-chip); color: var(--yellow-ink); border-color: #F0DFAE; }
.st--moved    { background: var(--chip-violet); color: var(--icon-violet); border-color: #D7CBF5; }
.st--left     { background: var(--ground);      color: var(--muted);      border-color: var(--line); }
.st--rejoined { background: var(--blue-chip);   color: var(--blue-deep);  border-color: #C3DCF6; }

/* FEE STATE, which is a different axis from the lifecycle above (client note
   21 Oct, points 17–18). A child can be Active AND Overdue at once — that pair
   is exactly the case the centre is chasing — so these live in their own column
   rather than competing for the status cell.

     paid       green, quiet   nothing owed
     part       amber          something paid, something still due
     overdue    red            past the due date
   Books are charged separately from tuition, so they carry their own chip
   rather than being folded into the total (point 17). */
/* THE LEVEL CHIP. "Level 3" appears on nine of these screens and was the same
   flat blue on all of them, which wasted the one piece of colour coding the
   product actually has — a level IS a category, and the ramp already exists.
   The chip is tinted to 14% of its level's colour with the colour itself as
   text, so it matches its donut segment and its bar without shouting.
   Set with style="--lvc:var(--lv3)" or the .st--lvN shorthands below. */
.st--lv1 { --lvc: var(--lv1); } .st--lv2 { --lvc: var(--lv2); }
.st--lv3 { --lvc: var(--lv3); } .st--lv4 { --lvc: var(--lv4); }
.st--lv5 { --lvc: var(--lv5); } .st--lv6 { --lvc: var(--lv6); }
.st--lv7 { --lvc: var(--lv7); } .st--lv8 { --lvc: var(--lv8); }

.st--lv, .st--lv1, .st--lv2, .st--lv3, .st--lv4,
.st--lv5, .st--lv6, .st--lv7, .st--lv8 {
  background: color-mix(in srgb, var(--lvc, var(--blue)) 12%, white);
  color: color-mix(in srgb, var(--lvc, var(--blue)) 82%, black);
  border-color: color-mix(in srgb, var(--lvc, var(--blue)) 28%, white);
  font-variant-numeric: tabular-nums;
}
/* Old browsers get the flat blue chip back rather than a transparent one. */
@supports not (color: color-mix(in srgb, red 50%, white)) {
  .st--lv, .st--lv1, .st--lv2, .st--lv3, .st--lv4,
  .st--lv5, .st--lv6, .st--lv7, .st--lv8 {
    background: var(--blue-chip); color: var(--blue-deep); border-color: #C3DCF6;
  }
}

.st--paid     { background: var(--green-chip);  color: var(--green-deep); border-color: #BFE3CD; }
.st--part     { background: var(--yellow-chip); color: var(--yellow-ink); border-color: #F0DFAE; }
.st--overdue  { background: #FDE7E8;            color: #B4181D;          border-color: #F4C3C5; }

/* A row for a student who has left reads back, not forward — see F4 and F21.
   Muted, not struck through: they may well be back (point 6). */
.prow--left td { color: var(--muted); }
.prow--left .pwho__text b { font-weight: 500; }
.prow--left .pav { opacity: .6; }

/* ---------------------------------------------------------------------------
   9. Data tables
   The shape of most admin and franchise screens. Rules that matter:
   - the CONTAINER scrolls, never the page (§10)
   - the header is sticky inside that container
   - the actions column is right-aligned and sticky on a scrolling table (§5.1)
   - below 720px each row becomes a card; a squeezed icon strip is forbidden
   ------------------------------------------------------------------------ */
.ptable__scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ptable { width: 100%; border-collapse: separate; border-spacing: 0; }

/* A nine-column table crushes its own content long before it runs out of
   container. Below this width the columns stop shrinking and the CONTAINER
   scrolls instead, which is the behaviour §10 asks for — the page itself never
   moves sideways. Lifted in card mode, where there are no columns left. */
@media (min-width: 721px) {
  .ptable { min-width: 980px; }
  .ptable--slim { min-width: 720px; }
  /* Nine columns or more — the support queue, where squeezing to fit turns
     every name into two lines. It scrolls in its container instead. */
  .ptable--wide { min-width: 1180px; }
}
/* A chip with a second line under it — the source page under a form name. */
.ptable td > .st + small { margin-top: 4px; }
.ptable caption { text-align: left; padding: 0 0 10px; color: var(--muted); font-size: var(--t-xs); }

.ptable th, .ptable td {
  padding: var(--row-y) 14px; text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--line);
}
.ptable thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--ground); color: var(--muted);
  font: 700 11.5px/1.2 var(--mark); letter-spacing: .07em; text-transform: uppercase;
  white-space: nowrap;
}
.ptable tbody tr:last-child td { border-bottom: 0; }
.ptable tbody tr:hover { background: var(--blue-tint); }
[data-panel="franchise"] .ptable tbody tr:hover { background: var(--yellow-tint); }
.ptable td b { font: 600 14.5px/1.3 var(--text); color: var(--navy); }
.ptable td small { display: block; font-size: 12.5px; color: var(--muted); }
/* nowrap because a figure broken across two lines stops being a figure:
   a price of 3,997 wrapped after the comma reads as 3,99 and then 7. */
.ptable .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* An email address is one long unbreakable word. Left alone it decides the
   width of its column and pushes everything else into three-line wraps. */
.ptable td { overflow-wrap: anywhere; }
.ptable td .link-plain { overflow-wrap: anywhere; }

/* A sortable header announces its state in aria-sort; the arrow is only the
   visual half of that (§8). */
.ptable th button {
  display: inline-flex; align-items: center; gap: 5px;
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit;
}
.ptable th button .ico { opacity: .5; }
.ptable th[aria-sort] button .ico { opacity: 1; color: var(--accent-ink); }

/* The row that needs attention — an unbatched student, a breached SLA. Tinted
   and given a left marker, so it reads without relying on the tint alone. */
.ptable tr[data-flag] td:first-child { box-shadow: inset 3px 0 0 var(--yellow); }
.ptable tr[data-flag="bad"] td:first-child { box-shadow: inset 3px 0 0 var(--red); }

/* Actions, pinned to the right edge while the table scrolls under them. */
.ptable .acts { width: 1%; white-space: nowrap; text-align: right; }
@media (min-width: 721px) {
  .ptable .acts {
    position: sticky; right: 0;
    background: var(--surface);
    box-shadow: -8px 0 12px -10px rgba(20, 38, 77, .35);
  }
  .ptable thead .acts { background: var(--ground); }
  .ptable tbody tr:hover .acts { background: var(--blue-tint); }
  [data-panel="franchise"] .ptable tbody tr:hover .acts { background: var(--yellow-tint); }
}
.acts__row { display: inline-flex; align-items: center; gap: 2px; justify-content: flex-end; }

/* Row action button: 20px glyph in a 36px target on desktop, 44px on touch —
   standards §2.4 and §5.1. Delete is separated and reddens on hover/focus. */
.ract {
  width: 36px; height: 36px; display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: none; cursor: pointer; color: var(--muted); text-decoration: none;
}
.ract:hover { background: var(--ground); border-color: var(--line); color: var(--navy); }
.ract:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.ract--danger { margin-left: 6px; position: relative; }
.ract--danger::before {
  content: ""; position: absolute; left: -4px; top: 7px; bottom: 7px;
  width: 1px; background: var(--line);
}
.ract--danger:hover { color: var(--red); background: #FDE7E8; border-color: #F4C3C5; }
.ract[disabled] { opacity: .4; cursor: not-allowed; }
@media (hover: none) {
  .ract { width: 44px; height: 44px; }
}

/* Below 720px the table stops being a table. Each row is a card with a real
   label against each value and an explicit action row. */
@media (max-width: 720px) {
  .ptable thead { display: none; }
  .ptable, .ptable tbody, .ptable tr, .ptable td { display: block; width: 100%; }
  .ptable tr {
    border: 1px solid var(--line); border-radius: var(--r-panel);
    margin-bottom: 10px; padding: 4px 0; background: var(--surface);
  }
  .ptable tr[data-flag] { border-left: 3px solid var(--yellow); }
  .ptable tr[data-flag="bad"] { border-left: 3px solid var(--red); }
  .ptable td {
    border-bottom: 0; padding: 7px 14px;
    display: grid; grid-template-columns: 38% minmax(0, 1fr);
    gap: 4px 10px; align-items: baseline;
  }
  .ptable td::before {
    content: attr(data-label); grid-column: 1; grid-row: 1;
    font: 700 11px/1.3 var(--mark); letter-spacing: .07em; text-transform: uppercase;
    color: var(--muted);
  }
  /* Everything in the cell goes in the value column and stacks down it. Without
     this a second child — the <small> under a name — is auto-placed back under
     the LABEL, which reads as though it belongs to the next row. */
  .ptable td > * { grid-column: 2; min-width: 0; }
  /* A chip is as wide as its words, not as wide as the column. */
  .ptable td > .st, .ptable td > .pwho { justify-self: start; }
  .ptable td.num { text-align: left; }

  /* The row checkbox needs no label of its own — the card it sits on is the
     label, and "SELECT" above every card is noise. */
  .ptable td.sel {
    grid-template-columns: minmax(0, 1fr); justify-items: start; padding-top: 10px;
  }
  .ptable td.sel::before { display: none; }
  .ptable td.sel > * { grid-column: 1; }

  /* The actions cell is single-column too, so its row has to be told to stay
     in column 1 — the rule above would otherwise push it into an implicit
     second column and strand it against the right edge. */
  .ptable td.acts > * { grid-column: 1; }
  .ptable td.acts {
    grid-template-columns: 1fr; width: auto; text-align: left;
    border-top: 1px solid var(--line); margin-top: 5px; padding-top: 9px;
  }
  .ptable td.acts::before { display: none; }
  .acts__row { justify-content: flex-start; }
}

/* ---------------------------------------------------------------------------
   10. Toolbar above a table — search, filters, bulk bar
   ------------------------------------------------------------------------ */
.ptools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.ptools__grow { flex: 1 1 220px; min-width: 0; }
.ptools .select, .ptools .input { height: 38px; font-size: 15px; }
/* site.css sets form controls to width:100% for the marketing forms, where one
   control owns its row. In a toolbar they sit side by side, so each takes the
   width of its own longest option and no more. */
.ptools .select { width: auto; flex: 0 1 auto; min-width: 140px; max-width: 100%; }
@media (max-width: 560px) {
  /* Once they can no longer sit side by side, full width is the honest layout
     rather than three stray half-width boxes. */
  .ptools .select { width: 100%; flex: 1 1 100%; }
}
@media (max-width: 480px) {
  /* 16px minimum on touch, or iOS Safari zooms the page on focus (§2.3). */
  .ptools .select, .ptools .input, .psearch input { font-size: 16px; }
}

.pfind { position: relative; }
.pfind .ico {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.pfind .input { padding-left: 36px; width: 100%; }

/* Bulk selection bar — sticky, and it names the count (§5.3). */
.pbulk {
  position: sticky; bottom: 0; z-index: var(--z-stuck);
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--navy); color: var(--on-navy);
  border-radius: 0 0 var(--r-panel) var(--r-panel);
  box-shadow: var(--lift-stuck);
}
.pbulk b { font: 700 14.5px/1 var(--text); }
.pbulk__acts { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------------------------------------------------------------------------
   11. Pagination
   ------------------------------------------------------------------------ */
.ppage {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 12px 16px; border-top: 1px solid var(--line);
}
.ppage__count { font: 400 var(--t-xs)/1.4 var(--text); color: var(--muted); }
.ppage__nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.ppage__nav a, .ppage__nav span {
  min-width: 34px; height: 34px; padding: 0 9px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--navy); text-decoration: none;
  font: 500 14px/1 var(--text); font-variant-numeric: tabular-nums;
}
.ppage__nav a:hover { background: var(--ground); }
.ppage__nav [aria-current="page"] {
  background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 700;
}
[data-panel="franchise"] .ppage__nav [aria-current="page"] { color: var(--navy); }
.ppage__nav [aria-disabled="true"] { opacity: .45; pointer-events: none; }

/* ---------------------------------------------------------------------------
   12. The states every screen must have — standards §9
   Empty, loading (skeleton, not a spinner on a blank page), error, locked,
   and no-permission. These are designed, not afterthoughts.
   ------------------------------------------------------------------------ */
.pempty { padding: clamp(32px, 5vw, 56px) 24px; text-align: center; }
.pempty__ico {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-tint); color: var(--accent-ink);
}
.pempty h3 { margin: 0; font: 700 17px/1.3 var(--display); color: var(--navy); }
.pempty p {
  margin: 6px auto 0; max-width: 46ch;
  font: 400 var(--t-sm)/1.55 var(--text); color: var(--muted);
}
.pempty .btn-row { justify-content: center; margin-top: 16px; }

/* A skeleton matches the shape of what is coming, so the page does not jump. */
.pskel { background: var(--line); border-radius: var(--r-sm); height: 12px; }
.pskel--text { height: 12px; }
.pskel--line { height: 12px; width: 62%; }
.pskel--num  { height: 26px; width: 44%; }
@media (prefers-reduced-motion: no-preference) {
  .pskel { animation: pskel 1.3s ease-in-out infinite; }
  @keyframes pskel { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
}

/* A banner that explains a rule. The SOW is full of locks — renewal overdue,
   level locked, games locked, verification pending — and a locked screen that
   does not say why is a defect (§5.3). */
.pnote {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--r-panel);
  border: 1px solid var(--line); background: var(--surface);
}
.pnote__ico { flex: 0 0 auto; margin-top: 1px; color: var(--muted); }
.pnote b { display: block; font: 700 14.5px/1.35 var(--text); color: var(--navy); }
.pnote p { margin: 3px 0 0; font: 400 var(--t-sm)/1.5 var(--text); color: var(--muted); }
.pnote__act { margin-left: auto; flex: 0 0 auto; }
@media (max-width: 560px) {
  .pnote { flex-wrap: wrap; }
  .pnote__act { margin: 10px 0 0; width: 100%; }
}
.pnote--warn { background: var(--yellow-tint); border-color: #F0DFAE; }
.pnote--warn .pnote__ico { color: var(--yellow-ink); }
.pnote--bad  { background: #FDE7E8; border-color: #F4C3C5; }
.pnote--bad .pnote__ico { color: var(--red); }
.pnote--info { background: var(--blue-tint); border-color: #C3DCF6; }
.pnote--info .pnote__ico { color: var(--blue); }
.pnote--good { background: var(--green-tint); border-color: #BFE3CD; }
.pnote--good .pnote__ico { color: var(--green); }

/* ---------------------------------------------------------------------------
   13. Modal
   Desktop sizes sm/md/lg/xl per §6; on a phone a full-screen sheet with a
   sticky footer, never a shrunken desktop dialog. The body scrolls inside.
   ------------------------------------------------------------------------ */
.pmodal {
  position: fixed; inset: 0; z-index: var(--z-modal); margin: 0;
  display: grid; place-items: center; padding: 20px;
  background: rgba(20, 38, 77, .55);
}
.pmodal[hidden] { display: none; }
.pmodal__box {
  width: 100%; max-width: 560px; max-height: 90dvh;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--lift-menu); overflow: hidden;
}
.pmodal--sm .pmodal__box { max-width: 420px; }
.pmodal--lg .pmodal__box { max-width: 720px; }
.pmodal--xl .pmodal__box { max-width: 960px; }
.pmodal__head {
  flex: 0 0 auto; display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.pmodal__head h2 { margin: 0; font: 700 17px/1.3 var(--display); color: var(--navy); }
.pmodal__head p { margin: 3px 0 0; font: 400 var(--t-sm)/1.5 var(--text); color: var(--muted); }
.pmodal__x { margin-left: auto; flex: 0 0 auto; }
.pmodal__body { flex: 1 1 auto; overflow-y: auto; padding: 18px; }
.pmodal__foot {
  flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--ground);
}
@media (max-width: 560px) {
  /* A form or a detail view takes the whole screen: it has enough in it to
     fill one, and a half-height sheet would mean scrolling a scroll. */
  .pmodal { padding: 0; place-items: stretch; }
  .pmodal__box { max-width: none; max-height: none; height: 100dvh; border-radius: 0; }
  .pmodal__foot > .btn { flex: 1 1 auto; }

  /* A short choice does not. Full-screen for a two-button confirm leaves most
     of the phone empty and puts the buttons miles from the thumb, so the small
     size becomes a bottom sheet instead — §6, "bottom sheet (short choices and
     confirms)". It is as tall as its own content and no taller. */
  .pmodal--sm { place-items: end stretch; }
  .pmodal--sm .pmodal__box {
    height: auto; max-height: 85dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }
}

/* ---------------------------------------------------------------------------
   14. Odds and ends the panels reuse
   ------------------------------------------------------------------------ */
/* An avatar with initials — child avatars are illustrated, not photographs
   (design plan assumption A3, for child safety). */
.pav {
  width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--chip-violet); color: var(--icon-violet);
  font: 700 12.5px/1 var(--mark);
}
.pwho { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pwho__text { min-width: 0; }

/* A definition row, for detail panels. */
.pdl { display: grid; gap: 0; }
.pdl > div {
  display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.pdl > div:last-child { border-bottom: 0; }
.pdl dt { font: 600 12.5px/1.4 var(--text); color: var(--muted); margin: 0; }
.pdl dd { margin: 0; font: 400 14.5px/1.5 var(--text); color: var(--navy); word-break: break-word; }
@media (max-width: 480px) {
  .pdl > div { grid-template-columns: 1fr; gap: 2px; }
}

/* A small two- or three-way toggle inside a card header — the period switch on
   a chart, "Weekly / Monthly" on a leaderboard. Not to be confused with
   site.css's .segmented, which is a full-width three-column control for the
   marketing forms and is keyed on aria-current rather than aria-pressed. */
.ptoggle {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--ground); border: 1px solid var(--line); border-radius: var(--r-pill);
}
.ptoggle button {
  padding: 5px 12px; border: 0; border-radius: var(--r-pill);
  background: none; cursor: pointer;
  font: 600 12.5px/1.3 var(--text); color: var(--muted);
}
.ptoggle button:hover { color: var(--navy); }
/* Pressed for a plain toggle group, selected when the group is a tablist —
   .ptoggle serves as the second, narrower switch on a screen whose first one
   is .ptabs (the leaderboard: period above, who-is-ranked here). */
.ptoggle button[aria-pressed="true"], .ptoggle button[aria-selected="true"] {
  background: var(--surface); color: var(--navy);
  box-shadow: var(--lift-card); border: 1px solid var(--line);
  padding: 4px 11px;
}
.ptoggle button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* Tabs, used on leaderboards, reports and ticket views. */
.ptabs {
  display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line);
  padding: 0 14px;
}
.ptabs a {
  padding: 12px 13px; text-decoration: none; white-space: nowrap;
  font: 600 14px/1.2 var(--text); color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.ptabs a:hover { color: var(--navy); }
.ptabs a[aria-current="page"] { color: var(--accent-ink); border-bottom-color: var(--accent); }

/* The preview ribbon. These screens are designs with sample data in them, and
   nobody reviewing one should be left wondering whether the numbers are real. */
.pdemo {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 7px 14px; background: var(--navy); color: var(--on-navy-3);
  font: 500 12.5px/1.4 var(--text); text-align: center;
}
.pdemo b { color: var(--yellow); font-weight: 700; }
.pdemo .ico { flex: 0 0 auto; color: var(--yellow); }

/* Screen-reader-only helper already exists in site.css as .sr-only. */

/* ---------------------------------------------------------------------------
   15. Detail layout
   A record and its side rail: the thing itself on the left, the decisions you
   can make about it on the right. Used by the franchise application review,
   the franchise account, and every later detail screen.
   ------------------------------------------------------------------------ */
/* minmax(0, 1fr) on the single-column form too, not only on the two-column
   one. An implicit `auto` track is sized by its content's min-content, so one
   wide child — a table, a long unbroken heading — pushes the whole column past
   the viewport and scrolls the PAGE sideways. Capping the track's floor at 0
   makes the child shrink or scroll inside itself instead, which is what §10
   asks for. Same reason for min-width on the children. */
.pdetail {
  display: grid; grid-template-columns: minmax(0, 1fr);
  gap: clamp(14px, 1.6vw, 20px); align-items: start;
}
.pdetail > * { min-width: 0; }
@media (min-width: 1000px) {
  .pdetail { grid-template-columns: minmax(0, 1fr) 340px; }
  .pdetail__rail { position: sticky; top: calc(var(--ptop-h) + 16px); }
}
.pdetail__rail { display: grid; gap: clamp(14px, 1.6vw, 20px); min-width: 0; }

/* The left-hand column of a .pdetail, when it holds more than one card. Same
   rhythm as the rail, without the sticky — the record scrolls, the decisions
   beside it stay put. */
.pdetail__main { display: grid; gap: clamp(14px, 1.6vw, 20px); min-width: 0; }
.pdetail__main > * { min-width: 0; }
.pdetail__rail > * { min-width: 0; }

/* A short label-and-value strip, tighter than .pdl, for the top of a record. */
.pfacts {
  display: grid; gap: 14px 22px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.pfacts div { min-width: 0; }
.pfacts dt {
  margin: 0 0 2px; font: 700 10.5px/1.2 var(--mark);
  letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
}
.pfacts dd {
  margin: 0; font: 600 14.5px/1.4 var(--text); color: var(--navy);
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------------------
   16. Document viewer — franchise KYC, scanned exam papers
   §6: "zoomable viewer, pinch-zoom on touch, download button, works in
   Safari". The frame below is the design; the zoom behaviour arrives with the
   real files. What matters here is that a reviewer can tell at a glance which
   documents are present and which are missing, because approving a centre on
   an incomplete file is the mistake this screen exists to prevent.
   ------------------------------------------------------------------------ */
.pdocs { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.pdoc {
  display: grid; gap: 8px; padding: 10px;
  border: 1px solid var(--line); border-radius: var(--r-panel);
  background: var(--surface); text-align: left; cursor: pointer;
  font: inherit; color: inherit;
}
.pdoc:hover { border-color: var(--accent); }
.pdoc:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.pdoc__thumb {
  aspect-ratio: 4 / 3; border-radius: var(--r-sm); background: var(--ground);
  display: grid; place-items: center; color: var(--muted);
  border: 1px solid var(--line);
}
.pdoc__name { font: 600 13px/1.35 var(--text); color: var(--navy); }
.pdoc__meta { font-size: 11.5px; color: var(--muted); }
/* A document that was never uploaded is not a blank card — it says so. */
.pdoc--missing { border-style: dashed; cursor: default; }
.pdoc--missing .pdoc__thumb { background: #FDE7E8; color: var(--red); border-color: #F4C3C5; }
.pdoc--missing:hover { border-color: var(--line); }

/* ---------------------------------------------------------------------------
   17. Conversation thread — support tickets
   ------------------------------------------------------------------------ */
.pthread { display: grid; gap: 14px; }
.pmsg { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; }
.pmsg__body {
  padding: 11px 13px; border-radius: var(--r-panel);
  background: var(--ground); border: 1px solid var(--line);
}
.pmsg__who {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 4px;
}
.pmsg__who b { font: 600 13.5px/1.3 var(--text); color: var(--navy); }
.pmsg__who time { font-size: 11.5px; color: var(--muted); }
.pmsg p { margin: 0; font: 400 14.5px/1.55 var(--text); color: var(--navy); }
/* Our own replies are tinted and flipped, so a thread reads as a conversation
   rather than as a list of identical blocks. */
.pmsg--ours { grid-template-columns: minmax(0, 1fr) 34px; }
.pmsg--ours .pav { order: 2; }
.pmsg--ours .pmsg__body { background: var(--blue-tint); border-color: #C3DCF6; }
.pmsg--ours .pmsg__who { justify-content: flex-end; }
.pmsg--ours p { text-align: right; }

/* ---------------------------------------------------------------------------
   18. Activity log
   A vertical rule with a dot per entry. Cheaper to scan than a table when what
   matters is the order things happened in.
   ------------------------------------------------------------------------ */
.plog { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.plog li {
  position: relative; padding: 0 0 18px 30px; border-left: 2px solid var(--line);
  margin-left: 7px;
}
.plog li:last-child { border-left-color: transparent; padding-bottom: 0; }
.plog__dot {
  position: absolute; left: -9px; top: 1px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line);
  display: grid; place-items: center; color: var(--muted);
}
.plog__dot--good { border-color: var(--green); color: var(--green); }
.plog__dot--bad { border-color: var(--red); color: var(--red); }
.plog__dot--warn { border-color: var(--yellow-deep); color: var(--yellow-ink); }
.plog b { display: block; font: 600 14px/1.4 var(--text); color: var(--navy); }
.plog p { margin: 2px 0 0; font: 400 13px/1.5 var(--text); color: var(--muted); }
.plog time { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------------
   19. A measured bar — students by level, revenue by region
   ------------------------------------------------------------------------ */
.pbars { display: grid; gap: 11px; }
.pbar { display: grid; grid-template-columns: minmax(84px, 22%) 1fr auto; gap: 12px; align-items: center; }
.pbar__label { font: 500 13.5px/1.35 var(--text); color: var(--navy); min-width: 0; }
.pbar__track { height: 9px; border-radius: var(--r-pill); background: var(--ground); overflow: hidden; }
/* --bar lets a bar carry its subject's colour — style="--bar:var(--lv3)" for
   Level 3, so the bar agrees with the donut segment and the chip. Unset, it
   falls back to the surface accent exactly as before. */
.pbar__fill { display: block; height: 100%; border-radius: var(--r-pill); background: var(--bar, var(--accent)); }
.pbar__value { font: 600 13.5px/1 var(--text); color: var(--navy); font-variant-numeric: tabular-nums; }
@media (max-width: 480px) {
  .pbar { grid-template-columns: 1fr auto; }
  .pbar__track { grid-column: 1 / -1; }
}

/* A chart's drawing area. The SVGs scale to their container and their aspect
   ratio is fixed, so width is height: unchecked, a 660x290 viewBox in a
   full-width card draws 470px tall. Capped here rather than in each component
   so one number governs every chart on the surface. Left-aligned, not centred
   (§7.1 #5) — the y-axis is the reading edge. */
.pchart { max-width: 820px; }

/* TWO CHARTS SIDE BY SIDE need more room than two cards of text, so the pair
   carries .grid--charts and goes single-column while there is still width to
   read them in. .grid--2's own breakpoint is 720px, which is right for prose
   and wrong here: a 660-unit viewBox squeezed into a 360px column scales its
   axis labels to about 6px and its bars to 20px, and no font size fixes that
   because the whole drawing is being scaled, text and all. */
@media (max-width: 1040px) {
  .grid--2.grid--charts { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------------------
   The welcome band (A5, franchise dashboard)
   A greeting, a line of context and a photograph — the one place on the
   franchise surface where warmth outranks density, because it is the first
   thing a partner sees each morning and a wall of figures is a cold open.

   A FLAT TINT, not a gradient (§7.1 #1). The photograph is the client's own
   (§7.1 #8 bans stock), cropped by object-position rather than by a second
   file, so the framing can be retuned without refetching anything. It sits
   flush to the bottom edge so the band reads as one shape rather than as a
   card with a picture pasted in it.
   ------------------------------------------------------------------------ */
.pwelcome {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(14px, 2vw, 26px);
  background: var(--yellow-tint); border: 1px solid #F3E3B8;
  border-radius: var(--r-panel);
  padding: 0 clamp(18px, 2.4vw, 28px);
  overflow: hidden;
}
.pwelcome__text { align-self: center; padding: clamp(18px, 2.4vw, 26px) 0; }
.pwelcome__text h2 {
  margin: 0; font: 800 clamp(21px, 2.5vw, 29px)/1.15 var(--display); color: var(--navy);
}
.pwelcome__text p {
  margin: 7px 0 0; font: 400 var(--t-lead)/1.45 var(--text); color: var(--muted);
  max-width: 46ch;
}
.pwelcome__art {
  align-self: end; display: block;
  width: clamp(104px, 13vw, 152px); height: clamp(116px, 15vw, 164px);
  object-fit: cover; object-position: 50% 6%;
  border-radius: var(--r-md) var(--r-md) 0 0;
}
/* Below 640px the photograph goes rather than shrinking to a thumbnail that
   reads as an avatar. The greeting is the part that has to survive. */
@media (max-width: 640px) {
  .pwelcome { grid-template-columns: minmax(0, 1fr); }
  .pwelcome__art { display: none; }
}

/* ---------------------------------------------------------------------------
   Donut + legend (<x-donut>)
   Chart left, legend right on desktop; stacked below 560px, where a legend
   squeezed into a third of a phone wraps every label onto two lines.
   ------------------------------------------------------------------------ */
.pdonut {
  display: grid; grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  gap: clamp(14px, 2vw, 24px); align-items: center;
  /* Capped, because a donut gains nothing from being 1200px wide: past this
     the ring stops growing and only the gap between each label and its number
     does, which reads as a layout that lost its right-hand column. */
  max-width: 620px;
}
.pdonut__chart { min-width: 0; }

.plegend { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; min-width: 0; }
.plegend__row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px; align-items: center;
  font: 400 13.5px/1.35 var(--text); color: var(--navy);
}
.plegend__dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.plegend__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plegend__val { font-weight: 600; font-variant-numeric: tabular-nums; }

@media (max-width: 560px) {
  .pdonut { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .pdonut__chart { max-width: 190px; }
  .plegend { width: 100%; }
}

/* ---------------------------------------------------------------------------
   Ring gauge (<x-ring>)
   For the things genuinely out of a hundred. Sized by --pring-size so one
   component serves a 44px row gauge and a 96px card gauge.
   ------------------------------------------------------------------------ */
.pring { display: inline-grid; justify-items: center; gap: 5px; }
.pring svg { width: var(--pring-size, 60px); height: var(--pring-size, 60px); }
.pring__cap {
  font: 600 11px/1.2 var(--mark); letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); text-align: center;
}

/* ---------------------------------------------------------------------------
   20. Status switch — suspend or reactivate an account
   A real checkbox underneath, so it is keyboard-operable and announces itself.
   ------------------------------------------------------------------------ */
.pswitch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.pswitch input { position: absolute; opacity: 0; width: 0; height: 0; }
.pswitch__track {
  width: 42px; height: 24px; flex: 0 0 auto; border-radius: var(--r-pill);
  background: var(--muted); position: relative; transition: background .16s ease-out;
}
.pswitch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform .16s ease-out;
}
.pswitch input:checked + .pswitch__track { background: var(--green); }
.pswitch input:checked + .pswitch__track::after { transform: translateX(18px); }
.pswitch input:focus-visible + .pswitch__track { outline: 2px solid var(--focus); outline-offset: 2px; }
.pswitch__label { font: 500 14px/1.3 var(--text); color: var(--navy); }
@media (prefers-reduced-motion: reduce) {
  .pswitch__track, .pswitch__track::after { transition: none; }
}

/* ---------------------------------------------------------------------------
   21. Reserved-for-later screen (A14, Online Competition)
   SOW §4.5.9 asks for the provision, not the feature. An honest placeholder
   says what it will be and what it is not, rather than showing a fake UI.
   ------------------------------------------------------------------------ */
.psoon { padding: clamp(36px, 6vw, 72px) 24px; text-align: center; }
.psoon__ico {
  width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--yellow-tint); color: var(--yellow-ink);
}
.psoon h2 { margin: 0; font: 700 var(--t-h3)/1.25 var(--display); color: var(--navy); }
.psoon > p {
  margin: 8px auto 0; max-width: 52ch;
  font: 400 var(--t-body)/1.6 var(--text); color: var(--muted);
}
.psoon__list {
  max-width: 460px; margin: 22px auto 0; padding: 16px 18px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--ground);
}
.psoon__list p {
  margin: 0 0 8px; font: 700 11px/1.2 var(--mark);
  letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
}
.psoon__list ul { margin: 0; padding-left: 18px; }
.psoon__list li { font: 400 14px/1.7 var(--text); color: var(--navy); }

/* ---------------------------------------------------------------------------
   22. Priority and SLA marks, used by the support queue
   ------------------------------------------------------------------------ */
.ppri {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 13px/1.4 var(--text); white-space: nowrap;
}
.ppri::before {
  content: ""; width: 8px; height: 8px; border-radius: 2px; flex: 0 0 auto;
  background: currentColor;
}
.ppri--high { color: #B4181D; }
.ppri--med { color: var(--yellow-ink); }
.ppri--low { color: var(--muted); }

/* ---------------------------------------------------------------------------
   23. Attendance roster — franchise F8
   The plan calls this the one mobile-critical screen (design plan assumption
   A5: "Franchise Portal is desktop-primary; only attendance is
   mobile-critical"), because it is marked at the start of a class, standing
   up, on a phone. So it is a card list at every width rather than a table that
   collapses into one — there is no desktop layout to collapse FROM, and the
   teacher's version is the real one.
   ------------------------------------------------------------------------ */
.proster { display: grid; gap: 8px; }
.proster__row {
  display: grid; gap: 10px 14px; align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 11px 13px;
  border: 1px solid var(--line); border-radius: var(--r-panel);
  background: var(--surface);
}
.proster__who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.proster__who b { font: 600 15px/1.3 var(--text); color: var(--navy); }
.proster__who small { display: block; font-size: 12.5px; color: var(--muted); }

/* Present / absent. A segmented pair of real radios — two 44px targets side
   by side, which is what a thumb needs, and what a keyboard understands. */
.ppick { display: inline-flex; gap: 4px; padding: 3px; flex: 0 0 auto;
  background: var(--ground); border: 1px solid var(--line); border-radius: var(--r-pill); }
.ppick label {
  position: relative; display: grid; place-items: center;
  min-width: 62px; min-height: 40px; padding: 0 12px; border-radius: var(--r-pill);
  font: 600 13.5px/1 var(--text); color: var(--muted); cursor: pointer;
}
.ppick input { position: absolute; opacity: 0; width: 0; height: 0; }
.ppick input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: var(--r-pill); }
.ppick label:has(input:checked) { background: var(--surface); box-shadow: var(--lift-card); }
.ppick label.is-present:has(input:checked) { color: var(--green-deep); }
.ppick label.is-absent:has(input:checked) { color: #B4181D; }
/* :has() is the neat way and Safari 15.4+ has it; this is the fallback for
   anything older, driven by a class the script sets. */
.ppick label.is-on { background: var(--surface); box-shadow: var(--lift-card); }
.ppick label.is-present.is-on { color: var(--green-deep); }
.ppick label.is-absent.is-on { color: #B4181D; }

/* The class-work note per student — page numbers and a comment. Folded away
   until wanted, so marking twenty students stays one tap each. */
.proster__work { grid-column: 1 / -1; display: grid; gap: 8px; }
.proster__work[hidden] { display: none; }
@media (min-width: 640px) {
  .proster__work { grid-template-columns: 150px minmax(0, 1fr); }
}
.proster__more {
  grid-column: 1 / -1; justify-self: start;
  border: 0; background: none; padding: 2px 0; cursor: pointer;
  font: 600 12.5px/1.4 var(--text); color: var(--accent-ink);
  display: inline-flex; align-items: center; gap: 5px;
}
@media (max-width: 420px) {
  .proster__row { grid-template-columns: minmax(0, 1fr); }
  .ppick { justify-self: stretch; }
  .ppick label { flex: 1 1 0; }
}

/* ---------------------------------------------------------------------------
   24. Monthly attendance grid — franchise F9
   One row per student, one cell per day. It scrolls in its own container like
   any wide table; the name column stays put so a row stays readable.
   ------------------------------------------------------------------------ */
.pmonth { border-collapse: separate; border-spacing: 0; }
.pmonth th, .pmonth td { border-bottom: 1px solid var(--line); }
.pmonth thead th {
  position: sticky; top: 0; z-index: 2; background: var(--ground);
  padding: 8px 0; width: 30px; text-align: center;
  font: 700 10.5px/1.2 var(--mark); color: var(--muted);
}
.pmonth th[scope="row"] {
  position: sticky; left: 0; z-index: 1; background: var(--surface);
  padding: 8px 14px 8px 0; text-align: left; min-width: 160px;
  font: 600 13.5px/1.35 var(--text); color: var(--navy);
  box-shadow: 8px 0 12px -10px rgba(20, 38, 77, .35);
}
.pmonth thead th:first-child { left: 0; z-index: 3; background: var(--ground); }
.pmonth td { padding: 4px 0; text-align: center; }
.pday {
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: var(--r-sm); font: 700 10.5px/1 var(--mark);
}
.pday--p { background: var(--green-chip); color: var(--green-deep); }
.pday--a { background: #FDE7E8; color: #B4181D; }
.pday--h { background: var(--ground); color: var(--muted); }
.pday--x { color: var(--line); }

/* A student who changed batch mid-month is shown split, with the tag the SOW
   asks for, rather than silently averaged across two batches. */
.pmonth__split {
  display: inline-flex; align-items: center; gap: 5px; margin-left: 8px;
  padding: 1px 7px; border-radius: var(--r-pill);
  background: var(--blue-chip); color: var(--blue-deep);
  font: 700 10px/1.5 var(--mark); letter-spacing: .04em; text-transform: uppercase;
}

/* ---------------------------------------------------------------------------
   25. A step counter, for the flows that have steps (F5, F12)
   ------------------------------------------------------------------------ */
.psteps { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 4px; padding: 0; list-style: none; }
.psteps li {
  display: flex; align-items: center; gap: 8px;
  font: 600 13px/1.3 var(--text); color: var(--muted);
}
.psteps b {
  width: 22px; height: 22px; flex: 0 0 auto; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ground); border: 1px solid var(--line);
  font: 700 11.5px/1 var(--mark); color: var(--muted);
}
.psteps [aria-current] { color: var(--navy); }
.psteps [aria-current] b { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-panel="franchise"] .psteps [aria-current] b { color: var(--navy); }
.psteps .is-done b { background: var(--green); border-color: var(--green); color: #fff; }

/* ---------------------------------------------------------------------------
   26. Price / total line, for the book cart (F10) and renewal (F13)
   ------------------------------------------------------------------------ */
.ptotal { display: grid; gap: 8px; }
.ptotal div { display: flex; justify-content: space-between; gap: 16px; font: 400 14px/1.5 var(--text); color: var(--muted); }
.ptotal div span:last-child { color: var(--navy); font-variant-numeric: tabular-nums; }
.ptotal .ptotal__sum {
  padding-top: 10px; border-top: 1px solid var(--line);
  font: 700 17px/1.4 var(--display); color: var(--navy);
}
.ptotal .ptotal__sum span:last-child { font-weight: 700; }

/* ---------------------------------------------------------------------------
   27. The student surface — the mobile bottom nav
   The design plan proposes one for the student portal (§4: "Mobile bottom nav
   proposed: Home · Practice · Games · Leaderboard · Profile"), because a child
   on a phone should reach the five things they actually do without opening a
   drawer first. The drawer stays — the burger still reaches all twenty screens.

   Sticky rather than fixed, so it takes up space in the flow and cannot sit on
   top of the last row of a list, and it carries safe-area padding for the home
   indicator (§2.3).
   ------------------------------------------------------------------------ */
.pbottom { display: none; }
@media (max-width: 1023px) {
  [data-panel="student"] .pbottom {
    position: sticky; bottom: 0; z-index: var(--z-stuck);
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
    background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: var(--lift-stuck);
  }
}
.pbottom > * {
  display: grid; place-items: center; gap: 3px; min-height: 56px; padding: 8px 2px;
  text-decoration: none; color: var(--muted);
  font: 700 10px/1.2 var(--mark); letter-spacing: .05em; text-transform: uppercase;
  box-shadow: inset 0 3px 0 transparent;
}
.pbottom > *:hover { color: var(--navy); }
.pbottom [aria-current="page"] {
  color: var(--accent-ink); box-shadow: inset 0 3px 0 var(--accent);
}
/* A destination that is in the plan but not designed yet. Dimmed and inert,
   never missing — a four-item nav would read as a bug (see .pnav__link--soon). */
.pbottom [aria-disabled="true"] { opacity: .42; cursor: default; }

/* ---------------------------------------------------------------------------
   28. Student dashboard — the greeting block (S1)
   Not a coloured hero band: the identity sits on an ordinary card, left
   aligned, with the balances as figures on the right. §7.1 bans the gradient
   hero, and a child does not need one — their name and their level are the
   point, and type scale is what makes them the point.
   ------------------------------------------------------------------------ */
.sgreet {
  display: grid; gap: 18px 24px; padding: clamp(15px, 2.2vw, 22px);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 760px) {
  .sgreet { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
}
.sgreet__who { display: flex; align-items: center; gap: 14px; min-width: 0; }
.sgreet h2 {
  margin: 0; font: 700 clamp(20px, 2.4vw, 26px)/1.2 var(--display); color: var(--navy);
}
.sgreet__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 9px; margin: 7px 0 0;
  font: 400 var(--t-sm)/1.45 var(--text); color: var(--muted);
}

/* The avatar. Illustrated, not a photograph — design plan assumption A3, for
   child safety. The drawings arrived on 13 October 2026 (config/avatars.php),
   so .sav--art holds one of the twenty. The base rule stays because the
   modifier is built on it — the disc, its size and the chip a slow image
   loads onto. Initials on a pastel chip are still right on .pav, the small
   chips on S11 and S17, where the person may not be this student and there is
   no avatar to draw. */
.sav {
  width: 58px; height: 58px; flex: 0 0 auto; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--chip-violet); color: var(--icon-violet);
  font: 700 20px/1 var(--display); letter-spacing: .01em;
}
@media (min-width: 760px) { .sav { width: 66px; height: 66px; font-size: 23px; } }
/* A picture, not two letters: the chip becomes the ground it loads onto. */
.sav--art { background: var(--blue-tint); overflow: hidden; padding: 0; }

/* The level, said once and plainly. Yellow because it is an achievement, and it
   carries the word "Level" so it is not a bare number in a pill. */
.slevel {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px 4px 9px; border-radius: var(--r-pill);
  background: var(--yellow-chip); color: var(--navy); border: 1px solid #F0DFAE;
  font: 700 12.5px/1.45 var(--text); white-space: nowrap;
}

/* Points and coins. A dl, because they are labelled values. */
.spoints { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }
.spoint {
  flex: 1 1 110px; padding: 10px 14px 11px;
  border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--ground);
}
.spoint dt {
  margin: 0; font: 700 10.5px/1.2 var(--mark);
  letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
}
.spoint dd {
  margin: 4px 0 0; display: flex; align-items: center; gap: 7px;
  font: 700 clamp(20px, 2vw, 24px)/1 var(--display); color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.spoint .ico { color: var(--yellow-ink); }

/* ---------------------------------------------------------------------------
   29. The student list row — one component, three jobs
   Daily challenges, recommended sheets and the quick links on S1 are all the
   same shape: a mark, a name with one line under it, and one thing you can do.
   Building it once keeps the surface consistent and keeps this file short.
   ------------------------------------------------------------------------ */
.srows { display: grid; gap: 9px; }
.srow {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 13px;
  align-items: center; padding: 12px 13px;
  border: 1px solid var(--line); border-radius: var(--r-panel);
  background: var(--surface); color: inherit; text-decoration: none;
  transition: border-color .16s ease-out, background .16s ease-out;
}
a.srow:hover { border-color: var(--accent); background: var(--blue-tint); }
a.srow:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.srow__ico {
  width: 42px; height: 42px; flex: 0 0 auto; border-radius: var(--r-md);
  display: grid; place-items: center;
  background: var(--blue-chip); color: var(--blue-deep);
}
.srow__ico--yellow { background: var(--yellow-chip); color: var(--yellow-ink); }
.srow__ico--green  { background: var(--green-chip);  color: var(--green-deep); }
.srow__ico--violet { background: var(--chip-violet); color: var(--icon-violet); }
.srow__ico--teal   { background: var(--chip-teal);   color: var(--icon-teal); }
.srow__text { min-width: 0; }
.srow b { display: block; font: 700 15px/1.3 var(--text); color: var(--navy); }
.srow small {
  display: block; margin: 3px 0 0; font: 400 12.5px/1.45 var(--text); color: var(--muted);
}
.srow__end { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.srow--done { background: var(--green-tint); border-color: #BFE3CD; }
/* A row held back by a rule is not greyed into illegibility — the reason has to
   stay readable (§9, "locked by rule"). It is tinted and dashed instead. */
.srow--locked { background: var(--ground); border-style: dashed; }
@media (max-width: 540px) {
  .srow { grid-template-columns: auto minmax(0, 1fr); }
  .srow__end { grid-column: 1 / -1; padding-left: 55px; }
  .srow__end > .btn { flex: 1 1 auto; }
}

/* ---------------------------------------------------------------------------
   30. The attendance strip (S1)

   THE LEADERBOARD SNAPSHOT THAT USED TO HEAD THIS SECTION IS GONE, and so is
   §35 below it. S1 stopped carrying a board on 12 October 2026 (the Maths
   Adventure Challenge rebuild), and S8 stopped being a list of .srank rows on
   the 17th, when the client's mockup made it a five-column table. Nothing
   rendered either block any more, and an unreachable rule is one somebody
   later reads as a promise. git c8fa015 has both whole.
   ------------------------------------------------------------------------ */
.sdays { display: flex; flex-wrap: wrap; gap: 4px; }
.sdays .pday { width: 26px; height: 26px; }

/* ---------------------------------------------------------------------------
   31. Practice — choosing a section (S3)
   Eleven sections, each with its own remaining-sheet counter for the chosen
   mode. Tiles rather than a table: this is the screen a seven-year-old uses
   most, the targets are large, and the number that matters — how many sheets
   are left — is the biggest thing on the tile.
   ------------------------------------------------------------------------ */
.ssecs {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 168px), 1fr));
}
.ssec {
  display: grid; align-content: start; gap: 9px;
  padding: 13px 14px 12px; min-height: 134px;
  border: 1px solid var(--line); border-radius: var(--r-panel);
  background: var(--surface); color: inherit; text-decoration: none;
  text-align: left; font: inherit;
  transition: border-color .16s ease-out, background .16s ease-out;
}
a.ssec:hover { border-color: var(--accent); background: var(--blue-tint); }
a.ssec:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ssec__top { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ssec__top .ico { flex: 0 0 auto; color: var(--accent-ink); }
.ssec__name { font: 700 15.5px/1.25 var(--display); color: var(--navy); min-width: 0; }
.ssec__n {
  display: flex; align-items: baseline; gap: 7px;
  font: 700 clamp(22px, 2vw, 27px)/1 var(--display); color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.ssec__n span {
  font: 500 12.5px/1.35 var(--text); color: var(--muted); font-variant-numeric: normal;
}
.ssec__foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: auto; padding-top: 3px;
}
.ssec__go {
  margin-left: auto; display: inline-flex; align-items: center; gap: 4px;
  font: 700 13px/1 var(--text); color: var(--accent-ink);
}
/* Nothing left to do here, or the package does not cover it. Both say why on
   the tile itself — a dead tile with no reason is a defect (§5.3). */
.ssec[aria-disabled="true"] { background: var(--ground); cursor: not-allowed; }
.ssec[aria-disabled="true"] .ssec__n,
.ssec[aria-disabled="true"] .ssec__name,
.ssec[aria-disabled="true"] .ssec__go { color: var(--muted); }
.ssec--locked { border-style: dashed; }

/* The mode picker reuses the attendance screen's .ppick — a segmented set of
   real radios, already a 44px target and already keyboard-operable. It has no
   present/absent colour class here, so the chosen side gets its own ink. */
.ppick--mode { display: grid; grid-template-columns: 1fr; width: 100%; }
/* Three across only once the half-width column that holds it is wide enough for
   "Without abacus" on one line; below that they stack full width, which is a
   better target anyway. */
@media (min-width: 920px) { .ppick--mode { grid-template-columns: repeat(3, 1fr); } }
.ppick--mode label { min-height: 44px; padding: 0 14px; font-size: 14px; }
.ppick--mode label:has(input:checked), .ppick--mode label.is-on { color: var(--navy); }

/* A lock beside a field label. site.css sets every svg to display: block, which
   is right on the marketing pages where an icon is a block in a flex row, so a
   label with a glyph in its text has to become a flex row itself. */
.field__label--lock { display: flex; align-items: center; gap: 6px; }
.field__label--lock .ico { color: var(--muted); }

/* The mode picker and the tiles it drives have to sit inside one element for
   the script to pair them up, and that wrapper would otherwise swallow the
   vertical rhythm .pbody gives to the cards it holds. */
[data-sections] > * + *, [data-sheet] > * + * { margin-top: clamp(14px, 1.6vw, 20px); }

/* ---------------------------------------------------------------------------
   32. Practice — attempting a sheet (S4)
   The bar with the timer in it sticks under the topbar, because a countdown you
   have to scroll to find is not a countdown. top is --ptop-h, the topbar height
   token, so the two never overlap.
   ------------------------------------------------------------------------ */
.sbar {
  position: sticky; top: var(--ptop-h); z-index: var(--z-stuck);
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding: 11px 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-panel); box-shadow: var(--lift-stuck);
}
.sbar__what { font: 600 13.5px/1.35 var(--text); color: var(--navy); }
.sbar__what span { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); }
.sprog { flex: 0 1 300px; min-width: 130px; display: grid; gap: 6px; }
.sprog__n {
  font: 600 12.5px/1 var(--text); color: var(--muted); font-variant-numeric: tabular-nums;
}
.stimer { display: flex; align-items: center; gap: 8px; margin-left: auto; color: var(--muted); }
.stimer b {
  font: 700 clamp(21px, 2.2vw, 27px)/1 var(--display); color: var(--navy);
  font-variant-numeric: tabular-nums;
}
/* The last minute. Colour is not the only signal — the words change with it. */
.stimer.is-warn { color: var(--red); }
.stimer.is-warn b { color: #B4181D; }
@media (max-width: 560px) {
  .sbar { gap: 9px 12px; }
  .sbar__what { flex: 1 1 100%; }
  .stimer { margin-left: 0; }
}

/* One question. A column sum with the operators to the left of the numbers and
   a rule under the last term — the shape of the paper worksheet the child
   already knows, not a generic label-and-input form row. */
.sqs {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 132px), 1fr));
}
.sq {
  padding: 10px 12px 12px; border: 1px solid var(--line);
  border-radius: var(--r-panel); background: var(--surface);
}
.sq__n {
  font: 700 10.5px/1.2 var(--mark); letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
}
.sq__col {
  margin: 8px 0 0; display: grid; grid-template-columns: 1.1em auto;
  justify-content: end; gap: 0 7px;
  font: 600 17px/1.55 var(--text); color: var(--navy); font-variant-numeric: tabular-nums;
}
.sq__col b { grid-column: 1; text-align: center; color: var(--muted); font-weight: 600; }
.sq__col i { grid-column: 2; text-align: right; font-style: normal; }
.sq__rule { margin: 7px 0 0; border: 0; border-top: 2px solid var(--navy); }
/* 18px, not 15px: iOS Safari zooms the whole page on a focus below 16px (§2.3),
   and this is the one field on the platform a child types into most. */
.sq .input {
  margin-top: 10px; height: 48px; text-align: right;
  font: 700 18px/1 var(--text); font-variant-numeric: tabular-nums;
}
.sq .input:disabled { background: var(--ground); }

/* The submit row. Sticky at the bottom on a phone, where the sheet is long and
   the button would otherwise be twenty scrolls away — but offset by the height
   of the bottom nav, which is pinned there too. Two things sharing bottom: 0 is
   one of them covering the other. */
.ssubmit {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 13px 15px;
  border: 1px solid var(--line); border-radius: var(--r-panel);
  background: var(--surface);
}
.ssubmit__note { font: 400 13px/1.45 var(--text); color: var(--muted); flex: 1 1 200px; }
@media (max-width: 720px) {
  .ssubmit {
    position: sticky; bottom: calc(56px + env(safe-area-inset-bottom));
    z-index: var(--z-stuck); box-shadow: var(--lift-stuck);
  }
  .ssubmit > .btn { flex: 1 1 auto; }
}

/* ---------------------------------------------------------------------------
   33. Practice — the result (S5)
   ------------------------------------------------------------------------ */
.sresult {
  display: grid; gap: 20px 26px; padding: clamp(16px, 2.4vw, 24px);
  grid-template-columns: minmax(0, 1fr); text-align: center;
}
/* The ring is centred by itself. justify-items on the grid would do it in one
   line and would also stop the text column stretching, which makes that column
   as wide as its longest heading and scrolls the page sideways on a phone. */
.sresult > * { min-width: 0; }
.sresult > .sring { justify-self: center; }
@media (min-width: 720px) {
  .sresult { grid-template-columns: auto minmax(0, 1fr); text-align: left; }
  .sresult > .sring { justify-self: start; }
}
.sresult h2 { margin: 0; font: 700 var(--t-h2)/1.2 var(--display); color: var(--navy); }
.sresult p { margin: 8px 0 0; font: 400 var(--t-lead)/1.55 var(--text); color: var(--muted); }
.sresult .btn-row { margin-top: 16px; }
@media (max-width: 719px) { .sresult .btn-row { justify-content: center; } }

/* The accuracy ring. An SVG arc, not a conic gradient: it prints, it scales and
   it behaves the same in Safari. The figure inside it is the label — the ring
   on its own would be decoration. */
.sring { position: relative; width: 138px; height: 138px; flex: 0 0 auto; }
.sring svg { display: block; transform: rotate(-90deg); }
.sring__track { stroke: var(--line); }
.sring__arc { stroke: var(--green); stroke-linecap: round; }
.sring--low .sring__arc { stroke: var(--yellow-deep); }
.sring__mid {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center;
}
.sring__mid b {
  display: block; font: 700 30px/1 var(--display); color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.sring__mid span {
  display: block; margin-top: 4px;
  font: 700 10px/1.2 var(--mark); letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}

/* Per-question marking. Icon and text, never colour alone (§3, §8). */
.sanswers {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 234px), 1fr));
}
.sans {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px;
  align-items: center; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
}
.sans__n {
  font: 700 11px/1.2 var(--mark); letter-spacing: .06em; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.sans__sum {
  min-width: 0; font: 500 13px/1.45 var(--text); color: var(--muted);
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.sans__val {
  display: flex; align-items: center; gap: 6px; text-align: right;
  font: 700 15px/1.25 var(--text); color: var(--navy); font-variant-numeric: tabular-nums;
}
.sans--ok { background: var(--green-tint); border-color: #BFE3CD; }
.sans--ok .sans__val { color: var(--green-deep); }
.sans--no { background: #FDE7E8; border-color: #F4C3C5; }
.sans--no .sans__val { color: #B4181D; }
.sans--no .sans__val s { text-decoration-thickness: 2px; }
.sans__right {
  display: block; margin-top: 3px; font: 600 11.5px/1.3 var(--text); color: var(--navy);
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   34. Tabs that switch a panel in place
   The leaderboard (S8) has four views of one list — weekly or monthly, this
   centre or everyone — and four routes for four filters would be silly. So
   .ptabs grows a button form beside its existing link form: links when a tab is
   a page, buttons when a tab is a view. Buttons key on aria-selected, which is
   the attribute a tablist is supposed to carry, rather than aria-current.
   ------------------------------------------------------------------------ */
.ptabs button {
  padding: 12px 13px; border: 0; background: none; cursor: pointer;
  white-space: nowrap; font: 600 14px/1.2 var(--text); color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.ptabs button:hover { color: var(--navy); }
.ptabs button[aria-selected="true"] { color: var(--accent-ink); border-bottom-color: var(--accent); }
.ptabs button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* ---------------------------------------------------------------------------
   36. Games (S16, S17)
   The art on these screens is a PLACEHOLDER and says so. Design plan assumption
   A10 puts the game content and art direction in a scope of their own, so what
   is designed here is the frame the games sit in — the card, the unlock rule,
   the HUD and the way out — not the games. A screenshot of an invented game
   would be the one thing on this platform that could not be built from its own
   design.
   ------------------------------------------------------------------------ */
.sart {
  position: relative; display: grid; place-items: center; align-content: center; gap: 7px;
  padding: 18px; text-align: center;
  background: var(--chip-teal); color: var(--icon-teal);
}
.sart--violet { background: var(--chip-violet); color: var(--icon-violet); }
.sart--yellow { background: var(--yellow-chip); color: var(--yellow-ink); }
.sart small {
  font: 700 10.5px/1.4 var(--mark); letter-spacing: .09em; text-transform: uppercase;
}
/* The dashed frame is the honest part: this is a reserved area, not a picture. */
.sart::after {
  content: ""; position: absolute; inset: 10px; pointer-events: none;
  border: 2px dashed currentColor; border-radius: var(--r-md); opacity: .3;
}

.sgames {
  display: grid; gap: clamp(12px, 1.6vw, 16px);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
}
.sgame {
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface);
}
/* Capped, because this is a placeholder standing in for key art and a 300px
   dashed rectangle is a lot of nothing to put above the thing it labels. */
.sgame .sart { aspect-ratio: 16 / 9; max-height: 200px; }
.sgame__body { flex: 1 1 auto; padding: 14px 15px; display: grid; gap: 7px; align-content: start; }
.sgame__body h3 { margin: 0; font: 700 17px/1.25 var(--display); color: var(--navy); }
.sgame__body p { margin: 0; font: 400 var(--t-sm)/1.5 var(--text); color: var(--muted); }
.sgame__meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 3px; }
.sgame__foot {
  margin-top: auto; padding: 13px 15px; border-top: 1px solid var(--line);
  background: var(--ground);
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.sgame__cost { font: 400 12.5px/1.4 var(--text); color: var(--muted); }
.sgame__foot .btn { margin-left: auto; }
@media (max-width: 420px) {
  .sgame__foot .btn { margin-left: 0; flex: 1 1 auto; }
}

/* The play frame. The stage is given a real minimum height rather than an
   aspect ratio, so a phone in portrait gets a playable area instead of a
   letterbox, and a desktop does not get a stage taller than its own window. */
.sstage {
  overflow: hidden; border: 1px solid var(--line);
  border-radius: var(--r-panel); background: var(--surface);
}
.sstage__area {
  min-height: clamp(260px, 46vh, 460px);
  display: grid; place-items: center;
}
.sstage__area .sart { min-height: inherit; width: 100%; height: 100%; }

/* The HUD. Navy, because the game area is the bright thing on this screen and
   the chrome around it should not compete with it. */
.shud {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px;
  padding: 12px 15px; background: var(--navy); color: var(--on-navy);
}
.shud dl { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 0; }
.shud div { min-width: 0; }
.shud dt {
  font: 700 10px/1.2 var(--mark); letter-spacing: .1em;
  text-transform: uppercase; color: var(--on-navy-4);
}
.shud dd {
  margin: 3px 0 0; font: 700 clamp(18px, 1.8vw, 22px)/1 var(--display);
  font-variant-numeric: tabular-nums;
}
.shud__end { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 520px) {
  .shud__end { margin-left: 0; width: 100%; }
  .shud__end .btn { flex: 1 1 auto; }
}

/* ---------------------------------------------------------------------------
   37. Rewards (S9)
   Badges and the redemption catalogue. Emoji would be allowed here — §4 permits
   them inside student-facing gamified content — but the platform already has
   one icon family and a badge drawn in a second style reads as clip art stuck
   onto the product. The badges use the same glyphs, enlarged and given a chip.
   ------------------------------------------------------------------------ */
.sbadges {
  display: grid; gap: 11px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 136px), 1fr));
}
.sbadge {
  padding: 15px 11px 13px; text-align: center;
  border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface);
}
.sbadge__ico {
  width: 52px; height: 52px; margin: 0 auto 11px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--yellow-chip); color: var(--yellow-ink);
}
.sbadge__ico--blue { background: var(--blue-chip); color: var(--blue-deep); }
.sbadge__ico--green { background: var(--green-chip); color: var(--green-deep); }
.sbadge__ico--violet { background: var(--chip-violet); color: var(--icon-violet); }
.sbadge b { display: block; font: 700 13.5px/1.3 var(--text); color: var(--navy); }
.sbadge small { display: block; margin-top: 4px; font: 400 11.5px/1.45 var(--text); color: var(--muted); }
/* A badge not yet earned says what earns it. Dimming it to nothing would hide
   the only useful thing on the tile (§9, "locked by rule"). */
.sbadge--locked { background: var(--ground); border-style: dashed; }
.sbadge--locked .sbadge__ico {
  background: var(--surface); color: var(--muted); border: 1px solid var(--line);
}
.sbadge--locked b { color: var(--muted); }

.sgifts {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 232px), 1fr));
}
.sgift {
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface);
}
.sgift .sart { aspect-ratio: 4 / 3; }
.sgift__body { flex: 1 1 auto; padding: 12px 13px 0; display: grid; gap: 5px; align-content: start; }
.sgift__body b { font: 700 14.5px/1.3 var(--text); color: var(--navy); }
.sgift__body small { font: 400 12px/1.45 var(--text); color: var(--muted); }
.sgift__cost {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 3px;
  font: 700 17px/1 var(--display); color: var(--navy); font-variant-numeric: tabular-nums;
}
.sgift__cost .ico { color: var(--yellow-ink); }
.sgift__foot { margin-top: auto; padding: 12px 13px 13px; }
/* Out of reach. Tinted rather than greyed, and the button under it says how
   many coins short you are — a dead button with no reason is a defect (§5.3). */
.sgift--short { background: var(--ground); }
.sgift--short .sgift__cost { color: var(--muted); }

/* The earning rules, read straight off the Rewards Master. A table would be
   heavier than three rows deserve. */
.srules { display: grid; gap: 0; margin: 0; }
.srules > div {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.srules > div:last-child { border-bottom: 0; }
.srules dt { margin: 0; flex: 1 1 200px; font: 500 14px/1.45 var(--text); color: var(--navy); }
.srules dd {
  margin: 0; font: 700 14px/1.45 var(--text); color: var(--accent-ink);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   38. The money screens (S11–S14)
   These four sit inside the student portal but they are not written for the
   student. Design plan assumption A4: payments and invoices are parent-visible
   on the same login, no separate parent role. So the shell stays — same
   sidebar, same tokens — and the density tightens: prices in tabular figures,
   a real total line, a transactions table rather than tiles. Three densities
   from one system (§7.2), and this is the third.
   ------------------------------------------------------------------------ */
.spacks {
  display: grid; gap: clamp(12px, 1.6vw, 16px);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 268px), 1fr));
}
.spack {
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface);
}
/* The one being recommended gets a border, not a badge and a shadow and a
   scale transform. One signal is enough to say "this one". */
.spack--pick { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.spack__top { padding: 15px 16px 0; display: grid; gap: 7px; }
.spack__top h3 { margin: 0; font: 700 17px/1.25 var(--display); color: var(--navy); }
.spack__top p { margin: 0; font: 400 var(--t-sm)/1.5 var(--text); color: var(--muted); }

.spack__price { padding: 14px 16px 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.spack__now {
  font: 700 clamp(24px, 2.2vw, 29px)/1 var(--display); color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.spack__was {
  font: 500 15px/1 var(--text); color: var(--muted);
  text-decoration: line-through; text-decoration-thickness: 1.5px;
}
.spack__per { width: 100%; font: 400 12.5px/1.4 var(--text); color: var(--muted); }

.spack__gives { margin: 14px 0 0; padding: 0 16px; list-style: none; display: grid; gap: 7px; }
.spack__gives li {
  display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 9px; align-items: start;
  font: 400 13.5px/1.5 var(--text); color: var(--navy);
}
.spack__gives .ico { color: var(--green); margin-top: 2px; }
.spack__foot { margin-top: auto; padding: 16px; }
.spack__foot .btn { width: 100%; }

/* A package above the student's level. Dashed and tinted, with the reason on
   the card — the restriction is a teaching moment, not a refusal, and there is
   nothing to buy that would lift it (M7, PACKAGE_LEVEL_LOCKED). */
.spack--locked { background: var(--ground); border-style: dashed; }
.spack--locked .spack__now, .spack--locked .spack__top h3 { color: var(--muted); }
.spack--locked .spack__gives .ico { color: var(--muted); }

/* The one already running. Green edge, and the date it lapses said plainly. */
.spack--active { border-color: var(--green); background: var(--green-tint); }

/* ---------------------------------------------------------------------------
   39. The payment result (S13)
   One block, three outcomes. The disc carries the icon and the colour, the
   heading carries the words, and the facts under it are the same four in every
   outcome — what, how much, which reference, when — because the reference is
   the thing a parent needs when something has gone wrong.
   ------------------------------------------------------------------------ */
.spay { padding: clamp(26px, 4vw, 40px) 22px; text-align: center; }
.spay__disc {
  width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--green-chip); color: var(--green-deep);
}
.spay--bad .spay__disc { background: #FDE7E8; color: #B4181D; }
.spay--wait .spay__disc { background: var(--yellow-chip); color: var(--yellow-ink); }
.spay h2 { margin: 0; font: 700 var(--t-h3)/1.25 var(--display); color: var(--navy); }
.spay > p {
  margin: 9px auto 0; max-width: 52ch;
  font: 400 var(--t-body)/1.6 var(--text); color: var(--muted);
}
.spay .pfacts {
  max-width: 620px; margin: 22px auto 0; padding: 16px 18px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--ground);
}
.spay .btn-row { justify-content: center; margin-top: 20px; }

/* A Razorpay id is the one string on these screens a parent may have to read
   out to somebody. It gets the monospace treatment and it does not wrap into
   an unreadable ladder. */
.sref {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px; letter-spacing: -.01em; overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------------------
   40. The avatar picker (S2) — MOVED, 16 October 2026
   The eight platform glyphs that stood in here are gone: the client sent the
   drawings on 13 October, twenty characters in two sheets, and the picker is
   now .avpick in site.css, shared with /student/register. It is there and not
   here because the public register page does not load panel.css. S2 renders
   it with partials/avatar-picker.
   ------------------------------------------------------------------------ */


/* ---------------------------------------------------------------------------
   41. A code to copy — the referral code and its link (S2, S10)
   The thing being copied sits in a box that looks like a field and is not one:
   a disabled input reads as something broken, and an editable one invites a
   child to change a code that is not theirs to change.
   ------------------------------------------------------------------------ */
.scode {
  display: flex; align-items: center; gap: 12px; margin: 0;
  padding: 10px 10px 10px 14px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--ground);
}
.scode > span:first-child {
  flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere;
  font: 600 14.5px/1.4 var(--text); color: var(--navy);
}
.scode .btn { flex: 0 0 auto; }
.scode--lg > span:first-child {
  font: 700 clamp(20px, 3vw, 26px)/1.2 var(--display); color: var(--navy);
  letter-spacing: .06em;
}
/* What the copy button says once it has copied. The script swaps the label and
   puts it back after a moment; the width is held so the row does not jump. */
.scode .btn[data-copied] { color: var(--green-deep); border-color: var(--green); }

/* ---------------------------------------------------------------------------
   42. One student's month (S15)
   The franchise sees a month as a TABLE — one row per student, one column per
   day (§24). A student sees their own month as a calendar, because there is
   only one row and the useful question is "which Thursday did I miss", which a
   run of twenty-eight numbers cannot answer and a calendar can.
   ------------------------------------------------------------------------ */
/* The month sits beside its facts rather than stretched across a 1100px card:
   thirty cells spread that wide stop reading as a month and start reading as a
   spreadsheet. Capped, and the space beside it carries the same four facts the
   snapshot on S1 shows. */
.sattend { display: grid; gap: clamp(16px, 2.2vw, 30px); align-items: start; }
.sattend > * { min-width: 0; }
@media (min-width: 780px) {
  .sattend { grid-template-columns: minmax(0, 420px) minmax(0, 1fr); }
}
.sattend__facts {
  align-content: start;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
}

.scal { width: 100%; max-width: 420px; border-collapse: collapse; table-layout: fixed; }
.scal caption { caption-side: top; }
.scal th {
  padding: 0 0 8px; font: 700 10.5px/1.2 var(--mark);
  letter-spacing: .06em; color: var(--muted); text-align: center;
}
.scal td { padding: 3px 0; text-align: center; }
.scal .pday { width: 34px; height: 34px; font-size: 12.5px; }
/* A day with no class. Present as a number so the calendar keeps its shape,
   quiet enough that the class days are what the eye lands on. */
.scal__off {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  font: 400 12.5px/1 var(--mark); color: var(--muted); opacity: .55;
}
/* A class taught in the batch the student has since left. Marked by an
   underline as well as its place in the month, so the split is visible without
   reading the legend — and it is never the only signal, because the per-batch
   counts above the grid say the same thing in words (§3). */
.scal__was { box-shadow: inset 0 -3px 0 var(--muted); }
/* A legend swatch: the same chip with nothing written in it. A "1" in a
   legend reads as "1 means present" rather than as a sample of the shape. */
.scal__key { width: 22px; height: 22px; }
/* An empty no-class swatch would be nothing at all, so in the legend it
   gets the outline of the cell it stands for. */
.scal__off.scal__key { border: 1px dashed var(--line); border-radius: var(--r-sm); opacity: 1; }
@media (max-width: 420px) {
  .scal .pday, .scal__off { width: 30px; height: 30px; }
}

/* ---------------------------------------------------------------------------
   43. The notification list (S19)
   Unread is a tint, a left rule and a dot — three signals, because a tint on
   its own fails for anyone who cannot see it and a dot on its own is easy to
   miss on a phone. Each row keeps its action on the right at desktop width and
   drops it below the text on a narrow screen, rather than squeezing a button
   into forty pixels.
   ------------------------------------------------------------------------ */
.snotif { display: grid; gap: 10px; }
.snotif__row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px; align-items: start; padding: 13px 14px;
  border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface);
}
.snotif__row--new {
  background: var(--blue-tint); border-color: #C3DCF6;
  box-shadow: inset 3px 0 0 var(--blue);
}
.snotif__ico { flex: 0 0 auto; margin-top: 1px; }
.snotif__text { min-width: 0; }
.snotif__text b { display: block; font: 600 14.5px/1.4 var(--text); color: var(--navy); }
.snotif__text p { margin: 3px 0 0; font: 400 13.5px/1.55 var(--text); color: var(--muted); }
.snotif__text time { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); }
.snotif__dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--blue); margin-left: 6px; vertical-align: middle;
}
.snotif__act { flex: 0 0 auto; }
@media (max-width: 620px) {
  .snotif__row { grid-template-columns: auto minmax(0, 1fr); }
  .snotif__act { grid-column: 2 / -1; }
  .snotif__act .btn { width: 100%; }
}

/* ---------------------------------------------------------------------------
   44. The masters — the register, the shared list and the shared form
   Twelve of the twenty masters are two screens with a different ?m=, so the
   pieces below are the ones that make one screen able to be seven: a reference
   badge, a record count, a drag handle, and the field parts the generic form
   assembles from config/masters.php.
   ------------------------------------------------------------------------ */

/* The SOW's own M-number, printed wherever a master is named. A reviewer is
   reading this next to their copy of §5, and "M13" is how they find their
   place in it. */
.mref {
  display: inline-block; vertical-align: middle; margin-left: 7px;
  padding: 2px 7px; border-radius: var(--r-sm);
  background: var(--ground); border: 1px solid var(--line); color: var(--muted);
  font: 700 10.5px/1.4 var(--mark); letter-spacing: .04em;
}

/* How many records a master holds, on the register. Tabular so the column of
   them reads as a column. */
.mcount {
  min-width: 34px; text-align: right;
  font: 700 14px/1 var(--text); color: var(--navy);
  font-variant-numeric: tabular-nums;
}

/* The reorder grip. Only on masters whose order is meaningful — levels and
   testimonials — because a handle on a list that sorts alphabetically is a
   promise the screen does not keep. */
.mdrag { display: inline-grid; place-items: center; color: var(--muted); cursor: grab; }
.mdrag:active { cursor: grabbing; }

/* Which of the three patterns a master uses. Neutral on purpose: the
   status palette means something here — green is active, amber is pending —
   and spending it on a category would make it mean less everywhere else.
   The row icon and its tint carry the same distinction a second time. */
.mpattern {
  display: inline-flex; align-items: center; white-space: nowrap;
  padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--ground); border: 1px solid var(--line); color: var(--muted);
  font: 600 12px/1.4 var(--text);
}

.mstars { color: var(--yellow-ink); letter-spacing: 1px; }

/* The master picker: a real form, so it needs the select and its button to sit
   together and to wrap as one unit below the header. */
.mswitch { display: flex; gap: 8px; align-items: center; min-width: 0; }
.mswitch .select { min-width: 0; }

/* A multi-value field. Chips with a remove button beat <select multiple>,
   which almost nobody operates correctly on a first attempt, and the chips say
   what is chosen without being opened. */
.mchips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
.mchip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 7px 5px 11px; border-radius: var(--r-pill);
  background: var(--blue-chip); color: var(--blue-deep);
  font: 600 13px/1.4 var(--text);
}
.mchip button {
  display: grid; place-items: center; width: 20px; height: 20px;
  border: 0; border-radius: 50%; background: none; cursor: pointer;
  color: inherit; opacity: .7;
}
.mchip button:hover { opacity: 1; background: rgba(255, 255, 255, .6); }
.mchip button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.mchip--add {
  padding: 5px 11px; background: var(--surface); color: var(--accent-ink);
  border: 1px dashed var(--line); cursor: pointer;
}
.mchip--add:hover { border-color: var(--accent); border-style: solid; }

/* A number with its unit attached — rupees before, days and per cent after.
   The unit sits inside the field's border rather than in the label, because
   "180" and "180 days" are different answers to "validity". */
.minput { display: flex; align-items: stretch; }
.minput .input { border-radius: 0; }
.minput .input:first-child { border-top-left-radius: var(--r-md); border-bottom-left-radius: var(--r-md); }
.minput .input:last-child { border-top-right-radius: var(--r-md); border-bottom-right-radius: var(--r-md); }
.minput__pre, .minput__post {
  display: grid; place-items: center; flex: 0 0 auto; padding: 0 12px;
  border: 1px solid var(--line); background: var(--ground); color: var(--muted);
  font: 600 14px/1 var(--text); white-space: nowrap;
}
.minput__pre { border-right: 0; border-radius: var(--r-md) 0 0 var(--r-md); }
.minput__post { border-left: 0; border-radius: 0 var(--r-md) var(--r-md) 0; }

/* A text button that lives inside a hint — "Replace it" under a masked
   secret. It is a button, because it does something. */
.mlink {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: 600 inherit/inherit var(--text); font-size: inherit;
  color: var(--accent-ink); text-decoration: underline;
}
.mlink:hover { text-decoration: none; }

/* Delete, sitting in a footer of ordinary buttons. Separated and reddened on
   hover only — a permanently red button in a row of grey ones is the thing the
   eye lands on first, and it should not be. */
.mdanger { color: var(--muted); }
.mdanger:hover { color: var(--red); border-color: #F4C3C5; background: #FDE7E8; }

/* ---------------------------------------------------------------------------
   45. The question bank (M3)
   A question is a column of terms a child adds downwards. Showing it as
   "24, 31, 12, 43" in a table cell would be a list of numbers; showing it as
   separated tokens keeps the shape the child actually reads, in a row, which
   is as close as a table gets.
   ------------------------------------------------------------------------ */
.qterms { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.qterm {
  display: inline-grid; place-items: center; min-width: 30px; padding: 2px 6px;
  border-radius: var(--r-sm); background: var(--ground); border: 1px solid var(--line);
  font: 600 13px/1.5 var(--text); color: var(--navy); font-variant-numeric: tabular-nums;
}
/* A negative term is a subtraction. Marked by its sign and by the tint, never
   by the tint alone (§3). */
.qterm--minus { background: #FDE7E8; border-color: #F4C3C5; color: #B4181D; }

/* The sheet composer: the questions in a sheet, in the order they are asked. */
.qcompose { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.qcompose li {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  gap: 10px; align-items: center; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface);
}
.qcompose__n {
  width: 24px; text-align: center;
  font: 700 12.5px/1 var(--mark); color: var(--muted); font-variant-numeric: tabular-nums;
}
.qcompose__a { font: 700 14px/1 var(--text); color: var(--navy); font-variant-numeric: tabular-nums; white-space: nowrap; }
.qcompose__more {
  display: block; padding: 8px 10px; border: 1px dashed var(--line);
  font: 400 13px/1.4 var(--text); color: var(--muted); text-align: center;
}

/* The student's own screen, at a size that fits a rail. Not a picture of S4 —
   the same questions, so a sheet can be checked before anybody sits it. */
.qpreview {
  border: 1px solid var(--line); border-radius: var(--r-panel);
  background: var(--ground); overflow: hidden;
}
.qpreview__bar {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin: 0; padding: 9px 12px; background: var(--surface);
  border-bottom: 1px solid var(--line);
  font: 600 12px/1.4 var(--text); color: var(--muted);
}
.qpreview__clock {
  font: 700 13px/1 var(--mark); color: var(--navy); font-variant-numeric: tabular-nums;
}
.qpreview__q {
  display: grid; grid-template-columns: auto minmax(0, 1fr) 54px;
  gap: 9px; align-items: center; padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}
.qpreview__q:last-child { border-bottom: 0; }
.qpreview__n {
  width: 20px; font: 700 12px/1 var(--mark); color: var(--muted); text-align: center;
}
.qpreview__in {
  height: 30px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface);
}

/* ---------------------------------------------------------------------------
   46. The game matrix (M7)
   "Two games per level" is a rule the product says out loud to children, so
   the place it is configured makes a gap impossible to miss: levels down the
   side, two slots across, and an empty slot looks empty rather than being
   something you work out by counting rows.
   ------------------------------------------------------------------------ */
.gmatrix {
  display: grid; gap: 9px;
  grid-template-columns: minmax(84px, auto) minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
}
.gmatrix__head {
  font: 700 10.5px/1.2 var(--mark); letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted); padding: 0 2px 2px;
}
.gmatrix__level { align-self: center; }
.gmatrix__level b { display: block; font: 700 14px/1.3 var(--text); color: var(--navy); }
.gmatrix__level small { display: block; font-size: 11.5px; color: var(--muted); }

.gslot {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 11px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface);
}
.gslot:hover { border-color: var(--accent); background: var(--blue-tint); }
.gslot:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.gslot__art {
  display: grid; place-items: center; gap: 1px;
  width: 46px; height: 46px; flex: 0 0 auto; border-radius: var(--r-md);
  background: var(--chip-teal); color: var(--icon-teal);
}
/* Dashed, because the artwork is scoped separately (A10) and a thumb that
   looks finished would be a promise this screen cannot keep. */
.gslot__art { border: 1px dashed var(--icon-teal); }
.gslot__text { min-width: 0; }
.gslot__text b { display: block; font: 700 14px/1.3 var(--text); color: var(--navy); }
.gslot__text small { display: block; font-size: 12px; color: var(--muted); }
.gslot--draft { background: var(--ground); }
.gslot--draft .gslot__art { background: var(--ground); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
/* An empty slot is a gap, and looks like one. Dashed, not tinted — nothing has
   gone wrong, there is simply no game there yet. */
.gslot--empty {
  justify-content: center; gap: 8px; min-height: 66px;
  border-style: dashed; background: none; color: var(--muted);
  font: 600 13px/1.4 var(--text);
}
.gslot--empty:hover { color: var(--accent-ink); border-style: solid; }
@media (max-width: 640px) {
  .gmatrix { grid-template-columns: minmax(0, 1fr); }
  .gmatrix__head { display: none; }
  .gmatrix__level { padding-top: 8px; }
}

/* ---------------------------------------------------------------------------
   47. The certificate (M11)
   The preview is the screen. A certificate is the one thing this platform
   makes that gets printed and framed, and the only way to know a template is
   right is to see it filled in with real values rather than merge syntax.
   ------------------------------------------------------------------------ */
.cupload {
  display: flex; align-items: center; gap: 11px; margin-top: 6px;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-panel);
  background: var(--ground);
}
.cupload__thumb {
  display: grid; place-items: center; width: 46px; height: 46px; flex: 0 0 auto;
  border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line);
}
.cupload__text { min-width: 0; flex: 1 1 auto; }
.cupload__text b { display: block; font: 600 13.5px/1.3 var(--text); color: var(--navy); }
.cupload__text small { display: block; font-size: 12px; color: var(--muted); }

.cert {
  padding: 18px 16px 16px; text-align: center;
  border: 1px solid var(--line); border-radius: var(--r-panel);
  background: var(--surface);
  box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 5px var(--line);
}
.cert__top { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 14px; }
.cert__wm { text-align: left; }
.cert__wm b { display: block; font: 700 11.5px/1.2 var(--display); color: var(--navy); }
.cert__wm span { display: block; font: 400 8.5px/1.3 var(--mark); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cert__kicker { margin: 0; font: 400 10.5px/1.4 var(--mark); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cert__name {
  margin: 5px 0 7px; font: 700 clamp(17px, 2.2vw, 21px)/1.2 var(--display); color: var(--navy);
}
.cert__line { margin: 0 auto; max-width: 34ch; font: 400 11.5px/1.6 var(--text); color: var(--navy); }
.cert__facts {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
  margin: 14px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line);
}
.cert__facts dt { margin: 0; font: 700 8px/1.2 var(--mark); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.cert__facts dd { margin: 2px 0 0; font: 600 11.5px/1.3 var(--text); color: var(--navy); overflow-wrap: anywhere; }
.cert__sigs { display: flex; gap: 14px; margin-top: 16px; }
.cert__sigs span { flex: 1 1 0; font: 600 10.5px/1.3 var(--text); color: var(--navy); }
.cert__sigs i { display: block; height: 1px; margin-bottom: 5px; background: var(--navy); opacity: .35; }
.cert__sigs small { display: block; margin-top: 1px; font: 400 9px/1.3 var(--mark); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }

/* ---------------------------------------------------------------------------
   48. Notification templates (M13)
   The same event said three ways: an in-app line a child reads, an email a
   parent reads, and an SMS with 160 characters to work with. Three boxes, not
   one, because writing one and hoping is how an SMS ends up costing three
   messages and an in-app alert ends up addressed to a parent.
   ------------------------------------------------------------------------ */
.nchan { border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; }
.nchan__head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding: 10px 13px; background: var(--ground); border-bottom: 1px solid var(--line);
}
.nchan__who { font: 400 12.5px/1.4 var(--text); color: var(--muted); margin-left: auto; }
.nchan__body { padding: 13px; }

/* How long the SMS is, against the segment it will actually be billed as. */
.nlen { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.nlen b { font: 600 12.5px/1.4 var(--text); color: var(--navy); font-variant-numeric: tabular-nums; }
.nlen__bar {
  flex: 1 1 130px; height: 7px; border-radius: var(--r-pill);
  background: var(--ground); overflow: hidden;
}
.nlen__bar span { display: block; height: 100%; background: var(--yellow-deep); border-radius: var(--r-pill); }

/* The trigger list. Three letters per row say which channels are on, which is
   the thing being scanned for down a column of twelve. */
.ntrig { margin: 0; padding: 0; list-style: none; }
.ntrig li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.ntrig li:last-child { border-bottom: 0; }
.ntrig li[aria-current] { background: var(--blue-tint); box-shadow: inset 3px 0 0 var(--blue); }
.ntrig__text { min-width: 0; flex: 1 1 auto; }
.ntrig__text b { display: block; font: 600 13.5px/1.35 var(--text); color: var(--navy); }
.ntrig__text small { display: block; font-size: 11.5px; color: var(--muted); }
.ntrig__ch { display: flex; gap: 4px; flex: 0 0 auto; }
.ntrig__ch i {
  display: grid; place-items: center; width: 20px; height: 20px;
  border-radius: var(--r-sm); background: var(--ground); border: 1px solid var(--line);
  font: 700 10px/1 var(--mark); font-style: normal; color: var(--line);
}
.ntrig__ch i.is-on { background: var(--green-chip); border-color: #BFE3CD; color: var(--green-deep); }

/* ---------------------------------------------------------------------------
   49. The field builder and the block editor (M16, M14)
   Both are a reorderable list of typed things with a palette under it, so they
   share their parts. What differs is what a row holds, not how it behaves.
   ------------------------------------------------------------------------ */
.fbuild, .cblocks { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.fbuild li, .cblocks li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 9px 11px; border: 1px solid var(--line);
  border-radius: var(--r-panel); background: var(--surface);
}
.fbuild__text, .cblock__text { min-width: 0; flex: 1 1 170px; }
.fbuild__text b, .cblock__text b { display: block; font: 600 14px/1.35 var(--text); color: var(--navy); }
.fbuild__text small, .cblock__text small { display: block; font-size: 12px; color: var(--muted); }
.fbuild__text code, .cblock__text code { font-size: 11.5px; }

.fbuild__type, .cblock__kind {
  flex: 0 0 auto; padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--ground); border: 1px solid var(--line); color: var(--muted);
  font: 600 11.5px/1.5 var(--text); white-space: nowrap;
}
.fbuild__req { flex: 0 0 auto; }

/* A field the builder may not touch. Tinted and locked, and still visible —
   an administrator who cannot see the honeypot will one day add their own and
   wonder why the spam did not stop. */
.fbuild__locked { background: var(--ground); border-style: dashed; }

.cblock--draft { background: var(--yellow-tint); border-color: #F0DFAE; }

/* The palette under the list. */
.fadd {
  margin-top: 14px; padding: 13px; border: 1px dashed var(--line);
  border-radius: var(--r-panel); background: var(--ground);
}
.fadd > p {
  margin: 0 0 8px; font: 700 10.5px/1.2 var(--mark);
  letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
}
.fadd .mchips { margin-top: 0; }

/* What a parent will see. A wireframe, deliberately — a pixel-accurate copy of
   the real form would invite the reviewer to review the form's design here
   rather than its fields, which is what this screen is for. */
.fpreview {
  padding: 14px; border: 1px solid var(--line); border-radius: var(--r-panel);
  background: var(--ground);
}
.fpreview__f { margin-bottom: 11px; }
.fpreview__l {
  display: block; margin-bottom: 4px;
  font: 600 11.5px/1.4 var(--text); color: var(--navy);
}
.fpreview__l i { color: var(--red); font-style: normal; margin-left: 2px; }
.fpreview__box {
  display: flex; align-items: center; justify-content: flex-end;
  height: 30px; padding: 0 8px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--surface); color: var(--muted);
}
.fpreview__box--tall { height: 54px; }
.fpreview__consent {
  display: flex; align-items: flex-start; gap: 8px; margin: 14px 0 12px;
  font: 400 11.5px/1.5 var(--text); color: var(--muted);
}
.fpreview__consent span {
  width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px;
  border: 1px solid var(--line); border-radius: 3px; background: var(--surface);
}
.fpreview__btn {
  display: block; padding: 9px; border-radius: var(--r-md);
  background: var(--blue); color: #fff; text-align: center;
  font: 700 12.5px/1.2 var(--text);
}

/* The rich-text box, with the four things a block editor allows and no more.
   No font picker and no colour picker: a year of those is how a site ends up
   with three yellows and four heading sizes. */
.ceditor { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; margin-top: 6px; }
.ceditor__bar {
  display: flex; gap: 2px; padding: 5px 6px;
  background: var(--ground); border-bottom: 1px solid var(--line);
}
.ceditor__bar button {
  display: grid; place-items: center; min-width: 30px; height: 30px;
  border: 0; border-radius: var(--r-sm); background: none; cursor: pointer;
  color: var(--muted); font: 600 14px/1 var(--text);
}
.ceditor__bar button:hover { background: var(--surface); color: var(--navy); }
.ceditor__bar button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.ceditor__area { border: 0; border-radius: 0; }
.ceditor__area:focus { outline: 2px solid var(--focus); outline-offset: -2px; }

/* The page list beside the block editor. */
.cpages { margin: 0; padding: 0; list-style: none; }
.cpages li { border-bottom: 1px solid var(--line); }
.cpages li:last-child { border-bottom: 0; }
.cpages a {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  text-decoration: none; color: inherit;
}
.cpages a:hover { background: var(--blue-tint); }
.cpages li[aria-current] a { background: var(--blue-tint); box-shadow: inset 3px 0 0 var(--blue); }
.cpages__text { min-width: 0; flex: 1 1 auto; }
.cpages__text b { display: block; font: 600 13.5px/1.35 var(--text); color: var(--navy); }
.cpages__text small { display: block; font-size: 11.5px; color: var(--muted); }

/* ---------------------------------------------------------------------------
   50. The permission matrix (M18)
   Checkboxes in a grid rather than three toggles per module down a page,
   because the question an administrator has is comparative — "can Finance
   approve anything?" — and that is a column to read, not eleven cards to open.
   ------------------------------------------------------------------------ */
.pmatrix th[scope="row"] {
  text-align: left; font: 600 13.5px/1.35 var(--text); color: var(--navy);
  min-width: 210px;
}
.pmatrix th[scope="row"] small { display: block; font: 400 11.5px/1.4 var(--text); color: var(--muted); }
.pmatrix__role { text-align: center; white-space: nowrap; }
.pmatrix__role small {
  display: block; font: 400 11px/1.4 var(--text); color: var(--muted); text-transform: none;
  letter-spacing: 0;
}
.pmatrix__cell { text-align: center; }

/* One cell, four states. Icon and tint together, never tint alone (§3). */
.pgrant {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--line);
  font: 600 13px/1 var(--text);
}
.pgrant--1 { background: var(--blue-chip); border-color: #C3DCF6; color: var(--blue-deep); }
.pgrant--2 { background: var(--yellow-chip); border-color: #F0DFAE; color: var(--yellow-ink); }
.pgrant--3 { background: var(--green-chip); border-color: #BFE3CD; color: var(--green-deep); }

/* A select inside a dense table row. */
.select--sm { padding-top: 6px; padding-bottom: 6px; font-size: 13.5px; min-width: 130px; }
