/* ---------------------------------------------------------------------------------------------
   Design tokens (CAP-201).

   Every colour, space and type size the portal uses is declared here and nowhere else. A component
   that hard-codes a colour is a bug, because it is the one that will not change when the customer
   confirms the palette (customer prerequisite 11).

   The course tokens are the only ones that vary at runtime. Each MiniMBA course carries its own
   colour (Marketing #ED1846, Brand Management #2196F2, confirmed by Luke 22 Jul 2026), and the
   assessment is part of that course's experience, so the page takes the colour of the framework being
   answered. The default below is deliberately neutral: a framework with no colour should look plain,
   not quietly borrow Marketing's. CourseTheme.razor overrides all three per assessment.
   --------------------------------------------------------------------------------------------- */

@font-face {
    font-family: "Plus Jakarta Sans";
    src: url("/fonts/PlusJakartaSans-variable.woff2") format("woff2-variations");
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Hedvig Letters Serif";
    src: url("/fonts/HedvigLettersSerif.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Course identity. Overridden per framework; see CourseTheme.razor.

       Three tokens, not two, and the distinction is load-bearing:
         --cap-course       the brand colour exactly as supplied. Fills, bars, borders, the roundel.
         --cap-course-ink   black or white, whichever is legible ON that fill.
         --cap-course-text  the same colour darkened until it is legible AS text on the page.

       The third exists because Brave Bison's real colours are saturated mid-tones: #ED1846 is 4.36:1
       against white and #2196F2 is 3.13:1, so both fail WCAG AA for body text while being perfectly
       good as fills. Using --cap-course for a link would ship an unreadable link. The brand colour is
       never altered; only glyphs on the page background use the derived one.

       The default is the brand's Deep Red, not a grey, and changed from Zinc #3F3F46 on 6 August 2026
       with the rest of the neutrals. It is what the shell resolves to, because the shell belongs to no
       course - a learner may be on two (D-020) - so this is the colour of every page outside an
       assessment. It must therefore look deliberately plain rather than quietly borrow Marketing's red,
       which is why it is the Deep Red the brand sets its body copy in and not any product's colour: no
       course is Deep Red, and none will be. White on it is 17.9:1, so the ink below is not a close
       call. */
    --cap-course: #380008;
    --cap-course-ink: #FFFFFF;
    --cap-course-text: #380008;

    /* The fill behind SMALL text on the course colour, darkened only as far as it must be for the ink
       above to clear 4.5:1. Identical to --cap-course here, because white on Deep Red is 17.9:1 and
       nothing needs to move; it differs only for a product colour that does not clear it, which today
       means Marketing's #ED1846 at 4.36:1. See ColourToken.FillForSmallTextOn. */
    --cap-course-strong: #380008;

    /* The banner colour, which is NOT the course colour and is the whole point of it being its own
       token. Brave Bison's marketing team, 6 August 2026: "banner needs to be 6A0008 for home screen,
       any banners within the course specific pages should use course colours."

       So the default here is the Mini MBA house colour, and CourseTheme overrides it to the course
       colour along with the other three. A banner that sits outside any course - the learner's landing
       page, which lists both programmes and therefore belongs to neither - gets #6A0008; a banner
       rendered inside a course's theme follows that course. One token, and the rule lives at the point
       the theme is applied rather than in each page.

       Before this the landing banner was painted in --cap-course, which outside a theme resolves to the
       neutral #3F3F46, so the first thing a learner saw was a slab of grey.

       White on #6A0008 is 14.2:1, so the ink is not derived; there is no colour a banner could take that
       would make it a close call, and the derivation exists for mid-tones. */
    --cap-banner: #6A0008;
    --cap-banner-ink: #FFFFFF;

    /* Neutrals, and they are warm reds rather than greys as of 6 August 2026.
       -------------------------------------------------------------------------------------------
       WHERE THESE CAME FROM, because the previous set had no provenance at all. Until today every
       neutral here was the Tailwind "Zinc" ramp - #18181B, #52525B, #71717A, #D4D4D8, #A1A1AA,
       #F4F4F5 - chosen at CAP-201 as a developer default and never sent to us by anybody. Carl asked
       the question on 6 August ("is that colour part of their branding? was it a conscious decision
       someone signed off?") and the honest answer was no. Brave Bison then sent the MiniMBA Brand
       Summary v2, and it settles it: the brand has a seventeen-colour palette in three product
       families and not one grey anywhere in it. Their own body copy is set in the deep red below.

       TAKEN EXACTLY FROM THE PALETTE:
         --cap-ink            Deep Red      #380008   (their body copy colour)
         --cap-surface-sunken Very Pale Red #F9EEED
         --cap-border         Pale Red      #FAD0CE

       DERIVED, because the palette contains no mid-tones and text needs them. Each is Deep Red
       blended toward white and then checked against BOTH backgrounds it can land on: the white card
       and the page canvas, which is itself the sunken colour. The figures are in
       ColourContrastTests, which fails the build if any of them drops below its threshold - so these
       are not eyeballed values and cannot quietly rot.

         --cap-ink-muted      6.68:1 on white, 5.88:1 on the canvas   (AA needs 4.5)
         --cap-ink-faint      5.41:1 on white, 4.76:1 on the canvas   (AA needs 4.5)
         --cap-border-strong  3.87:1 on white, 3.41:1 on the canvas   (1.4.11 needs 3.0)

       AND border-strong FIXES A FAILURE RATHER THAN INHERITING ONE. It draws the edge of every text
       box, select and rating pill in the portal, so WCAG 1.4.11 asks 3:1 of it. The Zinc #A1A1AA it
       replaces measured 2.56:1 on white and 2.26:1 on the canvas and had been below the line since
       CAP-201. Nothing reported it: axe does not check the boundary of a custom control, and it is
       the sort of thing that is only found by asking what each token is actually for. */
    --cap-ink: #380008;
    --cap-ink-muted: #785257;
    --cap-ink-faint: #846166;
    --cap-surface: #FFFFFF;
    --cap-surface-sunken: #F9EEED;
    --cap-border: #FAD0CE;
    --cap-border-strong: #987A7F;

    /* Status. Used by validation, by the score bands, and by every change figure on the results and
       cohort pages.

       Both are measured against the page canvas rather than against white, for the reason
       ColourToken.PalestSurface gives: the canvas is the darker of the two backgrounds these land on, so
       clearing it clears both. The success green was #15803D and measured 4.41:1 on the new canvas, just
       under the 4.5 AA asks, which the axe pass caught the moment the neutrals changed. Darkened by four
       percent to #137638: 5.03:1 on the canvas, 5.71:1 on a card, and visibly the same green.

       The danger red already cleared it comfortably (5.69:1 on the canvas) and is untouched. */
    --cap-danger: #B91C1C;
    --cap-success: #137638;

    /* Typography, confirmed by Luke 22 Jul 2026: predominantly Plus Jakarta Sans, with Hedvig Letters
       Serif for some headings. Both are Google Fonts under the Open Font Licence, so the licensing
       question prerequisite 11 was carrying disappears: there is nothing to ask permission for.

       Self-hosted from /fonts rather than loaded from Google. The CSP has no font-src, so fonts fall
       back to default-src 'self' and a Google-hosted face would simply be blocked - and self-hosting
       also means no third party sees a request for every page view. Latin subset only, variable
       weight for the sans, 48 KB for both faces together.

       MiniMBA Sans, which the earlier stack named, is not the current brand face. */
    --cap-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --cap-font-display: "Hedvig Letters Serif", Georgia, "Times New Roman", serif;
    --cap-text-sm: 0.875rem;
    --cap-text-base: 1rem;
    --cap-text-lg: 1.25rem;
    --cap-text-xl: 1.75rem;
    --cap-text-2xl: 2.25rem;

    /* Space and shape. */
    --cap-space-1: 0.25rem;
    --cap-space-2: 0.5rem;
    --cap-space-3: 1rem;
    --cap-space-4: 1.5rem;
    --cap-space-5: 2.5rem;
    --cap-radius: 6px;
    --cap-focus: 3px solid #2563EB;

    --cap-measure: 68ch;

    /* The content column. Capped, because a form row stretched across a 4K monitor puts the statement
       and the buttons that answer it a foot apart, and prose becomes unreadable past about 90
       characters. But 1140px was chosen against a 1140px browser and never looked at on a real desktop:
       on a 3840px screen it is under a third of the width, with bare canvas either side. 1440 keeps the
       row tight and stops the page looking abandoned on a large monitor. Anything that needs to be
       narrower than this says so itself (--cap-measure). */
    --cap-page: 1440px;

    /* The content column inside the page width, once the gutters are taken off. The masthead and footer
       get the same measurement from padding; the main grid needs it as a number. */
    --cap-content: calc(var(--cap-page) - (2 * var(--cap-space-3)));
}

/* --------------------------------------------------------------------------------------------- */

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

body {
    margin: 0;
    font-family: var(--cap-font);
    font-size: var(--cap-text-base);
    line-height: 1.55;
    color: var(--cap-ink);
    background: var(--cap-surface-sunken);
    -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 var(--cap-space-3); text-wrap: balance; }
h1 { font-size: var(--cap-text-2xl); }
h2 { font-size: var(--cap-text-xl); }
p { margin: 0 0 var(--cap-space-3); max-width: var(--cap-measure); }

a { color: var(--cap-course-text); }
/* Hover ADDS the cue. It removed the underline before, the reverse of what a pointer expects. */
a:hover { text-decoration-thickness: 2px; }

/* One visible focus ring everywhere. The questionnaire is a long keyboard-driven form and losing the
   caret in it is the single most likely accessibility complaint. `summary` is in the list because the
   "Add a note" disclosure takes focus and had no ring (20 Aug 2026 audit). */
:is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: var(--cap-focus);
    outline-offset: 2px;
}

/* FocusOnNavigate moves focus to the h1 on every navigation, for screen-reader users, and does it by
   giving the heading a tabindex. That makes the heading match the rule above and draws a focus ring
   around the page title on arrival, which is not what the ring is for. The focus itself stays: it is
   the announcement that matters, not the outline.

   The selector has to name the attribute, and this is why: CAP-201 wrote this rule as `h1:focus-visible`,
   which is specificity (0,1,1), and the rule above is `[tabindex]:focus-visible`, which is (0,2,0). The
   attribute selector wins, so the suppression has never once taken effect and every page in the portal
   has been drawing a blue box round its own title since CAP-201. Nobody saw it because it only appears
   on the heading of the page you have just navigated to, which is exactly where an eye is not looking for
   a defect. Found by screenshotting the review step. `h1[tabindex]` is (0,2,1) and beats it. */
h1[tabindex]:focus, h1[tabindex]:focus-visible { outline: none; }

/* The same for a step heading that takes focus after a POST (the add-a-user panel's step two). It is
   an announcement, not a control, and the ring drew a blue box across the button above it. */
h3[tabindex]:focus, h3[tabindex]:focus-visible { outline: none; }

/* And for the status and error messages that take focus after a POST, for the same reason. The green
   or red box is already the thing the eye lands on; the ring on top of it read as a browser artefact. */
:is([role="status"], [role="alert"])[tabindex]:focus,
:is([role="status"], [role="alert"])[tabindex]:focus-visible { outline: none; }

/* --- Shell ----------------------------------------------------------------------------------- */

/* CourseTheme exists to carry --cap-course on an element, not to be one. Without this it would be a
   box in the middle of the entry page's card grid, and every card would become a grid item's only
   child instead of the grid item. Custom properties inherit down the element tree, not the box tree,
   so the colour still reaches the card. */
.cap-theme { display: contents; }

/* overflow-x: clip catches an ordinary element that grows too wide, so one long unbreakable string
   cannot take the whole page sideways. IT DOES NOT FIX THE iOS SCROLLER LEAK, and it was tried for
   that first: with this rule in place WebKit still ran window.scrollX to 143px on Part C. That fix is
   contain: paint on the scrollers themselves; see .cap-matrix__scroll, which carries the measurements.

   clip rather than hidden, because hidden on one axis forces the other to compute to auto and would put
   a vertical scrollbar down the page - the trap .cap-radar__scroll already documents. clip creates no
   scroll container, so overflow-y stays visible. The skip link hides itself with translateY, moving up
   rather than sideways, so a horizontal clip cannot strand it. */
.cap-shell { min-height: 100dvh; display: flex; flex-direction: column; overflow-x: clip; }

/* The skip link (WCAG 2.4.1). Off screen until it takes focus, then it lands over the masthead as an
   ordinary button. Positioned rather than given the .cap-visually-hidden treatment, because that clips
   to a single pixel and a link has to be able to come back.

   The main element it points at carries tabindex="-1" so focus really moves; see MainLayout. */
.cap-skip {
    position: absolute;
    inset-block-start: var(--cap-space-2);
    inset-inline-start: var(--cap-space-2);
    z-index: 100;
    padding: var(--cap-space-2) var(--cap-space-3);
    border-radius: var(--cap-radius);
    background: var(--cap-ink);
    color: var(--cap-surface);
    font-weight: 600;
    text-decoration: none;

    /* Off screen, not display:none - a hidden element cannot be focused, so the link would never
       appear. */
    transform: translateY(-200%);
}

.cap-skip:focus-visible {
    transform: none;
    outline: var(--cap-focus);
    outline-offset: 2px;
}

/* The main landmark takes focus from the skip link, and only from it. A focus ring around the whole
   page would be alarming and says nothing; the announcement of the landmark is the useful part. */
.cap-main:focus,
.cap-main:focus-visible { outline: none; }

/* White, per Figures 6 and 7, and not the course colour.
   CAP-201 painted the whole bar in var(--cap-course), which had two problems. The shell belongs to no
   course (a learner may be on two, D-020), so the bar was the neutral fallback grey: a heavy dark slab
   across the top of every page that looks nothing like the wireframes. And it forced the sign-out button
   to be drawn in the masthead's own background colour, which is why it was invisible until CAP-202
   patched round it. A white bar fixes both, and the course colour goes where it belongs: on the
   wordmark, and on the page beneath. */
.cap-masthead {
    background: var(--cap-surface);
    color: var(--cap-ink);
    border-block-end: 1px solid var(--cap-border);
}

.cap-masthead__inner,
.cap-footer__inner {
    width: 100%;
    max-width: var(--cap-page);
    margin-inline: auto;
    padding-inline: var(--cap-space-3);
}

.cap-masthead__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--cap-space-3);
    flex-wrap: wrap;
    padding-block: var(--cap-space-3);
}

.cap-brand {
    display: flex;
    align-items: center;
    gap: var(--cap-space-2);
    color: var(--cap-course-text);
    text-decoration: none;
    font-weight: 700;
    font-size: var(--cap-text-lg);
}

/* The real MiniMBA lockup (prerequisite 11, received 22 Jul 2026), replacing the "MM" placeholder.

   Sized in the stylesheet and given intrinsic width/height in the markup, so the masthead does not
   reflow while the image loads. The file is 120px tall for a 40px slot, which covers 3x displays; it
   is deliberately not an SVG because Brave Bison supplied PNG, and tracing their mark to fake one
   would be inventing brand assets rather than using them. */
.cap-brand__logo {
    height: 2.5rem;
    width: auto;
    flex: none;
}

.cap-brand__sub { color: var(--cap-ink); font-weight: 400; font-size: var(--cap-text-base); }

.cap-nav { display: flex; align-items: center; gap: var(--cap-space-3); flex-wrap: wrap; }
.cap-nav a { color: var(--cap-ink-muted); text-decoration: none; font-weight: 600; }
.cap-nav a:hover { color: var(--cap-course-text); text-decoration: underline; }
.cap-nav__who { color: var(--cap-ink-muted); font-weight: 400; }

/* A full-bleed grid: three columns, where ordinary page content sits in the middle one and anything
   that wants the whole width (the entry page's hero) spans all three.

   The usual way to break an element out of a centred container is margin-inline: calc(50% - 50vw). It
   is wrong here, and measurably so: 100vw includes the scrollbar, so at 360px the hero was eight pixels
   wider than the viewport and the whole page scrolled sideways. This grid does the same job with no
   viewport arithmetic in it, so there is nothing for a scrollbar to be missing from. */
.cap-main {
    flex: 1;
    /* The cross-axis partner of the clip on .cap-shell, and the cause rather than the symptom: a flex
       item may take its content's widest size unless it is told it may be narrower, which is how a
       512px table reaches out of a 309px column in the first place. */
    min-inline-size: 0;
    display: grid;
    align-content: start;
    grid-template-columns:
        [full-start] minmax(var(--cap-space-3), 1fr)
        [content-start] minmax(0, var(--cap-content)) [content-end]
        minmax(var(--cap-space-3), 1fr) [full-end];
    padding-block: var(--cap-space-5);
}

.cap-main > * { grid-column: content; }

/* CourseTheme is display: contents, so it is not a grid item: its children are. A child selector does
   not reach through it, so a page wrapped in CourseTheme had its heading, progress bar, item list and
   navigation auto-placed into the three columns of the full-bleed grid, side by side, at a third of the
   width each. It only looked right on the entry page because there the theme wraps individual cards
   inside a grid of their own. */
.cap-main > .cap-theme > * { grid-column: content; }

.cap-footer {
    background: var(--cap-surface);
    border-top: 1px solid var(--cap-border);
    color: var(--cap-ink-muted);
    font-size: var(--cap-text-sm);
}

.cap-footer__inner {
    padding-block: var(--cap-space-3);
    display: flex;
    justify-content: space-between;
    gap: var(--cap-space-3);
    flex-wrap: wrap;
}

/* The staff sign-in link (D-104). Deliberately quiet: it inherits the footer's muted ink and only
   underlines on hover, because it is a route for a handful of people and must not read as a call to
   action beside the learner's own sign-in. Given its own colour rather than the browser default, or it
   arrives bright blue in the one place on the page that is meant to recede. */
.cap-footer__staff {
    color: inherit;
    text-decoration: none;
}

.cap-footer__staff:hover,
.cap-footer__staff:focus-visible {
    text-decoration: underline;
}

/* --- Primitives the admin area reuses (CAP-201 -> CAP-401) ------------------------------------ */

.cap-card {
    background: var(--cap-surface);
    border: 1px solid var(--cap-border);
    border-radius: var(--cap-radius);
    padding: var(--cap-space-4);
}

.cap-card__accent { border-top: 4px solid var(--cap-course); }

.cap-cards {
    display: grid;
    gap: var(--cap-space-3);
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
}

/* A row of stat tiles is narrower than a row of programme cards: four fit where two cards would. */
.cap-cards:has(> .cap-stat) { grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }

/* White on the brand colour, at large-text size, and the two halves of that sentence are one decision.
   Asked for by Brave Bison's marketing team on 6 August 2026: "white text on blue or red buttons for
   accessibility". Marketing's #ED1846 already had white; Brand Management's #2196F2 had near-black,
   because InkOn picks whichever of the two is more legible and black wins on a mid-tone blue.

   Doing as asked lowers the contrast, which is the opposite of the reason given, so it only ships in a
   form that still passes. WCAG 1.4.3 asks 4.5:1 of normal text and 3:1 of LARGE text, where large means
   18.66px bold or 24px regular. White on the two brand colours measures 4.36:1 and 3.13:1: both fail as
   normal text and both pass as large. So the label is 19px at weight 700, which is large text, and the
   brand hex is used exactly as supplied - which was Carl's condition (6 Aug 2026).

   24px regular passes the same bar and was rendered beside this one before choosing: it wraps on a
   full-width card and reads as a banner rather than a control.

   The blue clears by 0.13, so there is no headroom. ColourTokenContrastTests asserts every seeded course
   colour stays above 3:1 against white, so a future palette edit fails the build rather than the audit.

   --cap-course-ink is still what fills, pills and roundels use. Only this button is pinned to white. */
.cap-button {
    display: inline-block;
    padding: var(--cap-space-2) var(--cap-space-4);
    border: 1px solid transparent;
    border-radius: var(--cap-radius);
    background: var(--cap-course);
    color: #FFFFFF;
    font: inherit;
    font-size: 1.1875rem;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
    cursor: pointer;
}

.cap-button:hover { filter: brightness(1.12); }

/* Sign out sits in the nav row at nav size, so the masthead is two rows on a phone, not three. */
.cap-nav .cap-button { padding: var(--cap-space-1) var(--cap-space-3); font-size: var(--cap-text-base); }

/* Disabled had no rule, so Previous on Part 1, the arrows at list ends and the pager's first page all
   looked live and showed a pointer (20 Aug 2026 audit). */
.cap-button:disabled,
.cap-button[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    filter: none;
}

/* Row actions inside a table. The 19px primary button is sized for a card; four of them in a 14px
   table row made every admin row 60px tall and the action column as wide as the data. */
.cap-table .cap-button,
.cap-button--small {
    padding: var(--cap-space-1) var(--cap-space-3);
    font-size: var(--cap-text-sm);
    line-height: 1.4;
}

/* Destructive row actions (Deactivate, Block, Remove): an outline in the danger ink, so they no longer
   weigh the same as Manage or Edit beside them. */
.cap-button--danger {
    background: var(--cap-surface);
    border-color: var(--cap-danger);
    color: var(--cap-danger);
}

.cap-button--danger:hover { filter: none; background: #FBE9E9; }

/* The quiet variant draws its label in --cap-course-text, which is the course colour already darkened
   past 4.5:1 on white, so it passes as normal text and the size above is a free choice rather than a
   requirement. It keeps it anyway: a primary and a secondary button side by side that differ in text
   size read as two different kinds of control. */
/* The secondary button has a SURFACE, not a transparent hole.
   -------------------------------------------------------------------------------------------------
   It was `background: transparent`, which was invisible while the page canvas was a near-white grey
   and became obvious the moment the canvas was painted in Brave Bison's Very Pale Red: a row of
   outlined shapes filled with the page behind them reads as cut-outs rather than as controls. Carl,
   6 August 2026, on the admin area: "the buttons again use the page background".

   White works on both backgrounds and is the reason to prefer it over a tint. On the canvas the button
   now lifts off the page; on a white panel it matches the panel and the border is what carries it,
   which is the ordinary way a secondary button is drawn. */
.cap-button--quiet {
    background: var(--cap-surface);
    border-color: currentColor;
    color: var(--cap-course-text);
}

/* The fill is already white, so brightness() does nothing to it - the hover has to come from the ink. */
.cap-button--quiet:hover {
    filter: none;
    background: var(--cap-surface-sunken);
}

/* The selected one of a row of buttons acting as tabs (the framework editor's five sections).

   The class was in the markup from the day the editor was built and there was never a rule behind it,
   so all five looked identical, before and after every click: the only cue to which section was open
   was the content underneath it. A class with no rule fails silently, which is the third time that has
   happened on this page alone (see .cap-matrix__point and .cap-pre).

   Not colour alone (WCAG 1.4.1): the fill, the weight and the underline all change, and the markup
   carries aria-current so it is announced rather than only drawn. */
.cap-button--current {
    background: var(--cap-course-strong);
    border-color: var(--cap-course-strong);
    color: var(--cap-course-ink);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cap-button--current:hover { background: var(--cap-course); filter: brightness(0.95); }

/* Wide, unbroken machine text - the career-path signals are one line of several hundred characters,
   because they are serialised without indentation. It had no rule, so it kept `white-space: pre`, ran
   off the content column, and was clipped by .cap-shell's overflow with no scrollbar offered: an
   administrator saw the first forty characters of a mapping and no way to read the rest. Every other
   wide thing in the portal sits in a scroller, and `contain: paint` is here for the same reason those
   carry it (D-120). */
.cap-pre {
    overflow-x: auto;
    contain: paint;
    padding: var(--cap-space-3);
    background: var(--cap-surface-sunken);
    border: 1px solid var(--cap-border);
    border-radius: var(--cap-radius);
    font-size: var(--cap-text-sm);
}

/* The longest label we ship, "Start pre-course assessment", is one line at 19px until about 380px of
   button. Giving the side padding back holds it on one line on a phone rather than letting a two-line
   primary action head the card. The block padding is untouched, so the target stays well over the
   24x24 of WCAG 2.5.8. */
@media (max-width: 40rem) {
    .cap-button { padding-inline: var(--cap-space-3); }
}

/* A badge that FOLLOWS something needs a gap, and it had none: the scales table rendered
   "capabilityCapability scale" as one word, because Razor strips the whitespace before an @if and both
   <code> and the badge are inline. The same shape is in the users table ("You" after an email) and on
   the assessment detail page.

   Set on the badge and cleared for a first child rather than using `* + .cap-badge`, because the thing
   in front is sometimes bare text - a learner's name - and an adjacent-sibling selector only sees
   elements. A badge alone in a cell is a first child and stays flush. */
.cap-badge {
    display: inline-block;
    margin-inline-start: var(--cap-space-2);
    padding: 2px var(--cap-space-2);
    border-radius: 999px;
    background: var(--cap-surface-sunken);
    border: 1px solid var(--cap-border);
    color: var(--cap-ink);               /* explicit, so a muted table row cannot recolour it */
    font-size: var(--cap-text-sm);
    font-weight: 600;
    line-height: 1.3;                    /* was inheriting 1.55: a 32px pill in a 22px table line */
    vertical-align: middle;
    white-space: nowrap;
}

.cap-badge:first-child { margin-inline-start: 0; }

/* Meaning, not just a pill. One neutral badge carried Active, Blocked, Published, In progress and the
   "You" marker alike (20 Aug 2026 audit). Colour reinforces; the word still carries it (WCAG 1.4.1). */
.cap-badge--ok    { background: #E7F3EB; border-color: #A9D5B6; color: var(--cap-success); }
.cap-badge--warn  { background: #FBE9E9; border-color: #EFB3B3; color: var(--cap-danger); }
.cap-badge--info  { background: var(--cap-surface); border-color: currentColor; color: var(--cap-course-text); }
.cap-badge--muted { background: var(--cap-surface-sunken); border-color: var(--cap-border); color: var(--cap-ink-muted); }

/* The collection window switch (D-136). One control that IS the state, not a badge describing it with
   a button beside it. It is a submit button wearing role="switch": the page is static SSR, so the
   flip is a form POST like every other admin action, and the switch look carries the meaning. The
   open track is the success green, which already clears 3:1 on white for 1.4.11; the closed track is
   the same bordered white as every other control. The label has a fixed minimum width so Open and
   Closed toggling does not shuffle the column. */
.cap-switch {
    display: inline-flex;
    align-items: center;
    gap: var(--cap-space-2);
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-size: var(--cap-text-sm);
    font-weight: 600;
    color: var(--cap-ink);
    cursor: pointer;
}

.cap-switch:focus-visible { outline: var(--cap-focus); outline-offset: 3px; border-radius: 999px; }

.cap-switch__track {
    position: relative;
    inline-size: 2.5rem;
    block-size: 1.35rem;
    border-radius: 999px;
    border: 1px solid var(--cap-border-strong);
    background: var(--cap-surface);
    transition: background-color 120ms ease-out, border-color 120ms ease-out;
}

.cap-switch__thumb {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-start: 0.15rem;
    inline-size: 0.95rem;
    block-size: 0.95rem;
    border-radius: 50%;
    background: var(--cap-border-strong);
    transform: translateY(-50%);
    transition: inset-inline-start 120ms ease-out, background-color 120ms ease-out;
}

.cap-switch[aria-checked="true"] .cap-switch__track {
    background: var(--cap-success);
    border-color: var(--cap-success);
}

.cap-switch[aria-checked="true"] .cap-switch__thumb {
    inset-inline-start: calc(100% - 1.1rem);
    background: var(--cap-surface);
}

.cap-switch__label {
    min-inline-size: 3.4rem;
    text-align: start;
}

.cap-muted { color: var(--cap-ink-muted); }

/* --- Entry page (CAP-202, Figure 6) ----------------------------------------------------------- */

/* The hero spans the page rather than the content column, as the wireframe has it. It sits inside
   .cap-main, so the negative inline margin pulls it back out to the viewport edge and the padding puts
   the text back on the content grid. */
.cap-hero {
    /* The one thing on any page that spans the full width. */
    grid-column: full;

    background: var(--cap-banner);
    color: var(--cap-banner-ink);
    padding-block: var(--cap-space-5);
    margin-block-end: var(--cap-space-5);

    /* .cap-main pads the top of every page, which would leave a strip of background between the
       masthead and the hero. The hero is the only thing that wants to sit flush against it. */
    margin-block-start: calc(-1 * var(--cap-space-5));
}

.cap-hero > * {
    width: 100%;
    max-width: var(--cap-page);
    margin-inline: auto;
    padding-inline: var(--cap-space-3);
}

/* Sentence case, not capitals. Brave Bison's marketing team, 6 August 2026: "remove all block capitals,
   these aren't in the brand guidelines". Four rules in this sheet uppercased their content and this is
   one; the others are .cap-step__eyebrow, .cap-stat-group__title and .cap-subnav__tag. No page holds a
   literal capitalised string, so the four rules are the whole of it - checked, not assumed.

   The letter-spacing went with the capitals. Tracking is added to capitals because capitals have no
   ascenders or descenders to separate them; applied to lower case it just loosens the word. The
   remaining opacity is what still marks this line as secondary.

   Kept as its own rule rather than deleted, because it is also what a screen reader was already
   hearing: text-transform is presentational, so "WELCOME, KYRI." was only ever seen, never announced. */
.cap-hero__eyebrow {
    margin-block-end: var(--cap-space-2);
    font-size: var(--cap-text-sm);
    opacity: 0.85;
}

.cap-hero h1 { margin-block-end: var(--cap-space-2); }
.cap-hero__lede { margin-block-end: 0; opacity: 0.9; }

/* The card is a column so the action sits on the baseline whatever the length of the status line, and
   two cards side by side line their buttons up. */
.cap-card { display: flex; flex-direction: column; }
.cap-card > :last-child { margin-block-end: 0; }

/* Sized here, so an h2 and an h3 wearing it (nested under a section heading) match. */
.cap-card__title { margin-block-end: var(--cap-space-1); font-size: var(--cap-text-lg); }
.cap-card__meta { font-size: var(--cap-text-sm); margin-block-end: var(--cap-space-3); }

.cap-card__status {
    display: flex;
    align-items: center;
    gap: var(--cap-space-2);
    flex-wrap: wrap;
    margin-block-end: var(--cap-space-4);
}

/* Pushes the action to the bottom of the card. */
.cap-card__status + * { margin-block-start: auto; }

.cap-card .cap-button { align-self: flex-start; }

.cap-note {
    margin-block: var(--cap-space-3);   /* the same above and below, so two notes stack evenly */
    padding: var(--cap-space-3);
    border: 1px dashed var(--cap-border);
    border-radius: var(--cap-radius);
    color: var(--cap-ink-muted);
    font-size: var(--cap-text-sm);
    max-width: none;
}

/* Feedback after a POST. A dashed grey aside is guidance; "Saved" and "Could not save" are not. */
.cap-note--success {
    border: 1px solid #A9D5B6;
    background: #E7F3EB;
    color: var(--cap-success);
    font-weight: 600;
}

.cap-note--error {
    border: 1px solid #EFB3B3;
    background: #FBE9E9;
    color: var(--cap-danger);
    font-weight: 600;
}

/* The sentence under a page heading. It wore .cap-hero__lede on every admin page, which is written for
   white-on-banner text and takes the bottom margin away. */
.cap-lede {
    margin-block: 0 var(--cap-space-3);
    color: var(--cap-ink-muted);
    max-inline-size: var(--cap-measure);
}

/* The small line above a heading (Cohort reporting, Your results). */
.cap-kicker {
    margin-block-end: var(--cap-space-1);
    color: var(--cap-course-text);
    font-size: var(--cap-text-sm);
    font-weight: 700;
}

/* An admin checkbox or radio with its label: the box and the words on one line with a gap, inside the
   same bordered row the questionnaire uses. */
.cap-check {
    display: flex;
    align-items: center;
    gap: var(--cap-space-2);
    padding: var(--cap-space-2) var(--cap-space-3);
    border: 1px solid var(--cap-border-strong);
    border-radius: var(--cap-radius);
    cursor: pointer;
}

.cap-check + .cap-check { margin-block-start: var(--cap-space-2); }
.cap-check input { margin: 0; inline-size: 1.1rem; block-size: 1.1rem; flex: none; }

/* --- Questionnaire (CAP-203, Figure 7) -------------------------------------------------------- */

/* The questionnaire sits on a white panel, as Figure 7 has it, not directly on the page canvas. It is
   not decoration: the page is a long form with a fixed content width, so on a wide monitor the grey
   either side has to look like a surrounding surface rather than like the form failed to fill the
   window. It also gives the row separators something to end against. */
.cap-panel {
    background: var(--cap-surface);
    border: 1px solid var(--cap-border);
    border-radius: var(--cap-radius);
    padding: var(--cap-space-4) var(--cap-space-5);
    margin-block-end: var(--cap-space-3);
}

@media (max-width: 40rem) {
    .cap-panel { padding: var(--cap-space-3); }
}

/* A panel inside a panel is one panel.
   AdminLayout puts every admin page on a panel, and the two reporting views carry their own because
   they are also rendered at /org, where nothing else provides one. Rather than making either of them
   conditional - which would put "am I in the admin area" inside a shared component, the exact coupling
   CAP-409 avoided by hosting the SAME component in both places - the inner one simply stops being a
   panel. It keeps its contents; it gives up its border, its padding and its surface. */
.cap-panel .cap-panel {
    background: none;
    border: 0;
    border-radius: 0;
    padding: 0;
    margin-block-end: 0;
}

/* Visible to a screen reader, not to an eye. The rating pills read "3" and mean "Can apply with some
   guidance", and a learner who cannot see the tooltip is entitled to the label rather than the number. */
.cap-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.cap-step__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--cap-space-3);
    flex-wrap: wrap;
    margin-block-end: var(--cap-space-3);
}

/* The title takes the room that is left, and is allowed to be narrower than its longest word, or the
   progress figure is pushed onto its own line by a long domain name. */
.cap-step__head > :first-child { flex: 1 1 20rem; min-inline-size: 0; }

/* Sentence case; see .cap-hero__eyebrow. This is the busiest of the four, because it carries the course
   name on every questionnaire, review and results page, and a course name is the one string on the page
   that should be set the way its owner writes it. */
.cap-step__eyebrow {
    margin-block-end: var(--cap-space-1);
    color: var(--cap-course-text);
    font-size: var(--cap-text-sm);
    font-weight: 700;
}

/* The step title is a page heading, not a hero. At 2.25rem a five-word domain name fills the line and
   leaves nowhere for the progress figure to sit. */
.cap-step__head :is(h1, h2, h3) { font-size: var(--cap-text-xl); margin-block-end: 0; }

.cap-step__progress {
    flex: none;
    margin: 0;
    text-align: end;
    font-size: var(--cap-text-sm);
}

.cap-step__percent {
    display: block;
    color: var(--cap-course-text);
    font-size: var(--cap-text-lg);
}

/* On a phone the header wraps and the progress block drops onto its own line. It kept text-align: end
   while shrink-wrapping to its content, so the short word "Progress" was pushed right over the longer
   "Part 2 of 5" beneath it and read as a stray indent. Reported at UAT on 6 August 2026 as "spacing on
   the progress label". Full width, one line, reading order left to right. */
@media (max-width: 40rem) {
    .cap-step__progress {
        flex: 1 1 100%;
        display: flex;
        align-items: baseline;
        gap: var(--cap-space-2);
        text-align: start;
    }

    .cap-step__percent { display: inline; }
}

.cap-progress {
    block-size: 6px;
    border-radius: 999px;
    background: var(--cap-border);
    overflow: hidden;
    margin-block-end: var(--cap-space-3);
}

.cap-progress__fill {
    block-size: 100%;
    background: var(--cap-course);
}

.cap-step__intro { color: var(--cap-ink-muted); font-size: var(--cap-text-sm); }

/* The capability scale's key. Body size and full-strength ink, not fine print: it is what every row on
   the page is rated against, and it was smaller than the rows themselves. */
/* The two ends of the rating scale, spread over the width the rows occupy: the low end at the left
   margin, the high end right justified. Mark Ritson, 12 August 2026.

   `max-inline-size: none` is the whole of it working, and leaving it out is what shipped to dev first.
   Every paragraph in this stylesheet is capped at the reading measure (see the `p` rule), which is right
   for prose and wrong for this: the high end stopped 500px short of the column of 5s it names, half way
   across the page, spread between nothing. A measure is about reading a sentence; this is a key over a
   set of columns.

   It wraps to two lines on a phone, where there is no width to spread across. */
.cap-step__scale {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--cap-space-2) var(--cap-space-4);
    margin-block: 0 var(--cap-space-2);
    max-inline-size: none;
}

.cap-items { list-style: none; margin: 0 0 var(--cap-space-4); padding: 0; }

.cap-item { border-block-end: 1px solid var(--cap-border); padding-block: var(--cap-space-3); }
.cap-item:first-child { border-block-start: 1px solid var(--cap-border); }

/* The gap indicator when Next is refused. A left border rather than a red background: the row is
   unanswered, not wrong, and colouring it like an error tells the learner they have made a mistake. */
.cap-item--gap {
    border-inline-start: 3px solid var(--cap-danger);
    padding-inline-start: var(--cap-space-3);
}

.cap-item__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--cap-space-3);
    flex-wrap: wrap;
}

.cap-item__text { margin: 0; max-width: var(--cap-measure); }
.cap-item__name { font-weight: 600; }

.cap-scale { display: flex; gap: var(--cap-space-2); flex: none; }

/* The input carries the state and the keyboard behaviour; the label carries the appearance. Native
   radios give arrow-key navigation within the group for free, which a div of buttons would not. */
.cap-scale__input {
    position: absolute;
    opacity: 0;
    inline-size: 1px;
    block-size: 1px;
}

.cap-scale__point {
    display: grid;
    place-items: center;
    inline-size: 2.25rem;
    block-size: 2.25rem;
    border: 1px solid var(--cap-border-strong);
    border-radius: 50%;
    color: var(--cap-ink-muted);
    font-size: var(--cap-text-sm);
    cursor: pointer;
}

.cap-scale__point:hover { border-color: var(--cap-course); }

.cap-scale__input:checked + .cap-scale__point {
    background: var(--cap-course-strong);
    border-color: var(--cap-course-strong);
    color: var(--cap-course-ink);
    font-weight: 700;
}

/* The ring belongs on the pill, because the input it belongs to is invisible. */
.cap-scale__input:focus-visible + .cap-scale__point { outline: var(--cap-focus); outline-offset: 2px; }

.cap-item__note { margin-block-start: var(--cap-space-2); font-size: var(--cap-text-sm); }
.cap-item__note summary { color: var(--cap-ink-muted); cursor: pointer; }

.cap-textarea {
    inline-size: 100%;
    max-inline-size: var(--cap-measure);
    margin-block-start: var(--cap-space-2);
    padding: var(--cap-space-2);
    border: 1px solid var(--cap-border-strong);
    border-radius: var(--cap-radius);
    font: inherit;
    font-size: var(--cap-text-sm);
}

/* Clear of what it sits between, on BOTH sides, which is what put the buttons in the same visual block
   as the final answer (Luke Groves, UAT, 5 August 2026: "there should be a space between"). Measured at
   zero above and zero below before this. Both margins are needed because the same row is used twice and
   the two uses have it the other way up: on the questionnaire it follows the questions, and in the
   administrator's preview it precedes the panel it pages through. */
.cap-step__nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--cap-space-3);
    margin-block: var(--cap-space-4);
    flex-wrap: wrap;
}

.cap-step__validation { margin: 0; flex: 1; text-align: center; font-size: var(--cap-text-sm); }

.cap-error { color: var(--cap-danger); font-weight: 600; }

.cap-pending {
    border-style: dashed;
    color: var(--cap-ink-muted);
    margin-block-end: var(--cap-space-4);
}

/* At 360px the statement and its scale cannot share a line, and squeezing them makes the pills too
   small to hit. They stack, and the scale keeps its touch targets. */
@media (max-width: 40rem) {
    .cap-item__row { flex-direction: column; align-items: stretch; }
    .cap-scale { justify-content: space-between; }
    .cap-step__nav .cap-button { flex: 1; text-align: center; }
    .cap-step__validation { order: 3; flex-basis: 100%; }

    /* 44px on a phone, up from 36. Thirty-six passes WCAG 2.2 AA, which asks for 24, and misses what
       both platform makers ask for. Asked for at UAT on 6 August 2026: "a greater focus on keyboard
       navigation or bigger select buttons would be ideal". Five of these plus their gaps come to 208px
       inside a 309px column at 375px wide, so there is room. */
    .cap-scale__point { inline-size: 2.75rem; block-size: 2.75rem; }
}

/* --- Part C: role and workplace questions (CAP-208) ------------------------------------------ */

.cap-questions { list-style: none; margin: 0; padding: 0; }

.cap-question { border-block-end: 1px solid var(--cap-border); padding-block: var(--cap-space-4); }
.cap-question:first-child { border-block-start: 1px solid var(--cap-border); }

/* Block, and said explicitly: Part A's item text is a <label> (it names the input below it) where Parts
   C to E use a <p>, and a label is inline by default - which laid every field out on its own label's
   line, at a width that varied with how long the label was. Found by looking at the page (CAP-204). */
.cap-question__text {
    display: block;
    margin: 0 0 var(--cap-space-3);
    max-width: var(--cap-measure);
    font-weight: 600;
}

/* Single choice and the satisfaction scale render as a vertical list of full-width options, because the
   option text is a sentence, not a number. The whole label is the target, and native radios keep the
   arrow-key navigation a div of buttons would lose.

   BLOCK, NOT FLEX, AND THAT IS THE WHOLE OF D-105. An absolutely positioned child of a FLEX container
   is placed at the container's start corner, not where it would have sat in flow - so every hidden
   radio in the list parked at the top of the list, one on top of the other. Clicking a label hands
   focus to its radio, the browser scrolls a focused element into view, and the page jumped back up to
   the top of the option list. Measured at 319px on an eight-option list and around a thousand on Part
   E's twenty-one, which is what Luke Groves reported on 5 August 2026 as "the screen jumped to the
   top ... 4 out of the 5 times I tried it". Intermittent for a real reason: nothing moves when the top
   of the list is already on screen. In normal flow the static position is the option's own line, so
   the radio is where the eye already is and there is nothing to scroll to.

   The spacing therefore has to come from margins rather than gap. Keep it that way. */
.cap-choices { display: block; max-inline-size: var(--cap-measure); }

.cap-choice__input {
    position: absolute;
    opacity: 0;
    inline-size: 1px;
    block-size: 1px;
}

/* A grid of two columns: the drawn control, then the words. The native input is visually hidden (it
   still takes focus and the keyboard), and ::before draws the circle or box in its place, so an option
   list says "pick one" or "tick all that apply" before anything is chosen. It drew nothing before:
   twelve identical bordered rows with no control in sight (20 Aug 2026 audit). */
.cap-choice {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: var(--cap-space-2);
    align-items: center;
    margin-block-start: var(--cap-space-2);
    padding: var(--cap-space-2) var(--cap-space-3);
    border: 1px solid var(--cap-border-strong);
    border-radius: var(--cap-radius);
    cursor: pointer;
}

.cap-choice::before {
    content: "";
    inline-size: 1.1rem;
    block-size: 1.1rem;
    border: 2px solid var(--cap-border-strong);
    border-radius: 3px;
    background: var(--cap-surface);
    flex: none;
}

.cap-choice__input[type="radio"] + .cap-choice::before { border-radius: 50%; }

/* Anything after the words (the "your answer before the course" line) sits under the words, not
   under the control. */
.cap-choice > * { grid-column: 2; }

/* The list's own spacing sits above it, so the first option must not push itself down. */
.cap-choice:first-of-type { margin-block-start: 0; }

.cap-choice:hover { border-color: var(--cap-course); }

.cap-choice__input:checked + .cap-choice {
    background: var(--cap-course-strong);
    border-color: var(--cap-course-strong);
    color: var(--cap-course-ink);
    font-weight: 600;
}

.cap-choice__input:checked + .cap-choice::before {
    border-color: var(--cap-course-text);
    background: var(--cap-course-text);
    box-shadow: inset 0 0 0 3px var(--cap-surface);
}

.cap-choice__input:focus-visible + .cap-choice { outline: var(--cap-focus); outline-offset: 2px; }

/* Part D's capability tick list. The rows reuse .cap-choice, so a ticked capability and a chosen
   improvement look like every other choice in the questionnaire and inherit its focus and hover rules. */
.cap-improve { max-inline-size: var(--cap-measure); }

.cap-improve__item { margin-block-start: var(--cap-space-2); }
.cap-improve__item:first-child { margin-block-start: 0; }

/* Indented under the capability they belong to, so a ticked row reads as one thing rather than as
   three items in a flat list. */
.cap-improve__points {
    margin-block-start: var(--cap-space-2);
    margin-inline-start: var(--cap-space-4);
}

/* The answer this learner gave before the course (D-121). It is MARKED, NOT LOCKED: Carl's ruling on
   7 August 2026 is that a learner being asked whether they still feel the same way must be able to say
   no, so the option stays live and stays selectable.

   A dashed border rather than a fill, so it cannot be mistaken for the current selection, and it sits
   BEFORE the :checked rule below on purpose - where the old answer is also the current one, which is
   how a carried sitting opens (D-108), the solid selected style has to win.

   The words are not decoration. WCAG 1.4.1 does not allow colour to be the only carrier of meaning, and
   "the outlined one is your old answer" is exactly that. */
.cap-choice--before {
    border-style: dashed;
    border-color: var(--cap-course);
}

.cap-choice__before {
    display: block;
    margin-block-start: 2px;
    font-size: var(--cap-text-sm);
    font-weight: 400;
    color: var(--cap-course-text);
}

/* The selected style wins over the marker above, whichever order the rules are read in. Equal
   specificity decided by source order is what caused two of the defects found on 6 August 2026, so this
   one says which it is rather than relying on where it sits. */
.cap-choice__input:checked + .cap-choice.cap-choice--before {
    border-style: solid;
    background: var(--cap-course-strong);
    border-color: var(--cap-course-strong);
    color: var(--cap-course-ink);
}

.cap-choice__input:checked + .cap-choice .cap-choice__before { color: var(--cap-course-ink); }

/* A multi-select at its cap (Part E's E3, "select up to 3") disables the unticked options rather than
   letting a fourth click through to a refusal. The ticked ones stay live, so unticking re-opens the rest. */
.cap-choice__input:disabled + .cap-choice {
    color: var(--cap-ink-muted);
    border-color: var(--cap-border);
    cursor: not-allowed;
}

.cap-choices__count { margin-block-start: var(--cap-space-2); }

/* The employer statement matrix. Wide, so it scrolls inside its own container and the page never scrolls
   sideways. The visible control is the native radio (accent-coloured to the course); its accessible name
   is the statement and the point, carried on the input's aria-label. */
/* contain: paint, and WITHOUT IT THE WHOLE PAGE SCROLLS SIDEWAYS ON iOS.
   The table keeps a 32rem minimum inside this box, which is 309px wide on a phone. Chromium clips it
   here and the page stays put. WebKit lets the content extend the root scrolling box anyway, so
   window.scrollX ran to 143px at 375px wide - while document.body.scrollWidth still read 375, which is
   why every measurement taken on the body, and the accessibility pass, called the page clean. Measured
   7 August 2026 on both engines side by side: 143px against 0px, with and without mobile emulation, at
   viewport scale 1. Reported from UAT by Glen Harber, whose screenshot of Part C has the masthead
   clipped off the left edge.

   contain: paint is the fix that worked, and it is the honest one: it states what an overflow scroller
   already promises, that nothing inside paints outside the box. overflow-x: clip on .cap-shell, on
   .cap-main, on .cap-panel and on the row all leave it at 143px; only containment on the scroller
   itself brings it to zero, and the matrix still scrolls inside as it should. Do not remove it because
   the page looks fine in Chrome. It always did. */
.cap-matrix__scroll { overflow-x: auto; contain: paint; }

.cap-matrix { border-collapse: collapse; inline-size: 100%; min-inline-size: 32rem; }

.cap-matrix th, .cap-matrix td {
    padding: var(--cap-space-2);
    text-align: center;
    border-block-end: 1px solid var(--cap-border);
}

.cap-matrix thead th {
    font-size: var(--cap-text-sm);
    color: var(--cap-ink-muted);
    font-weight: 600;
    vertical-align: bottom;
}

.cap-matrix th[scope="row"] {
    text-align: start;
    font-weight: 500;
    max-inline-size: 20rem;
}

.cap-matrix__input {
    inline-size: 1.15rem;
    block-size: 1.15rem;
    accent-color: var(--cap-course);
    cursor: pointer;

    /* Above the full-cell label below, so the radio itself stays directly clickable. Without this the
       label covers it and a click aimed at the control is intercepted: harmless for a person, because
       the label activates the same input, but it silently breaks anything that targets the input, which
       is how the end-to-end suite found it. Both work now, which is the honest state. */
    position: relative;
    z-index: 2;
}

/* THE WHOLE CELL IS THE TARGET, not the 18px radio sitting in the middle of it.

   `.cap-matrix__point` had no rule at all, so the label rendered at zero size and the only thing a
   learner could hit was the native radio: 18.4px, on a table they are already scrolling sideways on a
   phone. A near miss did nothing whatsoever - no selection, no feedback - and they found out at the
   foot of the page, as "3 answers still needed" with no indication of which three.

   The naming (`__point`, mirroring `.cap-scale__point`) and the `for` attribute show a target was
   always intended. D-120 raised the single-choice pills to 44px on 7 August for exactly the UAT
   complaint "bigger select buttons would be ideal"; the matrix is the control on the same page that
   was missed, because a class with no rule behind it fails silently. */
.cap-matrix tbody td { position: relative; min-block-size: 2.75rem; }

.cap-matrix__point {
    position: absolute;
    inset: 0;
    cursor: pointer;

    /* Above the "before" ring, which is decoration: a tap must always reach the label. */
    z-index: 1;
}

/* The cell this learner chose before the course (D-121), as a ring round the radio rather than a fill,
   so the radio's own checked state stays the thing that says what is chosen now. A matrix cell has no
   room for the words the single-choice list carries, so the fact is said in the radio's aria-label
   instead - see QuestionnaireStepView. Colour alone would fail WCAG 1.4.1. */
.cap-matrix__cell--before { position: relative; }

.cap-matrix__before {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-start: 50%;
    inline-size: 1.85rem;
    block-size: 1.85rem;
    margin-block-start: -.925rem;
    margin-inline-start: -.925rem;
    border: 2px dashed var(--cap-course);
    border-radius: 50%;
    pointer-events: none;
}

/* The read-only view of the matrix: one line per statement with the point the learner chose. */
.cap-summary__matrix { list-style: none; margin: var(--cap-space-2) 0 0; padding: 0; font-size: var(--cap-text-sm); }
.cap-summary__matrix li { padding-block: 2px; color: var(--cap-ink-muted); }

/* --- Review, confirmation and the read-only view (CAP-205, spec 6.1.3) ------------------------ */

/* The counts of spec 6.1.3, across the top of the review. auto-fit rather than three fixed columns, so
   an instrument with more or fewer things worth counting does not need this rule changed. */
.cap-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: var(--cap-space-3);
    margin: 0 0 var(--cap-space-4);
    padding: var(--cap-space-3);
    background: var(--cap-surface-sunken);
    border-radius: var(--cap-radius);
}

.cap-summary__item dt {
    color: var(--cap-ink-muted);
    font-size: var(--cap-text-sm);
}

.cap-summary__item dd {
    margin: 0;
    color: var(--cap-course-text);
    font-size: var(--cap-text-lg);
    font-weight: 700;
}

.cap-summary__heading { font-size: var(--cap-text-lg); margin-block: var(--cap-space-4) var(--cap-space-2); }

/* Metadata about one record: who, when, which version (CAP-408). The same auto-fit grid as .cap-summary
   above, and deliberately not that class - .cap-summary's value is a large bold course-coloured number,
   which is right for "21 rated" and wrong for an email address. Wide values (an email, a long
   organisation name) are allowed to wrap rather than push the grid past the page. */
.cap-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: var(--cap-space-3);
    margin: 0;
}

.cap-facts dt {
    color: var(--cap-ink-muted);
    font-size: var(--cap-text-sm);
}

/* break-word, not anywhere. `anywhere` broke every long value at whatever character reached the column
   edge, so an email read as "chloe.barnes@northwind.e / xample" on a 1440px screen - found by looking.
   break-word only breaks a word that cannot fit on a line of its own, which at 14rem is a genuinely
   long address rather than an ordinary one. */
.cap-facts dd {
    margin: 0;
    overflow-wrap: break-word;
}

/* Red-edged, so the block naming what is still to answer does not read as another summary panel. The
   name is about assessment gaps (unanswered items), not spacing - a neutral card that only wants the
   margin uses cap-card--spaced, or the danger edge follows it onto a card that is not a warning. */
.cap-card--gap {
    border-inline-start: 3px solid var(--cap-danger);
    margin-block-end: var(--cap-space-4);
}

/* Just the bottom margin, no edge: for stacking neutral cards with no warning meaning. */
.cap-card--spaced { margin-block-end: var(--cap-space-4); }

.cap-gaps { margin: 0; padding-inline-start: var(--cap-space-4); font-size: var(--cap-text-sm); }
.cap-gaps li { margin-block-end: var(--cap-space-1); }

/* The read-only view's answer: the number, then what it means. The number alone is not something a
   learner recognises three months later.

   Fixed width, so every pill sits on the same vertical line down the page. Left to size itself, the
   block is right-aligned and the labels are all different lengths ("Expert - can lead and teach others
   in this area" against "Basic awareness"), so the pills land at a different x on every row and the
   column reads as ragged rather than as a column. */
.cap-answer {
    flex: none;
    inline-size: 24rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--cap-space-2);
    font-size: var(--cap-text-sm);
}

.cap-answer__value {
    display: grid;
    place-items: center;
    inline-size: 2.25rem;
    block-size: 2.25rem;
    border-radius: 50%;
    background: var(--cap-course-strong);
    color: var(--cap-course-ink);
    font-weight: 700;
    flex: none;
}

.cap-answer__note {
    margin: var(--cap-space-2) 0 0;
    color: var(--cap-ink-muted);
    font-size: var(--cap-text-sm);
    font-style: italic;
}

.cap-confirm__lede { font-size: var(--cap-text-lg); }

.cap-confirm__nav {
    display: flex;
    gap: var(--cap-space-3);
    flex-wrap: wrap;
    margin-block-start: var(--cap-space-4);
}

/* The fixed answer column is wider than a 360px phone. On a stacked row there is nothing to align it
   against anyway, so it gives the width back. */
@media (max-width: 40rem) {
    .cap-answer { inline-size: auto; align-self: flex-start; }
}

/* --- Admin: course presentations (CAP-407), and the form + table primitives CAP-401 will reuse -- */

/* --- Admin area (CAP-401) ---------------------------------------------------------------------------

   The back office wears the portal's own shell (MainLayout): same white masthead, top nav, light
   surface and tokens as every learner and corporate page, so it reads as one product. All the admin
   area adds is a section sub-nav under the masthead and a set of vitals tiles - both built from the
   existing card, button and colour tokens, nothing bespoke. */

.cap-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--cap-space-1) var(--cap-space-3);
    margin-block-end: var(--cap-space-5);
    border-block-end: 1px solid var(--cap-border);
}

.cap-subnav a,
.cap-subnav span {
    display: inline-flex;
    align-items: center;
    gap: var(--cap-space-2);
    padding: var(--cap-space-2) 0;
    margin-block-end: -1px;                 /* the active underline sits on the container border */
    border-block-end: 2px solid transparent;
    color: var(--cap-ink-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--cap-text-sm);
}

.cap-subnav a:hover { color: var(--cap-course-text); }

/* NavLink stamps .active on the current route (nav-state-active). */
.cap-subnav a.active {
    color: var(--cap-ink);
    border-block-end-color: var(--cap-course);
}

/* On a phone the eight sections wrapped to three lines. One line that scrolls sideways inside its own
   box, the arrangement every other wide thing in the portal uses (D-120). */
@media (max-width: 40rem) {
    .cap-subnav {
        flex-wrap: nowrap;
        overflow-x: auto;
        contain: paint;
        gap: var(--cap-space-3);
        margin-block-end: var(--cap-space-4);
    }

    .cap-subnav a,
    .cap-subnav span { white-space: nowrap; }
}

/* Vitals tiles: the portal card, with a large display-face figure. */
.cap-stat-group { margin-block-end: var(--cap-space-5); }
.cap-stat-group:last-child { margin-block-end: 0; }

/* Sentence case; see .cap-hero__eyebrow. These are real <h2> headings on the admin landing page, so they
   were the one set of capitals that a sighted reader met as a document heading. */
.cap-stat-group__title {
    font-size: var(--cap-text-sm);
    font-weight: 600;
    color: var(--cap-ink-muted);
    margin-block-end: var(--cap-space-3);
}

/* ONE rule for the stat tile, used by the admin dashboard, the results page and the cohort dashboard.
   It was declared three times (here, under the results section, and as .cap-card.cap-stat), and which
   padding and background won depended on file order (20 Aug 2026 audit). */
.cap-stat {
    display: flex;
    flex-direction: column;
    gap: var(--cap-space-1);
    padding: var(--cap-space-3);
    background: var(--cap-surface-sunken);
    border: 1px solid transparent;
    border-radius: var(--cap-radius);
}

/* Scoped to the admin card, and it has to be.
   -------------------------------------------------------------------------------------------------
   CAP-303's results page later declares a second `.cap-stat__figure` at body size, for the small number
   beside a domain name, and the two rules had identical specificity - so the later one won and the
   admin dashboard's headline vitals have been rendering at 16px instead of the 2.25rem display face
   they were written to use, since CAP-401.

   The same class of collision as `.cap-card.cap-stat` above, found in the same minute and for the same
   reason: a repaint sends you looking at pages you have not looked at in a fortnight. Scoping this one
   rather than renaming the class keeps both call sites working and leaves the results page untouched. */
.cap-card.cap-stat .cap-stat__figure {
    font-family: var(--cap-font-display);
    font-size: var(--cap-text-2xl);
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;     /* figures line up across the row */
    color: var(--cap-ink);
}

.cap-stat__label { font-weight: 600; }
.cap-stat__note { color: var(--cap-ink-muted); font-size: var(--cap-text-sm); }

/* A row of labelled fields that wraps to a column on a narrow screen. The add-a-presentation form is
   the first of these; the rest of the admin editors (CAP-401 onwards) are the same shape. */
.cap-form__row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--cap-space-3);
    margin-block: var(--cap-space-3);
}

.cap-field { display: flex; flex-direction: column; gap: var(--cap-space-1); flex: 1 1 14rem; }
.cap-field__label { font-size: var(--cap-text-sm); font-weight: 600; }
.cap-field__optional { font-weight: 400; color: var(--cap-ink-muted); }

/* Help that belongs to ONE field, sitting under it inside .cap-field, and named by its
   aria-describedby. Small and muted like .cap-muted; margin cleared because the column's gap spaces it. */
.cap-field__hint { margin: 0; font-size: var(--cap-text-sm); color: var(--cap-ink-muted); }

/* Step two of adding a user. It appears beneath step one's Find button once Piano has answered, and
   without a rule of its own the two forms ran together as one. */
.cap-add__step {
    margin-block-start: var(--cap-space-4);
    padding-block-start: var(--cap-space-3);
    border-block-start: 1px solid var(--cap-border);
}

/* --cap-border-strong, not --cap-border: a text box edge is a boundary of a control and needs 3:1
   (WCAG 1.4.11), which #FAD0CE does not reach (see the token notes at the top of this file). The
   min-block-size keeps a native date input level with the select beside it. */
.cap-field__control {
    min-block-size: 2.375rem;
    padding: var(--cap-space-2);
    border: 1px solid var(--cap-border-strong);
    border-radius: var(--cap-radius);
    font: inherit;
    font-size: var(--cap-text-sm);
    background: var(--cap-surface);
    color: var(--cap-ink);
}

.cap-field__control::placeholder { color: var(--cap-ink-faint); font-style: italic; }

.cap-field__control:focus-visible { outline: var(--cap-focus); outline-offset: 2px; }

/* A textarea inside a field already has the field's gap above it; its own top margin doubled it. */
.cap-field > .cap-textarea { margin-block-start: 0; }

.cap-table {
    inline-size: 100%;
    border-collapse: collapse;
    margin-block-start: var(--cap-space-3);
    font-size: var(--cap-text-sm);
}

.cap-table th,
.cap-table td {
    text-align: start;
    padding: var(--cap-space-2);
    border-block-end: 1px solid var(--cap-border);
    vertical-align: middle;
}

/* Column headings only. The bare `th` rule also caught th[scope=row], so learner names in the cohort
   roster and band names rendered in the muted ink (20 Aug 2026 audit). */
.cap-table thead th { color: var(--cap-ink-muted); font-weight: 600; }
.cap-table code { font-size: var(--cap-text-sm); color: var(--cap-ink); }

/* Figures: lined up and right-aligned. */
.cap-num,
.cap-table th.cap-num,
.cap-table td.cap-num { text-align: end; font-variant-numeric: tabular-nums; }

/* A finished presentation is still shown - it is the record of a real intake - but it recedes, because
   the active ones are what an administrator is here to manage. */
.cap-table__row--muted td { color: var(--cap-ink-muted); }
.cap-table__actions { text-align: end; white-space: nowrap; }
.cap-table__actions > * + * { margin-inline-start: var(--cap-space-2); }

/* The draft editor's domain header: a title on one line and its actions on the other, wrapping on a
   narrow screen (CAP-405).

   It needs its own rule rather than reusing .cap-table__actions, which was the first attempt and gave the
   page a horizontal scrollbar at 390px. That class carries `white-space: nowrap`, which is right inside a
   table that scrolls in its own wrapper and wrong for a row of buttons standing free in a card: four
   buttons that refuse to wrap are wider than a phone. */
.cap-editor__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--cap-space-2);
}

.cap-editor__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--cap-space-2);
}

/* The filter forms' Apply and Clear, right-aligned but still allowed to wrap on a phone (they wore
   .cap-table__actions before, whose nowrap is right in a scrolling table and wrong in a form). */
.cap-editor__actions--end { justify-content: flex-end; }

/* An actions cell holds a link and a form (the form is what carries the antiforgery token, CAP-206), and
   a form is a block, so the button inside it dropped onto its own line and sat indented from the link
   beside it. Every admin table has looked like that since CAP-402. Inline-block puts them back on one
   line, and the alignment rule above still right-aligns the pair. */
.cap-table__actions > form { display: inline-block; }

/* The resource id column does not wrap usefully on a phone, so the whole table scrolls rather than
   crushing every column (the page body itself must never scroll sideways). */
/* `position: relative` is load-bearing, not decoration. An absolutely positioned descendant is clipped
   by an ancestor's overflow only when that ancestor is its containing block, and the visually-hidden
   "Actions" heading in the last column is absolutely positioned. Without this it keeps its static
   position out at the full table width, escapes the scroller, and gives the whole PAGE a horizontal
   scrollbar on a phone - exactly what the wrapper exists to prevent. Found at 390px on CAP-403, whose
   table is the first one wider than a phone. */
/* contain: paint for the same reason .cap-matrix__scroll carries it: on WebKit a scroller's content
   reaches the root scrolling box and takes the whole page sideways with it. Same shape, same fix. */
.cap-table-wrap { overflow-x: auto; position: relative; contain: paint; }

/* A scroller that tells you it scrolls. On a phone the users table showed Name and half of Role with
   nothing to say Status and the buttons were off to the right (20 Aug 2026 audit). Two shadow layers
   painted with background-attachment: local, so each one slides away as its edge is reached; the white
   covers sit over them and scroll with the content. No script, no extra element. */
.cap-table-wrap,
.cap-radar__scroll {
    contain: paint;                      /* restated: the guard test reads the first rule it finds */
    background:
        linear-gradient(to right, var(--cap-surface) 30%, rgba(255, 255, 255, 0)),
        linear-gradient(to left, var(--cap-surface) 30%, rgba(255, 255, 255, 0)) 100% 0,
        radial-gradient(farthest-side at 0 50%, rgba(56, 0, 8, 0.18), rgba(56, 0, 8, 0)),
        radial-gradient(farthest-side at 100% 50%, rgba(56, 0, 8, 0.18), rgba(56, 0, 8, 0)) 100% 0;
    background-repeat: no-repeat;
    background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
}

/* The radar's text is part of the page: the SVG was falling back to the browser's serif/Arial at 11px
   in a grey that matched nothing else (20 Aug 2026 audit). */
.cap-radar text {
    font-family: var(--cap-font);
    fill: var(--cap-ink-muted);
}

@media (max-width: 40rem) {
    .cap-field { flex-basis: 100%; }
}

/* --- Learner results overview (CAP-303, spec 6.1.4, Figure 8) ---------------------------------- */

/* The headline cards. auto-fit like .cap-summary, so three cards (a single phase) and four (the
   comparison) both fill the row without a rule change. */
.cap-results__cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: var(--cap-space-3);
    margin: 0 0 var(--cap-space-4);
}

/* The admin vitals tiles, drawn exactly like the results page's headline cards.
   -------------------------------------------------------------------------------------------------
   `class="cap-card cap-stat"` sets a background twice at the same specificity, so which one won was
   decided by file order and nobody had ever looked. It did not matter while the two colours were
   #FFFFFF and #F4F4F5, 1.03:1 apart on a bordered card. Painting the canvas in Brave Bison's Very Pale
   Red made it obvious in an afternoon.

   The answer arrived in two steps and the second is the right one. The tiles first went white, because
   at that point they were sitting straight on the page canvas and a tinted card on a tinted page reads
   as nothing at all. Then AdminLayout put every admin page on a white panel - and on white, the tint is
   what the results page already does with its own headline cards, so the tiles now match those: filled
   with the pale surface, no border, and the card class contributes only its layout.

   Carl, 6 August 2026: "the white panel allows us to use the background colour in the boxes, and the
   dark colour for button background with white text". */
.cap-card.cap-stat {
    background: var(--cap-surface-sunken);
    border-color: transparent;
    padding: var(--cap-space-3);
}

.cap-stat dt { color: var(--cap-ink-muted); font-size: var(--cap-text-sm); }

/* A list of capability names (the suggested focus) is a sentence, not a figure, so it steps down from
   the headline size the other three cards use. */
.cap-stat dd.cap-stat__focus { font-size: var(--cap-text-lg); line-height: 1.3; }

/* --cap-course-TEXT, not --cap-course. These three rules paint figures on the sunken grey card, which
   is text, and the raw brand colour is a fill colour. Found by the axe pass of 6 August 2026:
   .cap-stat__figure rendered Marketing's #ED1846 on #F4F4F5 at 16px bold, which measures 3.96:1 against
   the 4.5:1 WCAG 1.4.3 asks of normal text.

   The two headline rules beside it were not reported, and only because they are large text where the
   bar drops to 3:1 - the same 3.96 passing on a technicality. They are corrected anyway. The whole
   reason --cap-course-text exists is that Brave Bison's colours are saturated mid-tones that are fine as
   fills and fail as text (see ColourToken.TextOnBackground), and a rule that passes today only because
   its font is big is one type-scale edit away from failing. ColourContrastTests already holds the token
   itself; this is the third place that forgot to use it. */
.cap-stat dd {
    margin: var(--cap-space-1) 0 0;
    font-size: var(--cap-text-xl);
    font-weight: 700;
    color: var(--cap-course-text);
    display: flex;
    align-items: baseline;
    gap: var(--cap-space-2);
    flex-wrap: wrap;
}

/* A domain name is a sentence, not a figure; it must not shout at headline size. */
.cap-stat__name { font-size: var(--cap-text-base); color: var(--cap-ink); }
.cap-stat__of { font-size: var(--cap-text-sm); font-weight: 400; color: var(--cap-ink-muted); }
.cap-stat__figure { font-size: var(--cap-text-base); font-weight: 700; color: var(--cap-course-text); }
/* Both of these are <dd>, and until 6 August 2026 both were <p>.
   A <dl> may contain only <dt>, <dd> and grouping <div>s, and a <div> inside one may contain only <dt>
   and <dd> - so a <p> in there is invalid, which axe reported as a WCAG 1.3.1 failure on five pages. A
   term is allowed more than one description, so the figure and the sentence explaining it are simply
   two <dd>s of the same <dt>, which is also the truer reading of what they are.

   Selector written as `.cap-stat dd.cap-stat__x` deliberately: `.cap-stat dd` above is (0,1,1) and a
   bare class is (0,1,0), so a plain `.cap-stat__basis` rule would lose and these notes would arrive in
   the headline's size, weight and colour. */
.cap-stat dd.cap-stat__band {
    margin: var(--cap-space-1) 0 0;
    display: block;
    font-size: var(--cap-text-base);
    font-weight: 400;
}

.cap-stat dd.cap-stat__basis {
    margin: var(--cap-space-1) 0 0;
    display: block;
    font-size: var(--cap-text-sm);
    font-weight: 400;
    color: var(--cap-ink-muted);
}

/* The change figures. Green up and red down lean on colour, so the sign is always in the text too
   (+1.48 / -0.50): colour reinforces, never carries, the meaning (WCAG 1.4.1). */
.cap-delta { font-weight: 700; font-size: var(--cap-text-base); white-space: nowrap; }
.cap-delta--up { color: var(--cap-success); }
.cap-delta--down { color: var(--cap-danger); }

/* Radar beside the table where there is room, stacked where there is not. The chart column is capped:
   a radar stretched across a 4K monitor is a decoration, not a reading. */
.cap-results__layout {
    display: grid;
    grid-template-columns: minmax(0, 30rem) minmax(0, 1fr);
    gap: var(--cap-space-4);
    align-items: start;
}

@media (max-width: 56rem) {
    .cap-results__layout { grid-template-columns: minmax(0, 1fr); }
}

/* The radar, and the one class in this file that had no CSS behind it at all until 6 August 2026 - it
   was in the markup from CAP-303 and never declared, which is the same trap CAP-405 and CAP-403 both
   hit. Its width is what the axis labels were measured against, so it is stated here rather than left
   to whatever the grid column happens to be.

   Below about 480px a radar cannot hold its labels: at 390px the column is 309px and the side labels
   hung 71px off one edge and 54px off the other, which is Luke's "the graph doesn't fit" at phone size.
   So the chart keeps its measured width and the box around it scrolls, the same arrangement as
   .cap-matrix__scroll and .cap-table-wrap. The page body still never scrolls sideways. */
/* Focusable, because it scrolls (WCAG 2.1.1) - so it needs a visible ring like everything else that
   takes focus. The generic ring rule names :is(a, button, input, select, textarea, [tabindex]), which
   this matches through [tabindex], so the outline comes for free; the offset is negative only because an
   outline outside a scroller is clipped by the layout around it. */
/* overflow-y: hidden is NOT redundant, and leaving it out put a vertical scrollbar down the middle of
   the results page. Setting overflow-x to anything other than visible forces the other axis to compute
   to auto rather than staying visible, so `overflow-x: auto` alone silently asks for vertical scrolling
   too - and the chart is a few pixels taller than the box, so the browser drew the bar. Found by looking
   at the page; the axe pass and every measurement had already passed. */
/* contain: paint for the same reason .cap-matrix__scroll carries it, and this box is wider than that
   one: 30rem of chart inside a 309px column took the results page sideways on WebKit too. */
.cap-radar__scroll { overflow-x: auto; overflow-y: hidden; contain: paint; }

.cap-radar__scroll:focus-visible { outline: var(--cap-focus); outline-offset: -3px; }

.cap-radar { min-inline-size: 30rem; }

.cap-results__table th[scope="row"] { color: var(--cap-ink); font-weight: 600; }
.cap-results__overall th,
.cap-results__overall td { border-block-start: 2px solid var(--cap-ink); border-block-end: none; font-weight: 700; }

.cap-results__dates { font-size: var(--cap-text-sm); display: flex; gap: var(--cap-space-3); flex-wrap: wrap; }

/* --- Domain breakdown (CAP-304, spec 6.1.5, Figure 9) ------------------------------------------ */

.cap-breakdown {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 18rem);
    gap: var(--cap-space-4);
    align-items: start;
}

@media (max-width: 56rem) {
    .cap-breakdown { grid-template-columns: minmax(0, 1fr); }
}

.cap-breakdown__aside {
    padding: var(--cap-space-3);
    background: var(--cap-surface-sunken);
    border-radius: var(--cap-radius);
}

.cap-breakdown__aside .cap-summary__heading { margin-block-start: 0; }

/* --cap-course-text, for the reason .cap-stat dd gives above: this is a figure on the sunken card, so
   it is text, and the raw brand colour is a fill. */
.cap-breakdown__score {
    margin: 0 0 var(--cap-space-2);
    font-size: var(--cap-text-2xl);
    font-weight: 700;
    color: var(--cap-course-text);
    display: flex;
    align-items: baseline;
    gap: var(--cap-space-2);
}

.cap-bars { list-style: none; margin: 0; padding: 0; }

.cap-bars__row {
    padding-block: var(--cap-space-3);
    border-block-end: 1px solid var(--cap-border);
}

.cap-bars__row:first-child { padding-block-start: 0; }

.cap-bars__text { margin: 0 0 var(--cap-space-2); }
.cap-bars__name { font-weight: 600; }
.cap-bars__desc { color: var(--cap-ink-muted); font-size: var(--cap-text-sm); }
.cap-bars__desc::before { content: " - "; }

/* The bars themselves: plain divs whose widths are the persisted ratings against the version's own
   scale, so the picture cannot disagree with the stored numbers. Pre is neutral, post is the course
   colour - the same series colouring as the radar (D-060). */
.cap-bars__track {
    background: var(--cap-surface-sunken);
    border-radius: 999px;
    block-size: 10px;
    margin-block-end: var(--cap-space-1);
    overflow: hidden;
}

.cap-bars__fill { block-size: 100%; border-radius: inherit; }
/* The "before" bar. Neutral against the course-coloured "after" bar, but a warm neutral now rather than
   the Zinc grey it was: a grey bar beside a red one on a warm page reads as a different product. Same
   value as --cap-border-strong, which is the darkest of the derived neutrals and therefore the one that
   holds its own against a saturated brand colour. */
.cap-bars__fill--pre { background: var(--cap-border-strong); }
.cap-bars__fill--post { background: var(--cap-course); }

.cap-bars__figures {
    margin: var(--cap-space-1) 0 0;
    font-size: var(--cap-text-sm);
    display: flex;
    gap: var(--cap-space-2);
    align-items: baseline;
    flex-wrap: wrap;
}

/* --- Framework defaults ----------------------------------------------------------------------- */

/* The circuit-failed banner. Its Reload and Dismiss controls had no rule at all (the template's
   .reload / .dismiss classes were never styled), so they rendered as bare text. The template's
   validation and error-boundary rules that used to sit here were dead: nothing in the portal renders
   a DataAnnotationsValidator or an ErrorBoundary. */
#blazor-error-ui .reload,
#blazor-error-ui .dismiss {
    font: inherit;
    font-weight: 600;
    color: var(--cap-ink);
    background: none;
    border: 0;
    padding: var(--cap-space-1) var(--cap-space-2);
    margin-inline-start: var(--cap-space-2);
    text-decoration: underline;
    cursor: pointer;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 1000;
    padding: var(--cap-space-3);
    background: #FEF3C7;
    border-top: 1px solid var(--cap-border-strong);
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.15);
}

/* The cohort dashboard's filter bar, sections and pager (CAP-311, spec 6.2). */

.cap-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: var(--cap-space-3);
    padding: var(--cap-space-3);
    margin: 0 0 var(--cap-space-4);
    background: var(--cap-surface-sunken);
    border: 1px solid var(--cap-border);
    border-radius: var(--cap-radius);
}

.cap-filters__field { display: flex; flex-direction: column; gap: 0.25rem; }

.cap-filters__field label {
    font-size: var(--cap-text-sm);
    font-weight: 600;
}

.cap-filters__field select,
.cap-filters__field input {
    min-block-size: 2.5rem;             /* a native date input and a select at one height */
    padding: 0.5rem;
    font: inherit;
    background: var(--cap-surface);
    border: 1px solid var(--cap-border-strong);
    border-radius: var(--cap-radius);
    /* Wide enough for the longest programme name without the bar reflowing as the filter changes. */
    min-inline-size: 12rem;
}

/* The download block (D-115). One primary action, and the per-table CSVs folded away behind a native
   <details>, because three equally weighted buttons made a reader choose between three files before
   they had read a number. */
.cap-downloads {
    margin: 0 0 var(--cap-space-4);
}

.cap-downloads__more {
    margin-block-start: var(--cap-space-3);
    padding-inline-start: var(--cap-space-3);   /* room for the summary's own marker */
}

/* list-item, NOT inline-block, and the difference is the whole affordance. A <summary> only draws its
   disclosure triangle while its display is list-item; inline-block silently removes the marker, which
   was the first version of this rule and left the line reading as a sentence nobody would think to
   click. Found by looking at the page. width: fit-content keeps the click target on the words rather
   than stretching it across the panel. */
.cap-downloads__more summary {
    display: list-item;
    inline-size: fit-content;
    padding-block: var(--cap-space-1);
    color: var(--cap-course-text);
    font-size: var(--cap-text-sm);
    font-weight: 600;
    cursor: pointer;
}

.cap-downloads__more summary:focus-visible { outline: var(--cap-focus); outline-offset: 2px; }

.cap-downloads__list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--cap-space-2);
    margin-block-start: var(--cap-space-2);
}

.cap-dash__section { margin-block-start: var(--cap-space-4); }

/* The shared list pager (Pager.razor). `flex-wrap` is not decoration: at 390px the five controls of a
   long list - First, Previous, "Page 12 of 42", Next, Last - are wider than the viewport, and a flex row
   that cannot wrap pushes them out of the page instead. */
.cap-pager {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--cap-space-3);
    margin-block-start: var(--cap-space-3);
}

/* Part A's inputs (CAP-204). A native select for a list of 33 industries, a native date picker, and text
   for a name: the platform's own controls, which come with keyboard behaviour, locale-aware date entry
   and autofill that a bespoke widget would have to reimplement badly. Sized to the reading measure so a
   name box is not the width of the page. */
.cap-select,
.cap-input {
    inline-size: 100%;
    max-inline-size: var(--cap-measure);
    margin-block-start: var(--cap-space-2);
    padding: var(--cap-space-2);
    font: inherit;
    background: var(--cap-surface);
    border: 1px solid var(--cap-border-strong);
    border-radius: var(--cap-radius);
}

.cap-select:focus-visible,
.cap-input:focus-visible { outline: var(--cap-focus); outline-offset: 2px; }

/* The required marker and its key (CAP-204, asked for at the 21 July review). The asterisk carries the
   danger colour so it reads as a marker rather than as punctuation, and the key sits under the section
   introduction in the muted voice - it is instruction, not content. */
.cap-required {
    color: var(--cap-danger);
    font-weight: 700;
    margin-inline-start: 0.15em;
}

.cap-step__required {
    margin-block: 0 var(--cap-space-3);
    color: var(--cap-ink-muted);
    font-size: var(--cap-text-sm);
    max-inline-size: var(--cap-measure);
}

/* --- 20 August 2026 audit additions ---------------------------------------------------------------- */

/* The framework editor's section strip. It was five primary buttons at 19px directly under the 14px
   admin sub-nav, with the selected one both filled and underlined. Now it is a second row of tabs in
   the sub-nav's own idiom: muted text, the current one in ink with the course-colour underline. */
.cap-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--cap-space-1) var(--cap-space-4);
    margin-block: var(--cap-space-3) var(--cap-space-4);
    border-block-end: 1px solid var(--cap-border);
}

.cap-tabs__tab {
    padding: var(--cap-space-2) 0;
    margin-block-end: -1px;
    border: 0;
    border-block-end: 2px solid transparent;
    background: none;
    color: var(--cap-ink-muted);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.cap-tabs__tab:hover { color: var(--cap-course-text); }

.cap-tabs__tab[aria-current],
.cap-tabs__tab[aria-selected="true"] {
    color: var(--cap-ink);
    border-block-end-color: var(--cap-course);
}

@media (max-width: 40rem) {
    .cap-tabs { flex-wrap: nowrap; overflow-x: auto; contain: paint; }
    .cap-tabs__tab { white-space: nowrap; }
}

/* The preview of the questionnaire inside the framework editor. The editor already sits on the admin
   panel, and the panel-in-panel rule rightly strips a second panel, so "what a learner sees" was
   drawn straight on the page with no surface of its own. A sunken frame marks it as a rendering. */
.cap-preview {
    margin-block-start: var(--cap-space-3);
    padding: var(--cap-space-4);
    background: var(--cap-surface-sunken);
    border: 1px solid var(--cap-border);
    border-radius: var(--cap-radius);
}

.cap-preview .cap-panel { background: var(--cap-surface); border: 1px solid var(--cap-border); padding: var(--cap-space-4); }

@media (max-width: 40rem) {
    .cap-preview { padding: var(--cap-space-3); }
    .cap-preview .cap-panel { padding: var(--cap-space-3); }
}

/* The "(before and after)" detail under a breakdown heading, and the confirmation panel after submit.
   Both classes were in the markup with no rule. */
.cap-breakdown__detail { color: var(--cap-ink-muted); font-weight: 400; font-size: var(--cap-text-lg); }
.cap-confirm { max-inline-size: var(--cap-measure); }

/* Motion is decoration here. The only transitions in the file are the switch's, and they stop for
   anyone who has asked their system for less movement. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* The admin dashboard's list of back-office links (replacing eight identical primary buttons). */
.cap-link-list {
    list-style: none;
    margin: 0 0 var(--cap-space-3);
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--cap-space-2) var(--cap-space-4);
}

.cap-link-list a { font-weight: 600; }

/* The signed-in person and the sign-out control, kept together at the end of the nav row. */
.cap-nav__account {
    display: inline-flex;
    align-items: center;
    gap: var(--cap-space-3);
}

@media (min-width: 40rem) {
    .cap-nav__account { margin-inline-start: auto; }
}

/* Tighter nav on a phone, so "Administration", the signed-in name and Sign out share one row. */
@media (max-width: 40rem) {
    .cap-nav { gap: var(--cap-space-2) var(--cap-space-3); }
    .cap-nav__account { gap: var(--cap-space-2); }
}

/* The signed-in name is confirmation, not navigation: on a phone it is what pushed Sign out onto a
   third masthead row, so it steps aside there. */
@media (max-width: 40rem) {
    .cap-nav__who { display: none; }
}
