/*
 * Kairo — base stylesheet. The single home of design tokens and the kr- class prefix.
 * Renaming the framework is a find-replace of `kr-` and `--kr-` here and in templates/
 * (docs/css.md, STANDARDS.md 10.4). Our own CSS — no framework, no CDN (on-prem, offline).
 *
 * Ported from Kasonjola's design system (which came from nkwazi before it), prefix-renamed, with its
 * school-only components removed and its semantic colours translated to the register's: the four
 * rating bands, breach, overdue, validated, pending. Port what is generic and visible, write what is
 * domain-shaped. A comment here naming a pupil, a mark or a fee is a leftover — fix it or delete it.
 */

:root {
  /* Neutral slate palette — a calm back-office tool, not a billboard. */
  --kr-color-bg: #f6f7f9;
  --kr-color-surface: #ffffff;
  --kr-color-border: #e2e5ea;
  --kr-color-text: #1c2530;
  --kr-color-text-muted: #5b6675;
  /* The shade under a scrolling grid's bottom edge, and the bar beside it. Both say the same thing —
     there are rows below this one — and both need a value per theme: a dark shade on a dark surface
     is invisible, which is the failure they exist to prevent. */
  --kr-color-scroll-shade: rgb(18 26 38 / 20%);
  --kr-color-scrollbar-thumb: #c3c9d2;
  --kr-color-text-faint: #9aa3b0;
  /* The accent, Kasonjola's green until Kairo's brand is settled. One accent, used for the primary
     action and the active nav item and nowhere else — an interface with three accents has none. Changing these four lines rebrands the product,
     which is the whole reason every colour in this file is a token. */
  --kr-color-accent: #1f6f54;
  --kr-color-accent-hover: #185a44;
  --kr-color-accent-contrast: #ffffff;
  --kr-color-accent-soft: #e6f1ed;

  /* Form controls — the three states a field moves through. At rest a control sits back on a tinted
     fill so a form reads as a calm block of labels; hover lifts the fill toward white and firms the
     border; focus takes it all the way to the surface colour with a border darkened to the text
     colour. A progression carried by fill and border alone — no halo, no coloured bar. */
  --kr-color-control: #eef0f4;
  --kr-color-control-hover: #f8f9fb;
  --kr-color-control-border: #dde1e8;
  --kr-color-control-border-hover: #b4bcc8;

  /* Status — used by flashes and field errors; defined once, not sprinkled as raw hex. */
  --kr-color-success: #16a34a;
  --kr-color-success-bg: #eef8f0;
  --kr-color-danger: #dc2626;
  --kr-color-danger-hover: #b91c1c;
  --kr-color-danger-bg: #fdeeec;
  --kr-color-warning: #d97706;
  --kr-color-warning-bg: #fef3e2;
  --kr-color-info: #1f6feb;
  --kr-color-info-bg: #eaf1fd;

  /* What goes ON a solid fill of the colour above — the label of a danger button, the glyph in a
     warning band's badge, the tick in a checked box.

     These have to flip with the theme and there was no token for them, so six rules wrote #fff. In
     light that is fine. In dark the fills lighten to carry on charcoal — danger becomes #f87171 and
     warning #fbbf24 — and white on those is about 2.4:1 and 1.8:1. Both fail; the amber one is
     unreadable. Dark text on a light fill is the answer, which is exactly what a token can say and a
     literal cannot. --kr-color-accent-contrast already did this for the accent and the same rules
     ignored it. */
  --kr-color-danger-contrast: #ffffff;
  --kr-color-warning-contrast: #ffffff;

  /* A picture of a theme, not a colour of one — the two-tone swatch on each card of the light/dark
     chooser. Deliberately NOT under --kr-color-*, and deliberately not given a dark counterpart: the
     dark card has to stay dark while you are looking at it in light mode, or it cannot answer the
     question it is asking. Named rather than written into the gradients so "these do not flip" is a
     statement somebody can read instead of an omission they have to infer. */
  --kr-swatch-light-bg: #f6f7f9;
  --kr-swatch-light-surface: #ffffff;
  --kr-swatch-dark-bg: #0f1218;
  --kr-swatch-dark-surface: #171b23;

  /* The surface of something floating ABOVE the page: a modal, a dropdown panel, the user menu, a
     toast, a date picker.

     In light mode this is the same white as a card, because a shadow does the separating and a shadow
     works: dark ink spread over a pale page is visible. In dark mode a shadow is black on near-black
     and does nothing at all — so every floating surface was the same colour as the card underneath it,
     separated by a hairline and an invisible shadow, and read as a shape with no edge.

     Elevation in dark is expressed by LIGHTNESS, not by shadow. That is the whole of this token: the
     higher a thing floats, the lighter it is. It is why a dark theme cannot be a light theme with the
     colours inverted, and it was the one part of that the port had not brought across. */
  --kr-color-surface-raised: #ffffff;

  /* The product's own ink, for what belongs to the installation rather than to an organisation: the
     operator's sign-in panel, its bar and its buttons. Never an organisation's brand colour, which is
     what --kr-color-accent becomes once somebody is signed in. */
  --kr-color-ink: #1c2530;
  --kr-color-ink-hover: #2b3644;
  --kr-color-ink-text: #eef1f5;
  /* Secondary words on ink: an address, a closing note. A colour, not an opacity, so it can be checked
     for contrast like any other text. */
  --kr-color-ink-text-muted: #aeb7c4;

  /* The face of a button that is a button but is not the primary action.
   *
   * A plain .kr-btn takes --kr-color-surface, which is the same colour as the card it usually sits on:
   * on a form, the Back button was a rectangle of card with a hairline round it, which reads as a ghost
   * button whatever the class says. This is the one neutral in the palette that is deliberately NOT the
   * surface, so a secondary button looks pressable in both themes.
   *
   * It goes the opposite way in each: darker than white in light, lighter than charcoal in dark. That
   * is the same reason --kr-color-surface-raised exists and cannot simply be reused here, since in
   * light mode "raised" is white, which is the colour we are trying to differ from. */
  --kr-color-control-face: #eef0f4;
  --kr-color-control-face-hover: #e3e7ec;

  /* How far the page behind a modal is pushed back. Blur does the work the scrim cannot in dark: the
     page is already dark, so darkening it further changes little, while blurring it removes the detail
     the eye was still reading. */
  --kr-scrim-blur: 3px;

  /* A scrim over the page, behind a drawer or a modal. Always a darkening, in both themes — but a
     token so the strength is tunable, and because it was written three times at two different
     opacities for the same job. */
  --kr-color-scrim: rgba(16, 24, 40, 0.45);
  /* A hairline that must stay visible against an ARBITRARY colour behind it — a colour swatch. The
     ordinary border token cannot do this: it is near-white in light and near-black in dark, so it
     disappears against half the swatches it is drawn around. */
  --kr-color-swatch-border: rgba(16, 24, 40, 0.12);
  /* A veil over a section while it loads. Takes the surface colour so it dims rather than whitens;
     it was a flat white at 66%, which in dark mode flashed a near-white panel over a dark card. */
  --kr-color-veil: rgba(255, 255, 255, 0.66);

  /* GRC's semantic tokens (docs/css.md). These carry meaning, not decoration, so they are tokens
     before the first screen needs one — otherwise the register invents an orange for "high" and the
     heat map invents a different one, and the audit committee is shown two colours for one band.

     The four rating bands are deliberately NOT the success and danger colours. A risk rated extreme
     is not an error: it is the register doing its job, and colouring it like a failed save teaches
     a reader that the product is broken rather than that the risk is serious. Which band a rating
     falls in comes from the organisation's matrix (STANDARDS.md 4.2); these say only how a band
     looks once the matrix has decided.

     Colour is never the only signal (STANDARDS.md 10.11). A band carries its name and its score as
     well as its tint, a breach says "breach" in words. Roughly one man in twelve has a colour vision
     deficiency, and board packs are printed in black and white.

     Every text value here clears 4.5:1 on white, on the page, and on its own -bg. */
  --kr-color-band-low: #0f7a4d;
  --kr-color-band-medium: #8a6300;
  --kr-color-band-high: #b2470e;
  --kr-color-band-extreme: #b4232a;
  /* The fills behind a band: a badge, a heat-map cell. Their own tokens rather than success-bg and
     danger-bg, because there is no "orange" status colour to borrow for high, and a heat map whose
     high and extreme cells share a fill is a heat map with three bands. */
  --kr-color-band-low-bg: #e7f4ec;
  --kr-color-band-medium-bg: #fbf1d3;
  --kr-color-band-high-bg: #fdeadb;
  --kr-color-band-extreme-bg: #fbe5e6;
  /* The tiers' marks (identity.TierMark): slate for a seat, the app's green for the circle, a warm ochre
     for the whole shelter. Not the bands' colours, so a tier never reads as a rating. */
  --kr-color-tier-stool: #5b6b7d;
  --kr-color-tier-stool-bg: #eef1f5;
  --kr-color-tier-circle: #1f6f5c;
  --kr-color-tier-circle-bg: #e3f2ec;
  --kr-color-tier-shelter: #7a4b12;
  --kr-color-tier-shelter-bg: #f6ecdc;
  /* The heat map's pictures. The pitch is grass and the broadcast a studio's dark screen in either
     theme, so their dark values are the same; the heat on them is painted by the server. The glow is
     the bubble heat's five steps, pale for a few risks and deep red for the fullest cell. The series are
     the risk profile's five category colours, checked against the common colour blindnesses, in the
     same order, with one grey for the categories past them. */
  --kr-color-pitch: #47993f;
  --kr-color-pitch-stripe: #3f8f3a;
  --kr-color-pitch-line: #ffffff;
  --kr-color-broadcast: #121a26;
  --kr-color-glow-1: #fee7a6;
  --kr-color-glow-2: #fdc274;
  --kr-color-glow-3: #f99450;
  --kr-color-glow-4: #e4573a;
  --kr-color-glow-5: #b8212a;
  --kr-color-glow-ink: #3a2a10;
  --kr-color-plot-label: #ffffff;
  --kr-color-plot-halo: #1c2530;
  --kr-color-series-1: #2a78d6;
  --kr-color-series-2: #1baf7a;
  --kr-color-series-3: #6250d6;
  --kr-color-series-4: #e87ba4;
  --kr-color-series-5: #eda100;
  --kr-color-series-other: #c3c9d1;
  /* A KRI reading past its red threshold. The extreme band's red: a breach is the indicator saying
     the risk has moved outside appetite, and it should be read with the same weight. Derived, never
     typed (CLAUDE.md), so this colour is only ever drawn from a comparison the system made. */
  --kr-color-breach: #b4232a;
  /* A management action past its due date. Amber, not red, and that is a decision rather than a
     shade: late is not failed. An action owner a week behind has not done anything wrong yet, and a
     tracker that shouts in red at every slipped date is one the audit committee learns to skim — at
     which point the finding that really is ignored for a year looks like all the others. Red belongs
     to the breach and the extreme band. */
  --kr-color-overdue: #985a00;
  /* Closed after audit validated the evidence — the only way a finding closes (STANDARDS.md 6.5).
     Green, because it is the end of the road; never drawn for "owner says done", which is pending. */
  --kr-color-validated: #0f7a4d;
  /* A queue, not an alarm. Evidence awaiting audit's validation, an appetite statement awaiting the
     board's approval. Somebody else has the next move. */
  --kr-color-pending: #5a6270;

  /* Alert triangle, as a mask so it inherits the danger colour. Used by .kr-form__error's icon. */
  --kr-icon-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");

  /* Every control is this tall — inputs, selects, date fields, buttons. One token, because a button
     standing next to an input at a different height is the most visible sloppiness in a form and the
     hardest to fix later, once each control has grown its own padding. */
  --kr-control-height: 2.375rem;
  --kr-control-height-sm: 2rem;
  /* The line inside a control, tight enough that --kr-control-height is what decides its height.
     The body's 1.5 is for reading paragraphs; in a 38px control it is 21px of line which, with padding
     and border, comes to 39 — so the box outgrew the token and min-height never bound. Named because
     `font: inherit` resets line-height, so several controls have to state it again after that line, and
     three of them stating 1.2 separately is how they drift. */
  --kr-control-line-height: 1.2;

  /* Spacing — a 4px scale. The two half steps are for the inside of small things: the room round a
     badge's word, the nudge that lines an icon up with its text. 0.1rem, 0.15rem, 0.3rem and 0.4rem
     were written some ninety times between them for that job, each within a pixel of one of these. */
  --kr-space-0-5: 0.125rem;
  --kr-space-1: 0.25rem;
  --kr-space-1-5: 0.375rem;
  --kr-space-2: 0.5rem;
  --kr-space-3: 0.75rem;
  --kr-space-4: 1rem;
  --kr-space-5: 1.25rem;
  --kr-space-6: 1.5rem;
  --kr-space-8: 2rem;

  /* Typography — system stack; no web fonts to fetch on an offline box.
     Two sizes, on purpose. --kr-font-size is the rem *base*: it sets what every rem in this file means,
     so the spacing scale, the sidebar width and the radii all hang off it. --kr-font-body is the size
     text is actually set in. Keeping them apart is what lets the type come down without the whole app
     shrinking with it — change the body size to retune the reading, the base to rescale the layout. */
  --kr-font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Figures that must line up in a column, and anything that is a code rather than a word: a hash on
     the audit trail, an admission number, a formula. Was written out at seven call sites in two
     different spellings — "SF Mono" at five of them, SFMono-Regular at the other two — so the same
     kind of text was set in different fonts on different screens.

     Always paired with --kr-font-mono-scale. A monospace face carries more ink at the same nominal
     size — wider glyphs, taller x-height — so mono set at the size of the sans beside it reads as
     bigger and pulls the eye to a hash that nobody came to read. The seven sites stepped down by
     hand, or forgot to: two set no size at all, and the rest used 0.88em, 0.9em, 0.8125rem, 0.75rem
     and 0.6875rem. em rather than rem so the step is relative to whatever it sits in: a hash inside
     small print stays small print. */
  --kr-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --kr-font-mono-scale: 0.9em;

  --kr-font-size: 16px;
  --kr-font-body: 0.875rem;
  --kr-line-height: 1.5;

  /* The rest of the type scale. These four were already the scale — 0.8125 appears forty times in this
     file, 0.75 twenty-nine, 0.875 twenty-three, 0.6875 thirteen — they simply had no names, so every
     new rule re-typed a number and the near-misses (0.7rem, 0.78125rem, 0.95rem) crept in beside them.
     Named, they can be retuned in one place; unnamed, retuning the small text means finding every
     0.75rem that meant "small" and none of the ones that meant something else. */
  --kr-font-xs: 0.6875rem;
  --kr-font-sm: 0.75rem;
  /* Small capitals (an eyebrow, a group's head, a label set in upper case) open up by this much. */
  --kr-tracking-caps: 0.04em;
  --kr-font-md: 0.8125rem;
  /* --kr-font-body (0.875rem) is the next step up and lives above, with the base it is set against. */
  --kr-font-lg: 1rem;
  --kr-font-xl: 1.125rem;
  --kr-font-2xl: 1.25rem;
  --kr-font-3xl: 1.375rem;
  /* One size, for one thing: the code on an error page. Not a heading — a number you read across a
     room while deciding whether the thing is broken or you typed the address wrong. */
  --kr-font-display: 3.5rem;
  /* A count read at a glance: the figure on a digest's or a dashboard's tile. Bigger than any heading,
     because on those tiles the number is the content and the words round it are its label. */
  --kr-font-figure: 1.75rem;

  /* Snapped onto the scale above and worth naming as a decision rather than a tidy-up: 1.0625rem
     appeared four times (a form head, an empty state's title, a confirm dialog's title, the calendar's
     month), 0.9375rem twice, and 0.95rem, 0.7rem and 0.78125rem once each. Every one of them was
     within a pixel or two of a step that already existed. A pixel is below the threshold at which a
     reader sees a difference and above the threshold at which the file stops having a scale — which is
     how the same kind of heading ended up three sizes across four screens. */

  --kr-radius: 6px;
  --kr-radius-lg: 10px;
  /* A pill — a badge, a chip. 999px is the idiom for "however tall this is, round it fully". */
  --kr-radius-pill: 999px;
  /* Barely rounded, for a focus ring drawn around inline text: the full radius on a one-line-tall box
     bulges, and a square corner reads as a rendering fault. */
  --kr-radius-sm: 2px;
  /* Something set inside a rounded box with a small inset — a swatch in its frame, a chip in a field —
     takes the outer radius less the inset, so the two curves run parallel. */
  --kr-radius-inner: calc(var(--kr-radius) - 2px);
  /* A circle: a dot, an avatar, a radio. */
  --kr-radius-round: 50%;
  --kr-border: 1px solid var(--kr-color-border);
  --kr-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --kr-shadow-lg: 0 8px 24px rgba(16, 24, 40, 0.12);

  --kr-sidebar-width: 15rem;
  --kr-sidebar-collapsed: 3.75rem;
  --kr-topbar-height: 3.75rem;
  /* The page column: 1,240px at the 16px root, centred in whatever the sidebar leaves. Wide enough that a
     register or a finding reads without wrapping every title, while a page on a big screen still has a
     margin. Prose inside keeps its own measure (a form, a lead line), so long text never runs the full
     width. */
  --kr-content-max: 77.5rem;
  /* The sign-in card, the organisation's and the operator's alike. */
  --kr-auth-width: 22rem;
  /* The tall control, the size a touch screen gets everywhere. */
  --kr-control-height-lg: 2.75rem;
  /* The upload sheet and the document viewer when they sit beside the page. Each is written twice —
     the panel's width and the room the page makes for it — so it is named once. */
  --kr-sheet-width: 30rem;
  --kr-viewer-width: 48rem;
  /* The insaka mark beside a name, sized from the name's own text so one rule serves every place. */
  --kr-brandmark-size: 1.5em;
  /* The keyboard's focus ring. Its colour follows the accent, so an organisation's brand carries it. */
  --kr-color-focus: var(--kr-color-accent);
  --kr-focus-width: 2px;
  --kr-focus-offset: 1px;
  /* A line of reading text inside a wider box, and the least width a table's row heading keeps. */
  --kr-measure: 34rem;
  --kr-row-head-min: 16rem;
  --kr-transition: 0.16s ease;
  /* A pressed control sinks for an instant; slower and it reads as lag. */
  --kr-transition-press: 0.06s ease;
  /* One turn of a spinner, and one breath of a placeholder waiting for its content. */
  --kr-spin-duration: 1.15s;
  --kr-pulse-duration: 1.4s;

  /* What floats over what, lowest first. Numbers inside one component (a sticky table head over its
     rows) are that component's own business; these are the layers of the page, named so that a new
     panel picks the layer it belongs to instead of a number that happens to win. */
  --kr-z-outline: 10;
  --kr-z-scrim: 15;
  /* The top bar, the sidebar a phone slides in, and the dropdowns that open inside the page. */
  --kr-z-bar: 20;
  /* A panel opened from the bar or a field: the notifications, the date picker. */
  --kr-z-popover: 25;
  /* The person's own menu and the toasts: above any popover, so neither is ever hidden by one. */
  --kr-z-menu: 30;
  --kr-z-note: 40;
  /* A sheet or a viewer beside the page, and a card that floats with the pointer. */
  --kr-z-sheet: 60;
  --kr-z-loader: 100;
  --kr-z-devpanel: 120;

  /* Printed pages are white whatever the screen's theme: paper is not dark. Not a --kr-color- token,
     because those all take a dark value and this one must not. */
  --kr-print-paper: #ffffff;

  /* Breakpoints. Custom properties cannot be read inside @media, so the widths cannot be tokens; they
     are this set and no other, written in rem so they move with the text size:
       34rem   a phone held upright
       40rem   a phone on its side, a small tablet
       48rem   a tablet; below it the page is one column
       64rem   a laptop, with the sidebar open
       80rem   a wide screen, room for two things side by side
     "max-width: N" covers N and narrower. Where a rule must hold only above it, the query is
     "not all and (max-width: N)", the exact complement, so a pair never overlaps and never leaves a
     sliver of width that neither covers. */
}

/* Dark ------------------------------------------------------------------------

   Only the tokens move. Not one component below this point knows which theme is on, which is the
   whole return on having had tokens from the first line of CSS.

   Three rules the palette follows:

   1. **Not inverted.** Pure white text on pure black is the classic mistake: the contrast is so hard
      that text blooms and long reading hurts. The darkest surface is #0f1218 and the brightest text
      #e7eaf0 — a strong contrast, short of the maximum.
   2. **Surfaces get lighter as they come forward**, the opposite of the light theme where they get
      whiter and gain shadow. Shadow does almost nothing on a dark ground, so depth has to come from
      the fill: page, then card, then control.
   3. **The status colours are lifted, not reused.** A 16a34a green that reads well on white is muddy
      on charcoal. Each one moves up in lightness until it carries its meaning again.

   Two selectors, deliberately. The media query is the default — somebody whose machine is in dark
   mode gets a dark application without being asked. The attribute is an explicit choice and beats it
   both ways, so a person who wants light on a dark laptop can have it. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --kr-color-bg: #0f1218;
    --kr-color-surface: #171b23;
    --kr-color-border: #272d39;
    --kr-color-scroll-shade: rgb(0 0 0 / 45%);
    --kr-color-scrollbar-thumb: #3a4250;
    --kr-color-text: #e7eaf0;
    --kr-color-text-muted: #a3adbd;
    --kr-color-text-faint: #6d7788;
    --kr-color-accent: #37a37c;
    --kr-color-accent-hover: #45b78d;
    --kr-color-accent-contrast: #0d1216;
    --kr-color-accent-soft: #16291f;
    --kr-color-control: #1d222c;
    --kr-color-control-hover: #232936;
    --kr-color-control-border: #303747;
    --kr-color-control-border-hover: #465063;
    --kr-color-success: #3dd68c;
    --kr-color-success-bg: #10261c;
    --kr-color-danger: #f87171;
    --kr-color-danger-hover: #ef5350;
    --kr-color-danger-bg: #2a1519;
    --kr-color-warning: #fbbf24;
    --kr-color-warning-bg: #2a2010;
    --kr-color-info: #60a5fa;
    --kr-color-info-bg: #14213a;
    --kr-color-band-low: #3dd68c;
    --kr-color-band-medium: #ecc54a;
    --kr-color-band-high: #fb9a4b;
    --kr-color-band-extreme: #f87171;
    --kr-color-band-low-bg: #10261c;
    --kr-color-band-medium-bg: #29230f;
    --kr-color-band-high-bg: #2e1c10;
    --kr-color-band-extreme-bg: #2c1518;
    --kr-color-tier-stool: #a9b6c6;
    --kr-color-tier-stool-bg: #1e2530;
    --kr-color-tier-circle: #6fcfae;
    --kr-color-tier-circle-bg: #10261c;
    --kr-color-tier-shelter: #e0b27a;
    --kr-color-tier-shelter-bg: #2a2010;
    --kr-color-pitch: #47993f;
    --kr-color-pitch-stripe: #3f8f3a;
    --kr-color-pitch-line: #ffffff;
    --kr-color-broadcast: #121a26;
    --kr-color-glow-1: #fee7a6;
    --kr-color-glow-2: #fdc274;
    --kr-color-glow-3: #f99450;
    --kr-color-glow-4: #e4573a;
    --kr-color-glow-5: #b8212a;
    --kr-color-glow-ink: #3a2a10;
    --kr-color-plot-label: #ffffff;
    --kr-color-plot-halo: #0b1016;
    --kr-color-series-1: #2a78d6;
    --kr-color-series-2: #1baf7a;
    --kr-color-series-3: #6250d6;
    --kr-color-series-4: #e87ba4;
    --kr-color-series-5: #eda100;
    --kr-color-series-other: #8a939e;
    --kr-color-breach: #f87171;
    --kr-color-overdue: #e9a93f;
    --kr-color-validated: #3dd68c;
    --kr-color-pending: #94a3b8;
    /* Dark text on the lightened fills — white on #f87171 is 2.4:1 and on #fbbf24 is 1.8:1. */
    --kr-color-danger-contrast: #2a1519;
    --kr-color-warning-contrast: #2a2010;
    /* Lighter than the surface below it, which is how elevation reads in dark. A shadow cannot do it
       here: black spread over charcoal is invisible, so without this a modal and the card behind it
       were the same colour with a hairline between them. */
    --kr-color-surface-raised: #212733;
    /* Raised slate rather than black: a black panel on a near-black page would not read as a panel. */
    --kr-color-ink: #2a3240;
    --kr-color-ink-hover: #343e4f;
    --kr-color-ink-text: #eef1f5;
    --kr-color-ink-text-muted: #aeb7c4;
    --kr-color-focus: var(--kr-color-accent);
    /* Lighter than the surface, not darker: in dark a raised thing is a lighter thing. */
    --kr-color-control-face: #232a36;
    --kr-color-control-face-hover: #2c3542;
    /* More, for the same reason the scrim is deeper: darkening a dark page changes little, and blur is
       what actually pushes it back. */
    --kr-scrim-blur: 8px;
    /* Deeper, because the surface it covers is already dark: 0.45 over charcoal barely reads. */
    --kr-color-scrim: rgba(0, 0, 0, 0.6);
    /* Light hairline — the light-mode value is a dark translucent and vanishes on a dark swatch. */
    --kr-color-swatch-border: rgba(255, 255, 255, 0.18);
    /* Darkens rather than whitens. This was a flat white 66% and flashed a near-white panel. */
    --kr-color-veil: rgba(15, 18, 24, 0.66);
    --kr-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --kr-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --kr-color-bg: #0f1218;
  --kr-color-surface: #171b23;
  --kr-color-border: #272d39;
  --kr-color-scroll-shade: rgb(0 0 0 / 45%);
  --kr-color-scrollbar-thumb: #3a4250;
  --kr-color-text: #e7eaf0;
  --kr-color-text-muted: #a3adbd;
  --kr-color-text-faint: #6d7788;
  --kr-color-accent: #37a37c;
  --kr-color-accent-hover: #45b78d;
  --kr-color-accent-contrast: #0d1216;
  --kr-color-accent-soft: #16291f;
  --kr-color-control: #1d222c;
  --kr-color-control-hover: #232936;
  --kr-color-control-border: #303747;
  --kr-color-control-border-hover: #465063;
  --kr-color-success: #3dd68c;
  --kr-color-success-bg: #10261c;
  --kr-color-danger: #f87171;
  --kr-color-danger-hover: #ef5350;
  --kr-color-danger-bg: #2a1519;
  --kr-color-warning: #fbbf24;
  --kr-color-warning-bg: #2a2010;
  --kr-color-info: #60a5fa;
  --kr-color-info-bg: #14213a;
  --kr-color-band-low: #3dd68c;
  --kr-color-band-medium: #ecc54a;
  --kr-color-band-high: #fb9a4b;
  --kr-color-band-extreme: #f87171;
  --kr-color-band-low-bg: #10261c;
  --kr-color-band-medium-bg: #29230f;
  --kr-color-band-high-bg: #2e1c10;
  --kr-color-band-extreme-bg: #2c1518;
  --kr-color-tier-stool: #a9b6c6;
  --kr-color-tier-stool-bg: #1e2530;
  --kr-color-tier-circle: #6fcfae;
  --kr-color-tier-circle-bg: #10261c;
  --kr-color-tier-shelter: #e0b27a;
  --kr-color-tier-shelter-bg: #2a2010;
  --kr-color-pitch: #47993f;
  --kr-color-pitch-stripe: #3f8f3a;
  --kr-color-pitch-line: #ffffff;
  --kr-color-broadcast: #121a26;
  --kr-color-glow-1: #fee7a6;
  --kr-color-glow-2: #fdc274;
  --kr-color-glow-3: #f99450;
  --kr-color-glow-4: #e4573a;
  --kr-color-glow-5: #b8212a;
  --kr-color-glow-ink: #3a2a10;
  --kr-color-plot-label: #ffffff;
  --kr-color-plot-halo: #0b1016;
  --kr-color-series-1: #2a78d6;
  --kr-color-series-2: #1baf7a;
  --kr-color-series-3: #6250d6;
  --kr-color-series-4: #e87ba4;
  --kr-color-series-5: #eda100;
  --kr-color-series-other: #8a939e;
  --kr-color-breach: #f87171;
  --kr-color-overdue: #e9a93f;
  --kr-color-validated: #3dd68c;
  --kr-color-pending: #94a3b8;
  /* Dark text on the lightened fills — white on #f87171 is 2.4:1 and on #fbbf24 is 1.8:1. */
  --kr-color-danger-contrast: #2a1519;
  --kr-color-warning-contrast: #2a2010;
  /* Lighter than the surface below it, which is how elevation reads in dark. A shadow cannot do it
     here: black spread over charcoal is invisible, so without this a modal and the card behind it
     were the same colour with a hairline between them. */
  --kr-color-surface-raised: #212733;
  --kr-color-ink: #2a3240;
  --kr-color-ink-hover: #343e4f;
  --kr-color-ink-text: #eef1f5;
  --kr-color-ink-text-muted: #aeb7c4;
  --kr-color-focus: var(--kr-color-accent);
  /* Lighter than the surface, not darker: in dark a raised thing is a lighter thing. */
  --kr-color-control-face: #232a36;
  --kr-color-control-face-hover: #2c3542;
  /* More, for the same reason the scrim is deeper: darkening a dark page changes little, and blur is
     what actually pushes it back. */
  --kr-scrim-blur: 8px;
  /* Deeper, because the surface it covers is already dark: 0.45 over charcoal barely reads. */
  --kr-color-scrim: rgba(0, 0, 0, 0.6);
  /* Light hairline — the light-mode value is a dark translucent and vanishes on a dark swatch. */
  --kr-color-swatch-border: rgba(255, 255, 255, 0.18);
  /* Darkens rather than whitens. This was a flat white 66% and flashed a near-white panel. */
  --kr-color-veil: rgba(15, 18, 24, 0.66);
  --kr-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --kr-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

/* Text size — the reader's choice ---------------------------------------------

   One token moves, and everything follows. --kr-font-size is the rem *base*, so every rem in this file
   — the type ladder, the spacing scale, the control heights, the sidebar, the radii — is expressed
   against it. Changing it rescales the whole application rather than just the words, which is what
   somebody actually wants: type alone growing inside controls that stayed put is how a UI ends up with
   clipped labels and buttons a reader still cannot hit.

   That is only possible because the sizes are on a scale. Before the type was tokenised this would
   have moved the hundred rem values that happened to be literals and left the em ones behind.

   The steps are deliberately close together. This is not a zoom control — the browser already has one,
   and it is better at it. It is for a district office with one monitor of unknown vintage and a board
   member who finds 14px hard at the end of a long meeting, and the useful range there is one notch
   either side of comfortable.

   No stored choice leaves the element unstamped and the :root value stands, so a reader who never
   opens the menu pays nothing and the default cannot drift away from what everyone else sees. */
:root[data-text-size="sm"] { --kr-font-size: 15px; }
:root[data-text-size="lg"] { --kr-font-size: 18px; }

/* Touch — a finger is not a mouse pointer ------------------------------------

   38px is a good height for something aimed with a cursor and a poor one for something aimed with a
   thumb. Every platform's guidance puts the minimum around 44px, and the phones this runs on are not
   new: an action owner reaching for a control on a cracked screen at a depot misses a small one, and
   the miss lands on whatever is beside it — which on these screens is another button.

   Keyed on the pointer rather than the width, deliberately. A narrow window on a laptop is still a
   mouse and does not need the extra height; a tablet at 1024px is still a finger and does.

   --sm goes to the same height, which reads like it defeats the point and does not. On touch, "small"
   has to mean visually lighter — less padding, smaller type — and not less tappable. A control you
   cannot reliably hit is not a smaller control, it is a broken one. */
@media (pointer: coarse) {
  :root {
    --kr-control-height: var(--kr-control-height-lg);
    --kr-control-height-sm: var(--kr-control-height-lg);
  }
  /* Safari on a phone zooms the whole page into any field whose text is under 16px the moment it is
     touched, and leaves it zoomed. 16px in every field on a touch screen, so nothing jumps. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  textarea {
    font-size: max(16px, 1em);
  }
}

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

/* The hidden attribute must always win, even over display:flex/inline-flex components. */
[hidden] { display: none !important; }

html { font-size: var(--kr-font-size); }

body {
  margin: 0;
  font-family: var(--kr-font-sans);
  font-size: var(--kr-font-body);
  line-height: var(--kr-line-height);
  color: var(--kr-color-text);
  background: var(--kr-color-bg);
}

h1, h2, h3, p { margin: 0; }

.kr-icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
}

/* App shell — sidebar + main column -------------------------------------

   The shell is exactly one screen tall and never scrolls. The sidebar and the top bar stay put
   because they are simply always on screen, not because they are stuck to something that moves under
   them, and the content region does the scrolling. That is what makes this read as an application
   rather than a document: the page furniture doesn't drift, and a long table can't push the top bar
   off the top of the screen.

   dvh, not vh: on a phone, 100vh is the height with the browser chrome *hidden*, so a vh-tall shell
   is always taller than what you can actually see and the bottom of the sidebar sits under the URL
   bar. dvh tracks the real viewport. */

html { height: 100%; }

.kr-app {
  display: grid;
  grid-template-columns: var(--kr-sidebar-width) 1fr;
  height: 100dvh;
  overflow: hidden;
  transition: grid-template-columns var(--kr-transition);
}

.kr-collapsed .kr-app {
  grid-template-columns: var(--kr-sidebar-collapsed) 1fr;
}

/* Full height of the shell, so it needs no stickiness of its own. `overflow: visible` is deliberate:
   the collapsed rail's submenus fly out sideways and must escape the sidebar's box. The nav list
   inside it scrolls instead (below), which keeps the flyouts free. */
.kr-sidebar {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: var(--kr-space-3);
  background: var(--kr-color-surface);
  border-right: var(--kr-border);
  overflow: visible;
}

.kr-sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--kr-space-2);
  padding: var(--kr-space-2) var(--kr-space-2) var(--kr-space-4);
}

/* The organisation's own logo, beside its name.
 *
 * flex: none so it keeps its size while the name beside it wraps and clamps; object-fit: contain so a
 * logo that is not square is letterboxed rather than squashed, which is what an organisation would
 * notice first and mind most. */
.kr-sidebar__badge {
  flex: none;
  width: 2rem;
  height: 2rem;
  object-fit: contain;
  border-radius: var(--kr-radius);
}

/* And on the branding screen, where somebody is checking the one they just uploaded. Bounded rather
   than sized: a tall logo and a wide one both have to be recognisable here. */
.kr-logo--preview {
  max-width: 10rem;
  max-height: 6rem;
  object-fit: contain;
}

/* The head of a printed document, a board pack or a report to Treasury: the logo, then the organisation
   and what the paper is. */
.kr-doc__head {
  display: flex;
  align-items: center;
  gap: var(--kr-space-3);
}

.kr-doc__badge {
  flex: none;
  width: 3.5rem;
  height: 3.5rem;
  object-fit: contain;
}

/* The name, the document's title and the address, stacked beside the logo.
   Its own element so the logo stays vertically centred against the whole block rather than against
   the first line of it, which is what happened in Kasonjola when the address was added underneath. */
.kr-doc__identity { min-width: 0; }

/* Where to find the organisation and how to ring it.
   Quiet and small on purpose: it is reference matter, not the point of the page — but it is the half
   the receiver actually uses when a report reaches a ministry and somebody there has a question. */
.kr-doc__address {
  margin-top: var(--kr-space-0-5);
  font-size: var(--kr-font-sm);
  line-height: 1.45;
  color: var(--kr-color-text-muted);
}

/* Kasonjola's past-paper reader (.kr-paperstage, .kr-paperframe), its shelf of papers by year
   (.kr-shelf) and the marking-scheme chip stood here. All school-only; they stayed behind (docs/css.md). */

/* "14 risks in 3 units." A list that groups has to say how much it is holding, or a reader has to add
   the groups up to find out whether a filter did anything. */
.kr-listcount {
  /* Space above as well as below: directly under a filter form's button it reads as that button's
     hint rather than as the answer the filter produced. */
  margin: var(--kr-space-5) 0 var(--kr-space-4);
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
}

/* text-overflow, because overflow: hidden on its own cuts mid-glyph and says nothing.
 *
 * It never showed in Kasonjola while this held the product's name. The day it started carrying a
 * tenant's own name instead, a long name was cut to its first sixteen characters in the corner of
 * every screen — a truncation with no ellipsis reads as the name itself, not as a name that has been
 * shortened. The element carries the full name in its title for the hover. */
/* AND THEN LET IT WRAP, because an ellipsis is still a name nobody can read.
 *
 * The ellipsis above was the right fix for a cut mid-glyph and it did not go far enough. Zambian
 * institutions' names are long — "Zambia Electricity Supply Corporation", "National Pension Scheme
 * Authority", "Ministry of Finance and National Planning" — and one nowrap line at 1.125rem holds
 * about sixteen characters of them.
 *
 * Two lines at the body-plus size holds the ones an organisation actually has. The clamp keeps the
 * ellipsis for the genuinely enormous, so nothing is ever cut mid-glyph, and the title attribute is
 * still there for those. Wrapping costs a line of sidebar height and buys an organisation seeing its
 * own name. */
.kr-sidebar__brand {
  font-weight: 700;
  font-size: var(--kr-font-lg);
  line-height: 1.25;
  letter-spacing: 0.01em;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  /* Three lines, not two. Two cut "Insaka Demonstration Authority" to "Insaka Demonstration…": a line
     breaks between words, so a long second word leaves the third nowhere to go. Three holds "Ministry
     of Finance and National Planning" too. */
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.kr-sidebar__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  padding: 0;
  color: var(--kr-color-text-muted);
  background: none;
  border: none;
  border-radius: var(--kr-radius);
  cursor: pointer;
  font-size: var(--kr-font-lg);
}

.kr-sidebar__toggle {
  transition: background var(--kr-transition), color var(--kr-transition), transform var(--kr-transition-press);
}

/* A quiet control under the pointer takes the page's ground and the full text colour. One rule for
   every such control, so they cannot drift apart; it sits before their own rules, which is where a
   state that should win on hover (the open tab, the current page) still wins. */
.kr-sidebar__toggle:hover,
.kr-nav__item:hover,
.kr-btn--ghost:hover,
.kr-toast__close:hover,
.kr-notify__button:hover,
.kr-upload__btn:hover,
.kr-modal__close:hover,
.kr-profile__tab:hover {
  background: var(--kr-color-bg);
  color: var(--kr-color-text);
}

.kr-sidebar__toggle:active,
.kr-topbar__menu:active { transform: translateY(1px); }

/* Nav ------------------------------------------------------------------- */

.kr-nav {
  display: flex;
  flex-direction: column;
  gap: var(--kr-space-1);
}

/* The sections scroll if they outgrow the sidebar; Admin stays pinned to the bottom regardless. When
   collapsed the submenus are absolute flyouts, and a scroll container would clip them — so the rail
   doesn't scroll. It holds icons only, which fit. */
.kr-nav--sections {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.kr-collapsed .kr-nav--sections { overflow: visible; }

.kr-nav--bottom {
  margin-top: auto;
  padding-top: var(--kr-space-3);
  border-top: var(--kr-border);
}

.kr-nav__item {
  display: flex;
  align-items: center;
  gap: var(--kr-space-3);
  width: 100%;
  padding: var(--kr-space-2) var(--kr-space-3);
  border: none;
  border-radius: var(--kr-radius);
  background: none;
  color: var(--kr-color-text-muted);
  font: inherit;
  font-size: var(--kr-font-body);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--kr-transition), color var(--kr-transition);
}

.kr-nav__item:not(.kr-nav__item--disabled):active {
  background: var(--kr-color-border);
}

.kr-nav__item--active {
  background: var(--kr-color-accent-soft);
  color: var(--kr-color-accent);
  font-weight: 600;
}

.kr-nav__item--disabled {
  color: var(--kr-color-text-faint);
  cursor: default;
}

.kr-nav__item--disabled:hover {
  background: none;
  color: var(--kr-color-text-faint);
}

.kr-nav__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kr-nav__soon {
  font-size: var(--kr-font-xs);
  color: var(--kr-color-text-faint);
}

/* How many things on that screen wait for this person: findings to answer. A filled pill at the end of
   the row, like the bell's badge; on the collapsed rail it sits on the icon's corner. */
.kr-nav__item--counted { position: relative; }

.kr-nav__count {
  flex: none;
  min-width: 1.25rem;
  padding: 0 0.35rem;
  border-radius: var(--kr-radius-pill);
  background: var(--kr-color-accent);
  color: var(--kr-color-accent-contrast);
  font-size: var(--kr-font-xs);
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.kr-collapsed .kr-nav__count {
  position: absolute;
  top: 0.1rem;
  right: 0.35rem;
  min-width: 1rem;
  padding: 0 0.2rem;
  line-height: 1rem;
}

/* A span around the icon, not a class on it: the icon fragment replaces the element it is called on,
   so a class written there is dropped, and the arrow of an open group never turned. */
.kr-nav__chevron {
  display: inline-flex;
  flex: none;
  color: var(--kr-color-text-faint);
  transition: transform var(--kr-transition);
}

/* Group / submenu -------------------------------------------------------

   A section that is open has to show where it starts and where it ends, or the sidebar reads as one
   long undifferentiated list. Two signals, doing different jobs:

     the panel   an open group sits on the page background, so the whole section — heading and its
                 pages — is one visible block with edges. That is the "starts here, ends here".
     the rail    a hairline runs down the submenu, aligned under the parent's icon, and every child
                 hangs off it. That is the "these belong to that". The active page owns its segment
                 of the rail in the accent colour.

   The parent also stops reading as a peer of the other links when its section is open: it takes full
   text colour and weight, so it presents as the heading of the block rather than another destination
   in the list. Clicking it still closes the section. */

/* Expanded, a section opens as an accordion. The row goes 0fr → 1fr, which animates the *real* height
   of the items: open and close take the same time and move at the same rate, so closing one section as
   another opens reads as a single movement. (The old max-height:0 → 24rem could only guess the height,
   so opening rushed and then waited, and closing did nothing for the first third of the animation.)

   This is deliberately not the mechanism the collapsed rail uses — see the flyout section below. One
   transition serving both was the cause of the flash on minimising: the mode switch inherited the
   flyout's hover-out delay and so animated the submenu from visible to hidden. */
.kr-nav__submenu {
  --kr-submenu-pad: calc(1.15em + var(--kr-space-3));
  /* Where the rail sits: under the centre of the parent item's icon. */
  --kr-rail-inset: calc(var(--kr-space-3) + 0.575em);
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--kr-transition);
}

.kr-nav__submenu-inner {
  min-height: 0;
  overflow: hidden;
}

/* Breathing room under the last item, inside the clipped box so it collapses away with everything
   else — padding on the animating element would stay visible at zero height. */
.kr-nav__submenu-inner > :last-child { margin-bottom: var(--kr-space-1); }

.kr-nav__group--open {
  background: var(--kr-color-bg);
  border-radius: var(--kr-radius);
}

.kr-nav__group--open > .kr-nav__item--group {
  color: var(--kr-color-text);
  font-weight: 600;
}

/* The heading already sits on the group's own panel; a hover fill on top of it just muddies the
   block. The colour shift carries the hover instead. */
.kr-nav__group--open > .kr-nav__item--group:hover {
  background: none;
  color: var(--kr-color-text);
}

.kr-nav__group--open > .kr-nav__submenu {
  grid-template-rows: 1fr;
}

.kr-nav__group--open .kr-nav__chevron {
  transform: rotate(90deg);
}

/* A child is indented under its group's icon and marked by its ground alone: the page you are on is
   tinted in the accent, as Dashboard is at the top level. No line down the side, coloured or not. */
.kr-nav__subitem {
  display: flex;
  align-items: center;
  gap: var(--kr-space-2);
  margin: 0 var(--kr-space-1) 1px var(--kr-rail-inset);
  padding: var(--kr-space-2) var(--kr-space-3);
  border-radius: var(--kr-radius);
  color: var(--kr-color-text-muted);
  font-size: var(--kr-font-md);
  text-decoration: none;
  transition: background var(--kr-transition), color var(--kr-transition);
}

.kr-nav__subitem:hover {
  background: var(--kr-color-surface);
  color: var(--kr-color-text);
}

.kr-nav__subitem--active,
.kr-nav__subitem--active:hover {
  background: var(--kr-color-accent-soft);
  color: var(--kr-color-accent);
  font-weight: 600;
}

.kr-nav__subitem--disabled {
  color: var(--kr-color-text-faint);
  cursor: default;
}

.kr-nav__subitem--disabled:hover { background: none; color: var(--kr-color-text-faint); }

/* Collapsed (desktop icon rail) ----------------------------------------- */

.kr-collapsed .kr-sidebar__brand,
.kr-collapsed .kr-nav__label,
.kr-collapsed .kr-nav__soon,
.kr-collapsed .kr-nav__chevron {
  display: none;
}

.kr-collapsed .kr-sidebar__head {
  justify-content: center;
}

.kr-collapsed .kr-nav__item {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

/* Collapsed: submenu becomes a hover flyout to the right. */
.kr-collapsed .kr-nav__group { position: relative; }

/* Collapsed, a section is a menu you open with a click and that stays open until you dismiss it —
   never a hover flyout. Hover-opening needs a delay to survive the pointer crossing the gap, that
   delay is what made the menu close while you were reaching for an item, and a delay long enough to
   be forgiving is long enough to feel broken. A click is unambiguous, works from the keyboard, and
   needs no timing at all.

   It is driven by --flyout, which only JavaScript sets. --open (the accordion state, which the server
   can render) deliberately does nothing here: that separation is what stops a flyout appearing on page
   load, or flashing as the sidebar collapses. */
.kr-collapsed .kr-nav__submenu {
  position: absolute;
  left: 100%;
  top: 0;
  display: block;
  margin-left: var(--kr-space-2);
  min-width: 12rem;
  padding: var(--kr-space-2);
  background: var(--kr-color-surface);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  box-shadow: var(--kr-shadow-lg);
  opacity: 0;
  visibility: hidden;
  z-index: var(--kr-z-bar);
  transition: opacity 0.12s ease, visibility 0s linear 0.12s;
}

.kr-collapsed .kr-nav__group--flyout > .kr-nav__submenu {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

/* The inner wrapper only exists to be clipped by the accordion; in a flyout it must not clip. */
.kr-collapsed .kr-nav__submenu-inner { overflow: visible; }

/* In the flyout there is nothing to differentiate from — the panel already is the section, and a rail
   hanging off nothing would just be a stray line. Both come off. */
.kr-collapsed .kr-nav__group--open,
.kr-collapsed .kr-nav__group--flyout { background: none; }

/* The open section's icon stays lit while its menu is up, so the rail shows where you are. */
.kr-collapsed .kr-nav__group--flyout > .kr-nav__item--group {
  background: var(--kr-color-bg);
  color: var(--kr-color-text);
}

.kr-collapsed .kr-nav__subitem {
  margin-left: 0;
  padding-left: var(--kr-space-3);
  border-left: none;
  border-radius: var(--kr-radius);
}

/* Bottom-pinned groups (Admin) open upward, so their flyout is not cut off at the viewport edge. */
.kr-collapsed .kr-nav--bottom .kr-nav__submenu {
  top: auto;
  bottom: 0;
}

/* Held still across the collapse/expand switch. The sidebar's width still animates; what must not
   animate is the submenu changing mechanism underneath it, because "accordion at some height" and
   "hidden flyout" have no sensible in-between to draw. JS sets this for one frame. */
.kr-anim-off .kr-nav__submenu,
.kr-anim-off .kr-nav__item,
.kr-anim-off .kr-nav__subitem { transition: none; }

/* The shell too, and this one is a correctness fix rather than a polish one.
 *
 * .kr-app animates grid-template-columns so the sidebar slides when it collapses. A transitioned
 * property holds the value it last animated to, and changing the rem base does not re-trigger it — so
 * the sidebar stayed exactly 240px while every other rem in the application rescaled around it, and a
 * fresh element given the very same token measured 270. Suppressing the transition for a frame makes
 * the grid resolve against the new base.
 *
 * It is also what a reader wants: a text-size change should land, not slide. The sidebar sweeping
 * across while the type reflows reads as the page having a wobble. */
.kr-anim-off .kr-app { transition: none; }

/* Main column ----------------------------------------------------------- */

.kr-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

/* Not sticky — it is a fixed row of a shell that never scrolls, so it cannot go anywhere. z-index
   keeps its popovers (notifications, the account menu) above the scrolling content. */
.kr-topbar {
  position: relative;
  z-index: var(--kr-z-bar);
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--kr-space-4);
  min-height: var(--kr-topbar-height);
  padding: var(--kr-space-3) var(--kr-space-6);
  background: var(--kr-color-surface);
  border-bottom: var(--kr-border);
}

.kr-topbar__title {
  font-size: var(--kr-font-xl);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Everything on the right, on one line — bell and user never wrap onto a second row. */
.kr-topbar__meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--kr-space-2);
  flex: none;
}

.kr-topbar__menu {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--kr-color-text-muted);
  background: none;
  border: none;
  border-radius: var(--kr-radius);
  cursor: pointer;
}

.kr-topbar__menu:hover { background: var(--kr-color-bg); }

/* The one scrolling region in the app. It is a separate element from .kr-content so the scrollbar
   sits at the edge of the window where a scrollbar belongs, not at the edge of the centred column. */
/* Positioned so that anything absolute inside it with no nearer positioned ancestor (a screen-reader
   label in a table head, say) is placed within it. Otherwise it is placed against the page, and on a
   long page it makes the document itself taller than the window: jumping to an anchor then scrolls
   the whole shell, top bar and sidebar with it. */
.kr-scroll {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.kr-content {
  width: 100%;
  max-width: var(--kr-content-max);
  margin: 0 auto;
  padding: var(--kr-space-6);
}

/* On a phone the margins a desk can spare are the information's room: the page's gutter and a card's
   padding go from 24px to 16px, which on a 390px screen gives a table back 32px of its width. */
@media (max-width: 40rem) {
  .kr-content { padding: var(--kr-space-4); }
  .kr-card { padding: var(--kr-space-4); }
}


.kr-scrim {
  position: fixed;
  inset: 0;
  background: var(--kr-color-scrim);
  z-index: var(--kr-z-scrim);
}

/* Page ------------------------------------------------------------------- */

.kr-page__lead {
  margin-bottom: var(--kr-space-6);
  color: var(--kr-color-text-muted);
}

/* A page that has to name itself, because no top bar does it for it.
 *
 * The shell puts the page's name in .kr-topbar__title and these two are unused there. They exist for
 * the standalone layout, where there is no top bar at all: the operator's screens opened straight
 * onto a sentence with their name only in the browser tab, and said nothing about which installation
 * they were. Two installations in two tabs were told apart by the tab title alone, and the cost of
 * confusing them is provisioning an organisation on the wrong box. */
.kr-page__eyebrow {
  margin-bottom: var(--kr-space-1);
  font-size: var(--kr-font-sm);
  font-weight: 600;
  letter-spacing: var(--kr-tracking-caps);
  text-transform: uppercase;
  color: var(--kr-color-text-muted);
}

.kr-page__title {
  margin-bottom: var(--kr-space-2);
  font-size: var(--kr-font-xl);
  font-weight: 600;
}

/* Cards ------------------------------------------------------------------ */

.kr-cards {
  display: grid;
  /* min(…, 100%) throughout this file — see .kr-checks--wide for what a bare floor does. It matters
     more than the numbers suggest: these are rem, so choosing the large text size grows every one of
     them, and a column that fits a phone at the default base stops fitting at 18px. */
  grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 1fr));
  gap: var(--kr-space-5);
}

.kr-card {
  display: block;
  background: var(--kr-color-surface);
  border: var(--kr-border);
  border-radius: var(--kr-radius-lg);
  box-shadow: var(--kr-shadow);
  padding: var(--kr-space-6);
}

.kr-card__title { font-size: var(--kr-font-lg); font-weight: 600; margin-bottom: var(--kr-space-2); }
.kr-card__text { color: var(--kr-color-text-muted); font-size: var(--kr-font-sm); line-height: 1.4; }

/* A card's header row: the title, and any action belonging to the card rather than to the page.
   Divided from the body the way a table divides its head, so a card carrying several sections still
   reads as titled rather than as one run of text.

   These two were written on four screens before they existed here, matching nothing — the card's own
   padding happened to carry the layout, so it looked deliberate (docs/css.md, "Invent a class and it
   styles nothing"). The divider is the reason to have a head element at all. */
.kr-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--kr-space-4);
  padding-bottom: var(--kr-space-3);
  margin-bottom: var(--kr-space-4);
  border-bottom: var(--kr-border);
}
.kr-card__head .kr-card__title { margin-bottom: 0; }

/* On a phone a title and a sentence side by side are two columns a few words wide: the sentence goes
   under the title instead. Heads with a button beside the title keep it beside. */
@media (max-width: 40rem) {
  .kr-card__head:has(> .kr-card__text) {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--kr-space-1);
  }
}

/* The body's job is to make the card's padding exact: a heading or paragraph arriving with its own
   margin would otherwise add to it, and cards would sit at slightly different heights across a row. */
.kr-card__body > :first-child { margin-top: 0; }
.kr-card__body > :last-child { margin-bottom: 0; }

/* Unless something follows the body, which the rule above quietly assumed nothing ever would.

   A card is not always head-then-body: the fill chain puts .kr-table-wrap as a direct child of the
   card so it can scroll, and the actions go in a second body under that. In those cards the body's
   last paragraph had its margin stripped for a padding that was not below it, so the sentence
   explaining a form sat flush against the header row of the table it was explaining. */
.kr-card__body:not(:last-child) { margin-bottom: var(--kr-space-4); }

/* A static colour swatch — a token being shown, not a colour being chosen. The picker's swatch is a
   button (.kr-swatches__item) and carries a pointer cursor and a hover ring with it, which is wrong
   for something nobody can click. */
.kr-swatch {
  display: block;
  width: 100%;
  height: 2.5rem;
  border: 1px solid var(--kr-color-swatch-border);
  border-radius: var(--kr-radius);
}

/* A card in the grid stands as its own tile — full height of its row, content pinned top and bottom. */
.kr-cards > .kr-card {
  display: flex;
  flex-direction: column;
  min-height: 9rem;
}

/* Clickable cards (navigation, settings) feel interactive without moving: the accent border and an
   inset accent rail arrive, the shadow deepens, the title colours, and an arrow reveals. No shift. */
a.kr-card {
  color: inherit;
  text-decoration: none;
  transition: box-shadow var(--kr-transition), border-color var(--kr-transition);
}

/* The arrow lives after the title, holding its space transparently so nothing reflows on hover. */
a.kr-card .kr-card__title::after {
  content: "\2192";
  margin-left: var(--kr-space-2);
  color: transparent;
  transition: color var(--kr-transition);
}

a.kr-card:hover {
  border-color: var(--kr-color-accent);
  background: var(--kr-color-accent-soft);
  box-shadow: var(--kr-shadow-lg);
}

a.kr-card:hover .kr-card__title,
a.kr-card:hover .kr-card__title::after { color: var(--kr-color-accent); }
a.kr-card:active { box-shadow: var(--kr-shadow); }

.kr-card--muted { background: var(--kr-color-bg); box-shadow: none; }
.kr-card--muted .kr-card__title { color: var(--kr-color-text-muted); }

/* Summary stats: a dashboard-style card per headline figure — a soft round icon badge, the value at a calm
   size (a touch above body, not a billboard), and a small label under it. Used where a screen leads with a
   few totals — the risks on a unit's register, the actions overdue, the quarter's net loss. */
.kr-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(12rem, 100%), 1fr));
  gap: var(--kr-space-4);
}
.kr-stat {
  display: flex;
  align-items: center;
  gap: var(--kr-space-3);
  background: var(--kr-color-surface);
  border: var(--kr-border);
  border-radius: var(--kr-radius-lg);
  box-shadow: var(--kr-shadow);
  padding: var(--kr-space-4) var(--kr-space-5);
}
.kr-stat__icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--kr-radius-round);
  background: var(--kr-color-accent-soft);
  color: var(--kr-color-accent);
}
.kr-stat__icon .kr-icon { width: 1.15rem; height: 1.15rem; }

/* The figure sits directly over its label, the two centred on each other. Left-aligned, a short number
   above a long label hangs off the left edge and the pair reads as two separate lines rather than as
   one fact. The icon keeps its place. */
.kr-stat > div { text-align: center; }

.kr-stat__value {
  font-size: var(--kr-font-lg);
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap; /* a money total stays on one line; the card widens, it does not wrap */
  font-variant-numeric: tabular-nums;
}
.kr-stat__label { font-size: var(--kr-font-md); color: var(--kr-color-text-muted); margin-top: 0.1rem; }
/* The headline figure of a row of stats: its icon takes the success tint so the eye lands on it first
   (the status tones, under the badges). Named --net in nkwazi, where it was the take-home pay; kept
   because a net loss is the same idea. */

/* A stat that is also the way to the screen it was counted from.
   The dashboard's figures are not decoration: "18 actions overdue" is read in order to go and look
   at the eighteen, so the whole card is the target rather than a link tucked underneath it. Inherits
   the text colour because a card of blue underlined numbers reads as a list of links and not as
   figures. */
.kr-stat--link {
  color: inherit;
  text-decoration: none;
  transition: border-color var(--kr-transition), box-shadow var(--kr-transition);
}
.kr-stat--link:hover {
  border-color: var(--kr-color-accent);
  box-shadow: var(--kr-shadow-lg);
}
/* The accent outline the rest of the design system focuses with, so a keyboard lands on the card
   rather than on the browser's own rectangle round a block-level anchor. */
.kr-stat--link:focus-visible {
  outline: 2px solid var(--kr-color-accent);
  outline-offset: 2px;
}

/* The approval panel on a run: its own tighter vertical rhythm (the generic .kr-stack is too airy here), and
   body-size explanatory text rather than the small .kr-card__text, so the one sentence that tells the approver
   what they are deciding reads at normal weight. */
.kr-approval { display: flex; flex-direction: column; gap: var(--kr-space-4); }
.kr-approval__text { margin: 0; color: var(--kr-color-text-muted); font-size: var(--kr-font-body); line-height: 1.5; }

/* Status frame: a run's state (with its icon) sits as a legend in a gap in the top border of its panel — a real
   fieldset/legend, so the border-break is the browser's own, not an overlay trick, and it stays accessible. The
   legend is a filled status pill; the modifier tints it to the state. Reusable for any run status panel. */
.kr-statusframe {
  min-width: 0;
  margin: 0;
  padding: var(--kr-space-4) var(--kr-space-6) var(--kr-space-6);
  background: var(--kr-color-surface);
  border: 1px solid var(--kr-color-border);
  border-radius: var(--kr-radius-lg);
  box-shadow: var(--kr-shadow);
  display: flex;
  flex-direction: column;
  gap: var(--kr-space-4);
}
.kr-statusframe__legend {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.55rem;
  padding: 0.25rem 0.7rem;
  border-radius: var(--kr-radius-pill);
  font-size: var(--kr-font-md);
  font-weight: 600;
  background: var(--kr-color-bg);
  color: var(--kr-color-text-muted);
  border: 1px solid var(--kr-color-border);
}
.kr-statusframe__legend .kr-icon { width: 1rem; height: 1rem; }
.kr-statusframe--pending .kr-statusframe__legend {
  border-color: color-mix(in srgb, var(--kr-color-warning) 35%, transparent);
}
.kr-statusframe--info .kr-statusframe__legend {
  border-color: color-mix(in srgb, var(--kr-color-info) 30%, transparent);
}
.kr-statusframe--success .kr-statusframe__legend {
  border-color: color-mix(in srgb, var(--kr-color-success) 30%, transparent);
}

/* An approval step row: the step name grows, the role sits at a steady width beside it, wrapping when narrow. */
.kr-approval-step {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kr-space-3);
  align-items: center;
}
.kr-approval-step > input { flex: 1 1 12rem; }
.kr-approval-step > select,
.kr-approval-step > .kr-select { flex: 0 1 16rem; }

/* The approval chain on a run: each step on its own line with its state badge. */
.kr-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--kr-space-2);
}
.kr-steps__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--kr-space-3);
  padding: var(--kr-space-3) var(--kr-space-4);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  background: var(--kr-color-bg);
}
.kr-steps__name { font-weight: 500; }
.kr-steps__meta {
  display: block;
  margin-top: var(--kr-space-0-5);
  font-weight: 400;
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
}

/* The step's state, on the vertical chain.

   A step that is done recedes; the step waiting on somebody right now is the only one that carries
   weight, because the single question this panel answers is "whose desk is this on?". A later step
   stays visible but quiet — knowing what happens after you approve is part of deciding whether to.

   The current step is set apart on a tinted ground, as every callout is; never a coloured edge. */
.kr-steps__item--done {
  color: var(--kr-color-text-muted);
  background: transparent;
}
.kr-steps__item--current {
  border-color: var(--kr-color-accent);
  background: var(--kr-color-accent-soft);
}
.kr-steps__item--waiting {
  color: var(--kr-color-text-muted);
  border-style: dashed;
  background: transparent;
}

/* A wizard strip: where you are in a form broken into steps, laid out left to right and numbered.
   Distinct from the vertical .kr-steps above, which is an approval chain — that one is a record of
   what happened, this one is a map of what is left. A form that shows no end is a form people abandon
   halfway, and on a transaction screen half-finished means re-keyed.

   It must come after the base rule, not before: both are one class deep, so the later one wins and a
   modifier written above the thing it modifies silently does nothing.

   Done steps are marked with more than colour — the number stays — and the current step is the only
   one carrying weight and the accent. */
.kr-steps--wizard {
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--kr-space-2);
  counter-reset: kr-step;
  margin-bottom: var(--kr-space-5);
}
.kr-steps--wizard .kr-steps__item {
  flex: 1 1 8rem;
  justify-content: flex-start;
  gap: var(--kr-space-2);
  color: var(--kr-color-text-muted);
}
.kr-steps--wizard .kr-steps__item::before {
  counter-increment: kr-step;
  content: counter(kr-step);
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  font-size: var(--kr-font-sm);
  font-weight: 600;
  border-radius: var(--kr-radius-round);
  background: var(--kr-color-control);
  border: 1px solid var(--kr-color-control-border);
}
.kr-steps--wizard .kr-steps__item--done { color: var(--kr-color-text); }
.kr-steps--wizard .kr-steps__item--done::before {
  border-color: var(--kr-color-success);
}
.kr-steps--wizard .kr-steps__item--current {
  color: var(--kr-color-text);
  font-weight: 600;
  border-color: var(--kr-color-accent);
  background: var(--kr-color-accent-soft);
}
.kr-steps--wizard .kr-steps__item--current::before {
  background: var(--kr-color-accent);
  border-color: var(--kr-color-accent);
  color: var(--kr-color-accent-contrast);
}

/* A settings-index card: title and status on one line, description below. */
.kr-setting__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--kr-space-3);
  margin-bottom: var(--kr-space-2);
}
.kr-setting__head .kr-card__title { margin-bottom: 0; }

/* Forms ------------------------------------------------------------------ */

.kr-form { display: flex; flex-direction: column; gap: var(--kr-space-4); max-width: 32rem; }

.kr-field { display: flex; flex-direction: column; gap: var(--kr-space-1); }

/* The label follows its control: quiet while the field is at rest, full strength once the reader is
   in it. Hover counts as well as focus — pointing at a field is already intent. */
.kr-field__label {
  font-size: var(--kr-font-sm);
  font-weight: 600;
  color: var(--kr-color-text-muted);
  letter-spacing: 0.01em;
  transition: color var(--kr-transition);
}
/* Both wrappers a label can sit in. A single control lives in .kr-field; a group of them (radios, check
   boxes) lives in .kr-fieldset with its label as the <legend>, and the rule missed that one, so a group was
   the one kind of field whose label did not follow it. Any new wrapper belongs on this list. */
.kr-field:hover .kr-field__label,
.kr-field:focus-within .kr-field__label,
.kr-fieldset:hover .kr-field__label,
.kr-fieldset:focus-within .kr-field__label { color: var(--kr-color-text); }
/* A quiet "(optional)" hint appended to a label. */
.kr-field__optional {
  margin-left: var(--kr-space-1);
  font-weight: 400;
  font-size: var(--kr-font-xs);
  color: var(--kr-color-text-faint);
}

.kr-field__input {
  font: inherit;
  /* Stated here as well as in the shared rule below. This one only worked because it happens to sit
     above that rule in the file: `font: inherit` resets line-height, so moving either rule past the
     other would have silently given every input back the body's 1.5 and a pixel of extra height. A
     control's line-height should not depend on what order two rules were written in. */
  line-height: var(--kr-control-line-height);
  font-size: var(--kr-font-body);
  color: inherit;
  padding: var(--kr-space-2) var(--kr-space-3);
  border-radius: var(--kr-radius);
}

/* One height for everything a person can click or type into, so a button beside an input lines up
   exactly rather than nearly. box-sizing is stated because these carry a border.

   .kr-listbar__search input was missing from this list, and that was the whole of a Kasonjola register's
   misalignment: the toolbar's search box took its height from a padding written on its own component,
   so it came out 36px beside a 38px select. The data table's search box is in the list and was right.
   Two search boxes, one in the list and one not, is exactly how a house rule becomes a house style. */
.kr-field__input,
.kr-select__control,
select[data-kr-select],
.kr-datepicker__control,
.kr-datatable__search input,
.kr-listbar__search input,
.kr-btn {
  box-sizing: border-box;
  min-height: var(--kr-control-height);
  /* And a line-height tight enough that min-height is what decides.
   *
   * Without this an input inherited the body's 1.5, which at 14px is 21px of line — 21 + 16 of padding
   * + 2 of border is 39, so the box was already taller than the 38 the token asks for and min-height
   * never bound. The button sets its own 1.2 and came out at exactly 38. One pixel, on every input
   * standing next to a button in the product: the "nearly" this rule was written to prevent, sitting
   * inside the rule itself. Measured, not spotted — it is below what the eye catches on a single pair
   * and above what it catches on a row of them. */
  line-height: var(--kr-control-line-height);
}
/* The small family, in step with the full-size one above.
 *
 * .kr-btn--sm had this and .kr-field__input--sm did not, so it kept the full height from the rule
 * above and only its padding and type came down — a small input beside a small button was 38px against
 * 32px. Exactly the "nearly" the comment above exists to prevent, and invisible in the style guide
 * because the two were never shown side by side.
 *
 * Every control in the list above needs its --sm variant here when it grows one. StylesheetConventionTest
 * fails the build if one is added without it. */
.kr-btn--sm,
.kr-field__input--sm { min-height: var(--kr-control-height-sm); }
/* A textarea is deliberately exempt: its height is its number of rows. */

.kr-field__input::placeholder { color: var(--kr-color-text-faint); }

/* Control states — one place, every control -------------------------------

   A field moves through three states and the reader should be able to tell them apart without
   looking twice:

     rest    tinted fill, hairline border. The control sits back, so a form reads as a column of
             labels rather than a grid of white boxes.
     hover   the fill lifts toward white and the border firms. Nothing moves.
     focus   full surface colour, and the border darkens all the way to the text colour.

   Focus is carried by the fill and the border alone. Nothing is added on top: no bar, no ring, and no
   outline either. An outline here draws a *second* edge outside the border — a text input matches
   :focus-visible on a plain mouse click, so it is not a keyboard-only addition, it is a double ring on
   every field. The border going from hairline grey to full text colour, against a fill that goes to
   white, is the indicator. */

/* This block owns the fill and the border for every control listed. A control's own rule sets its
   shape (padding, radius, layout) and nothing else — declaring `border` there would land later in
   the file and quietly win. `.kr-control` is the hook for anything that needs the same three states
   without being one of the named controls. */

.kr-control,
.kr-field__input,
.kr-field__textarea,
.kr-select__control,
select[data-kr-select],
.kr-datepicker__control,
input[data-kr-datepicker]:not(.kr-datepicker__native),
.kr-cal__select,
.kr-datatable__search input {
  background-color: var(--kr-color-control);
  border: 1px solid var(--kr-color-control-border);
  transition: background-color var(--kr-transition), border-color var(--kr-transition),
              color var(--kr-transition);
}

.kr-control:hover,
.kr-field__input:hover,
.kr-field__textarea:hover,
.kr-select__control:hover,
select[data-kr-select]:hover,
.kr-datepicker__control:hover,
input[data-kr-datepicker]:not(.kr-datepicker__native):hover,
.kr-cal__select:hover,
.kr-datatable__search input:hover {
  background-color: var(--kr-color-control-hover);
  border-color: var(--kr-color-control-border-hover);
}

.kr-control:focus,
.kr-field__input:focus,
.kr-field__textarea:focus,
.kr-cal__select:focus,
.kr-datatable__search input:focus,
.kr-select__control:focus-visible,
/* The datepicker's control wraps the text input, so focus lands inside it, not on it. */
.kr-datepicker__control:focus-within,
.kr-select.is-open .kr-select__control,
.kr-datepicker.is-open .kr-datepicker__control {
  outline: none;
  background-color: var(--kr-color-surface);
  /* The focused edge takes the brand accent, so the field a person is typing in belongs to the same
     colour as the button they will press to save it. Buttons already focus in the accent; a field
     stopping at neutral grey was the one control that ignored the company's own theme.

     Still the border and not an added outline: an outline would draw a second edge outside this one,
     and a text input matches :focus-visible on an ordinary mouse click, so it would be a double ring
     on every field rather than a keyboard-only affordance. */
  border-color: var(--kr-color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--kr-color-accent) 15%, transparent);
}

/* Invalid runs the same three states in danger tones. The edge must stay red *through* hover and focus:
   the reader is in the field precisely because something is wrong with it, and a neutral border there
   leaves the message below as the only sign of it. These need the :hover/:focus compounds to outrank
   the neutral state rules above — a plain .kr-field__input--invalid loses to .kr-field__input:hover on
   specificity, wherever it sits in the file. The fill still lifts, so the progression survives. */
.kr-field__input--invalid,
.kr-field__textarea--invalid,
.kr-field__input--invalid:hover,
.kr-field__textarea--invalid:hover { border-color: var(--kr-color-danger); }

.kr-field__input--invalid:focus,
.kr-field__textarea--invalid:focus { border-color: var(--kr-color-danger-hover); }

/* A control that cannot be typed in never lights up: the fill flattens into the page background so it
   reads as furniture. */
.kr-field__input:disabled,
.kr-field__textarea:disabled,
.kr-field__input[readonly],
.kr-field__textarea[readonly] {
  background-color: var(--kr-color-bg);
  border-color: var(--kr-color-border);
  color: var(--kr-color-text-muted);
}
.kr-field__input:disabled,
.kr-field__textarea:disabled { cursor: not-allowed; }
.kr-field:has(:disabled) .kr-field__label { color: var(--kr-color-text-faint); }

.kr-field__error { font-size: var(--kr-font-sm); color: var(--kr-color-danger); }

/* Buttons ---------------------------------------------------------------- */

/* Links are neutral by default — they take the colour of whatever they sit in (nav items, buttons,
   breadcrumbs style their own). Only an explicit .kr-link is a coloured, hover-underlined text link. */
a {
  color: inherit;
  text-decoration: none;
}

/* A text link, behaving like the two places links already work.

   At rest it is the table link: accent, dotted underline. Dotted rather than solid so a paragraph
   carrying several does not read as ruled, but still visibly a link without relying on colour — one
   man in twelve cannot use colour as a signal.

   On hover it is the breadcrumb: the underline goes solid and a soft accent pill appears behind it.
   The pill is padded and pulled back by the same amount, so nothing on the line moves when it
   appears — a link that shifts its own paragraph on hover is worse than one with no hover at all.

   Focus gets the identical treatment. A hover state that a keyboard cannot reach is half a state. */
.kr-link {
  color: var(--kr-color-accent);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
  padding: 0.1rem 0.3rem;
  margin: -0.1rem -0.3rem;
  border-radius: var(--kr-radius);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background var(--kr-transition), color var(--kr-transition);
}

.kr-link:hover,
.kr-link:focus-visible {
  color: var(--kr-color-accent-hover);
  background: var(--kr-color-accent-soft);
  text-decoration-style: solid;
}
/* A link that opens a dialog rather than a page is a button, and wears the link's face, not the button's. */
button.kr-link { border: 0; background: none; font: inherit; font-weight: 500; cursor: pointer; }

.kr-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--kr-space-2);
  font: inherit;
  font-size: var(--kr-font-md);
  font-weight: 500;
  line-height: 1.2;
  padding: 0.45rem 0.85rem;
  color: var(--kr-color-text);
  background: var(--kr-color-surface);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--kr-transition), border-color var(--kr-transition),
    color var(--kr-transition), transform var(--kr-transition-press);
}

.kr-btn .kr-icon { width: 1.05em; height: 1.05em; }
.kr-btn:hover { background: var(--kr-color-bg); }
.kr-btn:active { transform: translateY(1px); }

.kr-btn:focus-visible {
  outline: 2px solid var(--kr-color-accent);
  outline-offset: 1px;
}

.kr-btn--primary {
  color: var(--kr-color-accent-contrast);
  background: var(--kr-color-accent);
  border-color: var(--kr-color-accent);
}

.kr-btn--primary:hover {
  background: var(--kr-color-accent-hover);
  border-color: var(--kr-color-accent-hover);
}

/* A button that is plainly a button, but is not the thing the page is for.
 *
 * The gap this fills: .kr-btn on its own takes --kr-color-surface, and a form's actions sit on a card
 * that is also --kr-color-surface. So the Back button was an outline on the same colour as everything
 * around it, which reads as a ghost button no matter what the class is called. Nobody notices in the
 * style guide, where the buttons sit on the page rather than on a card.
 *
 * Use it for the second button in a pair where both are real: Save and Back to settings. NOT for a
 * toolbar, which is what --ghost is for, and not for anything destructive.
 */
.kr-btn--secondary {
  background: var(--kr-color-control-face);
  border-color: var(--kr-color-control-face);
}

.kr-btn--secondary:hover {
  background: var(--kr-color-control-face-hover);
  border-color: var(--kr-color-control-face-hover);
}

/* Quiet button for toolbars and secondary actions. */
.kr-btn--ghost {
  background: none;
  border-color: transparent;
  color: var(--kr-color-text-muted);
}


.kr-btn--sm { padding: 0.3rem 0.6rem; font-size: var(--kr-font-sm); }

/* A button at the end of its range: visibly inert but kept in place, so a pager holds its shape. */
.kr-btn--disabled { opacity: 0.5; pointer-events: none; }

/* Server-side pager — previous / page-of / next — below a table paged in the DB, where the row count is
   too large to send at once: a large organisation's risk register, the loss event history, an audit trail. */
.kr-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--kr-space-4);
  margin-top: var(--kr-space-5);
}

/* A server-paged list's toolbar: search and filters on the left, the download on the right, wrapping on a
   narrow card. The search field and the sortable headers mirror the client data-table's look, so a paged list
   and a small config list read as the same thing even though only one of them is a data-table.

   Named for the job, not the first screen to want it: the register and the audit trail will both use it, and
   both are lists whose rows come a page at a time from the database. */
.kr-listbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--kr-space-3);
  margin-bottom: var(--kr-space-3);
}
.kr-listbar__filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--kr-space-2);
}
.kr-listbar__export {
  display: flex;
  align-items: center;
  gap: var(--kr-space-1-5);
  /* Right even when it does wrap, which on a narrow screen it will. */
  margin-left: auto;
}
.kr-listbar__filters .kr-select { min-width: 9rem; max-width: 13rem; }
/* The native select in a filter row, before main.js: the width its dropdown comes to, 9rem for every
   "All …" and "Any …". A form's select fills its field; here that put each filter on a line of its own
   until the script arrived, and the list under them jumped up 46px for each. */
.kr-listbar__filters select[data-kr-select]:not(.is-enhanced),
.kr-datatable__filters select[data-kr-select]:not(.is-enhanced) { width: 9rem; }
/* A date is eleven characters, "05 Nov 2026"; the input's own width was 13rem, and two of them beside
   a name and a kind of change pushed the Narrow button onto a line of its own on a laptop. */
.kr-listbar__filters .kr-datepicker { width: 10.5rem; }

/* A range filter: a "[from] to [to]" span, such as a band range or a score range. The values are short, so
   the two selects are narrow. */
.kr-listbar__range { display: inline-flex; align-items: center; gap: var(--kr-space-1-5); }
.kr-listbar__rangelabel,
.kr-listbar__rangeto { font-size: var(--kr-font-md); color: var(--kr-color-text-muted); }
.kr-listbar__range .kr-select { min-width: 6rem; max-width: 8.5rem; }

/* 12rem, not 16rem: on the audit trail a person's name, a kind of change and two dates beside it put
   the Narrow button on a line of its own at an ordinary laptop width. A username fits in 12rem. */
.kr-listbar__search { position: relative; min-width: 12rem; }
.kr-listbar__search .kr-icon {
  position: absolute;
  left: var(--kr-space-2);
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--kr-color-text-faint);
}
.kr-listbar__search input {
  width: 100%;
  padding: var(--kr-space-2) var(--kr-space-2) var(--kr-space-2) var(--kr-space-8);
  border-radius: var(--kr-radius);
  font: inherit;
  font-size: var(--kr-font-md);
  background-color: var(--kr-color-control);
  border: 1px solid var(--kr-color-control-border);
  transition: background-color var(--kr-transition), border-color var(--kr-transition), color var(--kr-transition);
}
.kr-listbar__search input:hover {
  background-color: var(--kr-color-control-hover);
  border-color: var(--kr-color-control-border-hover);
}
.kr-listbar__search input:focus {
  outline: none;
  background-color: var(--kr-color-surface);
  border-color: var(--kr-color-text);
}

/* Popover menu — a toggle button and a panel that drops below it (the run review's Download menu and Filters).
   Keeps a crowded toolbar to one line by folding several controls behind one button. */
.kr-menu { position: relative; display: inline-flex; }
/* The chevron icon points right, so a caret needs rotating to read as one: down when closed, up when
   open. Rotating by 180 from its own right-pointing rest state — which is what this did — gives a
   caret that points right, then left, and never at the panel it controls. The same fix is already
   commented on .kr-user__caret; this component missed it. */
.kr-menu__toggle .kr-menu__caret {
  transition: transform var(--kr-transition);
  transform: rotate(90deg);
}
.kr-menu.is-open .kr-menu__toggle .kr-menu__caret { transform: rotate(-90deg); }
.kr-menu__panel {
  position: absolute;
  top: calc(100% + var(--kr-space-1-5));
  right: 0;
  z-index: var(--kr-z-bar);
  min-width: 12rem;
  padding: var(--kr-space-1-5);
  background: var(--kr-color-surface);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  box-shadow: var(--kr-shadow);
}
.kr-menu__panel[hidden] { display: none; }
/* The Filters panel holds a form, so it is wider and lays its controls out in a column. It sits on the left of
   the toolbar, so it opens to the RIGHT (left:0), not right-aligned like the Download menu — otherwise it would
   extend left past the content and be clipped by the shell (.kr-main overflow:hidden), reading as "behind the
   sidebar". */
.kr-menu__panel--form { min-width: 20rem; padding: var(--kr-space-4); left: 0; right: auto; }
.kr-menu__panel--form .kr-listbar__filters { flex-direction: column; align-items: stretch; gap: var(--kr-space-3); }
.kr-menu__panel--form .kr-listbar__search { min-width: 0; }
.kr-menu__panel--form .kr-listbar__range { justify-content: space-between; }

.kr-menu__item {
  display: flex;
  align-items: center;
  gap: var(--kr-space-2);
  padding: var(--kr-space-2);
  border-radius: var(--kr-radius);
  color: var(--kr-color-text);
  text-decoration: none;
  font-size: var(--kr-font-md);
  white-space: nowrap;
}
.kr-menu__item:hover { background: var(--kr-color-bg); }
.kr-menu__item .kr-icon { width: 1rem; height: 1rem; color: var(--kr-color-text-muted); }

/* The Filters button and the chips describing what is narrowed to, side by side on the left of the toolbar.

   flex: 0 1 auto, and the 0 is the part that matters. Told to grow, this takes every spare pixel of
   the toolbar and pushes the download off the line entirely — which is worse than the wrapping it was
   meant to prevent, because a wrapped flex line is laid out from its own start and the button ends up
   at the left margin of a row of its own. Natural width, free to shrink, and min-width: 0 is what lets
   it shrink below its content at all. */
.kr-listbar__filterset {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--kr-space-2);
  flex: 0 1 auto;
  min-width: 0;
}
.kr-listbar__filteractions { display: flex; gap: var(--kr-space-2); }

/* Active-filter chips, on their own line under the controls they describe.

   flex-basis: 100% is what puts them there. Inline with the controls they read as two more buttons in
   the row, and they are the part that grows without warning — one chip per thing narrowed to, each as
   wide as what was typed — so they were what pushed the Download button off the toolbar and onto a
   line of its own. Underneath, the row above stays the same width whatever is searched for, and the
   chips are where somebody looks to see what they have narrowed to. */
.kr-listbar__active {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--kr-space-1-5);
  flex-basis: 100%;
}
.kr-chip--filter {
  display: inline-flex;
  align-items: center;
  gap: var(--kr-space-1);
  padding: var(--kr-space-1) var(--kr-space-2);
  font-size: var(--kr-font-sm);
  background: var(--kr-color-bg);
  border: var(--kr-border);
  border-radius: var(--kr-radius-pill);
  color: var(--kr-color-text-muted);
}

/* Slim totals: where a screen packs a lot above its table, the headline figures sit in one thin strip
   rather than four tall cards, giving the table back its height. */
.kr-stats--slim {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kr-space-5);
  padding: var(--kr-space-3) var(--kr-space-4);
  background: var(--kr-color-surface);
  border: var(--kr-border);
  border-radius: var(--kr-radius-lg);
}
.kr-stats--slim .kr-stat {
  flex: 1 1 auto;
  display: flex;
  align-items: baseline;
  gap: var(--kr-space-2);
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}
.kr-stats--slim .kr-stat__icon { display: none; }
/* The value and its label sit on one line (they are stacked in the card layout). */
.kr-stats--slim .kr-stat > div { display: flex; align-items: baseline; gap: 0.4rem; }
.kr-stats--slim .kr-stat__value { font-size: var(--kr-font-lg); font-weight: 600; margin: 0; }
.kr-stats--slim .kr-stat__label { font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); margin: 0; }

/* A sortable column header: the label is the link; an arrow (a caret, flipped for descending) shows when it
   is the active sort. The same caret the data-table headers use, so sorting reads the same across the app. */
.kr-sortlink {
  display: inline-flex;
  align-items: center;
  gap: var(--kr-space-1);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
/* A sortable header has to say so before it is touched. The arrow appeared only once a column was
   already sorted, so on arrival every header looked identical to the ones that cannot be sorted at
   all, and the only way to discover the feature was to click something and see what happened.

   At rest the arrow is faint but present — enough to read as an affordance, not enough to compete
   with the heading. Hover brings it up; the sorted column takes the accent and full strength, so
   which column the table is ordered by is legible from across the desk. */
.kr-sortlink:hover,
.kr-sortlink:focus-visible { color: var(--kr-color-text); }
.kr-sortlink:hover::after,
.kr-sortlink:focus-visible::after { opacity: 0.7; }

.kr-sortlink.is-asc,
.kr-sortlink.is-desc { color: var(--kr-color-accent); }

.kr-sortlink::after {
  content: "";
  width: 0.7em;
  height: 0.7em;
  opacity: 0.28;
  transition: opacity var(--kr-transition), transform var(--kr-transition);
  background: currentColor;
  -webkit-mask: no-repeat center / contain;
  mask: no-repeat center / contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 15 12 9 18 15'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 15 12 9 18 15'/%3E%3C/svg%3E");
}
.kr-sortlink.is-asc::after { opacity: 1; }
.kr-sortlink.is-desc::after { opacity: 1; transform: rotate(180deg); }

.kr-table__empty {
  text-align: center;
  color: var(--kr-color-text-faint);
  padding: var(--kr-space-6);
}
.kr-pager__status {
  font-size: var(--kr-font-md);
  color: var(--kr-color-text-muted);
  font-variant-numeric: tabular-nums;
}

/* Square icon-only button — for genuinely universal actions in dense rows (STANDARDS.md 10.5). */
.kr-btn--icon { padding: 0.4rem; }

/* Toasts — light, coloured by type, with a status chip and a draining bar ---- */

.kr-toasts {
  position: fixed;
  /* THE TOP RIGHT IS WHERE THIS PRODUCT PUTS A PAGE'S ACTIONS, SO THE RAIL IS NOT THERE.
   *
   * It sat at space-5 from the top and covered the operator's "Your password" and "Sign out" — the
   * two things somebody reads "hand the administrator their password" and then wants. The first fix
   * pushed it down by --kr-topbar-height, on the reasoning that both shells carry the same bar in the
   * same place. They do not: the operator's pages have no .kr-topbar at all, so on the one screen the
   * finding named it moved 60 pixels and still landed on the buttons. Measured on 2026-09-17.
   *
   * The second look found the bigger version of the same thing. .kr-page__actions is top right on
   * nearly every screen in the product — Download and Print on a finding, Issue on a board pack,
   * Record an assessment on a risk — so a rail anchored to the top right covers a page's own
   * controls whether or not a topbar is in the way. Pushing it below one bar was fixing the instance
   * and not the fault.
   *
   * Bottom right instead, which is where nothing lives: actions are at the top of a page or inline
   * with the thing they act on, and a transient message belongs out of their way. column-reverse so
   * a second toast stacks upward from the corner and the newest is always the one nearest it. */
  bottom: max(var(--kr-space-5), env(safe-area-inset-bottom));
  /* The inset, not a bare space token. A desktop window has no notch; a tablet held sideways does,
     and this rail sits against the edge it cuts into. env() is 0 wherever there is nothing to avoid,
     so the desktop value is unchanged. */
  right: max(var(--kr-space-5), env(safe-area-inset-right));
  z-index: var(--kr-z-menu);
  display: flex;
  flex-direction: column-reverse;
  gap: var(--kr-space-3);
  pointer-events: none;
}

.kr-toast {
  position: relative;
  display: flex;
  align-items: center;
  /* Tighter and quieter than a card, deliberately.
   *
   * It was built to card metrics — a card's padding, a card's large radius — so it read as another
   * panel that happened to be floating, and a risk officer who sees a dozen of these a day was reading a
   * dozen small cards. A notification is a sentence with a status on it, not a container: less around
   * the words, a smaller radius so it reads as a bar rather than a box, and enough of the width given
   * back that the message is what fills it. */
  gap: var(--kr-space-2);
  min-width: 17rem;
  max-width: 24rem;
  padding: var(--kr-space-3);
  /* Raised: it floats over the page and needs to read as separate from it in dark too. */
  background: var(--kr-color-surface-raised);
  color: var(--kr-color-text);
  /* No coloured bar down the left. Same objection as the status band: it is every framework's alert
     and it says "generic notification" before it says anything about this system. The icon badge
     carries the state, and the progress bar along the bottom already picks up the same hue. */
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  box-shadow: var(--kr-shadow-lg);
  pointer-events: auto;
  overflow: hidden;
  animation: kr-toast-in 0.28s cubic-bezier(0.2, 0.85, 0.25, 1);
  transition: opacity var(--kr-transition), transform var(--kr-transition);
}

.kr-toast--leaving {
  opacity: 0;
  transform: translateX(0.75rem) scale(0.98);
}

@keyframes kr-toast-in {
  from { opacity: 0; transform: translateX(1.5rem) scale(0.96); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

/* The same notification, on a phone -------------------------------------------

   It had no responsive rules at all: a fixed 19rem pinned to the top right, which is a desktop
   notification wherever it is shown. On a 390px screen that is narrower than the window it is in and
   as far from the thumb as the geometry allows — and at the large text size 19rem stops fitting.

   Nothing had ever caught it, because every other screen test navigates by GET and a GET produces no
   flash. A component no test can reach is a component with no rules.

   So: across the bottom, inside the safe area, spanning the width it has. Bottom because that is
   where the hand is and where every mobile platform puts a transient message; full width because a
   message on a phone is the width of the phone. It rises rather than sliding in from the right.

   The corner is no longer the difference. The desktop rail moved to the bottom right too, once it
   turned out the top right is where every page keeps its own actions — so what is left here is the
   full width and the rise, which are the two things that are about being on a phone. */
@media (max-width: 34rem) {
  .kr-toasts {
    left: var(--kr-space-3);
    right: var(--kr-space-3);
    /* Clear of the home indicator, which is what sits at the bottom edge of a modern phone. */
    bottom: calc(var(--kr-space-3) + env(safe-area-inset-bottom));
    /* Newest nearest the thumb. */
    flex-direction: column-reverse;
  }

  .kr-toast {
    min-width: 0;
    max-width: none;
    width: 100%;
    animation-name: kr-toast-up;
  }

  .kr-toast--leaving {
    transform: translateY(0.75rem) scale(0.98);
  }
}

@keyframes kr-toast-up {
  from { opacity: 0; transform: translateY(1.5rem) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* The badge carries the state, so it stays — but smaller. At 1.75rem it was the largest thing in the
   toast and the eye went to a coloured disc before the sentence it was there to qualify. */
.kr-toast__icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: var(--kr-radius-pill);
}

.kr-toast__icon .kr-icon { width: 1rem; height: 1rem; stroke-width: 2.6; }
.kr-toast__i { display: none; align-items: center; justify-content: center; }

.kr-toast__msg { flex: 1; font-size: var(--kr-font-md); line-height: 1.45; }

/* How many times the same message has just arrived. Hidden when empty, which is the ordinary case:
   an element reserving space for a count that is not there would put a gap in every toast. */
.kr-toast__repeat {
  align-self: center;
  flex: none;
  padding: 0.05rem 0.4rem;
  border-radius: var(--kr-radius-pill);
  background: var(--kr-color-bg);
  color: var(--kr-color-text-muted);
  font-size: var(--kr-font-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.kr-toast__repeat:empty { display: none; }

.kr-toast__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  color: var(--kr-color-text-faint);
  background: none;
  border: none;
  border-radius: var(--kr-radius);
  cursor: pointer;
  transition: background var(--kr-transition), color var(--kr-transition);
}


/* Thinner and fainter, but still here — and this is the one place the "quieter" pass stops short of
   what was proposed, which was to drop it.

   It is the only thing that says the message is about to leave. Without it a toast vanishing mid-read
   is the product taking something away for no visible reason, and the reader's next move is to wonder
   what it said. A hairline at half strength is quiet; absent is a different decision, and one about
   behaviour rather than volume. Say so and it goes. */
.kr-toast__progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  transform-origin: left;
  opacity: 0.5;
  background: var(--kr-color-text-muted);
  animation: kr-toast-progress 5s linear forwards;
}

@keyframes kr-toast-progress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* Per-type colour: the border, the icon chip (the status tones, under the badges), and the progress bar. */
.kr-toast--success { border-color: color-mix(in srgb, var(--kr-color-success) 30%, transparent); }
.kr-toast--success .kr-toast__i--success { display: inline-flex; }
.kr-toast--success .kr-toast__progress { background: var(--kr-color-success); }

.kr-toast--error { border-color: color-mix(in srgb, var(--kr-color-danger) 30%, transparent); }
.kr-toast--error .kr-toast__i--error { display: inline-flex; }
.kr-toast--error .kr-toast__progress { background: var(--kr-color-danger); }

.kr-toast--warning { border-color: color-mix(in srgb, var(--kr-color-warning) 32%, transparent); }
.kr-toast--warning .kr-toast__i--warning { display: inline-flex; }
.kr-toast--warning .kr-toast__progress { background: var(--kr-color-warning); }

.kr-toast--info { border-color: color-mix(in srgb, var(--kr-color-info) 30%, transparent); }
.kr-toast--info .kr-toast__i--info { display: inline-flex; }
.kr-toast--info .kr-toast__progress { background: var(--kr-color-info); }

/* Notifications ---------------------------------------------------------- */

.kr-notify { position: relative; }

.kr-notify__button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--kr-color-text-muted);
  background: none;
  border: none;
  border-radius: var(--kr-radius);
  cursor: pointer;
  transition: background var(--kr-transition), color var(--kr-transition), transform var(--kr-transition-press);
}

.kr-notify__button:active { transform: translateY(1px); }

.kr-notify__badge[hidden] { display: none; }

.kr-notify__badge {
  position: absolute;
  top: var(--kr-space-0-5);
  right: var(--kr-space-0-5);
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 var(--kr-space-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--kr-font-xs);
  font-weight: 600;
  line-height: 1;
  color: var(--kr-color-accent-contrast);
  background: var(--kr-color-danger);
  border-radius: var(--kr-radius-pill);
}

.kr-notify__panel {
  position: absolute;
  top: calc(100% + var(--kr-space-2));
  right: 0;
  width: 20rem;
  max-width: calc(100vw - var(--kr-space-8));
  background: var(--kr-color-surface-raised);
  border: var(--kr-border);
  border-radius: var(--kr-radius-lg);
  box-shadow: var(--kr-shadow-lg);
  z-index: var(--kr-z-popover);
  overflow: hidden;
  animation: kr-toast-in var(--kr-transition);
}

.kr-notify__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--kr-space-3) var(--kr-space-4);
  border-bottom: var(--kr-border);
}

.kr-notify__title { font-weight: 600; font-size: var(--kr-font-body); }

.kr-notify__clear {
  font: inherit;
  font-size: var(--kr-font-sm);
  color: var(--kr-color-accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.kr-notify__list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 22rem;
  overflow-y: auto;
}

.kr-notify__item {
  border-bottom: var(--kr-border);
}
.kr-notify__item:last-child { border-bottom: none; }

/* The whole row is the link to where it happened; hover shifts the background, never the position. */
.kr-notify__link {
  display: flex;
  flex-direction: column;
  gap: var(--kr-space-1);
  padding: var(--kr-space-3) var(--kr-space-4);
  color: inherit;
  text-decoration: none;
}
.kr-notify__link:hover { background: var(--kr-color-bg); }
.kr-notify__link--plain { cursor: default; }
.kr-notify__link--plain:hover { background: none; }

.kr-notify__msg { font-size: var(--kr-font-md); }
.kr-notify__time { font-size: var(--kr-font-xs); color: var(--kr-color-text-faint); }

.kr-notify__empty {
  padding: var(--kr-space-6) var(--kr-space-4);
  text-align: center;
  color: var(--kr-color-text-faint);
  font-size: var(--kr-font-md);
}

/* Textarea --------------------------------------------------------------- */

.kr-field__textarea {
  font: inherit;
  font-size: var(--kr-font-body);
  color: inherit;
  padding: var(--kr-space-2) var(--kr-space-3);
  border-radius: var(--kr-radius);
  resize: vertical;
  min-height: 5rem;
}

.kr-field__textarea::placeholder { color: var(--kr-color-text-faint); }

/* Table ------------------------------------------------------------------ */

.kr-table-wrap {
  overflow-x: auto;
  border: var(--kr-border);
  border-radius: var(--kr-radius-lg);
}

/* A row of a tree drawn as a table: the organisation's structure. Indented by depth, one step per
   level, so a department reads as under its division without lines or toggles to maintain. Five steps
   at most; a tree deeper than that is read by its path, and the indent would eat the name. Classes
   rather than an inline style, which the content security policy refuses. */
.kr-tree__name {
  display: flex;
  align-items: baseline;
  gap: var(--kr-space-2);
}
.kr-tree__name--d1 { padding-left: var(--kr-space-5); }
.kr-tree__name--d2 { padding-left: calc(2 * var(--kr-space-5)); }
.kr-tree__name--d3 { padding-left: calc(3 * var(--kr-space-5)); }
.kr-tree__name--d4 { padding-left: calc(4 * var(--kr-space-5)); }
.kr-tree__name--d5 { padding-left: calc(5 * var(--kr-space-5)); }

/* 0.8125rem is the house table size — what --compact used to be, now the default everywhere.

   A table is read by scanning down a column, not by reading a sentence, and at 14px a six-column
   register row runs wider than the eye tracks comfortably. Dropping to 13px fits more of the record on
   one line without straining, and it is the size the rest of this product's furniture already uses. */
.kr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--kr-font-md);
}

.kr-table th,
.kr-table td {
  padding: 0.55rem 0.8rem;
  text-align: left;
}

/* A link in a cell is a .kr-link, written out: the same weight, the same dotted underline, the same
   pill on hover. A link that looked one way in a table and another in a paragraph read as two kinds
   of link. The pill clones onto each line where a long link wraps.

   Not a button that happens to be a link (Change, beside a Done that is a form), not a sort heading (a
   control, not a link to read), and not a heat map's count or bubble, which wear their band's colour. */
.kr-table a:not(.kr-btn):not(.kr-sortlink):not(.kr-heatmap__count):not(.kr-bubble) {
  color: var(--kr-color-accent);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
  padding: 0.1rem 0.3rem;
  margin: -0.1rem -0.3rem;
  border-radius: var(--kr-radius);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background var(--kr-transition), color var(--kr-transition);
}
.kr-table a:not(.kr-btn):not(.kr-sortlink):not(.kr-heatmap__count):not(.kr-bubble):hover,
.kr-table a:not(.kr-btn):not(.kr-sortlink):not(.kr-heatmap__count):not(.kr-bubble):focus-visible {
  color: var(--kr-color-accent-hover);
  background: var(--kr-color-accent-soft);
  text-decoration-style: solid;
}

/* A table held to a fixed height, scrolling inside itself, with the header staying put. For a list
   long enough to need it but not long enough to deserve paging — and so the page's own actions stay
   reachable rather than being pushed a screen and a half down. */
.kr-table-wrap--scroll {
  overflow: auto;
  max-height: 22rem;
}
.kr-table-wrap--scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--kr-color-bg);
}

.kr-table thead th {
  font-size: var(--kr-font-sm);
  font-weight: 600;
  color: var(--kr-color-text-muted);
  background: var(--kr-color-bg);
  border-bottom: var(--kr-border);
  white-space: nowrap;
}

.kr-table tbody td { border-bottom: var(--kr-border); }
.kr-table tbody tr:last-child td { border-bottom: none; }
.kr-table tbody tr:hover { background: var(--kr-color-bg); }

/* A total, in the column it is a total of. Ruled off above and in the full text colour, because a
   total that looks like another row is a total somebody has to look for; the rows above it are the
   working. Written for a worked example in a modal and then wanted again the same week by a form that
   adds up as you type, which is the third repetition rule saying the same thing twice. */
/* th as well as td: a total row that names itself does so in a <th scope="row"> ("All units" on a
   loss summary), and styling only the cells left the rule drawn under six columns and not the
   seventh — a line that stops short of the label it belongs to. */
.kr-table tfoot td,
.kr-table tfoot th {
  border-top: var(--kr-border);
  font-weight: 600;
  color: var(--kr-color-text);
}
.kr-table tfoot .kr-num { font-variant-numeric: tabular-nums; }

/* A running total that has arrived, and one that has gone past where it can arrive. Colour is not the
   only signal — the sentence beside it says how far off it is, and says it in words. */
.kr-table tfoot.is-whole td { color: var(--kr-color-success); }
.kr-table tfoot.is-over td { color: var(--kr-color-danger); }

.kr-table__actions { text-align: right; white-space: nowrap; }

/* A table of boxes keeps a width worth typing into, and scrolls in its wrapper below that.

   Rows of boxes (STANDARDS 10.7d) have a floor that a table of text does not: a column can be too
   narrow to read a value in, and a form is unusable at that point rather than merely cramped. The
   parts table is SN, a code, a name and a worth, and on a 390px phone the fixed columns left the name
   about fifty pixels — wide enough to show "Cont" of what somebody had just typed. The wrapper is
   already a scroller (10.8, and ResponsiveLayoutIT asserts it), so the honest trade is a table that
   holds its shape and a sideways scroll on the narrowest screens. */
.kr-table--boxes { min-width: 30rem; }

/* A box in a cell fills its column, and the column decides how wide that is.

   An input outside a .kr-field wrapper keeps the browser's intrinsic width — about twenty characters,
   whatever it is for. In a row of boxes (STANDARDS 10.7d) that means every box comes out the same
   size regardless of what goes in it, and the column widths the header set are then spent on the
   leftover space rather than on the boxes: on the adopt screen the name of an assessment typed into
   a 180px box while the three-digit weight beside it had 180px of its own. Width belongs to the
   column, so the box takes all of it and the <th> scale is what decides. */
.kr-table td > .kr-field__input { width: 100%; }

/* Searchable select ------------------------------------------------------ */

.kr-select { position: relative; }

/* The native select BEFORE main.js has wrapped it, and for anybody with JavaScript off.
 *
 * This is the fix for a visible blip on every screen with a select. main.js is deferred, so the page
 * paints first and enhances afterwards: for that frame the browser drew its own unstyled dropdown,
 * 21px tall with a grey bevel, and then it was replaced by a 38px control with our border and radius.
 * The result was a lurch on load and again on every refresh, worse on a slow connection because the
 * gap between the two is however long the script takes to arrive.
 *
 * A page loader would have hidden that. It would not have fixed it, and hiding it costs everybody a
 * spinner on every page. Making the un-enhanced control the same size and shape as the enhanced one
 * means there is nothing to hide: the swap happens inside an identical box.
 *
 * Not gated on .kr-js, deliberately, unlike the data-table skeleton. With JavaScript off this select
 * is the control for good, and it should look like the rest of the form rather than like the 1990s.
 *
 * The arrow is left to the browser: appearance:none would take it away, and drawing a replacement
 * means an SVG data URI with a colour baked into it, which cannot follow the theme and is exactly the
 * literal-colour trap the stylesheet rules exist to catch. A slightly different arrow for one frame
 * is a far smaller thing than a control that changes height. */
select[data-kr-select] {
  box-sizing: border-box;
  width: 100%;
  padding: var(--kr-space-2) var(--kr-space-3);
  border-radius: var(--kr-radius);
  font: inherit;
  font-size: var(--kr-font-body);
  line-height: var(--kr-control-line-height);
  color: var(--kr-color-text);
}

/* A multiple select is the browser's list box, four rows tall, and the dropdown that replaces it is one
   control high: the swap pulled everything below it up 50px. Until main.js arrives it is held at the
   dropdown's height. Gated on .kr-js: with JavaScript off the list box is the control for good, and a
   list box one row high could not be used. Chosen values wrap to more lines in the dropdown, which no
   rule can know before the script has drawn them; the empty case, which is every new record, is exact. */
.kr-js select[data-kr-select][multiple]:not(.is-enhanced) {
  height: var(--kr-control-height);
  overflow: hidden;
}

.kr-select__native.is-enhanced { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.kr-select__control {
  display: flex;
  align-items: center;
  gap: var(--kr-space-2);
  padding: var(--kr-space-2) var(--kr-space-3);
  border-radius: var(--kr-radius);
  cursor: pointer;
  font-size: var(--kr-font-body);
}

.kr-select__value { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kr-select__value--placeholder { color: var(--kr-color-text-faint); }

.kr-select__caret {
  flex: none;
  width: 1.1rem;
  height: 1.1rem;
  color: var(--kr-color-text-faint);
  transition: transform var(--kr-transition);
}

.kr-select.is-open .kr-select__caret { transform: rotate(180deg); }

.kr-select__panel {
  position: absolute;
  top: calc(100% + var(--kr-space-1));
  left: 0;
  right: 0;
  z-index: var(--kr-z-bar);
  /* Raised. It opens over a card of exactly the same colour, so in dark it had no edge at all — the
     options simply appeared in mid-air over the form. */
  background: var(--kr-color-surface-raised);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  box-shadow: var(--kr-shadow-lg);
  overflow: hidden;
}

/* The filter box inside an open dropdown.
 *
 * background and color are STATED, not left out. It is the one input in the file that is deliberately
 * not one of the filled controls — it sits on the panel's own surface with a hairline under it — and
 * "not filled" is not the same as "unspecified". An input with no background takes the browser's
 * default, which is white and knows nothing about the theme, so in dark mode this rendered as a white
 * slab across the top of a dark panel: the one part of the component a person is looking straight at
 * as they type.
 *
 * Nothing caught it because there was no literal colour to catch. It is the absence of a declaration,
 * which is the one shape a rule about wrong values cannot see. */
.kr-select__search {
  width: 100%;
  padding: var(--kr-space-2) var(--kr-space-3);
  border: none;
  border-bottom: var(--kr-border);
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: var(--kr-control-line-height);
  font-size: var(--kr-font-body);
  outline: none;
}

.kr-select__search::placeholder { color: var(--kr-color-text-faint); }

.kr-select__options { max-height: 14rem; overflow-y: auto; padding: var(--kr-space-1); }

.kr-select__option {
  padding: var(--kr-space-2);
  border-radius: var(--kr-radius);
  cursor: pointer;
  font-size: var(--kr-font-body);
}

.kr-select__option:hover,
.kr-select__option.is-active { background: var(--kr-color-bg); }
.kr-select__option.is-selected { color: var(--kr-color-accent); font-weight: 500; }

/* Choosing several ---------------------------------------------------------

   The same control with the same panel, search and keyboard handling — it reads native.multiple and
   changes what a click does. A separate component would have been a second copy of all of that, and
   the two would drift with the multiple one always poorer, because it is the one nobody demos.

   The control grows instead of scrolling. A row of chosen units clipped to one line is a control
   that hides its own value, and the question somebody has in front of a multi-select is always
   "which ones are on?". */
.kr-select--multi .kr-select__control {
  height: auto;
  padding-top: var(--kr-space-1);
  padding-bottom: var(--kr-space-1);
}

.kr-select--multi .kr-select__value {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kr-space-1);
  /* Undoes the single-value ellipsis: there is nothing to truncate now, and truncating would take the
     last tags off the end of the answer. */
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
}

/* One chosen thing, with its own way off. Removing from the control rather than only from the panel:
   the thing a person wants to undo is in front of them, and making them reopen a list to untick it is
   two moves for something that should be none. */
.kr-select__tag {
  display: inline-flex;
  align-items: center;
  gap: var(--kr-space-1);
  padding: var(--kr-space-0-5) var(--kr-space-1) var(--kr-space-0-5) var(--kr-space-2);
  border-radius: var(--kr-radius-sm);
  background: var(--kr-color-accent-soft);
  color: var(--kr-color-text);
  font-size: var(--kr-font-sm);
  line-height: 1.5;
}

.kr-select__tagx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  border: none;
  border-radius: var(--kr-radius-sm);
  background: none;
  color: var(--kr-color-text-muted);
  font: inherit;
  font-size: var(--kr-font-lg);
  line-height: 1;
  cursor: pointer;
}
.kr-select__tagx:hover { background: var(--kr-color-control-hover); color: var(--kr-color-text); }

/* A tick, in the space a tick would occupy whether or not it is there — so the labels line up down the
   panel instead of shifting sideways as things are chosen. */
.kr-select--multi .kr-select__option {
  display: flex;
  align-items: center;
  gap: var(--kr-space-2);
}
.kr-select--multi .kr-select__option::before {
  content: "";
  flex: none;
  width: 1rem;
  height: 1rem;
  border: 1.5px solid var(--kr-color-control-border);
  border-radius: var(--kr-radius-inner);
  background: var(--kr-color-control);
}
.kr-select--multi .kr-select__option.is-selected::before {
  background: var(--kr-color-accent);
  border-color: var(--kr-color-accent);
}

/* The tick: two borders of a box, rotated. The same construction .kr-check uses, and reused rather
   than reinvented — the first attempt built it from two gradients and drew a cross, which is the
   wrong mark entirely on a control that means "chosen".

   Drawn rather than a character, because a glyph is a different shape in every font and absent
   wherever that font fails to load. */
.kr-select--multi .kr-select__option { position: relative; }
.kr-select--multi .kr-select__option::after {
  content: "";
  position: absolute;
  left: var(--kr-space-4);
  top: 50%;
  width: 0.28rem;
  height: 0.55rem;
  border: solid var(--kr-color-accent-contrast);
  border-width: 0 2px 2px 0;
  transform: translateY(-65%) rotate(45deg);
  opacity: 0;
}
.kr-select--multi .kr-select__option.is-selected::after { opacity: 1; }

.kr-select__empty {
  padding: var(--kr-space-2);
  text-align: center;
  color: var(--kr-color-text-faint);
  font-size: var(--kr-font-md);
}

/* A group heading inside the panel — the province above its districts. Sticky, because the whole
   point of the heading is knowing which group you are in, and a list of 116 scrolls past it in a
   second. Not clickable and deliberately not styled like an option: it is a label, not a choice. */
.kr-select__group {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: var(--kr-space-2) var(--kr-space-3) var(--kr-space-0-5);
  background: var(--kr-color-surface-raised);
  color: var(--kr-color-text-muted);
  font-size: var(--kr-font-xs);
  font-weight: 600;
  letter-spacing: var(--kr-tracking-caps);
  text-transform: uppercase;
}
.kr-select__group + .kr-select__option { border-top: none; }

/* Date picker ------------------------------------------------------------ */

.kr-datepicker { position: relative; }

/* The native date field BEFORE main.js has wrapped it, and for anybody with JavaScript off: the same box as
   the picker that replaces it, so the swap moves nothing. Drawn by the browser it was 22px high beside a
   38px picker, and every field below a date moved down 16px when the script arrived. The fill and border
   come from the shared control block, like every other control's. */
input[data-kr-datepicker]:not(.kr-datepicker__native) {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--kr-control-height);
  padding: var(--kr-space-2) var(--kr-space-1) var(--kr-space-2) var(--kr-space-3);
  border-radius: var(--kr-radius);
  font: inherit;
  font-size: var(--kr-font-body);
  line-height: var(--kr-control-line-height);
  color: var(--kr-color-text);
}

.kr-datepicker__native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* The control is a shell around a real text input, so a date can be typed. It takes the control states
   from the shared block; the input inside is transparent and borderless, and the calendar sits on its
   own trigger at the end. */
.kr-datepicker__control {
  display: flex;
  align-items: center;
  gap: var(--kr-space-1);
  width: 100%;
  padding: 0 var(--kr-space-1) 0 var(--kr-space-3);
  border-radius: var(--kr-radius);
  font: inherit;
  /* After `font: inherit`, which is a shorthand and resets line-height to the body's 1.5. */
  line-height: var(--kr-control-line-height);
  font-size: var(--kr-font-body);
  text-align: left;
}

.kr-datepicker__field {
  flex: 1;
  min-width: 0;
  padding: var(--kr-space-2) 0;
  border: none;
  background: none;
  font: inherit;
  line-height: var(--kr-control-line-height);
  font-size: var(--kr-font-body);
  color: inherit;
}

.kr-datepicker__field:focus { outline: none; }
.kr-datepicker__field::placeholder { color: var(--kr-color-text-faint); }

/* Typed something the field couldn't read. Not an error state — nothing has been submitted yet — so
   it marks the text rather than shouting in red around the whole control. */
.kr-datepicker__field.is-unreadable {
  color: var(--kr-color-danger);
  text-decoration: underline wavy var(--kr-color-danger);
  text-underline-offset: 0.2em;
}

/* The reason a typed date was rejected, under the field. Empty (and so invisible) until there is one to show. */
.kr-datepicker__message {
  display: block;
  font-size: var(--kr-font-sm);
  color: var(--kr-color-danger);
}
.kr-datepicker__message:empty { display: none; }

.kr-datepicker__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: none;
  border-radius: var(--kr-radius);
  color: var(--kr-color-text-faint);
  cursor: pointer;
  transition: background var(--kr-transition), color var(--kr-transition);
}

.kr-datepicker__trigger:hover,
.kr-datepicker.is-open .kr-datepicker__trigger {
  background: var(--kr-color-surface);
  color: var(--kr-color-text);
}

.kr-datepicker__panel {
  position: absolute;
  top: calc(100% + var(--kr-space-1-5));
  left: 0;
  z-index: var(--kr-z-popover);
  width: 19rem;
  padding: var(--kr-space-3);
  background: var(--kr-color-surface-raised);
  border: var(--kr-border);
  border-radius: var(--kr-radius-lg);
  box-shadow: var(--kr-shadow-lg);
}

/* A panel lifted out of a scrolling ancestor so it is not cut in half.
 *
 * Set by main.js on the dropdowns and calendars that open inside something that scrolls, and only on
 * those — see the comment above detachPanel() for what it cost to find. It carries the same weight as
 * the two panel rules it overrides, one class each, so it wins on source order alone: it has to stay
 * below both of them.
 *
 * right: auto is load-bearing. The select's panel stretches left: 0; right: 0 to match the width of
 * its field; once fixed, right: 0 would stretch it to the far edge of the window instead, and the
 * inline left and min-width the script sets could not pull it back. */
.kr-panel--detached {
  position: fixed;
  right: auto;
  bottom: auto;
}

/* The month sits on the left where reading starts, with the two steppers together on the right — so
   moving month to month is one small target area rather than a reach across the panel. */
.kr-cal__head {
  display: flex;
  align-items: center;
  gap: var(--kr-space-1);
  margin-bottom: var(--kr-space-2);
}

.kr-cal__title {
  margin-right: auto;
  border: none;
  background: none;
  font: inherit;
  font-weight: 600;
  font-size: var(--kr-font-body);
  color: var(--kr-color-text);
  padding: var(--kr-space-1) var(--kr-space-2);
  border-radius: var(--kr-radius);
  cursor: pointer;
  transition: background var(--kr-transition), color var(--kr-transition);
}

/* The month name is the way into the month and year pickers. It carries no marker of that — a caret
   next to it was tried and looked tacked on. The hover fill is the affordance. */
.kr-cal__title:hover { background: var(--kr-color-control); }

.kr-cal__cells {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--kr-space-1-5);
  padding: var(--kr-space-1) 0;
}

.kr-cal__cell {
  padding: var(--kr-space-3) var(--kr-space-1-5);
  border: none;
  background: none;
  border-radius: var(--kr-radius);
  color: var(--kr-color-text);
  font: inherit;
  font-size: var(--kr-font-md);
  cursor: pointer;
  transition: background var(--kr-transition), color var(--kr-transition);
}

.kr-cal__cell:hover { background: var(--kr-color-control); }
.kr-cal__cell.is-outside { color: var(--kr-color-text-faint); }
.kr-cal__cell.is-selected,
.kr-cal__cell.is-selected:hover { background: var(--kr-color-accent); color: var(--kr-color-accent-contrast); }

.kr-cal__nav {
  width: 1.9rem;
  height: 1.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: var(--kr-radius);
  color: var(--kr-color-text-muted);
  font-size: var(--kr-font-lg);
  cursor: pointer;
}

.kr-cal__nav:hover { background: var(--kr-color-control); color: var(--kr-color-text); }

.kr-cal__weekdays,
.kr-cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); }

.kr-cal__grid { gap: 1px; }

.kr-cal__weekdays {
  margin-bottom: var(--kr-space-1);
  padding-bottom: var(--kr-space-1);
  border-bottom: var(--kr-border);
}

.kr-cal__weekdays span {
  text-align: center;
  padding: var(--kr-space-1) 0;
  font-size: var(--kr-font-xs);
  font-weight: 600;
  color: var(--kr-color-text-faint);
}

.kr-cal__day {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  /* Round, so the selected day reads as a marked date rather than a filled table cell. */
  border-radius: var(--kr-radius-pill);
  color: var(--kr-color-text);
  font: inherit;
  font-size: var(--kr-font-md);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background var(--kr-transition), color var(--kr-transition);
}

.kr-cal__day:hover { background: var(--kr-color-control); }
.kr-cal__day.is-outside { color: var(--kr-color-text-faint); }

/* Today is a dot under the number, not a colour on it: colour here competes with the selected day,
   and the two are often the same square. */
.kr-cal__day.is-today { font-weight: 600; }
.kr-cal__day.is-today::after {
  content: "";
  position: absolute;
  bottom: var(--kr-space-1);
  width: 3px;
  height: 3px;
  border-radius: var(--kr-radius-round);
  background: var(--kr-color-accent);
}

.kr-cal__day.is-selected,
.kr-cal__day.is-selected:hover {
  background: var(--kr-color-accent);
  color: var(--kr-color-accent-contrast);
  font-weight: 600;
}

.kr-cal__day.is-selected.is-today::after { background: var(--kr-color-accent-contrast); }

.kr-cal__day.is-disabled {
  color: var(--kr-color-text-faint);
  opacity: 0.4;
  cursor: not-allowed;
}

.kr-cal__day.is-disabled:hover { background: none; }
.kr-cal__day.is-disabled.is-today::after { display: none; }

/* The weekend reads a shade quieter — a due date, a committee meeting and a filing deadline fall on
   working days, so it helps to see the shape of the week at a glance when picking one. */
.kr-cal__day:nth-child(7n),
.kr-cal__day:nth-child(7n - 1) { color: var(--kr-color-text-muted); }
.kr-cal__day.is-outside:nth-child(7n),
.kr-cal__day.is-outside:nth-child(7n - 1) { color: var(--kr-color-text-faint); }
.kr-cal__day.is-selected:nth-child(7n),
.kr-cal__day.is-selected:nth-child(7n - 1) { color: var(--kr-color-accent-contrast); }

.kr-cal__time {
  display: flex;
  align-items: center;
  gap: var(--kr-space-1-5);
  margin-top: var(--kr-space-2);
  padding-top: var(--kr-space-2);
  border-top: var(--kr-border);
  font-size: var(--kr-font-md);
  color: var(--kr-color-text-muted);
}

.kr-cal__time-label { margin-right: auto; }

/* The calendar's month and year pickers — shape only; the "Control states" block gives them the fill,
   the border and the three states, same as every other control. */
.kr-cal__select {
  padding: var(--kr-space-1) var(--kr-space-1-5);
  border-radius: var(--kr-radius);
  font: inherit;
  font-size: var(--kr-font-md);
}

.kr-cal__foot {
  display: flex;
  justify-content: space-between;
  margin-top: var(--kr-space-2);
  padding-top: var(--kr-space-2);
  border-top: var(--kr-border);
}

/* A file attached to a form and not yet saved -------------------------------- */

.kr-files {
  list-style: none;
  margin: var(--kr-space-3) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--kr-space-2);
}

.kr-file {
  display: flex;
  align-items: center;
  gap: var(--kr-space-3);
  padding: var(--kr-space-2) var(--kr-space-3);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  background: var(--kr-color-surface);
  font-size: var(--kr-font-md);
}

.kr-file__icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--kr-radius);
  background: var(--kr-color-bg);
  color: var(--kr-color-text-muted);
}

.kr-file__icon .kr-icon { width: 1.05rem; height: 1.05rem; }
.kr-file__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--kr-color-text); }
.kr-file__size { flex: none; color: var(--kr-color-text-faint); font-size: var(--kr-font-sm); }

.kr-file__remove {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  color: var(--kr-color-text-faint);
  background: none;
  border: none;
  border-radius: var(--kr-radius);
  cursor: pointer;
}

.kr-file__remove .kr-icon { width: 1rem; height: 1rem; }
.kr-file__remove:hover { background: var(--kr-color-bg); color: var(--kr-color-danger); }

/* Upload dialog ----------------------------------------------------------------
   fragments/upload.html and initUploads in main.js. A file goes up as soon as it is chosen; each row
   shows its progress, then how each check on the server came out. */

.kr-upload__heading { display: flex; flex-direction: column; gap: var(--kr-space-0-5); min-width: 0; }
.kr-upload__accepts { font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }

.kr-upload__zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--kr-space-1);
  padding: var(--kr-space-6) var(--kr-space-4);
  text-align: center;
  border: 1.5px dashed var(--kr-color-control-border);
  border-radius: var(--kr-radius-lg);
  color: var(--kr-color-text-muted);
  cursor: pointer;
  transition: border-color var(--kr-transition), background var(--kr-transition), padding var(--kr-transition);
}

.kr-upload__zone:hover,
.kr-upload__zone:focus-visible,
.kr-upload__zone.is-over {
  border-color: var(--kr-color-accent);
  background: var(--kr-color-accent-soft);
  outline: none;
}

.kr-upload__zone:focus-visible { box-shadow: 0 0 0 3px var(--kr-color-accent-soft); }

/* Once a file is in the list the zone steps back to one line, so the list has the room. */
.kr-upload__zone.is-compact {
  flex-direction: row;
  justify-content: center;
  gap: var(--kr-space-2);
  padding: var(--kr-space-2) var(--kr-space-4);
}

.kr-upload__zone.is-compact .kr-upload__zone-hint { display: none; }

.kr-upload__zone-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--kr-radius-pill);
  background: var(--kr-color-accent-soft);
  color: var(--kr-color-accent);
}

.kr-upload__zone-icon .kr-icon { width: 1.3rem; height: 1.3rem; }
.kr-upload__zone.is-compact .kr-upload__zone-icon { width: 1.75rem; height: 1.75rem; }
.kr-upload__zone.is-compact .kr-upload__zone-icon .kr-icon { width: 1rem; height: 1rem; }
.kr-upload__zone-text { font-size: var(--kr-font-md); color: var(--kr-color-text); }
.kr-upload__browse { color: var(--kr-color-accent); font-weight: 600; }
.kr-upload__zone-hint { font-size: var(--kr-font-sm); color: var(--kr-color-text-faint); }
.kr-upload__native { display: none; }

.kr-upload__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--kr-space-2);
}

.kr-upload__list:empty { display: none; }

.kr-upload__item {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr) auto;
  gap: var(--kr-space-1) var(--kr-space-3);
  align-items: center;
  padding: var(--kr-space-3);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  background: var(--kr-color-surface);
}

.kr-upload__item.is-ready { border-color: var(--kr-color-success); }
.kr-upload__item.is-refused,
.kr-upload__item.is-failed { border-color: var(--kr-color-danger); background: var(--kr-color-danger-bg); }

.kr-upload__kind {
  grid-row: span 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--kr-radius);
  background: var(--kr-color-bg);
  color: var(--kr-color-text-muted);
}

.kr-upload__kind .kr-icon { width: 1.15rem; height: 1.15rem; }
.kr-upload__item.is-refused .kr-upload__kind,
.kr-upload__item.is-failed .kr-upload__kind { background: var(--kr-color-surface); color: var(--kr-color-danger); }

.kr-upload__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: var(--kr-font-md);
  color: var(--kr-color-text);
}

.kr-upload__actions { grid-row: span 2; display: flex; gap: var(--kr-space-1); align-self: center; }

.kr-upload__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: var(--kr-radius);
  background: none;
  color: var(--kr-color-text-faint);
  cursor: pointer;
}

.kr-upload__btn .kr-icon { width: 1rem; height: 1rem; }
.kr-upload__btn--remove:hover { color: var(--kr-color-danger); }

.kr-upload__meta {
  grid-column: 2;
  min-width: 0;
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
  font-variant-numeric: tabular-nums;
}

.kr-upload__state { font-weight: 600; }
.kr-upload__item.is-ready .kr-upload__state { color: var(--kr-color-success); }
.kr-upload__item.is-refused .kr-upload__state,
.kr-upload__item.is-failed .kr-upload__state { color: var(--kr-color-danger); }

/* The refusal itself: a sentence somebody can act on, given its own line under the name. */
.kr-upload__reason {
  grid-column: 2 / 4;
  margin: 0;
  font-size: var(--kr-font-sm);
  line-height: 1.45;
  color: var(--kr-color-text);
}

.kr-upload__bar {
  grid-column: 2 / 4;
  height: 0.375rem;
  margin-top: var(--kr-space-1);
  overflow: hidden;
  border-radius: var(--kr-radius-pill);
  background: var(--kr-color-bg);
}

.kr-upload__bar > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: var(--kr-radius-pill);
  background: var(--kr-color-accent);
  transition: width 0.2s linear;
}

/* Checking on the server: no number to show, so a band that moves. */
.kr-upload__bar.is-working > span { width: 35%; animation: kr-upload-working 1.1s ease-in-out infinite; }

@keyframes kr-upload-working {
  from { transform: translateX(-100%); }
  to { transform: translateX(290%); }
}

@media (prefers-reduced-motion: reduce) {
  .kr-upload__bar.is-working > span { width: 100%; animation: none; opacity: 0.45; }
}

.kr-upload__checks { grid-column: 2 / 4; margin-top: var(--kr-space-1); font-size: var(--kr-font-sm); }

.kr-upload__checks > summary {
  width: max-content;
  color: var(--kr-color-accent);
  cursor: pointer;
}

.kr-upload__check-list {
  list-style: none;
  margin: var(--kr-space-2) 0 0;
  padding: var(--kr-space-2) var(--kr-space-3);
  display: flex;
  flex-direction: column;
  gap: var(--kr-space-1);
  border-radius: var(--kr-radius);
  background: var(--kr-color-bg);
}

.kr-upload__check {
  display: grid;
  grid-template-columns: 1.1rem minmax(0, 1fr);
  gap: 0 var(--kr-space-2);
  color: var(--kr-color-text-faint);
}

.kr-upload__check .kr-icon { width: 0.95rem; height: 0.95rem; margin-top: var(--kr-space-0-5); }
.kr-upload__check.is-passed { color: var(--kr-color-text); }
.kr-upload__check.is-passed .kr-icon { color: var(--kr-color-success); }
.kr-upload__check.is-refused { color: var(--kr-color-danger); font-weight: 600; }
.kr-upload__check.is-skipped { color: var(--kr-color-text-muted); }

/* Revealed one after another as the answer is read, so the eye can follow them down. */
.kr-upload__check.is-hidden { visibility: hidden; }

.kr-upload__check-detail {
  grid-column: 2;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--kr-color-text-muted);
  font-weight: 400;
}

.kr-upload__check-detail--mono { font-family: var(--kr-font-mono); font-size: var(--kr-font-xs); }

.kr-upload__summary {
  margin-right: auto;
  align-self: center;
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
  font-variant-numeric: tabular-nums;
}

.kr-upload .kr-modal__foot .kr-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Layout C, for evidence: a side sheet beside the page, opened without a backdrop so the page stays
   usable while files go up, and a tray in the corner when it is put aside with files still going. */
.kr-upload__layouts {
  display: inline-flex;
  flex: 0 0 auto;
  margin-left: auto;
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  overflow: hidden;
}

.kr-upload__layout {
  min-height: 1.85rem;
  padding: 0 var(--kr-space-3);
  border: 0;
  border-left: var(--kr-border);
  background: var(--kr-color-control-face);
  color: var(--kr-color-text);
  font: inherit;
  font-size: var(--kr-font-sm);
  cursor: pointer;
}

.kr-upload__layout:first-child { border-left: 0; }
.kr-upload__layout:hover { background: var(--kr-color-control-face-hover); }
.kr-upload__layout:focus-visible { outline: 2px solid var(--kr-color-accent); outline-offset: -2px; }
.kr-upload__layout[aria-pressed="true"] {
  background: var(--kr-color-accent-soft);
  color: var(--kr-color-accent);
  font-weight: 600;
}

.kr-upload__tray,
.kr-upload__show { display: none; }

.kr-modal.kr-upload[data-kr-upload-layout="sheet"] {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(var(--kr-sheet-width), 100vw);
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
  border-width: 0 0 0 1px;
  z-index: var(--kr-z-sheet);
}

.kr-modal.kr-upload.is-tray {
  inset: auto var(--kr-space-4) var(--kr-space-4) auto;
  width: min(24rem, calc(100vw - var(--kr-space-8)));
  height: auto;
  border-width: 1px;
  border-radius: var(--kr-radius-lg);
  cursor: pointer;
}

.kr-upload.is-tray .kr-modal__head { border-bottom: 0; padding: var(--kr-space-3) var(--kr-space-4); }
.kr-upload.is-tray .kr-modal__body,
.kr-upload.is-tray .kr-modal__foot,
.kr-upload.is-tray .kr-upload__accepts,
.kr-upload.is-tray .kr-upload__layouts,
.kr-upload.is-tray .kr-modal__close { display: none; }

.kr-upload.is-tray .kr-upload__show { display: inline-flex; margin-left: auto; }

.kr-upload.is-tray .kr-upload__tray {
  display: block;
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
  font-variant-numeric: tabular-nums;
}

.kr-upload.is-tray.is-ready .kr-upload__tray { color: var(--kr-color-accent); font-weight: 600; }

/* The page makes room for the sheet rather than sitting under it, as it does for the viewer beside. */
@media (min-width: 64rem) {
  html:has(.kr-upload[open][data-kr-upload-layout="sheet"]:not(.is-tray)) .kr-main {
    margin-right: min(var(--kr-sheet-width), 100vw);
  }
}

/* A phone gets the whole screen: a dialog with a list and a keyboard does not fit in a box. */
@media (max-width: 40rem) {
  .kr-modal.kr-upload {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
}

/* Modal ------------------------------------------------------------------ */

.kr-modal {
  width: calc(100vw - var(--kr-space-8));
  /* Never taller than the screen: the head and foot hold their place and only the body scrolls. */
  max-height: calc(100dvh - var(--kr-space-8));
  padding: 0;
  /* A border, where there was none. In light the shadow drew the edge; in dark the shadow is black on
     near-black and the dialog simply dissolved into the scrim — the corners went first. */
  border: var(--kr-border);
  border-radius: var(--kr-radius-lg);
  background: var(--kr-color-surface-raised);
  color: var(--kr-color-text);
  box-shadow: var(--kr-shadow-lg);
}

.kr-modal::backdrop {
  background: var(--kr-color-scrim);
  backdrop-filter: blur(var(--kr-scrim-blur));
}

/* Nothing behind a modal scrolls.

   A dialog is on the top layer, so a wheel over the backdrop still scrolls whatever is underneath —
   the page slides around behind the thing you are reading, and on a touch screen the modal appears to
   drag the page with it. .kr-scroll is this application's only scrolling region, so freezing that and
   the document is the whole job.

   :has() rather than a class toggled from JavaScript: the state is already in the DOM as the dialog's
   open attribute, and a second source of truth for the same fact is one that gets left behind when a
   dialog closes by a route nobody wired up.

   :modal, so only a dialog that blocks the page freezes it. The document viewer beside the page is
   opened with show(), not showModal(), so the page behind it can still be read and scrolled. */
html:has(dialog:modal) {
  overflow: hidden;
}
html:has(dialog:modal) .kr-scroll {
  overflow: hidden;
}

/* Flex column only when open: an author display:flex on the base would beat the UA's
   dialog:not([open]){display:none} — origin trumps specificity — and show a closed dialog inline. */
.kr-modal[open] {
  display: flex;
  flex-direction: column;
  animation: kr-modal-in var(--kr-transition);
}

@keyframes kr-modal-in {
  from { opacity: 0; transform: translateY(0.5rem) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.kr-modal--sm { max-width: 24rem; }
.kr-modal--md { max-width: 34rem; }
.kr-modal--lg { max-width: 52rem; }
/* On a big screen a row's detail has room to spread: its paired boxes (causes beside consequences)
   get readable line lengths instead of a tall narrow column. */
@media (min-width: 80rem) {
  .kr-modal--lg { max-width: 64rem; }
}

.kr-modal__head {
  flex: 0 0 auto; /* holds its place at the top while the body scrolls */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--kr-space-4);
  padding: var(--kr-space-4) var(--kr-space-5);
  border-bottom: var(--kr-border);
}

.kr-modal__title { font-size: var(--kr-font-lg); font-weight: 600; }

.kr-modal__close {
  display: inline-flex;
  flex: none;
  padding: 0.3rem;
  color: var(--kr-color-text-faint);
  background: none;
  border: none;
  border-radius: var(--kr-radius);
  cursor: pointer;
}


.kr-modal__body {
  flex: 1 1 auto; /* takes the middle, and is the only part that scrolls */
  min-height: 0;
  overflow-y: auto;
  /* More air at the top than the sides. The head has its own padding and a rule under it, so content
     starting at the same inset as the sides sits visually tight against that line — the eye reads the
     rule and the first word as one block. */
  padding: var(--kr-space-5) var(--kr-space-5) var(--kr-space-5);
  padding-top: var(--kr-space-5);
  display: flex;
  flex-direction: column;
  gap: var(--kr-space-4);
}
.kr-modal__body p { margin: 0; color: var(--kr-color-text-muted); font-size: var(--kr-font-body); line-height: 1.5; }
.kr-modal__body > :first-child { margin-top: 0; }
/* A subhead opening a modal draws its own rule directly under the head's rule, which reads as a
   double line ruling off nothing. The head has already done that job. */
.kr-modal__body > .kr-form__subhead:first-child { padding-top: 0; border-top: 0; }
.kr-modal__body > :last-child { margin-bottom: 0; }

/* Anything scrollable inside a modal is bounded by the modal, never by its own content. A table that
   sets its own 22rem or 100vh height inside a dialog fights the dialog's max-height and wins, which
   is how a modal ends up taller than the window and takes the page's scrollbar with it. */
.kr-modal .kr-table-wrap,
.kr-modal .kr-table-wrap--scroll,
.kr-modal .kr-datatable__scroll {
  max-height: min(22rem, 45dvh);
  overflow: auto;
}
.kr-modal .kr-table-wrap thead th,
.kr-modal .kr-table-wrap--scroll thead th,
.kr-modal .kr-datatable__scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--kr-color-surface);
}

/* A worked example inside a modal is prose, not data.

   --kr-font-md is the house table size and it is set for a register of sixty rows read at a glance.
   A two-row illustration at that size, sitting between two paragraphs a step larger, reads as a
   footnote to the explanation rather than as the thing being explained — which is backwards, because
   the table is the answer and the paragraphs are the commentary. Body size, the same as the
   sentences around it, and a little air beneath before the commentary starts. */
.kr-modal__example .kr-table {
  font-size: var(--kr-font-body);
}
.kr-modal__example .kr-table thead th {
  font-size: var(--kr-font-md);
}
.kr-modal__example {
  /* Never shrinks, and this is the whole reason the class is not just a font size.

     The body is a flex column, so every child of it is shrinkable by default; a wrapper that also
     says overflow:auto is one the layout is free to squeeze to nothing when the content is taller
     than the dialog — which it does, silently, leaving a 1px line where the table was. The rule
     above it exists so a scrolling table cannot outgrow the dialog; an example is four short rows
     and does not scroll, so it opts out and lets the body do the scrolling instead. */
  flex: 0 0 auto;
  margin-bottom: var(--kr-space-2);
}

.kr-modal__foot {
  flex: 0 0 auto; /* holds its place at the bottom */
  display: flex;
  justify-content: flex-end;
  gap: var(--kr-space-2);
  padding: var(--kr-space-4) var(--kr-space-5);
  border-top: var(--kr-border);
}

/* The Close button sits on its own on the left; any other actions stay on the right. */
.kr-modal__foot-close { margin-right: auto; }

/* Document viewer ----------------------------------------------------------

   fragments/viewer.html. Pages are pictures drawn on the server, laid one under another on a sunken
   ground like paper on a desk, each holding its room (its own proportions) before it is drawn so the
   scrollbar never jumps. Three layouts, each person's choice; a phone always gets the whole screen. */

.kr-viewer {
  --kr-viewer-page-w: 52rem;
  width: min(76rem, calc(100vw - var(--kr-space-8)));
  max-width: none;
  height: calc(100dvh - var(--kr-space-8));
}

.kr-viewer[data-kr-viewer-layout="beside"] {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(var(--kr-viewer-width), 50vw);
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
  border-width: 0 0 0 1px;
  z-index: var(--kr-z-sheet);
}

/* The page makes room for the panel rather than sitting under it: the entry on the left, the report
   it is checked against on the right. */
@media (min-width: 64rem) {
  html:has(.kr-viewer[open][data-kr-viewer-layout="beside"]) .kr-main {
    margin-right: min(var(--kr-viewer-width), 50vw);
  }

  /* With a panel beside it the page is a phone's width again, and the squeeze the phone rule under
     .kr-topbar explains came back: "Audit committee pack" went to "A…". The same three things give way,
     so the title says where you are. */
  html:has(.kr-viewer[open][data-kr-viewer-layout="beside"]) .kr-topbar__meta .kr-nav__soon,
  html:has(.kr-viewer[open][data-kr-viewer-layout="beside"]) .kr-user__name,
  html:has(.kr-viewer[open][data-kr-viewer-layout="beside"]) .kr-user__caret,
  html:has(.kr-upload[open][data-kr-upload-layout="sheet"]:not(.is-tray)) .kr-topbar__meta .kr-nav__soon,
  html:has(.kr-upload[open][data-kr-upload-layout="sheet"]:not(.is-tray)) .kr-user__name,
  html:has(.kr-upload[open][data-kr-upload-layout="sheet"]:not(.is-tray)) .kr-user__caret { display: none; }
}

.kr-viewer[data-kr-viewer-layout="whole"] {
  width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  border: 0;
  border-radius: 0;
}

.kr-viewer[open] { animation: none; }

.kr-viewer__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--kr-space-3);
  padding: var(--kr-space-3) var(--kr-space-4);
  border-bottom: var(--kr-border);
}

.kr-viewer__kind {
  display: inline-flex;
  flex: none;
  padding: var(--kr-space-2);
  border-radius: var(--kr-radius);
  background: var(--kr-color-accent-soft);
  color: var(--kr-color-accent);
}

.kr-viewer__title { flex: 1 1 auto; min-width: 0; }

.kr-viewer__name {
  margin: 0;
  font-size: var(--kr-font-md);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kr-viewer__meta {
  margin: 0;
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
}

.kr-viewer__tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--kr-space-2);
}

.kr-viewer__group {
  display: inline-flex;
  border: 1px solid var(--kr-color-control-border);
  border-radius: var(--kr-radius);
  overflow: hidden;
}

.kr-viewer__tool {
  min-width: var(--kr-control-height-sm);
  height: var(--kr-control-height-sm);
  padding: 0 var(--kr-space-2);
  border: 0;
  border-left: 1px solid var(--kr-color-control-border);
  background: var(--kr-color-control-face);
  color: var(--kr-color-text);
  font: inherit;
  font-size: var(--kr-font-sm);
  cursor: pointer;
}

.kr-viewer__tool:first-child { border-left: 0; }
.kr-viewer__tool--wide { min-width: 3.25rem; padding: 0 var(--kr-space-3); }
.kr-viewer__tool:hover { background: var(--kr-color-control-face-hover); }
.kr-viewer__tool:focus-visible { outline: 2px solid var(--kr-color-focus); outline-offset: -2px; }
.kr-viewer__tool[aria-pressed="true"] {
  background: var(--kr-color-accent-soft);
  color: var(--kr-color-accent);
  font-weight: 600;
}
.kr-viewer__tool[disabled] { opacity: 0.45; cursor: not-allowed; }

.kr-viewer__body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background: var(--kr-color-bg);
  overscroll-behavior: contain;
}

.kr-viewer__body:focus-visible { outline: 2px solid var(--kr-color-focus); outline-offset: -2px; }

.kr-viewer__pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--kr-space-4);
  padding: var(--kr-space-5) var(--kr-space-4);
  min-width: min-content;
}

.kr-viewer__page {
  position: relative;
  flex: none;
  margin: 0;
  width: var(--kr-viewer-page-w);
  background: var(--kr-color-surface);
  box-shadow: var(--kr-shadow);
}

.kr-viewer__page img,
.kr-viewer__canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* The page's text, laid over its drawing by pdf.js: transparent, placed word for word on the drawn
   words, so a selection, a copy and the browser's own Find all work on the text itself. From pdf.js's
   own pdf_viewer.css (Apache License 2.0, as static/vendor/pdfjs/LICENSE), trimmed to what the viewer
   uses. Every size is a multiple of --scale-factor, which the viewer sets on the page. */
.kr-viewer__page .textLayer {
  position: absolute;
  inset: 0;
  overflow: clip;
  text-align: initial;
  line-height: 1;
  opacity: 1;
  text-size-adjust: none;
  forced-color-adjust: none;
  transform-origin: 0 0;
  caret-color: CanvasText;
  z-index: 0;
}
.kr-viewer__page .textLayer :is(span, br) {
  position: absolute;
  color: transparent;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
}
.kr-viewer__page .textLayer > :not(.markedContent),
.kr-viewer__page .textLayer .markedContent span:not(.markedContent) { z-index: 1; }
.kr-viewer__page .textLayer span.markedContent { top: 0; height: 0; }
.kr-viewer__page .textLayer span[role="img"] { user-select: none; cursor: default; }
.kr-viewer__page .textLayer ::selection { background: color-mix(in srgb, AccentColor, transparent 75%); }
.kr-viewer__page .textLayer br::selection { background: transparent; }
.kr-viewer__page .textLayer .endOfContent {
  display: block;
  position: absolute;
  inset: 100% 0 0;
  z-index: 0;
  cursor: default;
  user-select: none;
}
.kr-viewer__page .textLayer.selecting .endOfContent { top: 0; }

/* Waiting to be drawn: the page's own room, faintly marked, so the scrollbar is already right. */
.kr-viewer__page:not(.is-drawn)::after {
  content: attr(data-page);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--kr-color-text-faint);
  font-size: var(--kr-font-lg);
}

.kr-viewer__page.is-failed::after { content: "This page could not be drawn"; font-size: var(--kr-font-sm); }

.kr-viewer__picture {
  display: block;
  max-width: 100%;
  margin: var(--kr-space-5) auto;
  box-shadow: var(--kr-shadow);
  background: var(--kr-color-surface);
}

.kr-viewer__state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--kr-space-3);
  padding: var(--kr-space-6);
  text-align: center;
  color: var(--kr-color-text-muted);
}

.kr-viewer__state[hidden] { display: none; }
.kr-viewer__state.is-stopped .kr-viewer__spinner { display: none; }

.kr-viewer__spinner {
  width: 1.75rem;
  height: 1.75rem;
  border: 3px solid var(--kr-color-border);
  border-top-color: var(--kr-color-accent);
  border-radius: var(--kr-radius-pill);
  animation: kr-viewer-turn 0.8s linear infinite;
}

@keyframes kr-viewer-turn { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .kr-viewer__spinner { animation-duration: 2.4s; }
}

.kr-viewer__foot {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  gap: var(--kr-space-3);
  padding: var(--kr-space-2) var(--kr-space-4);
  border-top: var(--kr-border);
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
}

.kr-viewer__note { text-align: right; }

/* A phone: the whole screen whatever was chosen, and no choice to make. */
@media (max-width: 40rem) {
  .kr-viewer,
  .kr-viewer[data-kr-viewer-layout] {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .kr-viewer__group--layouts,
  .kr-viewer__group[data-kr-viewer-zoom] { display: none; }
  .kr-viewer__tools .kr-btn span { display: none; }
  .kr-viewer__pages { padding: var(--kr-space-3) var(--kr-space-2); }
}

/* Data table ------------------------------------------------------------- */

.kr-datatable {
  /* The two strips main.js adds around the table. Their heights are pinned here so that the
     placeholders further down can hold exactly the right room open before either one exists. */
  --kr-datatable-toolbar-h: 4rem;
  --kr-datatable-foot-h: 3.2rem;
  border: var(--kr-border);
  border-radius: var(--kr-radius-lg);
  overflow: hidden;
  background: var(--kr-color-surface);
}

.kr-datatable__toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--kr-space-3);
  padding: var(--kr-space-3) var(--kr-space-4);
  border-bottom: var(--kr-border);
  min-height: var(--kr-datatable-toolbar-h);
  /* Never squeezed: where the table fills the screen the card is a flex column of fixed height, and a
     toolbar whose filters wrap onto a second line was shrunk back to one, its filters spilling over
     the first rows of the table. The table is what scrolls; the toolbar keeps its lines. */
  flex-shrink: 0;
}

/* Column filters: one of the project's enhanced dropdowns (kr-select) per data-kr-filter column, sitting
   between the search box and the export buttons. Sized compact so several fit on the toolbar. */
.kr-datatable__filters { display: flex; flex-wrap: wrap; gap: var(--kr-space-2); align-items: center; }
.kr-datatable__filters .kr-select { min-width: 9rem; max-width: 13rem; }

.kr-datatable__search {
  position: relative;
  flex: 1;
  max-width: 22rem;
}

.kr-datatable__search .kr-icon {
  position: absolute;
  left: var(--kr-space-2);
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--kr-color-text-faint);
}

.kr-datatable__search input {
  width: 100%;
  padding: var(--kr-space-2) var(--kr-space-2) var(--kr-space-2) var(--kr-space-8);
  border-radius: var(--kr-radius);
  font: inherit;
  /* After `font: inherit`, which resets the line-height the shared control rule set. */
  line-height: var(--kr-control-line-height);
  font-size: var(--kr-font-md);
}

.kr-datatable__actions { margin-left: auto; display: flex; gap: var(--kr-space-1-5); }

/* Fill the working area on big screens rather than capping short; the sticky header (below) keeps the
   column names in view as the rows scroll inside this box. */
/* No min-height. It was 12rem, which reserved most of a screenful whatever the table held — so a list
   of two users drew two rows and then a hand's width of nothing before the pager, and read as though
   the rest had failed to load. The floor was there to stop the pager jumping as pages of differing
   length load, but the fixed page size already makes every full page the same height, and the only
   page that differs is the last one; steadying that at the cost of every short list is the wrong
   trade. The max-height stays: that is what keeps a long table inside the viewport. */
.kr-datatable__scroll { overflow: auto; max-height: calc(100vh - 20rem); }

/* Inside a modal the same wrapper is only there to let a wide table scroll sideways. The minimum height is a
   grid's, meant to stop a short list looking collapsed on a page of its own, and in a two-row help table it
   just leaves a hole under the last row. */
.kr-modal .kr-datatable__scroll { min-height: 0; }

.kr-datatable .kr-table { border: none; }

.kr-datatable thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* The sort affordance belongs to the heading, not to the data table.
 *
 * These selectors were written when only .kr-datatable had sortable headings. A document with one
 * short table — a risk's controls — wants the sorting and none of the rest of that component,
 * so [data-kr-sortable] carries the same indicator rather than growing a second one that drifts from
 * it. One appearance, two ways of asking for it. */
.kr-datatable thead th.is-sortable,
[data-kr-sortable] thead th.is-sortable { cursor: pointer; user-select: none; }

/* The heading is a control, so it takes the focus ring every other control here takes. */
[data-kr-sortable] thead th.is-sortable:focus-visible {
  outline: 2px solid var(--kr-color-focus);
  outline-offset: -2px;
}

.kr-datatable__sort {
  display: inline-flex;
  align-items: center;
  gap: var(--kr-space-1);
}

.kr-datatable__sort::after {
  content: "";
  width: 0.75em;
  height: 0.75em;
  opacity: 0;
  background: currentColor;
  transition: opacity var(--kr-transition);
  -webkit-mask: no-repeat center / contain;
  mask: no-repeat center / contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 15 12 9 18 15'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 15 12 9 18 15'/%3E%3C/svg%3E");
}

.kr-datatable th.is-sortable:hover,
[data-kr-sortable] th.is-sortable:hover { color: var(--kr-color-text); }
.kr-datatable th.is-sortable:hover .kr-datatable__sort::after,
[data-kr-sortable] th.is-sortable:hover .kr-datatable__sort::after { opacity: 0.4; }
.kr-datatable th.is-asc .kr-datatable__sort::after,
[data-kr-sortable] th.is-asc .kr-datatable__sort::after { opacity: 1; }
.kr-datatable th.is-desc .kr-datatable__sort::after,
[data-kr-sortable] th.is-desc .kr-datatable__sort::after { opacity: 1; transform: rotate(180deg); }

.kr-datatable tbody tr,
[data-kr-rowdetail] tbody tr,
tr[data-kr-href] { cursor: pointer; }
.kr-datatable tbody tr:focus-visible,
[data-kr-rowdetail] tbody tr:focus-visible {
  outline: 2px solid var(--kr-color-accent);
  outline-offset: -2px;
}
.kr-datatable__num { text-align: right; font-variant-numeric: tabular-nums; }

.kr-datatable__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--kr-space-3);
  padding: var(--kr-space-3) var(--kr-space-4);
  border-top: var(--kr-border);
  font-size: var(--kr-font-md);
  color: var(--kr-color-text-muted);
  min-height: var(--kr-datatable-foot-h);
  /* On a narrow screen the pages go under the count rather than over it; and, like the toolbar, the
     foot is never squeezed by a table that fills the screen. */
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* The breathing of a placeholder: the page loaders' sketches use it. */
@keyframes kr-skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* "Showing 26–50 of 80": figures of one width, so the count does not shift as the pages are stepped. */
.kr-datatable__count { font-variant-numeric: tabular-nums; }
.kr-datatable__pages { display: flex; align-items: center; gap: var(--kr-space-1-5); }
.kr-datatable__gap { padding: 0 var(--kr-space-1); color: var(--kr-color-text-faint); }

.kr-datatable__empty {
  padding: var(--kr-space-8);
  text-align: center;
  color: var(--kr-color-text-faint);
}

/* Freeze the first column so the row's identifier (Emp No, Period) stays in view when the table is
   scrolled sideways. Sticky in both axes on the top-left header cell; opaque backgrounds so scrolled
   cells pass underneath, not through. Header sits above the frozen column, which sits above the body. */
.kr-datatable thead th:first-child,
.kr-datatable tbody td:first-child {
  position: sticky;
  left: 0;
}
.kr-datatable tbody td:first-child {
  z-index: 1;
  background: var(--kr-color-surface);
}
.kr-datatable tbody tr:hover td:first-child { background: var(--kr-color-bg); }
.kr-datatable thead th:first-child { z-index: 3; }

/* Fill listing: the page never scrolls — the data grid inside the card does — so the toolbar (search,
   filters, export) and the pagination footer stay pinned in view. The page becomes a flex column that
   fills the shell's scroll region; the card, the datatable and its scroll area each grow to take what's
   left, and the scroll area alone owns the overflow (replacing the max-height guess used elsewhere). */
.kr-content:has(> .kr-page--fill) {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.kr-page--fill {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* The region that grows to take the leftover height and owns the internal scroll. A listing page marks its
   one data card; a page with cards above the table (the run review) marks just the table's card, so the
   status and totals above it keep their natural height and only the grid scrolls. */
.kr-page--fill > .kr-fill {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* Kairo's pages put their parts in a .kr-stack, which Kasonjola's do not, so the stack takes the page's
   height and hands it on to the part marked .kr-fill. Without this the class was carried over and never
   worked: a register of twenty-five rows ran off the bottom of the window with its pager. */
.kr-page--fill > .kr-stack {
  flex: 1 1 auto;
  min-height: 0;
}
.kr-page--fill > .kr-stack > .kr-fill {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* Only the part marked .kr-fill gives up height; everything above it keeps its own. A box that scrolls
   sideways may otherwise shrink to nothing: the register's tabs for each assessment day (overflow-x: auto)
   were squeezed to 14px under links 18px tall, and clipped to a bare rule, so nobody could choose a day. */
.kr-page--fill > .kr-stack > :not(.kr-fill) {
  flex: none;
}
/* Not every list fills. The audit trail is read entry by entry, each one tall, under a band that says
   whether the chain holds; boxed into what is left of a laptop screen it showed one entry at a time. It
   keeps its full height and the page scrolls. */
.kr-page--fill .kr-fill > .kr-datatable {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.kr-page--fill .kr-fill .kr-datatable__scroll,
.kr-page--fill .kr-fill > .kr-table-wrap {
  flex: 1 1 auto;
  /* A floor, not 0: the grid grows to fill on a tall screen, but on a short one it keeps a usable height and
     the page scrolls to the pagination rather than the grid collapsing and the pager falling off the bottom. */
  min-height: 8rem;
  max-height: none;
  overflow: auto;
}
/* On a phone the page scrolls, not the grid. What is left of a phone's height under the title, the
   buttons and a toolbar that has wrapped to three lines is one row, so a list boxed into it showed one
   risk at a time. Below 48rem the list takes its full height, and only its width scrolls inside it. */
@media (max-width: 48rem) {
  .kr-page--fill,
  .kr-page--fill > .kr-stack,
  .kr-page--fill > .kr-fill,
  .kr-page--fill > .kr-stack > .kr-fill,
  .kr-page--fill .kr-fill > .kr-datatable {
    flex: none;
  }
  .kr-page--fill .kr-fill > .kr-datatable { display: block; }
  .kr-datatable__scroll,
  .kr-page--fill .kr-fill .kr-datatable__scroll,
  .kr-page--fill .kr-fill > .kr-table-wrap {
    max-height: none;
    min-height: 0;
  }
}

/* SAY THAT IT SCROLLS, because nothing did.
 *
 * The arrangement above is deliberate and stays: the page holds still, the grid scrolls under a sticky
 * heading, and the toolbar and pager never leave the screen. What it never did was admit to any of it.
 * In Kasonjola, on 2026-09-16, a register held twenty-five rows and showed six — 278px of box
 * against 989px of rows — with the page itself unable to scroll, no scrollbar anywhere, and a pager
 * underneath reading "Showing 1-25 of 25". Every part of that is true and the screen still says the
 * wrong thing. macOS hides overlay scrollbars until something moves, so the one cue there might have
 * been is absent exactly when a reader needs it: before they have touched anything.
 *
 * Two cues, because either alone can be missed. A scrollbar that is always drawn rather than on
 * movement; and a shadow at whichever edge has more behind it.
 *
 * The shadow is Roman Komarov's: two gradient pairs, a cover painted with background-attachment:local
 * so it travels with the content, and a shade painted with scroll so it stays at the edge. Where the
 * content is flush against the edge the cover sits over the shade and hides it; scroll away and the
 * cover leaves with the content, uncovering the shade. No script, no measurement, and it is right
 * again the moment rows are filtered away.
 *
 * The top shade is set transparent: the sticky heading is already opaque and sits over it, so it would
 * only ever be a smear under the column names. The bottom edge is the one that matters, because that is
 * where the rows nobody can see are.
 */
.kr-page--fill .kr-fill .kr-datatable__scroll,
.kr-page--fill .kr-fill > .kr-table-wrap {
  scrollbar-width: thin;
  scrollbar-gutter: stable;
  background:
    linear-gradient(var(--kr-color-surface) 30%, transparent) center top / 100% 2rem no-repeat local,
    linear-gradient(transparent, var(--kr-color-surface) 70%) center bottom / 100% 2rem no-repeat local,
    linear-gradient(transparent, transparent) center top / 100% 0.65rem no-repeat scroll,
    radial-gradient(farthest-side at 50% 100%, var(--kr-color-scroll-shade), transparent) center bottom / 100%
      0.65rem no-repeat scroll;
}

/* Always drawn, never only while moving. WebKit hides the overlay bar at rest on macOS, which is the
   platform this was found on and the one most of our customers' laptops are not — but a reader on a
   Windows machine got the cue and a reader on a Mac did not, and a register that depends on which
   laptop is open is not a register. */
.kr-page--fill .kr-fill .kr-datatable__scroll::-webkit-scrollbar,
.kr-page--fill .kr-fill > .kr-table-wrap::-webkit-scrollbar {
  -webkit-appearance: none;
  width: 0.55rem;
  height: 0.55rem;
}
.kr-page--fill .kr-fill .kr-datatable__scroll::-webkit-scrollbar-thumb,
.kr-page--fill .kr-fill > .kr-table-wrap::-webkit-scrollbar-thumb {
  border-radius: var(--kr-radius-pill);
  background: var(--kr-color-scrollbar-thumb);
}

/* Keep the column names in view as the rows scroll inside the box. The header cell already carries an opaque
   background (.kr-table thead th), so scrolled rows pass under it, not through. (The data-table sets its own.) */
.kr-page--fill .kr-fill > .kr-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* And the total in view at the other end, for the same reason and a stronger one: on a loss summary the last
   row is the figure the whole screen exists to produce — the one a finance officer copies into the Treasury
   return. A total you have to scroll to find, under a heading that has scrolled away, is a total copied wrongly.
   It needs a background of its own, unlike the header cell, because nothing else gives a tfoot one. */
.kr-page--fill .kr-fill > .kr-table-wrap tfoot th,
.kr-page--fill .kr-fill > .kr-table-wrap tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 1;
  background: var(--kr-color-surface);
}

/* Detail — stacked label/value in a grid, for the row modal --------------- */

.kr-detail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr));
  gap: var(--kr-space-5) var(--kr-space-6);
}

/* Short entries — a token and its name, an icon and its name — where the 13rem column leaves most of
   the row empty and the eye has to travel between neighbours that belong together. */
.kr-detail--tight {
  grid-template-columns: repeat(auto-fill, minmax(min(8rem, 100%), 1fr));
  gap: var(--kr-space-4);
}

.kr-detail__item { display: flex; flex-direction: column; gap: var(--kr-space-0-5); min-width: 0; }
.kr-detail__item--wide { grid-column: 1 / -1; }
/* Two columns for a value that is often a sentence, such as a risk's key process. Only once there is
   room for three: spanning two in a one-column grid would push the page sideways. */
@media (min-width: 64rem) {
  .kr-detail__item--double { grid-column: span 2; }
}

/* A figure and its label line up on the same edge.

   .kr-num right-aligns the value, and the label stayed left — so an amount sat at the right of its
   column with its own caption stranded at the left, reading as two unrelated things rather than as
   one labelled figure. The whole item takes the alignment of the value it holds.

   :has() so it applies from the value's own class and nobody has to remember a matching modifier on
   the parent; --num is there for anywhere the value is a figure without carrying .kr-num. */
.kr-detail__item:has(.kr-num),
.kr-detail__item--num { text-align: right; }

/* A label/value list is semantically a description list, so the block may be marked up as
   <dl>/<dt>/<dd>. Browsers indent <dd> by 40px, which puts every value out of line with its own
   label — reset it here rather than making pages avoid the correct element. */
.kr-detail dd { margin: 0; }

/* A summary detail block that sits above a form in the same card: a hairline and space set it apart from the
   inputs below, so the read-only figures and the fields you fill do not run together. */
.kr-detail--divided {
  padding-bottom: var(--kr-space-6);
  border-bottom: 1px solid var(--kr-color-border);
  margin-bottom: var(--kr-space-6);
}
.kr-detail__label { font-size: var(--kr-font-xs); line-height: 1.3; color: var(--kr-color-text-muted); }
.kr-detail__value { line-height: 1.3; color: var(--kr-color-text); overflow-wrap: anywhere; white-space: pre-line; }

/* A value that holds a badge rather than a sentence.

   pre-line above is deliberate and stays: an address is written on three lines and has to render on
   three. It is also a trap for anything built from a fragment, because the whitespace between that
   fragment's branches survives into the output — a badge chosen from five, each on its own line in
   the source, arrives with three blank lines around it and lands well below its own label. That is
   what a status badge on a Kasonjola record did, and it looked like a spacing bug rather than
   like markup.

   Flex rather than just white-space: normal, because it also settles the case this is really for —
   a badge with a few words beside it ("Refused", and the note saying why). Inline-block on a pill
   whose line-height differs from the value's leaves the two sitting a pixel or two apart; centring
   them on the cross axis is exact rather than nearly.

   :has() so it applies from what the value contains, and nobody has to remember a modifier. The same
   technique .kr-detail__item:has(.kr-num) already uses a few lines above. */
.kr-detail__value:has(.kr-badge) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--kr-space-2);
  white-space: normal;
}

/* A value whose content is markup rather than a typed sentence: a link, or a link chosen from a
   branch. The same trap as the badge above, met by the approval's "Open what was asked about", a
   unit's "Reports to" and a statute's source — each written on its own line in the template, each
   arriving with a blank line above it and sitting a line below its label. A typed value never holds an
   element, so pre-line still keeps an address on its three lines. */
.kr-detail__value:has(> a, > span) {
  white-space: normal;
}

/* A person's profile ----------------------------------------------------- */

/* Header: avatar, name and reference, then the actions pushed to the right. */
.kr-profile__head {
  display: flex;
  align-items: center;
  gap: var(--kr-space-4);
  margin-bottom: var(--kr-space-5);
}

/* Initials for now; a photo replaces this later (same circle, so no reflow). */
.kr-profile__avatar {
  flex: none;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--kr-radius-round);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--kr-color-accent-soft);
  color: var(--kr-color-accent);
  font-size: var(--kr-font-xl);
  font-weight: 700;
  text-transform: uppercase;
}

/* A real photo fills the same circle the initials avatar uses, cropped to fit — no reflow either way. */
.kr-profile__photo {
  flex: none;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--kr-radius-round);
  object-fit: cover;
  background: var(--kr-color-accent-soft);
}

/* Small text links under the name: change/add photo, and remove. */
.kr-profile__photo-actions {
  display: flex;
  gap: var(--kr-space-4);
  margin-top: var(--kr-space-1-5);
  font-size: var(--kr-font-sm);
}
.kr-photo-upload { display: inline; }
.kr-photo-upload__pick { cursor: pointer; }

/* The organisation's logo on the setup page: the mark as it will print, with its actions beside it. Boxed on a tinted
   fill because a logo is usually transparent — on plain white there would be no way to see its extent. */
.kr-logo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--kr-space-5);
}
.kr-logo__image {
  max-width: 12rem;
  max-height: 6rem;
  padding: var(--kr-space-3);
  background: var(--kr-color-bg);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
}
.kr-logo__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 12rem;
  height: 6rem;
  background: var(--kr-color-bg);
  border: 1px dashed var(--kr-color-border);
  border-radius: var(--kr-radius);
  color: var(--kr-color-text-faint);
}
.kr-logo__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kr-space-2);
}
.kr-link--danger { color: var(--kr-color-danger); background: none; border: none; padding: 0; cursor: pointer; font: inherit; }
.kr-link--danger:hover { color: var(--kr-color-danger-hover); }

.kr-profile__ident { min-width: 0; }
.kr-profile__name { font-size: var(--kr-font-xl); font-weight: 650; margin: 0; }
.kr-profile__meta { margin: var(--kr-space-0-5) 0 0; color: var(--kr-color-text-muted); font-size: var(--kr-font-md); }
.kr-profile__meta strong { color: var(--kr-color-text); font-weight: 600; }

/* Actions sit on the right and wrap under on a narrow screen. */
.kr-profile__actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: var(--kr-space-3);
}

.kr-profile__section { margin-bottom: var(--kr-space-4); }
.kr-profile__section-title {
  font-size: var(--kr-font-body);
  font-weight: 650;
  margin: 0 0 var(--kr-space-4);
  padding-bottom: var(--kr-space-3);
  border-bottom: var(--kr-border);
}

/* A section whose header carries an action (e.g. "Edit bank details") beside its title. */
.kr-profile__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--kr-space-3);
  margin: 0 0 var(--kr-space-4);
  padding-bottom: var(--kr-space-3);
  border-bottom: var(--kr-border);
}
.kr-profile__section-head .kr-profile__section-title {
  margin: 0;
  padding: 0;
  border: 0;
}

/* Profile shell: a shared header, then a left tab rail beside the active section's panel ---------- */

.kr-profile__body {
  display: flex;
  gap: var(--kr-space-4);
  align-items: flex-start;
}

.kr-profile__tabs {
  flex: 0 0 13rem;
  display: flex;
  flex-direction: column;
  gap: var(--kr-space-0-5);
  position: sticky;
  top: var(--kr-space-4);
}

.kr-profile__tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--kr-space-2);
  padding: var(--kr-space-2) var(--kr-space-3);
  border-radius: var(--kr-radius);
  color: var(--kr-color-text-muted);
  font-size: var(--kr-font-body);
  font-weight: 500;
  text-decoration: none;
  transition: background var(--kr-transition), color var(--kr-transition);
}
.kr-profile__tab.is-active {
  background: var(--kr-color-accent-soft);
  color: var(--kr-color-accent);
  font-weight: 600;
}
.kr-profile__tab--soon { color: var(--kr-color-text-faint); cursor: default; }
.kr-profile__tab--soon:hover { background: transparent; color: var(--kr-color-text-faint); }

.kr-profile__soon {
  font-size: var(--kr-font-xs);
  text-transform: uppercase;
  letter-spacing: var(--kr-tracking-caps);
  color: var(--kr-color-text-faint);
  border: var(--kr-border);
  border-radius: var(--kr-radius-pill);
  padding: 0 var(--kr-space-1-5);
}

.kr-profile__panel { flex: 1 1 auto; min-width: 0; }

/* On desktop the profile fills the viewport below the topbar, so the header, breadcrumb and tab rail
   stay put and only the details panel scrolls. */
@media not all and (max-width: 48rem) {
  .kr-profile {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--kr-topbar-height) - 2 * var(--kr-space-6));
  }
  /* Stretch the columns to the pane height so the panel has a definite height to scroll against;
     without this the panel grows past the body and is clipped rather than scrolled. */
  .kr-profile__body { flex: 1 1 auto; min-height: 0; overflow: hidden; align-items: stretch; }
  .kr-profile__tabs { position: static; overflow-y: auto; }
  .kr-profile__panel { overflow-y: auto; min-height: 0; padding-right: var(--kr-space-2); }
}

@media (max-width: 48rem) {
  .kr-profile__body { flex-direction: column; }
  .kr-profile__tabs {
    flex-direction: row;
    flex-wrap: wrap;
    position: static;
    width: 100%;
  }
}

/* Confirm — a little SweetAlert: centred, a typed icon chip on top --------- */

.kr-modal--confirm { max-width: 30rem; }
.kr-modal--confirm .kr-modal__body { text-align: center; padding-top: var(--kr-space-6); }
.kr-modal--confirm .kr-modal__foot { justify-content: center; border-top: none; padding-top: 0; padding-bottom: var(--kr-space-6); }
/* The confirm's OK button carries an icon: a check to proceed, swapped for a trash when the action is
   destructive (the button gets kr-btn--danger). Only the matching one shows. */
/* Cancel in the confirm dialog is a real button, quietly.

   It was a ghost — no border, no fill — so on a centred two-button footer it read as a caption beside
   the primary rather than as the other choice, and on a destructive confirm the safe option was the
   one that looked least like something you could press. It keeps a soft fill and a hairline edge:
   clearly secondary to the primary, clearly a button. */
[data-kr-confirm-cancel] {
  background: var(--kr-color-control);
  border-color: var(--kr-color-control-border);
  color: var(--kr-color-text);
}
[data-kr-confirm-cancel]:hover {
  background: var(--kr-color-bg);
  border-color: var(--kr-color-control-border-hover);
}

.kr-confirm-ok__go, .kr-confirm-ok__danger { display: inline-flex; }
[data-kr-confirm-ok] .kr-confirm-ok__danger { display: none; }
[data-kr-confirm-ok].kr-btn--danger .kr-confirm-ok__go { display: none; }
[data-kr-confirm-ok].kr-btn--danger .kr-confirm-ok__danger { display: inline-flex; }
/* Red because it is risky, but it records rather than deletes: keep the check, not the trash. */
[data-kr-confirm-ok].kr-btn--danger.kr-confirm-ok--go .kr-confirm-ok__go { display: inline-flex; }
[data-kr-confirm-ok].kr-btn--danger.kr-confirm-ok--go .kr-confirm-ok__danger { display: none; }

/* The value being questioned, in bold and in red, above the explanation. Scoped to the body so it
   outranks .kr-modal__body p, which would turn it back into muted body text. */
.kr-modal__body .kr-confirm__lead {
  font-size: var(--kr-font-lg);
  font-weight: 700;
  color: var(--kr-color-danger);
  margin-bottom: var(--kr-space-2);
  overflow-wrap: anywhere;
}

.kr-confirm__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto var(--kr-space-4);
  border-radius: var(--kr-radius-pill);
}

.kr-confirm__icon .kr-icon { width: 1.9rem; height: 1.9rem; }
.kr-confirm__i { display: none; }
.kr-confirm__title { font-size: var(--kr-font-lg); font-weight: 600; margin-bottom: var(--kr-space-2); }

/* Type variants set the chip colour (the status tones, under the badges; warning when no type is
   given) and reveal the matching icon. */

.kr-confirm--success  .kr-confirm__i--success,
.kr-confirm--error    .kr-confirm__i--error,
.kr-confirm--warning  .kr-confirm__i--warning,
.kr-confirm--info     .kr-confirm__i--info,
.kr-confirm--question .kr-confirm__i--question { display: inline-flex; }

.kr-btn--danger {
  color: var(--kr-color-danger-contrast);
  background: var(--kr-color-danger);
  border-color: var(--kr-color-danger);
}

/* Set its own hover background — otherwise the generic .kr-btn:hover grey wins and washes the red out. */
.kr-btn--danger:hover {
  background: var(--kr-color-danger-hover);
  border-color: var(--kr-color-danger-hover);
}

/* Form layouts ----------------------------------------------------------- */

/* A form too wide to live in the 32rem column .kr-form gives it.
 *
 * <strong>Because one form was squeezed into half the page it had.</strong> In Kasonjola a form asked
 * for three short fields and then a table of eight amounts across three columns. It wore
 * .kr-form and put --grid on a div INSIDE the form, which is the one place in the product that
 * modifier is not worn by the form itself. The inner div duly said max-width: none and was still
 * trapped in its parent's 32rem, so a four-column table of amounts rendered in 512 pixels on a
 * 1440-pixel screen. Found on 2026-09-17 by looking at the screen.
 *
 * The cap on .kr-form is right and stays: a column of single fields is unreadable at full width,
 * which is what it exists to prevent. This says "this form is not that", and a form carrying a table
 * never is. */
.kr-form--wide { max-width: none; }

.kr-form--grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--kr-space-4) var(--kr-space-5);
  max-width: none;
}

/* Three across, for a form of short fields (a likelihood, an impact, an amount, two dates) where two
   columns would leave each one absurdly wide. Three is the ceiling: past that the labels are closer to
   each other than to their own inputs, and the row stops reading left to right.

   Wear it WITH --grid, not instead of it: this rule sets the column count and nothing else, so on its
   own it lands on a .kr-form that is still a flex column and changes nothing visible. */
.kr-form--grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.kr-field--full { grid-column: 1 / -1; }

.kr-form__section { border: none; padding: 0; margin: 0; }
.kr-form__legend { font-size: var(--kr-font-body); font-weight: 600; }
.kr-form__hint { margin-top: 0.1rem; font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }

/* A heading that splits a form into groups (e.g. an incident's facts, then who must be told): a quiet
   rule above it and a note beneath, so the group reads as its own thing without shouting like a card title. */
.kr-form__subhead {
  margin: var(--kr-space-2) 0 0;
  padding-top: var(--kr-space-4);
  border-top: var(--kr-border);
  font-size: var(--kr-font-lg);
  font-weight: 600;
  color: var(--kr-color-text);
}
.kr-form__subnote {
  margin: var(--kr-space-1) 0 0;
  font-size: var(--kr-font-sm);
  line-height: 1.5;
  color: var(--kr-color-text-muted);
}

/* The bulk-fill control above the rated grid: "They all did [ 8 ] units [Fill all]" on one line, a quiet band
   set off from the grid below by a rule, so a sweeping action reads as separate from the per-row entry. */
/* Bulk fill: one figure applied to everyone entitled. It is an ordinary stacked field (label above its
   control), not a sentence laid across a toolbar, so it reads the same way as every other field on the app.
   The input and the button share one line as a pair. */
.kr-fillbar {
  max-width: none;
  margin-top: var(--kr-space-4);
  margin-bottom: var(--kr-space-4);
  padding-bottom: var(--kr-space-4);
  border-bottom: var(--kr-border);
  /* Both controls are pinned to this, rather than left to their own padding and font size. A button a few
     pixels shorter than the input beside it stops reading as a button and starts reading as a label. */
  --kr-fillbar-control-h: 2.5rem;
}

.kr-fillbar__controls {
  display: flex;
  align-items: center;
  gap: var(--kr-space-2);
  flex-wrap: wrap;
}

.kr-fillbar__input {
  width: 8rem;
  height: var(--kr-fillbar-control-h);
}

/* .kr-btn defaults to align-self: flex-start, which would hang the button off the top of the row. */
.kr-fillbar__go {
  align-self: center;
  height: var(--kr-fillbar-control-h);
}

/* Pick a month and show it: a compact inline control that sits in a section header, where a stacked label
   would push the heading out of line. Its own class because it is a different shape from the bulk fill, and
   one class meaning two layouts is how a change to one of them quietly breaks the other. */
.kr-monthpick {
  display: flex;
  align-items: center;
  gap: var(--kr-space-2);
  flex-wrap: wrap;
  --kr-monthpick-control-h: 2.125rem;
}
.kr-monthpick__label { font-size: var(--kr-font-md); color: var(--kr-color-text-muted); }
.kr-monthpick__input { height: var(--kr-monthpick-control-h); }
.kr-monthpick .kr-btn { align-self: center; height: var(--kr-monthpick-control-h); }

.kr-form__actions {
  display: flex;
  /* Wraps, because a row of buttons is the one part of a form that grows without warning. Two fit on
     a phone; a third — a download, an alternative action — pushes the row past the screen, and a
     nowrap flex row does not clip, it makes the whole page scroll sideways. Every screen in the
     product inherits this, so the next form to gain a button does not have to rediscover it. */
  flex-wrap: wrap;
  gap: var(--kr-space-2);
  padding-top: var(--kr-space-2);
}

/* Form-card header: what this screen does, and a helper line. */
.kr-formhead { margin-bottom: var(--kr-space-2); }
.kr-formhead__title { margin: 0; font-size: var(--kr-font-lg); font-weight: 600; }
.kr-formhead__lead { margin: var(--kr-space-1) 0 0; color: var(--kr-color-text-muted); font-size: var(--kr-font-body); }

/* Drop a column at a time rather than reflowing to one narrow column straight away. */
@media (max-width: 64rem) {
  .kr-form--grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* minmax(0, 1fr), not 1fr: a bare 1fr is never narrower than its widest content, so one long option
   in a select (an opinion with its meaning) pushed the whole form past the card's edge on a phone. */
@media (max-width: 34rem) {
  .kr-form--grid,
  .kr-form--grid3 { grid-template-columns: minmax(0, 1fr); }
}

/* Breadcrumb trail ------------------------------------------------------- */
.kr-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--kr-space-2);
  margin-bottom: var(--kr-space-4);
  font-size: var(--kr-font-sm);
}

/* A breadcrumb is a trail you can walk back up, so the links have to look walkable. They were plain
   muted text that only changed colour on hover — indistinguishable from a caption until the pointer
   was already on them, and invisible as links to anyone using a keyboard.

   Each link now sits in its own quiet hit area that fills on hover, which also gives the row a
   comfortable target on a touch screen. The current page stays flat: it is where you already are,
   and nothing about it should invite a press. */
.kr-breadcrumb__link {
  color: var(--kr-color-text-muted);
  text-decoration: none;
  padding: var(--kr-space-0-5) var(--kr-space-1-5);
  margin: calc(-1 * var(--kr-space-0-5));
  border-radius: var(--kr-radius);
  transition: background var(--kr-transition), color var(--kr-transition);
}
.kr-breadcrumb__link:hover,
.kr-breadcrumb__link:focus-visible {
  color: var(--kr-color-accent);
  background: var(--kr-color-accent-soft);
}
.kr-breadcrumb__current { color: var(--kr-color-text); font-weight: 600; }

/* A chevron rather than a slash: it points the way the trail runs, where a slash is just punctuation.
   Sized down and dimmed so the separators recede and the names carry the line. */
.kr-breadcrumb__sep {
  color: var(--kr-color-text-faint);
  font-size: 0.9em;
  line-height: 1;
  user-select: none;
}

/* Error pages ----------------------------------------------------------- */

/* The body of a standalone page.
 *
 * The shell keeps its content out of the notch and the home indicator; these pages have no shell, so
 * they need saying separately — and did not have it. They are the ones reached edge-to-edge on a phone
 * with nothing else on the screen, which is the case the insets exist for. */
.kr-errorpage-body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: max(var(--kr-space-4), env(safe-area-inset-left));
  padding-right: max(var(--kr-space-4), env(safe-area-inset-right));
}

.kr-errorpage {
  max-width: 30rem;
  margin: calc(2 * var(--kr-space-8)) auto;
  text-align: center;
}

.kr-errorpage__code {
  margin: 0;
  font-size: var(--kr-font-display);
  font-weight: 800;
  line-height: 1;
  color: var(--kr-color-accent);
}

.kr-errorpage__title { margin: var(--kr-space-4) 0 var(--kr-space-2); font-size: var(--kr-font-2xl); font-weight: 600; }
/* The reference, well below the way out: it is for the person who is going to report this, and it must
   not compete with the button for the far larger number who just want to carry on. */
.kr-errorpage__ref {
  margin: var(--kr-space-6) 0 0;
  color: var(--kr-color-text-faint);
  font-size: var(--kr-font-sm);
}
.kr-errorpage__text { margin: 0 0 var(--kr-space-6); color: var(--kr-color-text-muted); }
.kr-errorpage .kr-btn { align-self: center; }

/* Spinner and loaders ---------------------------------------------------- */

/* A tapered arc that sweeps, rather than a ring with a bite out of it.

   Built from a conic gradient masked to a ring, so the stroke fades from full colour to nothing round
   the circle and the leading end is bright while the tail dissolves. That reads as motion even in a
   still screenshot, which a plain broken ring does not.

   Deliberately unhurried at 1.15s. A fast spinner reads as agitation and makes a two-second wait feel
   like a fault; this is a system where building a quarter's board pack, or importing a whole register,
   is legitimately slow, and the loader should say "working" rather than "panicking". */
.kr-spinner {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  border-radius: var(--kr-radius-round);
  background: conic-gradient(from 0deg, transparent 0deg, currentColor 300deg, transparent 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  animation: kr-spin var(--kr-spin-duration) linear infinite;
}

.kr-spinner--lg {
  width: 2.25rem;
  height: 2.25rem;
  color: var(--kr-color-accent);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
}

/* Reduced motion: keep the shape, drop the sweep to a slow pulse. Someone who has asked the operating
   system for less movement should not be handed a spinning element for the length of a board pack build. */
@media (prefers-reduced-motion: reduce) {
  .kr-spinner { animation: kr-spinner-pulse 1.6s ease-in-out infinite; }
}
@keyframes kr-spinner-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

@keyframes kr-spin { to { transform: rotate(360deg); } }

/* Spinner with words. */
.kr-loader {
  display: inline-flex;
  align-items: center;
  gap: var(--kr-space-2);
  color: var(--kr-color-text-muted);
  font-size: var(--kr-font-md);
}

/* A chip that submits (a layout or a line to look from) loads exactly as a button does. Without the
   chip here it took the button's words and spinner with none of the button's flex row, so the spinner
   sat low on the baseline, touching the words. */
:is(.kr-btn, .kr-chip).is-loading-text { pointer-events: none; }
.kr-chip.is-loading-text { display: inline-flex; align-items: center; gap: var(--kr-space-2); }
:is(.kr-btn, .kr-chip).is-loading-text .kr-spinner { flex: none; width: 1em; height: 1em; }

/* Button loading: keep the button's size, hide its content, show a spinner. */
:is(.kr-btn, .kr-chip).is-loading { position: relative; color: transparent; pointer-events: none; }
:is(.kr-btn, .kr-chip).is-loading > * { visibility: hidden; }

/* The same spinner as everywhere else. This one was still the old broken ring at 0.6s, so a button
   spun differently — and faster — than the spinner sitting next to it. A loading indicator that
   changes shape depending on where it appears reads as two different systems. */
:is(.kr-btn, .kr-chip).is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.15em;
  height: 1.15em;
  margin: -0.575em 0 0 -0.575em;
  border-radius: var(--kr-radius-round);
  color: var(--kr-color-accent-contrast);
  background: conic-gradient(from 0deg, transparent 0deg, currentColor 300deg, transparent 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  animation: kr-spin var(--kr-spin-duration) linear infinite;
}

.kr-btn.is-loading:not(.kr-btn--primary):not(.kr-btn--danger)::after { color: var(--kr-color-text-muted); }
.kr-chip.is-loading::after { color: var(--kr-color-accent); }

/* Top page-loading bar — activates on navigation, resets on the new page. */
.kr-pageloader {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: var(--kr-color-accent);
  opacity: 0;
  z-index: var(--kr-z-loader);
}

/* While the next page is on its way (main.js, "While the next page is on its way"). ------------------

   The bar in steps: a third of the way at once, so the click is answered, then slower and slower towards
   the end it never reaches until the page arrives.

   Every delay in this block is the stylesheet's, not a script timer's. main.js puts the classes on the
   moment the page starts to leave; once it has, the browser may stop running the page's script, and a
   loader waiting on a timer then never shows. Transform and opacity only, which the browser animates
   without the page's script. */
.kr-pageloader.is-active {
  opacity: 1;
  animation: kr-trickle 14s cubic-bezier(0.05, 0.7, 0.1, 1) 120ms both;
}
@keyframes kr-trickle {
  0% { transform: scaleX(0); }
  4% { transform: scaleX(0.32); }
  30% { transform: scaleX(0.7); }
  100% { transform: scaleX(0.94); }
}

/* The sidebar item asked for is the current one at once, and says it is on its way. */
.kr-nav__item.is-pending > svg:first-child {
  animation: kr-skeleton-pulse 1.1s ease-in-out infinite;
}

/* A plain link (a row's reference, a crumb): the hand becomes a wait, and the link a fainter one. */
a.is-pending {
  opacity: 0.6;
  cursor: progress;
}

/* The same page with another choice, and a form's answer: the old page dimmed and closed once the wait is
   worth noticing, so it is not read as the new one and cannot be clicked twice. */
.kr-scroll.is-stale {
  opacity: 0.45;
  transition: opacity 0.2s ease 450ms;
  pointer-events: none;
  cursor: progress;
}

/* Another page: an outline of the page on its way, laid over the content area (main.js sets its top to the
   top bar's foot), in the column the page will use. Opaque, so it hides the old page once it shows. */
.kr-main:has(> .kr-outline) {
  position: relative;
}
.kr-outline {
  position: absolute;
  /* Above the page's own layers (a table's sticky header and first column go to 3), so none shows
     through; below the shell's (the top bar and its panels start at 15). */
  z-index: var(--kr-z-outline);
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  background: var(--kr-color-bg);
  animation: kr-outline-in 0.18s ease-out 250ms both;
}
@keyframes kr-outline-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.kr-outline__inner {
  max-width: var(--kr-content-max);
  margin: 0 auto;
  padding: var(--kr-space-6);
  display: flex;
  flex-direction: column;
  gap: var(--kr-space-5);
}
.kr-outline__head {
  display: flex;
  align-items: center;
  gap: var(--kr-space-3);
}
.kr-outline__card {
  display: flex;
  flex-direction: column;
  gap: var(--kr-space-4);
  padding: var(--kr-space-6);
  background: var(--kr-color-surface);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
}
.kr-outline__toolbar,
.kr-outline__row {
  display: flex;
  align-items: center;
  gap: var(--kr-space-5);
}
.kr-outline__row {
  padding: var(--kr-space-3) 0;
  border-top: var(--kr-border);
}
.kr-outline__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--kr-space-5) var(--kr-space-6);
}
.kr-outline__grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.kr-outline__field {
  display: flex;
  flex-direction: column;
  gap: var(--kr-space-2);
}
.kr-outline__bar {
  display: block;
  height: 0.75rem;
  border-radius: var(--kr-radius-sm);
  background: var(--kr-color-control);
  animation: kr-skeleton-pulse var(--kr-pulse-duration) ease-in-out infinite;
}
.kr-outline__bar--w10 { width: 10%; }
.kr-outline__bar--w15 { width: 15%; }
.kr-outline__bar--w20 { width: 20%; }
.kr-outline__bar--w25 { width: 25%; }
.kr-outline__bar--w30 { width: 30%; height: 1rem; }
.kr-outline__bar--w35 { width: 35%; }
.kr-outline__bar--w45 { width: 45%; }
.kr-outline__bar--w60 { width: 60%; }
.kr-outline__bar--w80 { width: 80%; }
.kr-outline__bar--w90 { width: 90%; }
.kr-outline__bar--pill { width: 5rem; height: 1.25rem; border-radius: var(--kr-radius-pill); }
.kr-outline__bar--btn { width: 7.5rem; height: 2.25rem; border-radius: var(--kr-radius); }
.kr-outline__bar--input { width: 100%; height: 2.4rem; border-radius: var(--kr-radius); }
.kr-outline__bar--search { width: min(22rem, 35%); height: 2.15rem; border-radius: var(--kr-radius); }
.kr-outline__bar--select { width: 9rem; height: 2.15rem; border-radius: var(--kr-radius); }
.kr-outline__bar--push { margin-left: auto; }

/* The outline of a page as it last looked (main.js, recordedOutline): its parts where they were. A frame
   for each card or table, a bar for each button, field and line of text. */
.kr-outline__part {
  position: absolute;
  display: block;
}
.kr-outline__part--f {
  background: var(--kr-color-surface);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
}
.kr-outline__part--b,
.kr-outline__part--t {
  border-radius: var(--kr-radius-sm);
  background: var(--kr-color-control);
  animation: kr-skeleton-pulse var(--kr-pulse-duration) ease-in-out infinite;
}
.kr-outline__part--b { border-radius: var(--kr-radius); }

@media (prefers-reduced-motion: reduce) {
  /* Still held back, still there; it only stops moving. The outline keeps its fade, which is not movement. */
  .kr-pageloader.is-active { animation: kr-trickle-still 0s linear 120ms both; }
  .kr-outline__part,
  .kr-outline__bar,
  .kr-nav__item.is-pending > svg:first-child { animation: none; }
}
@keyframes kr-trickle-still {
  from, to { transform: scaleX(0.6); }
}

/* The developer's panel: development only (DevToolsAdvice). */
.kr-devpanel {
  position: fixed;
  bottom: var(--kr-space-3);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--kr-z-devpanel);
  display: flex;
  align-items: center;
  gap: var(--kr-space-1);
  padding: var(--kr-space-1) var(--kr-space-2);
  background: var(--kr-color-text);
  color: var(--kr-color-surface);
  border-radius: var(--kr-radius-pill);
  box-shadow: var(--kr-shadow-lg);
  font-size: var(--kr-font-sm);
}
.kr-devpanel__label {
  padding: 0 var(--kr-space-1) 0 var(--kr-space-2);
  opacity: 0.6;
}
.kr-devpanel__option {
  padding: var(--kr-space-1) var(--kr-space-2);
  border: 0;
  border-radius: var(--kr-radius-pill);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.kr-devpanel__option:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.kr-devpanel__option.is-on { background: var(--kr-color-accent); color: var(--kr-color-accent-contrast); }

/* Section / div overlay loader — put an overlay in a .kr-loadable, toggle .is-loading. */
.kr-loadable { position: relative; }

.kr-loadable__overlay {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--kr-space-2);
  background: var(--kr-color-veil);
  border-radius: inherit;
  color: var(--kr-color-text-muted);
  z-index: 5;
}

.kr-loadable__text { font-size: var(--kr-font-md); }
.kr-loadable.is-loading > .kr-loadable__overlay { display: flex; }

/* Responsive — the sidebar becomes an off-canvas drawer. Desktop-first tool. */

.kr-scrim { display: none; }

@media (max-width: 48rem) {
  .kr-app { grid-template-columns: 1fr; }
  .kr-collapsed .kr-app { grid-template-columns: 1fr; }

  .kr-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: var(--kr-z-bar);
    width: var(--kr-sidebar-width);
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform var(--kr-transition);
    border-right: var(--kr-border);
  }

  /* On mobile, ignore the desktop collapse — always show full labels in the drawer. */
  .kr-collapsed .kr-sidebar__brand,
  .kr-collapsed .kr-nav__label,
  .kr-collapsed .kr-nav__soon,
  .kr-collapsed .kr-nav__chevron { display: revert; }

  .kr-collapsed .kr-nav__item { justify-content: flex-start; padding-left: var(--kr-space-3); }

  .kr-collapsed .kr-nav__submenu {
    position: static;
    display: grid;
    grid-template-rows: 0fr;
    margin-left: 0;
    min-width: 0;
    padding: 0;
    border: none;
    box-shadow: none;
    background: none;
    opacity: 1;
    visibility: visible;
    transition: grid-template-rows var(--kr-transition);
  }

  .kr-collapsed .kr-nav__submenu-inner { overflow: hidden; }
  .kr-collapsed .kr-nav__group--open > .kr-nav__submenu { grid-template-rows: 1fr; }

  /* The drawer shows the full sidebar, so the panel and the rail come back with it — the collapsed
     rules that strip them are for the icon rail's flyouts, which don't exist at this width. And with
     the submenus inline again, the sections can scroll without clipping anything. */
  .kr-collapsed .kr-nav--sections { overflow-y: auto; }
  .kr-collapsed .kr-nav__group--open { background: var(--kr-color-bg); }

  .kr-collapsed .kr-nav__subitem {
    margin-left: var(--kr-rail-inset);
    padding-left: var(--kr-space-3);
    border-radius: var(--kr-radius);
  }

  .kr-sidebar-open .kr-sidebar { transform: translateX(0); box-shadow: var(--kr-shadow-lg); }
  .kr-sidebar-open .kr-scrim { display: block; }

  .kr-topbar__menu { display: inline-flex; }

  /* Inside the safe area on every edge that touches one. A phone's viewport is not its usable area:
     without these the drawer runs under the status bar, and content in landscape runs under the
     notch on whichever side it happens to be. env() is 0 when there is nothing to avoid, so the
     max() leaves the ordinary padding exactly as it was. */
  .kr-content {
    padding: var(--kr-space-4);
    padding-left: max(var(--kr-space-4), env(safe-area-inset-left));
    padding-right: max(var(--kr-space-4), env(safe-area-inset-right));
    padding-bottom: max(var(--kr-space-4), env(safe-area-inset-bottom));
  }
  .kr-topbar {
    padding: var(--kr-space-3) var(--kr-space-4);
    padding-top: max(var(--kr-space-3), env(safe-area-inset-top));
    padding-left: max(var(--kr-space-4), env(safe-area-inset-left));
    padding-right: max(var(--kr-space-4), env(safe-area-inset-right));
  }
  .kr-sidebar {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* The title gets the room, because it is the one thing on this bar that says where you are.
   *
   * .kr-topbar__meta is flex:none and the title is the only thing that can shrink, so on a phone the
   * whole squeeze landed on the title and it ellipsised to a single letter — "Users" rendered as
   * "U…" and "Add a role" as "Ad…". Two things beside it were paying for that and neither is worth
   * a page title: the build version, which is for us and not for an action owner, and the signed-in
   * name, which is still the first line of the menu the avatar opens. */
  .kr-topbar__meta .kr-nav__soon,
  .kr-user__name,
  .kr-user__caret { display: none; }
}

/* Sign-in page ---------------------------------------------------------- */
/* Standalone: a centred card on the app background, no shell. */
/* The installation operator's pages, which have no application shell to sit inside.

   An organisation's screens get their padding and their width from .kr-content, which the shell draws
   around them. These have no shell on purpose: an operator has no organisation, so there is no navigation
   to show and nothing to navigate to. The two rules the shell would have supplied are stated here
   instead, and nothing else is - if these pages ever want more chrome than this, they want a layout
   of their own rather than a growing body class. */
.kr-platform {
  background: var(--kr-color-bg);
}

.kr-platform__page {
  max-width: var(--kr-content-max);
  margin: 0 auto;
  padding: var(--kr-space-6);
  padding-left: max(var(--kr-space-6), env(safe-area-inset-left));
  padding-right: max(var(--kr-space-6), env(safe-area-inset-right));
}

/* The operator's bar (fragments/operator.html): the product's ink across the top of every operator page. */
.kr-opbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--kr-space-2) var(--kr-space-4);
  padding: var(--kr-space-3) var(--kr-space-6);
  padding-left: max(var(--kr-space-6), env(safe-area-inset-left));
  padding-right: max(var(--kr-space-6), env(safe-area-inset-right));
  background: var(--kr-color-ink);
  color: var(--kr-color-ink-text);
}

.kr-opbar__id {
  display: flex;
  align-items: center;
  gap: var(--kr-space-3);
  min-width: 0;
  color: inherit;
  text-decoration: none;
  font-size: var(--kr-font-body);
}

.kr-opbar__where {
  color: var(--kr-color-ink-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kr-opbar__nav {
  display: flex;
  align-items: center;
  gap: var(--kr-space-1);
}

.kr-opbar__nav form { margin: 0; }

.kr-opbar__link {
  display: inline-flex;
  align-items: center;
  height: var(--kr-control-height-sm);
  padding: 0 var(--kr-space-3);
  border: 0;
  border-radius: var(--kr-radius);
  background: none;
  color: inherit;
  font: inherit;
  font-size: var(--kr-font-body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.kr-opbar__link:hover,
.kr-opbar__link[aria-current="page"] { background: var(--kr-color-ink-hover); }

.kr-opbar__link[aria-current="page"] { font-weight: 600; }

.kr-opbar__link:focus-visible {
  outline: var(--kr-focus-width) solid var(--kr-color-ink-text);
  outline-offset: var(--kr-focus-offset);
}

/* On a phone the address goes, and the links take a row of their own under the name, one line each,
   scrolling sideways as a tab bar does rather than pushing the page wider than the screen. */
@media (max-width: 40rem) {
  .kr-opbar__where { display: none; }
  .kr-opbar__nav {
    flex: 1 1 100%;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
}

/* The installation's licence, above the list: whether tiers can be chosen here at all, and until when. */
.kr-licenceline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--kr-space-1) var(--kr-space-3);
  margin: 0;
  padding: var(--kr-space-3) var(--kr-space-4);
  border-radius: var(--kr-radius-lg);
  background: var(--kr-color-success-bg);
  font-size: var(--kr-font-body);
}

.kr-licenceline--warn { background: var(--kr-color-warning-bg); }
.kr-licenceline--danger { background: var(--kr-color-danger-bg); }

.kr-licenceline strong { font-weight: 600; }

/* The operator's list of organisations: one line each where it fits, the code after the name, and a
   second line only for a suspension's reason. Standing and additions are the product's badges. */
.kr-orgtable {
  /* Room for a name and its code on one or two lines; without it the browser gives the kind the width
     and a long name runs to four. */
  --kr-orgtable-name: 14rem;
}

.kr-orgtable td { vertical-align: baseline; }

.kr-orgtable td:first-child { min-width: var(--kr-orgtable-name); }

.kr-orgtable__name { font-weight: 600; }

.kr-orgtable__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--kr-space-1);
}

.kr-orgtable__actions .kr-btn { width: 100%; justify-content: flex-start; }

/* After the name with a space only: a margin would indent it when it wraps to a line of its own. */
.kr-orgtable__code {
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
  white-space: nowrap;
}

.kr-orgtable__sub {
  display: block;
  margin-top: var(--kr-space-1);
  font-size: var(--kr-font-md);
  color: var(--kr-color-text-muted);
}

.kr-orgtable__badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kr-space-1);
  margin-top: var(--kr-space-1);
}

/* The insaka, wherever the product names itself (fragments/brand.html): the favicon's drawing in the
   colour of the text beside it, so it follows the theme and the ink. */
.kr-brandmark {
  width: var(--kr-brandmark-size);
  height: var(--kr-brandmark-size);
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kr-auth {
  /* dvh, not vh: on a phone 100vh is the tallest the viewport ever gets, so with the browser's own
     bars showing, the card is pushed below the fold on the one screen that must not need scrolling. */
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--kr-space-6);
  /* Standalone, so the insets are stated here rather than inherited from the shell. */
  padding-left: max(var(--kr-space-6), env(safe-area-inset-left));
  padding-right: max(var(--kr-space-6), env(safe-area-inset-right));
  background: var(--kr-color-bg);
}

/* The sign-in card, as ported. The fields and the button are the application's own, at the
   application's own size: the first screen anybody sees is the style guide, not an exception to it. */
.kr-auth__card {
  width: 100%;
  max-width: var(--kr-auth-width);
  padding: var(--kr-space-8);
  background: var(--kr-color-surface);
  border: var(--kr-border);
  border-radius: var(--kr-radius-lg);
  box-shadow: var(--kr-shadow-lg);
}

/* A demonstration or test server's badge, above the name (NoticeAdvice). */
.kr-auth__notice { margin: 0 0 var(--kr-space-3); }

.kr-auth__brand {
  margin: 0;
  font-size: var(--kr-font-3xl);
  font-weight: 700;
  color: var(--kr-color-text);
}

.kr-auth__lead {
  margin: var(--kr-space-1) 0 var(--kr-space-6);
  color: var(--kr-color-text-muted);
}

.kr-auth__note,
.kr-auth__error {
  margin: 0 0 var(--kr-space-4);
  padding: var(--kr-space-3);
  border-radius: var(--kr-radius);
  font-size: var(--kr-font-md);
}

.kr-auth__note {
  background: var(--kr-color-info-bg);
  color: var(--kr-color-info);
}

.kr-auth__error {
  background: var(--kr-color-danger-bg);
  color: var(--kr-color-danger);
}

.kr-auth__submit {
  width: 100%;
  justify-content: center;
  margin-top: var(--kr-space-2);
}

/* Under the form: the way to the other sign-in or to the prices, and the installation's address. */
.kr-auth__more {
  margin: var(--kr-space-4) 0 0;
  text-align: center;
  font-size: var(--kr-font-md);
  color: var(--kr-color-text-muted);
}

@media (max-width: 34rem) {
  .kr-auth__card { padding: var(--kr-space-6); }
}


/* Admin lists & forms --------------------------------------------------- */
.kr-page__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--kr-space-4);
  margin-bottom: var(--kr-space-4);
  /* Wraps, so the actions drop below the lead rather than off the side of a phone. Both this and the
     wrap on .kr-page__actions are needed: without this one the actions can never leave the first row,
     and the row is the lead's width plus theirs. It went unnoticed while every page header had a
     single short button. */
  flex-wrap: wrap;
}

.kr-page__head .kr-page__lead {
  margin: 0;
  /* Takes the room the actions leave and wraps inside it. Without a basis the lead claimed its whole
     sentence as one line, so a lead longer than the gap pushed the button onto a row of its own: Add a
     role sat under the text on the left while Add a user, with a shorter lead, sat on the right. 20rem
     is where it gives up and the actions drop below, which is the phone case the wrap is for. */
  flex: 1 1 20rem;
  min-width: 0;
}

/* The action cluster on the right of a page head — one or more buttons kept together. */
.kr-page__actions {
  display: flex;
  gap: var(--kr-space-3);
  /* Wraps, because a button's label cannot. .kr-btn is white-space: nowrap on purpose — a two-line
     button reads as broken — so a row of two real labels is simply wider than a phone, and without
     this it ran 63px past the window with the second button's right edge off the screen.
     ResponsiveLayoutIT caught it the moment a second action appeared on a page header; every header
     before this one had exactly one. */
  flex-wrap: wrap;
  /* And it has to be ABLE to wrap, which flex: none prevented.
   *
   * flex: none is flex: 0 0 auto: the box is fixed at the width of its contents laid out on one
   * line, and a box that cannot be made narrower never reaches the width at which its own wrap
   * would fire. With two buttons the content happened to fit a phone and the wrap above looked
   * like it was working. The third one on a Kasonjola screen — "Open full width", "Download", a
   * long "Back to …" — ran straight off the right edge of a 390px window.
   *
   * 0 1 auto keeps the same starting width, on a wide screen nothing shrinks and nothing moves,
   * and where there is not room the box narrows and the buttons wrap onto their own line. */
  flex: 0 1 auto;
}

/* Import screen: give the upload room to breathe so the card doesn't feel packed. */
.kr-import__zone {
  margin-top: var(--kr-space-2);
}
.kr-import__templates {
  margin-top: var(--kr-space-4);
  color: var(--kr-color-text-muted);
  font-size: var(--kr-font-md);
}
.kr-import__report {
  margin-top: var(--kr-space-5);
}

/* A vertical run of cards/sections with even breathing room between them. Opt-in; .kr-page itself sets
   no gap, so a page that stacks full-width cards reaches for this instead of per-card margins. */
.kr-stack {
  display: flex;
  flex-direction: column;
  gap: var(--kr-space-5);
}

/* Status band — a card that states where something stands (the rate pack in force, the licence). The icon
   sits in a soft round badge (same treatment as the empty-state icon) so it reads at a glance instead of as
   a tiny stroke. Default is calm/positive (green); the variants below shout when they need to. Shared by
   Settings › Statutory and Settings › Licence. */
/* Not a coloured bar down the left-hand side. That is every framework's alert box, it says "generic
   warning" before it says anything about this system, and four of them stacked read as a wall of
   stripes.

   Instead the whole band takes a wash of its own tint, edged in the same hue at low opacity, and the
   state is carried by the icon badge — which is the thing the eye lands on first anyway. The result
   sits inside a card without fighting it, and a run of them reads as a list of conditions rather than
   as a column of warnings.

   colour-mix keeps every tone derived from one token, so a state stays coherent when the token moves
   and there are no hand-picked pastels to maintain. */
.kr-statusband {
  display: flex;
  align-items: flex-start;
  gap: var(--kr-space-4);
  padding: var(--kr-space-4) var(--kr-space-5);
  border-radius: var(--kr-radius-lg);
  background: color-mix(in srgb, var(--kr-color-success) 7%, var(--kr-color-surface));
  border: 1px solid color-mix(in srgb, var(--kr-color-success) 22%, transparent);
}
.kr-statusband + .kr-statusband { margin-top: var(--kr-space-3); }

/* And a gap between the last band and whatever follows it.
 *
 * The band carried a margin only between itself and another band, so the first card after one sat
 * flush against its border — two boxes touching, reading as one object with a coloured stripe at the
 * top. Every Kasonjola screen that put a band above a card had it, both import previews included.
 *
 * :not(.kr-statusband) so a stack of bands keeps its own tighter rhythm rather than taking both rules.
 * On the sibling rather than as a margin-bottom on the band, so a band that ends a page adds no
 * trailing space under itself. */
.kr-statusband + *:not(.kr-statusband) { margin-top: var(--kr-space-5); }

/* Info stays a quiet tint deliberately — see its icon rule further down. --warn and --danger were
   declared here too in the same quiet color-mix, and again below at full strength; the second pair won
   on order alone, so these two were dead and said the opposite of what the component actually drew.
   Removed rather than reconciled: the loud pair below carries the icon treatment as well, and that is
   what makes those two states readable at a glance. */
.kr-statusband--info {
  background: color-mix(in srgb, var(--kr-color-info) 7%, var(--kr-color-surface));
  border-color: color-mix(in srgb, var(--kr-color-info) 22%, transparent);
}
.kr-statusband__note:last-child { margin-bottom: 0; }
/* The licence's band, above the trail on every organisation page (fragments/licence.html). */
.kr-licenceband { margin-bottom: var(--kr-space-4); }
.kr-statusband__icon {
  flex: none;
  box-sizing: content-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  padding: var(--kr-space-2);
  border-radius: var(--kr-radius-round);
}
.kr-statusband__icon .kr-icon { width: 1.25rem; height: 1.25rem; }
.kr-statusband__title { font-weight: 600; margin-bottom: var(--kr-space-1); }
.kr-statusband__note {
  color: var(--kr-color-text-muted);
  font-size: var(--kr-font-body);
  line-height: 1.5;
}
/* An action under a status band (e.g. "go to the open run") sits a step below the note. */
.kr-statusband__actions { margin-top: var(--kr-space-3); }
/* Warn (amber): a placeholder pack in force, a licence expiring soon. */
.kr-statusband--warn {
  background: var(--kr-color-warning-bg);
  border-color: var(--kr-color-warning);
}
.kr-statusband--warn .kr-statusband__icon {
  background: var(--kr-color-warning);
  color: var(--kr-color-warning-contrast);
}
/* Ok (green): done and settled, such as a past audit checked against its report and taken on. */
.kr-statusband--ok {
  background: var(--kr-color-success-bg);
  border-color: color-mix(in srgb, var(--kr-color-success) 35%, transparent);
}
.kr-statusband--ok .kr-statusband__icon {
  background: var(--kr-color-success);
  color: var(--kr-color-surface);
}
/* Danger (red): a lapsed licence. */
.kr-statusband--danger {
  background: var(--kr-color-danger-bg);
  border-color: var(--kr-color-danger);
}
.kr-statusband--danger .kr-statusband__icon {
  background: var(--kr-color-danger);
  color: var(--kr-color-danger-contrast);
}
/* Info (calm white card, blue badge): nothing installed yet — reads as a next step, not an error. */
.kr-statusband--info .kr-statusband__icon {
  background: var(--kr-color-info-bg);
  color: var(--kr-color-accent);
}

.kr-tags { display: flex; gap: var(--kr-space-2); }
.kr-note-muted { color: var(--kr-color-text-muted); font-size: var(--kr-font-md); }

/* Text a service wrote, with the line breaks it wrote and nothing read as markup. The notification
   write-up is the first user of it: an import's account is a paragraph and a list of rows, and
   collapsing that to one run-on line loses the list. */
.kr-pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.kr-muted {
  color: var(--kr-color-text-faint);
}

.kr-form__error {
  display: flex;
  align-items: flex-start;
  gap: var(--kr-space-2);
  margin: 0 0 var(--kr-space-4);
  padding: var(--kr-space-3);
  border-radius: var(--kr-radius);
  font-size: var(--kr-font-md);
  line-height: 1.4;
}

/* A small alert glyph so an error reads as an error at a glance, not just red text. Inline SVG mask
   so it takes the danger colour like the text (no separate icon markup in every template). */
.kr-form__error::before {
  content: "";
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.05rem;
  background: currentColor;
  -webkit-mask: var(--kr-icon-alert) center / contain no-repeat;
  mask: var(--kr-icon-alert) center / contain no-repeat;
}

.kr-field__hint {
  display: block;
  margin-top: var(--kr-space-1);
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
}

/* How much of a capped field is used, under its right edge: "4/10". Sits opposite the hint rather than under
   it, because it is a running total rather than something to read. Any field with a maxlength can opt in with
   data-kr-count; it is not a code-only thing. It fills in at the limit so hitting the cap is felt, not just
   discovered when typing stops doing anything. */
.kr-field__count {
  display: block;
  margin-top: var(--kr-space-1);
  font-size: var(--kr-font-xs);
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--kr-color-text-faint);
}
.kr-field__count--full {
  color: var(--kr-color-text-muted);
  font-weight: 600;
}

/* Readable first, decorative second. At 11px in a pill this was the smallest type in the product and
   the hardest to read, which is the wrong way round for something that carries a record's *state* —
   "Settled" against "Awaiting authorisation" is a distinction somebody has to make at a glance down a
   column. 12.5px, a little more room inside the pill, and the neutral one takes full text colour
   rather than muted grey. */
.kr-badge {
  display: inline-block;
  flex: none;
  padding: 0.2rem 0.6rem;
  border-radius: var(--kr-radius-pill);
  font-size: var(--kr-font-sm);
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  background: var(--kr-color-control);
  color: var(--kr-color-text);
  vertical-align: middle;
}

/* --ok, --info, --warn and --danger take the status tones, below. */

/* Three states a person's account can be in, and they should not look alike.
 *
 *   --ok    active, and nothing to do
 *   --warn  something is holding it up and somebody can clear it — a dormancy lock
 *   --off   switched off on purpose, by a person, and it stays off until a person says otherwise
 *
 * --off was amber, which read as an alarm. A disabled account is not an alarm; it is a decision that
 * was taken and is working as intended. Amber now belongs to the state that actually wants attention. */
.kr-badge--off { background: var(--kr-color-control); color: var(--kr-color-text-muted); }

/* Waiting on somebody. Its own colour, not --off and not --warn: evidence sitting with audit, or an
 * appetite statement sitting with the board, is neither switched off nor a problem, it is simply not
 * yet decided, and a pending badge that looked like an alarm would have every queue in the product
 * reading as a fault. */
.kr-badge--pending { background: var(--kr-color-control); color: var(--kr-color-pending); }

/* A refusal, --danger, is with the status tones below. It had been declared on its own in the audit
   section, five hundred lines from the badges it belongs with — the sort of thing that gets redefined
   by the next person who searches for it and finds nothing nearby. */

/* A rating band, as a badge: the residual rating in a register row, the band in an assessment's history.
   The label inside is the band's name — "High", never a blank pill — and usually its score as well
   ("High · 16"), because colour is never the only signal (STANDARDS.md 10.11): the register has to read on
   a black-and-white board pack and to somebody who does not separate orange from red.

   One modifier per band, each spelled out, so TemplateConventionTest can see every class a template uses.
   A template that builds "kr-badge--band-" + band at render time is a class the test cannot check.

   A heat map's cell (.kr-heat--*) is the same band in the same colours, so it shares the rule. */
.kr-badge--band-low, .kr-heat--low { background: var(--kr-color-band-low-bg); color: var(--kr-color-band-low); }
.kr-badge--band-medium, .kr-heat--medium { background: var(--kr-color-band-medium-bg); color: var(--kr-color-band-medium); }
.kr-badge--band-high, .kr-heat--high { background: var(--kr-color-band-high-bg); color: var(--kr-color-band-high); }
.kr-badge--band-extreme, .kr-heat--extreme { background: var(--kr-color-band-extreme-bg); color: var(--kr-color-band-extreme); }

/* The states a KRI reading or a management action is in, where it is not simply ok or pending. The word in
   the badge — "Breach", "Overdue 12 days", "Validated" — is the fact; the colour is the quick glance. */
.kr-badge--breach { background: var(--kr-color-danger-bg); color: var(--kr-color-breach); }
.kr-badge--overdue { background: var(--kr-color-warning-bg); color: var(--kr-color-overdue); }
.kr-badge--validated { background: var(--kr-color-success-bg); color: var(--kr-color-validated); }

.kr-badge__sign {
  margin-right: 0.15rem;
  font-weight: 700;
  /* Tabular so a + and a − take the same width and the labels line up down the column. */
  font-variant-numeric: tabular-nums;
}

/* The run's state as a pill: an icon that codes the state beside a normal-weight label, not the tiny all-caps
   badge. Colour follows the state (draft neutral, pending amber, approved blue, posted green), reusing the
   badge palette. Debuts in the run review's page head. */
.kr-runstatus {
  display: inline-flex;
  align-items: center;
  gap: var(--kr-space-1-5);
  padding: var(--kr-space-1) var(--kr-space-3);
  border-radius: var(--kr-radius-pill);
  font-size: var(--kr-font-body);
  font-weight: 500;
  background: var(--kr-color-bg);
  color: var(--kr-color-text-muted);
}
.kr-runstatus .kr-icon { width: 1rem; height: 1rem; }

/* The status tones: a status's pale ground with its own colour on it. A badge, a run's state, the
   chip on a toast or a confirm, a marker on the audit trail and a few panels all say "this went
   well", "this needs a look", "for your information" or "this failed" the same way, so the pairing is
   written once per status and each of them is listed here. After the base rules of these components,
   so a single-class one (.kr-runstatus--posted over .kr-runstatus) still wins over its base. */
.kr-badge--ok,
.kr-runstatus--posted,
.kr-statusband__icon,
.kr-stat--net .kr-stat__icon,
.kr-statusframe--success .kr-statusframe__legend,
.kr-steps--wizard .kr-steps__item--done::before,
.kr-toast--success .kr-toast__icon,
.kr-confirm--success .kr-confirm__icon,
.kr-upload__item.is-ready .kr-upload__kind,
.kr-audit__entry--created .kr-audit__marker,
.kr-audit__entry--authorised .kr-audit__marker {
  background: var(--kr-color-success-bg);
  color: var(--kr-color-success);
}
.kr-badge--warn,
.kr-runstatus--pending,
.kr-confirm__icon,
.kr-confirm--warning .kr-confirm__icon,
.kr-statusframe--pending .kr-statusframe__legend,
.kr-toast--warning .kr-toast__icon,
.kr-answer__stale {
  background: var(--kr-color-warning-bg);
  color: var(--kr-color-warning);
}
.kr-badge--info,
.kr-runstatus--approved,
.kr-statusframe--info .kr-statusframe__legend,
.kr-toast--info .kr-toast__icon,
.kr-confirm--info .kr-confirm__icon,
.kr-confirm--question .kr-confirm__icon,
.kr-audit__entry--edited .kr-audit__marker {
  background: var(--kr-color-info-bg);
  color: var(--kr-color-info);
}
.kr-badge--danger,
.kr-form__error,
.kr-stat--attention .kr-stat__icon,
.kr-toast--error .kr-toast__icon,
.kr-confirm--error .kr-confirm__icon,
.kr-audit__entry--reversed .kr-audit__marker,
.kr-audit__entry--deleted .kr-audit__marker {
  background: var(--kr-color-danger-bg);
  color: var(--kr-color-danger);
}

.kr-fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

.kr-permgroup { margin-top: var(--kr-space-3); }
.kr-permgroup__title {
  margin: 0 0 var(--kr-space-2);
  font-size: var(--kr-font-sm);
  font-weight: 600;
  color: var(--kr-color-text-muted);
}

/* Checkboxes & radios — one control drawn ourselves. Works with plain markup:
   <label class="kr-check"><input type="checkbox"><span>Label</span></label>. The native input is
   restyled with appearance:none and the tick/dot is its ::before, so no extra wrapper is needed. */
.kr-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(14rem, 100%), 1fr));
  gap: var(--kr-space-2) var(--kr-space-4);
}

/* The words of a choice are its label: they name it, and clicking them toggles it. So they follow their
   control exactly as a field's label follows its input, quiet at rest and full strength when the reader is
   on it. They were fixed at full strength before, which is the one state that says nothing: a column of
   choices read as a wall of equally loud text, and pointing at one gave no answer back.
   Ticked counts as well as hovered: a chosen option is not resting. */
.kr-check {
  display: inline-flex;
  align-items: center;
  gap: var(--kr-space-2);
  cursor: pointer;
  font-size: var(--kr-font-body);
  /* Stated rather than inherited. The body line-height gives the label a line box much taller than the
     1.1rem control, and centring a tall box against a short one leaves the words reading low against
     the tick — the text is optically centred inside its own line box, which sits below the box's
     middle. 1.35 brings the line box close to the control's height, so "centred" looks centred. */
  line-height: 1.35;
  color: var(--kr-color-text-muted);
  user-select: none;
  transition: color var(--kr-transition);
}

.kr-check:hover,
.kr-check:focus-within,
.kr-check:has(input:checked) { color: var(--kr-color-text); }

/* A CHOICE THAT CARRIES AN EXPLANATION.
 *
 * .kr-check above is one line: a box and its words, centred against each other. Put a description in
 * as a third child and all three land on the same row — so a role's name and its description sit side
 * by side, wrap independently, and collide. On a user screen "Chief risk officer" broke over two
 * lines while "Approves appetite and reads every register" broke over two more, beside it.
 *
 * A grid instead: the box in the first column spanning both rows, the name above its description in
 * the second. No extra markup, because the fix has to be reachable from the templates that already
 * have this shape.
 *
 * TWO CLASSES IN THE SELECTOR, DELIBERATELY. .kr-check--strong sets display: flex and is declared
 * further down this file, so at equal specificity it wins on order and a described choice that is also
 * strong silently reverts to one row — which is precisely how it looked on the user screen. Matching
 * on .kr-check as well outranks it whatever the order, so this cannot be undone by somebody moving a
 * block. The same trap took .kr-steps--wizard earlier and is worth only falling into once.
 */
.kr-check.kr-check--described {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  /* Beside a taller neighbour the label is stretched to the row's height, and its two rows shared the
     extra: the hint drifted away from its name. Packed at the top, the pair stays one thought. */
  align-content: start;
  gap: 0 var(--kr-space-2);
}

/* Centred on the FIRST LINE of the label, not on the block.
 *
 * align-items: start puts the control on the block's top edge, which is above the middle of the first
 * line — so the name reads low against its tick. The nudge is half the difference between the line box
 * (0.875rem x 1.35 = 1.18rem) and the control (1.1rem). Small, and it is the whole difference between
 * "aligned" and "very slightly wrong in a way nobody can name". */
.kr-check--described > input { margin-top: 0.04rem; }

/* Second column, second row — without this the hint would fall under the checkbox.
 *
 * Weight reset explicitly: .kr-check--strong bolds the whole label, and a description inherits it. A
 * bold hint under a bold name is two things shouting and no hierarchy between them — the point of the
 * hint is that it is the quieter half.
 *
 * Tighter leading than body text and a hair of space above it: a name and its explanation are one
 * thought, and they should sit closer to each other than to the next choice down. Loose leading here
 * made the pair read as two unrelated lines that happened to be adjacent. */
.kr-check--described > .kr-field__hint {
  grid-column: 2;
  margin-top: 0.15rem;
  font-weight: 400;
  line-height: 1.4;
}


/* Wider columns, for a list whose options carry descriptions.
 *
 * The default .kr-checks fills as many 14rem columns as fit, which is right for a wall of short labels
 * (a permission grid) and too narrow the moment each choice has a sentence under it — the description
 * wraps three times and the block stops reading as a pair.
 *
 * 17rem rather than a fixed column count, so the row count follows the space instead of being decided
 * here: three across a full-width card, two on a narrower one or a split screen, one on a phone. A
 * fixed "three" would be three squeezed columns on a laptop at 1280 and a wasted half-screen on a
 * wide monitor.
 *
 * Row gap is the larger one — each choice is two lines now, so the air between choices has to beat the
 * air between a name and its own description, or the list reads as one continuous block. */
.kr-checks--described {
  grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr));
  gap: var(--kr-space-4) var(--kr-space-5);
}

/* Fewer, wider columns — two across a full-width card instead of three.
 *
 * For a list whose descriptions are sentences rather than names. "Record management actions and
 * submit evidence for validation" over a 17rem column breaks three times and the choice stops reading as one
 * block; the permission groups on the role screen are all like that. A list of role names is not,
 * which is why this is a second modifier rather than a change to the one above. */
/* min(26rem, 100%), not 26rem. A bare minimum in minmax() is a floor the column will not go below even
   when the window is narrower than it — so on a 390px phone this asked for 416px, got it, and pushed
   the whole form grid off the right-hand edge. It was clipped rather than scrollable, because .kr-app
   is overflow:hidden, so half the permission labels were simply not on the screen and nothing said so.
   The 100% lets the column collapse to whatever there is. */
.kr-checks--wide { grid-template-columns: repeat(auto-fill, minmax(min(26rem, 100%), 1fr)); }

.kr-check input[type="checkbox"],
.kr-check input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  display: inline-grid;
  place-content: center;
  border: 1.5px solid var(--kr-color-control-border);
  /* A shade tighter than a card's corner, because the box is 1.1rem: the full radius on something this
     small reads as a circle. Same calc the colour swatch uses, so the two stay in step. */
  border-radius: var(--kr-radius-inner);
  /* Same fill as the text controls: an unticked box is a control at rest, and a white one sitting in
     a column of filled fields reads as already-actioned. */
  background: var(--kr-color-control);
  cursor: pointer;
  transition: background var(--kr-transition), border-color var(--kr-transition);
}

.kr-check input[type="radio"] { border-radius: var(--kr-radius-round); }

/* Hover the whole choice, not just the box. Clicking the words toggles it, so the words are part of the
   control, and lighting up only for the 1.1rem square meant pointing at a checkbox the way you point at a
   text input (anywhere on it) gave no answer at all. A text field lights wherever you point at it; so does
   this now. Checked boxes stay accent-filled, and a disabled one never lights. */
.kr-check:hover input:not(:checked):not(:disabled) {
  background: var(--kr-color-control-hover);
  border-color: var(--kr-color-control-border-hover);
}

.kr-check input:checked {
  background: var(--kr-color-accent);
  border-color: var(--kr-color-accent);
}

.kr-check input[type="checkbox"]::before {
  content: "";
  width: 0.32rem;
  height: 0.6rem;
  border: solid var(--kr-color-accent-contrast);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-8%);
  opacity: 0;
}

.kr-check input[type="radio"]::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--kr-radius-round);
  background: var(--kr-color-accent-contrast);
  opacity: 0;
}

.kr-check input:checked::before { opacity: 1; }

/* Keyboard focus is an outline sitting just clear of the box — the same treatment the fields take, and
   the same "no blur" reading. */
.kr-check input:focus-visible {
  outline: 2px solid var(--kr-color-text);
  outline-offset: 2px;
}

.kr-check input:disabled { opacity: 0.5; cursor: not-allowed; }
.kr-check:has(input:disabled) { cursor: not-allowed; color: var(--kr-color-text-faint); }

/* The "all units" master, on its own line above the finer choices. */
.kr-check--strong {
  display: flex;
  font-weight: 600;
  margin-bottom: var(--kr-space-3);
}

/* A muted "select all shown" convenience row, spanning the full width above the checkboxes. */
.kr-check--muted {
  grid-column: 1 / -1;
  color: var(--kr-color-text-muted);
  font-size: var(--kr-font-md);
}

/* A list dimmed while "all units" is on — its individual choices no longer apply. */
.kr-checks[data-kr-disabled] { opacity: 0.5; }

/* A cell that stays on one line and trails off with an ellipsis; the full text sits in its title. */
.kr-cell-ellipsis {
  display: block;
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A table of rules whose text runs long (a matrix's band definitions, an indicator's thresholds), so
   rows align to the top. */
.kr-table--bands td { vertical-align: top; }

/* Fixed-layout table: columns take their assigned width step (the scale below) instead of sizing to their
   content, so a long value truncates (with .kr-cell-ellipsis) rather than stretching the column, the money
   columns line up, and the whole table scrolls sideways inside its datatable wrap. width:max-content holds
   the columns at their set widths on a narrow viewport (so it scrolls) while min-width:100% lets them share
   the slack when the screen is wide. Runtime resize (the grips) overrides individual widths.

   Deliberately this way round, and not width:100% + min-width:max-content. That pair asks the table how
   wide its content wants to be while its content is being sized from the table's own width — a loop. Chrome
   picks an answer; Firefox unwinds it to its widest legal coordinate and the table lays out about 17 million
   pixels across, one column per two million, so every column past the first sits off-screen and the page
   looks empty. Sizing from max-content and treating 100% as the floor asks the same question in an order
   that has an answer. */
.kr-table--fixed { table-layout: fixed; width: max-content; min-width: 100%; }

/* Centralised column-width scale — one small vocabulary every table composes from, so widths live in one
   place and the stylesheet does not grow a new block per table. Tag each <col> with a step. */
/* One step below xs, for a column whose whole content is a serial number: 3rem holds "100" with the
   cell padding and nothing wider ever goes there. xs at 5rem was the narrowest step and it took a
   third of a modal's width to show a 1. */
.kr-col--2xs { width: 3rem; }
.kr-col--xs { width: 5rem; }
.kr-col--sm { width: 7.5rem; }
.kr-col--md { width: 10rem; }
.kr-col--lg { width: 14rem; }
.kr-col--xl { width: 20rem; }

/* A cell that must not wrap (dates, short codes). */
.kr-nowrap { white-space: nowrap; }

/* Read out, not drawn: a table's caption when the card title already says it on screen. */
.kr-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Only for a browser without JavaScript: the button of a form that sends itself when a choice changes
   (data-kr-autosubmit). */
.kr-js .kr-nojs-only { display: none; }

/* Password field with a reveal toggle (initPasswordToggles wraps the input). */
.kr-field__control { position: relative; display: flex; }
.kr-field__control .kr-field__input { flex: 1; padding-right: calc(var(--kr-space-8) + var(--kr-space-2)); }

.kr-field__reveal {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 2.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: var(--kr-radius);
  color: var(--kr-color-text-faint);
  cursor: pointer;
}

.kr-field__reveal:hover { color: var(--kr-color-text); }
.kr-field__reveal:focus-visible { outline: 2px solid var(--kr-color-accent); outline-offset: -2px; }
.kr-field__reveal svg { width: 1.1rem; height: 1.1rem; }

/* Topbar user menu ------------------------------------------------------ */
.kr-user { position: relative; }

.kr-user__trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--kr-space-2);
  flex: none;
  padding: var(--kr-space-1) var(--kr-space-2) var(--kr-space-1) var(--kr-space-1);
  border: none;
  background: none;
  border-radius: var(--kr-radius);
  color: var(--kr-color-text);
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.kr-user__trigger:hover,
.kr-user.is-open .kr-user__trigger { background: var(--kr-color-bg); }

.kr-user__avatar {
  flex: none;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: var(--kr-radius-round);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--kr-color-accent-soft);
  color: var(--kr-color-accent);
  font-size: var(--kr-font-sm);
  font-weight: 700;
}

.kr-user__name { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* A dropdown caret: the chevron icon points right, so rotate it to point down when closed and up when
   open, the way a menu caret should read (not sideways). */
.kr-user__caret { display: inline-flex; color: var(--kr-color-text-faint); transition: transform var(--kr-transition); transform: rotate(90deg); }
.kr-user__caret svg { width: 0.9rem; height: 0.9rem; }
.kr-user.is-open .kr-user__caret { transform: rotate(-90deg); }

.kr-user__menu {
  position: absolute;
  right: 0;
  top: calc(100% + var(--kr-space-1-5));
  min-width: 14rem;
  width: max-content;
  max-width: 20rem;
  padding: var(--kr-space-2);
  background: var(--kr-color-surface-raised);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  box-shadow: var(--kr-shadow-lg);
  z-index: var(--kr-z-menu);
}

.kr-user__ident { padding: var(--kr-space-2) var(--kr-space-3) var(--kr-space-2); border-bottom: var(--kr-border); margin-bottom: var(--kr-space-1); }
.kr-user__ident-label { font-size: var(--kr-font-xs); color: var(--kr-color-text-faint); }
.kr-user__ident-name { font-size: var(--kr-font-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kr-user__ident-sub { font-size: var(--kr-font-xs); color: var(--kr-color-text-muted); }

.kr-user__menuitem {
  display: flex;
  align-items: center;
  gap: var(--kr-space-2);
  width: 100%;
  padding: var(--kr-space-1-5) var(--kr-space-3);
  border: none;
  background: none;
  border-radius: var(--kr-radius);
  color: var(--kr-color-text);
  font: inherit;
  font-size: var(--kr-font-md);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.kr-user__menuitem:hover { background: var(--kr-color-bg); }
.kr-user__menuitem svg { width: 1rem; height: 1rem; color: var(--kr-color-text-muted); }
.kr-user__menu form { margin: 0; }

.kr-user__menuitem--disabled { color: var(--kr-color-text-faint); cursor: default; }
.kr-user__menuitem--disabled:hover { background: none; }
.kr-user__menuitem--disabled .kr-nav__soon { margin-left: auto; }

/* Choices — a small row of cards, one of which is on ---------------------------
   For a setting with two or three answers where each one can be *shown*: a text size that samples
   itself, a theme that shows its own colours. A radio group would be correct and would say nothing —
   the whole reason to spend this much room on three options is that the option is a picture of its own
   effect, which is what makes it choosable without reading. */
/* A list of places to go, each with a sentence saying what is there. For a hub screen: two words on
   their own ("Organisation", "Password") are not enough to tell somebody whether the thing behind the link
   changes what only they see or what everybody sees.

   Rows rather than a grid of tiles, because the note is the point and a note wants a line length. */
.kr-linklist {
  display: flex;
  flex-direction: column;
}

.kr-linklist__item {
  display: flex;
  align-items: flex-start;
  gap: var(--kr-space-3);
  padding: var(--kr-space-3);
  border-radius: var(--kr-radius);
  color: inherit;
  text-decoration: none;
  transition: background var(--kr-transition);
}
/* --kr-color-control-face, not the --kr-color-surface-sunken this first reached for: that token does
   not exist, so the hover silently did nothing. An undefined custom property is not an error, it is
   just a rule that never applies, which is the failure mode custom properties are worst at. */
.kr-linklist__item:hover,
.kr-linklist__item:focus-visible {
  background: var(--kr-color-control-face);
}

/* A separator between rows but not above the first, so the list reads as one block. */
.kr-linklist__item + .kr-linklist__item {
  border-top: 1px solid var(--kr-color-border);
  border-radius: 0;
}

/* --split: the same rows, two across.

   For a list that is an index rather than a sequence. Four destinations stacked one per line down a
   wide screen is a column of text with most of the card empty beside it, and the eye travels the
   whole height to find the one it wants. Two across halves that and still leaves room for the
   sentence under each title, which is the part that makes these rows worth having.

   auto-fit rather than a fixed 2, and the floor is min(…, 100%) like every other grid in this file:
   these are rem, so choosing the large text size grows the column, and a pair that fits at the
   default base stops fitting at 18px. On a phone it becomes one per row on its own.

   Each row grows its own border here, because the divider trick above is a vertical-list idea: as a
   grid, "the item before me" is the one to my left as often as the one above, so a top border lands
   in the middle of a row. */
.kr-linklist--split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr));
  gap: var(--kr-space-3);
}
.kr-linklist--split .kr-linklist__item,
.kr-linklist--split .kr-linklist__item + .kr-linklist__item {
  border: 1px solid var(--kr-color-border);
  border-radius: var(--kr-radius);
}

.kr-linklist__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--kr-radius);
  background: var(--kr-color-accent-soft);
  color: var(--kr-color-accent);
}
.kr-linklist__icon svg { width: 1.15rem; height: 1.15rem; }

.kr-linklist__body { flex: 1; min-width: 0; }

.kr-linklist__title {
  display: block;
  font-weight: 600;
}

.kr-linklist__note {
  display: block;
  margin-top: 0.15rem;
  color: var(--kr-color-text-muted);
  font-size: var(--kr-font-sm);
  line-height: 1.45;
}

/* The chevron sits with the title rather than centred on the whole row: on a phone the note wraps to
   three lines and a vertically centred arrow ends up pointing at the middle of a paragraph. */
.kr-linklist__go {
  flex: none;
  color: var(--kr-color-text-faint);
}
/* An arrow that points right, rather than a chevron rotated to. The chevron is drawn pointing down
   for a dropdown, and rotating it landed pointing up in the rendered page: the sort of thing that
   looks fine in the CSS and wrong in a screenshot. */
.kr-linklist__go svg {
  width: 1.1rem;
  height: 1.1rem;
}

.kr-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr));
  gap: var(--kr-space-3);
}

.kr-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--kr-space-1);
  padding: var(--kr-space-4);
  border: var(--kr-border);
  border-radius: var(--kr-radius-lg);
  background: var(--kr-color-surface);
  color: var(--kr-color-text);
  font: inherit;
  line-height: var(--kr-control-line-height);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--kr-transition), background var(--kr-transition);
}
.kr-choice:hover { border-color: var(--kr-color-control-border-hover); }

/* The chosen one is stated twice — a ring and a tinted fill — because a single hairline of accent is
   the first thing lost to a poor monitor in a bright office, which is the exact machine this screen
   exists for. aria-pressed carries it for a screen reader. */
.kr-choice[aria-pressed="true"] {
  border-color: var(--kr-color-accent);
  background: var(--kr-color-accent-soft);
  box-shadow: 0 0 0 1px var(--kr-color-accent);
}

.kr-choice__name { font-weight: 600; }
.kr-choice__note { color: var(--kr-color-text-muted); font-size: var(--kr-font-sm); }

/* Samples its own step, so the card shows the size rather than naming it. In em against the card, not
   the ladder: these are a legend for the sizes, not text set at them. */
.kr-choice__sample { font-size: 1.4em; font-weight: 600; line-height: 1.1; }
.kr-choice__sample--sm { font-size: 1.1em; }
.kr-choice__sample--lg { font-size: 1.8em; }

.kr-choice__swatch {
  width: 100%;
  height: 2.25rem;
  border-radius: var(--kr-radius);
  border: 1px solid var(--kr-color-swatch-border);
}
/* Drawn from the palettes themselves rather than from the current theme's tokens, so each card shows
   what you would get — the dark card stays dark while you are in light mode, which is the only way it
   answers the question it is asking. */
.kr-choice__swatch--light {
  background: linear-gradient(135deg, var(--kr-swatch-light-bg) 0 50%, var(--kr-swatch-light-surface) 50% 100%);
}
.kr-choice__swatch--dark {
  background: linear-gradient(135deg, var(--kr-swatch-dark-bg) 0 50%, var(--kr-swatch-dark-surface) 50% 100%);
}
/* Half of each, which is what "follow the machine" actually means. */
.kr-choice__swatch--system {
  background: linear-gradient(135deg, var(--kr-swatch-light-bg) 0 50%, var(--kr-swatch-dark-surface) 50% 100%);
}

/* A row in the menu that holds a control rather than being one. Same metrics as a menu item so the
   icons line up down the column, but no hover: nothing happens when you point at the row itself. */
.kr-user__menugroup {
  display: flex;
  align-items: center;
  gap: var(--kr-space-2);
  width: 100%;
  padding: var(--kr-space-1-5) var(--kr-space-3);
  font-size: var(--kr-font-md);
}
.kr-user__menugroup svg { width: 1rem; height: 1rem; color: var(--kr-color-text-muted); }
.kr-user__menulabel { white-space: nowrap; }

/* Three A's, ascending, showing what each step does rather than naming it. Pushed to the right of the
   row so the label reads as the setting and the letters as the values. */
.kr-sizepick {
  display: inline-flex;
  align-items: baseline;
  gap: var(--kr-space-0-5);
  margin-left: auto;
  padding: var(--kr-space-0-5);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  background: var(--kr-color-control);
}

.kr-sizepick__step {
  min-width: 1.6rem;
  padding: var(--kr-space-0-5) var(--kr-space-1);
  border: none;
  background: none;
  border-radius: var(--kr-radius-inner);
  color: var(--kr-color-text-muted);
  font: inherit;
  /* Not on the type ladder, and deliberately so: these are a picture of the three sizes rather than
     text set at them. The ladder is what the application is set in; this is a legend for it. */
  font-size: var(--kr-font-xs);
  line-height: 1;
  cursor: pointer;
  transition: background var(--kr-transition), color var(--kr-transition);
}
.kr-sizepick__step--md { font-size: var(--kr-font-md); }
.kr-sizepick__step--lg { font-size: var(--kr-font-lg); }

.kr-sizepick__step:hover { color: var(--kr-color-text); }
.kr-sizepick__step.is-current {
  background: var(--kr-color-surface);
  color: var(--kr-color-accent);
  box-shadow: var(--kr-shadow);
}

/* Appearance — brand colour picker ------------------------------------------
   The native colour input styled as a swatch, a hex field beside it, a row of suggested swatches, and
   a live preview whose components read the accent tokens so they follow the pick in real time. */

.kr-colour {
  display: flex;
  align-items: center;
  gap: var(--kr-space-2);
}

/* The native <input type=color>, stripped of its chrome and shown as a rounded swatch. */
.kr-colour__swatch {
  appearance: none;
  -webkit-appearance: none;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  background: none;
  cursor: pointer;
}
.kr-colour__swatch::-webkit-color-swatch-wrapper { padding: 0; }
.kr-colour__swatch::-webkit-color-swatch { border: none; border-radius: var(--kr-radius-inner); }
.kr-colour__swatch::-moz-color-swatch { border: none; border-radius: var(--kr-radius-inner); }

.kr-colour__hex {
  width: 9rem;
  font-family: var(--kr-font-mono);
  font-size: var(--kr-font-mono-scale);
}

/* Monospace, for anything that is code rather than prose — a formula, a key. Font only, no chrome. */
.kr-mono {
  font-family: var(--kr-font-mono);
  font-size: var(--kr-font-mono-scale);
}

/* Muted secondary text, inline — a category's name beside its code, for instance. */
.kr-text-muted {
  color: var(--kr-color-text-muted);
}

/* A refusal written as a sentence rather than worn as a pill.
 *
 * .kr-badge--danger is right for a short phrase — "No date of birth" — and it is nowrap, so the
 * moment a refusal says what to write instead it becomes one very long pill that stretches the table
 * it sits in. The import preview's refusals grew that sentence on 2026-09-17, because naming the bad
 * value and nothing that would work is not a refusal somebody can act on. So they read as text. */
.kr-text-danger {
  margin: 0;
  font-size: var(--kr-font-sm);
  line-height: 1.45;
  color: var(--kr-color-danger);
}

/* An inline identifier — a component key, a variable name a formula reads. Monospace so it reads as a
   token, not prose; tinted to sit apart from the surrounding text without shouting. */
.kr-code {
  font-family: var(--kr-font-mono);
  font-size: var(--kr-font-mono-scale);
  padding: var(--kr-space-0-5) var(--kr-space-1);
  border-radius: var(--kr-radius-inner);
  background: var(--kr-color-bg);
  border: 1px solid var(--kr-color-border);
  color: var(--kr-color-text);
}

/* A block of code or data, as opposed to a token inside a sentence. An example CSV row, for instance.
 *
 * The design system arrived with .kr-code for inline use and nothing for a block, which is the sort of
 * gap that only appears when a screen finally needs one. TemplateConventionTest caught the first
 * attempt to invent .kr-pre for it.
 *
 * overflow-x on the block itself, because the content is deliberately unwrapped: a CSV row broken
 * across three lines stops looking like a CSV row, which is the whole point of showing it. Scrolling
 * inside its own box is what keeps the page from scrolling sideways (ResponsiveLayoutIT). */
.kr-codeblock {
  margin: var(--kr-space-3) 0 0;
  padding: var(--kr-space-3);
  border-radius: var(--kr-radius);
  background: var(--kr-color-bg);
  border: 1px solid var(--kr-color-border);
  color: var(--kr-color-text);
  font-family: var(--kr-font-mono);
  font-size: var(--kr-font-mono-scale);
  line-height: 1.5;
  overflow-x: auto;
}

/* A read-only value shown where an input would otherwise sit — a field that is fixed and cannot be
   edited (a component's family once chosen). Reads as settled, not as a disabled control. */
.kr-field__static {
  margin: 0;
  padding: var(--kr-space-2) 0;
  font-weight: 600;
  color: var(--kr-color-text);
}

/* A numeric table cell — right-aligned so figures line up on the decimal, the way money should read.
   Stated for a table cell too: `.kr-table th, .kr-table td` sets text-align on an element+class selector,
   which outweighs a bare class, so on its own this rule never reached the cells it was written for. */
.kr-num {
  text-align: right;
}
.kr-table th.kr-num,
.kr-table td.kr-num {
  text-align: right;
}

/* A figure that means something by being where it is, on the number itself. The colour is the second signal,
   never the first — the threshold beside a KRI reading, the word "overdue" beside a count of days, are what
   carry it. Applied to the number rather than the row, because one row can hold a reading in breach and an
   action that is on time.

   These take the SAME tokens as the badges, which is the whole reason the tokens exist. Kasonjola's port
   once gave the badge and the number different tokens for one meaning, and the same figure came out amber
   in a badge and red in a column. A breach is one colour wherever it is shown. */
.kr-num--breach { color: var(--kr-color-breach); }
.kr-num--overdue { color: var(--kr-color-overdue); }
.kr-text-overdue { color: var(--kr-color-overdue); }

/* A figure that has gone out of date — the last KRI reading when the next one was due a month ago. The
   age is always shown in text beside it; this only makes it findable in a long column. A stale reading
   is not a breach and must not look like one: nobody knows yet, and that is a different problem. */
.kr-num--stale { color: var(--kr-color-pending); }

/* A heat map: likelihood down the side, impact along the top, a count of risks in each cell. The audit
   committee's first page, and the one most often printed in black and white — so every cell carries the
   band's name as well as its tint, and the count is the figure. Which band a cell is in comes from the
   organisation's matrix (STANDARDS.md 4.2); the template spells out one modifier per band, never a class
   built from the band's name. Worn on the <td> of an ordinary .kr-table. */
.kr-heat {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 4.5rem;
}
.kr-table td.kr-heat { text-align: center; }
.kr-heat__band {
  display: block;
  font-size: var(--kr-font-xs);
  font-weight: 500;
}
/* A cell's band colours are the badge's, set with .kr-badge--band-*. */

/* Tabs ----------------------------------------------------------------------
   Sections of one page shown one at a time, so a page that holds several things shows one of them.
   Every panel is in the page: with no script they all show, one after another, and the tabs are links
   down to them. main.js hides all but the chosen one and follows the address's #fragment, so a form
   that comes back to #bands opens on Bands. */
.kr-tabs {
  display: flex;
  gap: var(--kr-space-1);
  border-bottom: var(--kr-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.kr-tabs__tab {
  padding: var(--kr-space-2) var(--kr-space-3);
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--kr-color-text-muted);
  font-size: var(--kr-font-md);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--kr-transition), border-color var(--kr-transition);
}
.kr-tabs__tab:hover { color: var(--kr-color-text); }
.kr-tabs__tab.is-active {
  color: var(--kr-color-accent);
  border-bottom-color: var(--kr-color-accent);
  font-weight: 600;
}
.kr-tabs__tab:focus-visible { outline: 2px solid var(--kr-color-accent); outline-offset: -2px; border-radius: var(--kr-radius); }

/* Before main.js: the panel it will choose, and only that one. Otherwise every panel paints, one after
   another, and then all but one vanish and the page shortens under the reader. The script's choice is
   the panel the #fragment names, or holds what it names, else the first; :target says the same before
   any script has run. The panels are the tab root's own children with an id, after the tab bar.
   Gated on .kr-js: with JavaScript off every panel stays, and the tabs are links down to them. */
.kr-js [data-kr-tabs]:not(.is-tabbed):not(:has(:target)) > .kr-tabs ~ [id] ~ [id],
.kr-js [data-kr-tabs]:not(.is-tabbed):has(:target) > .kr-tabs ~ [id]:not(:target):not(:has(:target)) {
  display: none;
}
/* And the first tab lit, as the script will light it. Only where nothing is targeted: which tab answers
   a #fragment is the script's to say, and lighting the wrong one would be worse than lighting none. */
.kr-js [data-kr-tabs]:not(.is-tabbed):not(:has(:target)) .kr-tabs__tab:first-child {
  color: var(--kr-color-accent);
  border-bottom-color: var(--kr-color-accent);
  font-weight: 600;
}
.kr-tabs__count {
  margin-left: var(--kr-space-1);
  color: var(--kr-color-text-faint);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* The organogram ----------------------------------------------------------
   The structure drawn the way the organisation draws it, boxes joined by lines, in either of two
   shapes: top-down, the organisation at the top and each level a row; or sideways, the organisation at
   the left and each level a column, where a long list of directorates stacks down the page. Nested
   lists, so it reads in order to a screen reader and prints as an outline; the lines are borders on
   each item.

   The chart scrolls inside its frame rather than shrinking its boxes, and the frame can be dragged.
   It opens folded below what reports to the organisation (structure/chart.html). */
.kr-orgchart__bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kr-space-2);
  justify-content: space-between;
  margin-bottom: var(--kr-space-3);
}
/* Its buttons only work once main.js has wired them: with scripts off there is no bar at all, and with
   them on its room is kept from the first paint, invisible until it works, so it arriving pushes nothing
   down. Not the hidden attribute, which the base rule makes display: none whatever is said here. */
html:not(.kr-js) .kr-orgchart__bar { display: none; }
.kr-orgchart__bar:not(.is-ready) { visibility: hidden; }
.kr-orgchart__seg {
  display: inline-flex;
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  background: var(--kr-color-surface);
  overflow: hidden;
}
.kr-orgchart__seg button {
  padding: var(--kr-space-1-5) var(--kr-space-3);
  border: 0;
  background: none;
  color: var(--kr-color-text-muted);
  font: inherit;
  font-size: var(--kr-font-sm);
  cursor: pointer;
}
.kr-orgchart__seg button + button { border-left: var(--kr-border); }
.kr-orgchart__seg button:hover { background: var(--kr-color-control-face-hover); color: var(--kr-color-text); }
.kr-orgchart__seg button[aria-pressed="true"] {
  background: var(--kr-color-accent-soft);
  color: var(--kr-color-accent);
  font-weight: 600;
}
.kr-orgchart__seg [data-kr-orgchart-zoom="0"] { min-width: 3.6rem; font-variant-numeric: tabular-nums; }

/* The frame: scrolls both ways, faintly dotted so a dragged chart visibly moves. */
.kr-orgchart {
  max-height: min(70vh, 44rem);
  overflow: auto;
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  background-color: var(--kr-color-bg);
  background-image: radial-gradient(var(--kr-color-border) 1px, transparent 1px);
  background-size: 18px 18px;
  --kr-orgchart-gap: var(--kr-space-6);
  --kr-orgchart-line: var(--kr-color-text-faint);
}
/* With scripts on the frame is a canvas of one height. The chart's shape is each person's choice, kept in
   their browser, and the script folds it and turns it on arrival: sized to its content, the frame grew
   from 480px to 720px under the reader. A canvas that is dragged and zoomed is better one height anyway. */
.kr-js .kr-orgchart { height: min(70vh, 44rem); }
.kr-orgchart.is-draggable { cursor: grab; }
.kr-orgchart.is-dragging { cursor: grabbing; user-select: none; }
.kr-orgchart__canvas {
  display: inline-block;
  min-width: 100%;
  padding: var(--kr-space-6) var(--kr-space-6) var(--kr-space-8);
  box-sizing: border-box;
}
.kr-orgchart ul { margin: 0; padding: 0; list-style: none; }
.kr-orgchart ul[hidden] { display: none; }

/* Top-down: each row of siblings under a line across their tops, a drop from it to each box. */
.kr-orgchart--down ul { position: relative; display: flex; justify-content: center; padding-top: var(--kr-orgchart-gap); }
.kr-orgchart--down .kr-orgchart__tree { padding-top: 0; }
.kr-orgchart--down li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--kr-orgchart-gap) var(--kr-space-1) 0;
}
.kr-orgchart--down .kr-orgchart__tree > li { padding-top: 0; }
.kr-orgchart--down li::before,
.kr-orgchart--down li::after {
  content: '';
  position: absolute;
  top: 0;
  width: 50%;
  height: var(--kr-orgchart-gap);
  border-top: 1px solid var(--kr-orgchart-line);
}
.kr-orgchart--down li::before { right: 50%; }
.kr-orgchart--down li::after { left: 50%; border-left: 1px solid var(--kr-orgchart-line); }
.kr-orgchart--down li:first-child::before { border-top: 0; }
/* The last box's drop is its curved corner, drawn by ::before; a second, straight drop beside it read
   as a doubled line at the end of every row. */
.kr-orgchart--down li:last-child::after { border: 0; }
.kr-orgchart--down li:last-child::before { border-right: 1px solid var(--kr-orgchart-line); border-top-right-radius: var(--kr-radius); }
.kr-orgchart--down li:first-child::after { border-top-left-radius: var(--kr-radius); }
.kr-orgchart--down li:only-child::before { display: none; }
.kr-orgchart--down li:only-child::after { border-top: 0; border-radius: 0; }
.kr-orgchart--down .kr-orgchart__tree > li::before,
.kr-orgchart--down .kr-orgchart__tree > li::after { display: none; }
.kr-orgchart--down ul ul::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  height: var(--kr-orgchart-gap);
  border-left: 1px solid var(--kr-orgchart-line);
}
.kr-orgchart--down .kr-orgnode__toggle { bottom: calc(-1 * var(--kr-space-3)); left: 50%; transform: translateX(-50%); }

/* Sideways: the same lines turned: each column of siblings joined by a line down their left, an arm
   from it to each box. */
.kr-orgchart--side ul {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-left: var(--kr-orgchart-gap);
}
.kr-orgchart--side .kr-orgchart__tree { padding-left: 0; }
.kr-orgchart--side li {
  position: relative;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  padding: var(--kr-space-1) 0 var(--kr-space-1) var(--kr-orgchart-gap);
}
.kr-orgchart--side .kr-orgchart__tree > li { padding-left: 0; }
.kr-orgchart--side li::before,
.kr-orgchart--side li::after {
  content: '';
  position: absolute;
  left: 0;
  width: var(--kr-orgchart-gap);
  height: 50%;
  border-left: 1px solid var(--kr-orgchart-line);
}
.kr-orgchart--side li::before { top: 0; border-bottom: 1px solid var(--kr-orgchart-line); }
.kr-orgchart--side li::after { top: 50%; }
.kr-orgchart--side li:first-child:not(:only-child)::before { border-left: 0; border-bottom: 0; }
.kr-orgchart--side li:first-child:not(:only-child)::after { border-top: 1px solid var(--kr-orgchart-line); border-top-left-radius: var(--kr-radius); }
.kr-orgchart--side li:last-child:not(:only-child)::after { border-left: 0; }
.kr-orgchart--side li:last-child:not(:only-child)::before { border-bottom-left-radius: var(--kr-radius); }
.kr-orgchart--side li:only-child::before { border-left: 0; }
.kr-orgchart--side li:only-child::after { display: none; }
.kr-orgchart--side .kr-orgchart__tree > li::before,
.kr-orgchart--side .kr-orgchart__tree > li::after { display: none; }
.kr-orgchart--side ul ul::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: var(--kr-orgchart-gap);
  border-top: 1px solid var(--kr-orgchart-line);
}
.kr-orgchart--side .kr-orgnode { width: 14rem; align-items: flex-start; text-align: left; }
.kr-orgchart--side .kr-orgnode--root { min-width: 0; }
.kr-orgchart--side .kr-orgnode__toggle { right: calc(-1 * var(--kr-space-3)); top: 50%; transform: translateY(-50%); }

.kr-orgnode {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--kr-space-0-5);
  box-sizing: border-box;
  width: 12.5rem;
  padding: var(--kr-space-2) var(--kr-space-3) var(--kr-space-3);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  background: var(--kr-color-accent-soft);
  box-shadow: var(--kr-shadow);
  text-align: center;
  color: inherit;
  transition: border-color var(--kr-transition), box-shadow var(--kr-transition);
}
.kr-orgnode:hover,
.kr-orgnode:has(.kr-orgnode__name:focus-visible) { border-color: var(--kr-color-accent); }
.kr-orgnode--root { width: auto; min-width: 14rem; max-width: 22rem; background: var(--kr-color-accent-soft); }
/* The top units sit on the tint; the units under them on plain ground, so the levels read apart. */
.kr-orgnode--below { background: var(--kr-color-surface); }
.kr-orgnode:has(> [aria-expanded="true"]:not([hidden])) { border-color: var(--kr-color-accent); }
/* The whole box is the link, so it answers as one: the border and the name take the accent, and the
   name is never underlined, which read as a stray line across a box. */
a.kr-orgnode__name { color: inherit; text-decoration: none; transition: color var(--kr-transition); }
.kr-orgnode:hover a.kr-orgnode__name,
a.kr-orgnode__name:focus-visible { color: var(--kr-color-accent); }
a.kr-orgnode__name:focus-visible { outline: none; }
.kr-orgnode:has(a.kr-orgnode__name:focus-visible) { box-shadow: 0 0 0 2px var(--kr-color-accent); }
/* The name's link covers the whole box; the fold button sits above it. */
a.kr-orgnode__name::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
/* The fold button, on the edge of the box facing what it folds: the count when folded, a minus when
   open. */
.kr-orgnode__toggle {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 1.6rem;
  height: 1.45rem;
  padding: 0 var(--kr-space-2);
  border: 1px solid var(--kr-color-control-border);
  border-radius: var(--kr-radius-pill);
  background: var(--kr-color-surface);
  box-shadow: var(--kr-shadow);
  color: var(--kr-color-text-muted);
  font: inherit;
  font-size: var(--kr-font-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.kr-orgnode__toggle[hidden] { display: none; }
.kr-orgnode__toggle:hover { border-color: var(--kr-color-accent); color: var(--kr-color-accent); }
.kr-orgnode__toggle[aria-expanded="true"] {
  border-color: var(--kr-color-accent);
  background: var(--kr-color-accent);
  color: var(--kr-color-accent-contrast);
}
.kr-orgnode__kind {
  color: var(--kr-color-text-muted);
  font-size: var(--kr-font-xs);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.kr-orgnode__name { font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.kr-orgnode__head { color: var(--kr-color-text-muted); font-size: var(--kr-font-sm); line-height: 1.3; }
.kr-orgnode__head--none { color: var(--kr-color-text-faint); font-style: italic; }

/* A unit's page (structure/unit.html) -------------------------------------
   The units under it as a run of links that wraps; the switch between its own risks and those below
   it sits on the card head's rule, so the chosen tab's underline is that rule rather than a second one. */
/* normal, not the value's pre-line, which turned the line breaks around each link into blank lines. */
.kr-unit__under {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kr-space-1) var(--kr-space-4);
  margin: 0;
  padding: 0;
  list-style: none;
  white-space: normal;
}
/* A rating and the reference it belongs to, side by side in a table cell. */
.kr-unit__top { display: inline-flex; align-items: center; gap: var(--kr-space-2); }
/* On a phone the tabs do not fit beside the title, so the head wraps and they drop under it, still
   standing on the rule. */
.kr-card__head:has(.kr-unit__scope) { flex-wrap: wrap; row-gap: var(--kr-space-2); }
.kr-card__head .kr-unit__scope {
  align-self: flex-end;
  margin-bottom: calc(-1 * var(--kr-space-3) - 1px);
  border-bottom: 0;
}
.kr-unit__figure {
  font-size: var(--kr-font-xl);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-right: var(--kr-space-2);
}
.kr-unit__note { font-size: var(--kr-font-sm); margin: 0; }

/* The risk matrix ---------------------------------------------------------
   The grid is the page the board looks at, so its cells are given room: a score big enough to read
   across a committee room, the band's name under it. Read-only and drafted grids share the size, so a
   draft looks like the matrix it will become. */
.kr-matrixgrid { border-collapse: separate; border-spacing: 3px; }
.kr-matrixgrid thead th { white-space: nowrap; }
.kr-matrixgrid tbody th[scope="row"] { white-space: nowrap; vertical-align: middle; padding-right: var(--kr-space-4); }
.kr-matrixgrid td.kr-heat {
  padding: var(--kr-space-3) var(--kr-space-2);
  min-width: 7rem;
  border-radius: var(--kr-radius);
  vertical-align: middle;
}
.kr-matrixgrid__corner { color: var(--kr-color-text-muted); font-weight: 500; font-size: var(--kr-font-xs); }
.kr-matrixgrid .kr-heat__score { display: block; font-size: var(--kr-font-lg); line-height: 1.2; }

/* A drafted cell: the band to choose, and the score under it. The controls sit on the band's tint, so
   they are drawn as part of the cell rather than as grey boxes laid on top of it; the band's name keeps
   the band's colour while it is being chosen. */
.kr-heat__edit { display: flex; flex-direction: column; gap: var(--kr-space-2); align-items: stretch; }
.kr-heat__edit .kr-select__control {
  background: var(--kr-color-surface);
  border-color: transparent;
  color: inherit;
  font-weight: 600;
  justify-content: center;
}
.kr-heat__edit .kr-select__value { text-align: center; }
.kr-heat__edit .kr-field__input {
  text-align: center;
  font-weight: 600;
  color: inherit;
  background: transparent;
  border-color: currentColor;
  border-style: dashed;
  padding-block: 0.3rem;
}

.kr-matrixsection { scroll-margin-top: var(--kr-space-4); }

/* The heat map ------------------------------------------------------------
   The matrix's grid with the register counted into it. The count is the figure, big enough to read
   across a committee room, and twenty risks in one cell is still two digits; the band and score stay
   under it in the matrix's own small type. A cell keeps its height when it is empty, so the grid does
   not shrink where nothing is. The cell opened is outlined in its own band's colour. */
.kr-heatmap td.kr-heat { height: 4.75rem; }
.kr-heatmap__count {
  display: block;
  min-height: 1.25em;
  font-size: var(--kr-font-2xl);
  font-weight: 700;
  line-height: 1.1;
  color: inherit;
}
/* In the band's colour, not the accent a link in a table otherwise takes: a green count in a red cell
   reads as a different band. The table's link rule leaves the count out; this says what it is instead. */
.kr-table.kr-heatmap a.kr-heatmap__count { color: inherit; text-decoration: none; }
.kr-table.kr-heatmap a.kr-heatmap__count:hover,
.kr-table.kr-heatmap a.kr-heatmap__count:focus-visible { color: inherit; text-decoration: underline 2px; text-underline-offset: 0.15em; }
.kr-heatmap td.is-chosen { box-shadow: inset 0 0 0 2px currentColor; }
.kr-heatmap__chosen { scroll-margin-top: var(--kr-space-4); padding-top: var(--kr-space-4); border-top: var(--kr-border); }
.kr-heatmap__chosenhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--kr-space-3);
  flex-wrap: wrap;
}

/* The heat layout: one hue, light to dark by how many risks are in the cell against the fullest cell,
   in five steps. The hue is the top band's, mixed into the surface, so dark mode gets its own steps from
   its own tokens. The band is still named under the count, so a cell's band is never lost to its heat.
   Named kr-warmth--n rather than an element of kr-heatmap: Thymeleaf reads a pair of double underscores
   in an expression as preprocessing, so a conditional that names two kr-x__y classes fails to parse. */
.kr-warmth--0 { background: var(--kr-color-bg); color: var(--kr-color-text-muted); }
.kr-warmth--1 { background: color-mix(in oklab, var(--kr-color-band-extreme) 12%, var(--kr-color-surface)); color: var(--kr-color-text); }
.kr-warmth--2 { background: color-mix(in oklab, var(--kr-color-band-extreme) 28%, var(--kr-color-surface)); color: var(--kr-color-text); }
.kr-warmth--3 { background: color-mix(in oklab, var(--kr-color-band-extreme) 46%, var(--kr-color-surface)); color: var(--kr-color-text); }
.kr-warmth--4 { background: color-mix(in oklab, var(--kr-color-band-extreme) 68%, var(--kr-color-surface)); color: var(--kr-color-surface); }
.kr-warmth--5 { background: color-mix(in oklab, var(--kr-color-band-extreme) 90%, var(--kr-color-surface)); color: var(--kr-color-surface); }
.kr-heatmap__legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--kr-space-1);
  margin: 0;
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
  font-variant-numeric: tabular-nums;
}
.kr-heatmap__swatch {
  display: inline-block;
  width: 1.75rem;
  height: 0.85rem;
  border-radius: var(--kr-radius);
}

/* The bubble layout: the count in a disc of the band's own colour, its area going with the count (the
   view steps it by the square root). The smallest still holds two digits. */
.kr-table.kr-heatmap a.kr-bubble,
.kr-table.kr-heatmap a.kr-bubble:hover,
.kr-table.kr-heatmap a.kr-bubble:focus-visible {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.2rem;
  border-radius: var(--kr-radius-round);
  font-size: var(--kr-font-md);
  color: var(--kr-color-surface);
  text-decoration: none;
}
.kr-heat--low a.kr-bubble { background: var(--kr-color-band-low); }
.kr-heat--medium a.kr-bubble { background: var(--kr-color-band-medium); }
.kr-heat--high a.kr-bubble { background: var(--kr-color-band-high); }
.kr-heat--extreme a.kr-bubble { background: var(--kr-color-band-extreme); }
.kr-bubble--1 { width: 1.6rem; height: 1.6rem; }
.kr-bubble--2 { width: 2.1rem; height: 2.1rem; }
.kr-bubble--3 { width: 2.6rem; height: 2.6rem; }
.kr-bubble--4 { width: 3.1rem; height: 3.1rem; }
.kr-bubble--5 { width: 3.6rem; height: 3.6rem; }
.kr-heatmap:has(.kr-bubble) td.kr-heat { height: 5.5rem; }

/* Inherent to residual: a drawing in the SVG's own units, which scales to the card. The cells are the
   bands' tints, the arrows and dots the text's colour, each count on a disc of the surface so it reads
   across a line.

   Its words are on the type scale, read as the drawing's units: 11 of them at the 16px base, and
   12.4 at the largest text size. The tightest fit is a two-figure count in a 20-by-14 pill, which
   still clears it, and the row names have 136 units to the left of the grid. */
.kr-moves { overflow-x: auto; }
.kr-moves__drawing { display: block; width: 100%; min-width: 34rem; max-width: 56rem; height: auto; }
.kr-moves__band { font-size: var(--kr-font-xs); font-weight: 500; }
/* A cell's band, worn by the group that holds its box and its label. */
.kr-tone--low .kr-moves__cell { fill: var(--kr-color-band-low-bg); }
.kr-tone--medium .kr-moves__cell { fill: var(--kr-color-band-medium-bg); }
.kr-tone--high .kr-moves__cell { fill: var(--kr-color-band-high-bg); }
.kr-tone--extreme .kr-moves__cell { fill: var(--kr-color-band-extreme-bg); }
.kr-tone--low .kr-moves__band { fill: var(--kr-color-band-low); }
.kr-tone--medium .kr-moves__band { fill: var(--kr-color-band-medium); }
.kr-tone--high .kr-moves__band { fill: var(--kr-color-band-high); }
.kr-tone--extreme .kr-moves__band { fill: var(--kr-color-band-extreme); }
.kr-moves__axis { font-size: var(--kr-font-xs); fill: var(--kr-color-text-muted); }
/* Lines half-strength, so where many cross the cells and the numbers stay readable through them; a line
   the mouse is on comes up in the accent, whole. */
.kr-moves__line { fill: none; stroke: var(--kr-color-text); stroke-linecap: round; stroke-opacity: 0.5; }
/* Every arrow says where it leaves and where it lands: a ring at the start, a solid head at the end, both
   whole while the line is half, so the ends read even where lines cross. */
.kr-moves__start { fill: var(--kr-color-surface); stroke: var(--kr-color-text); stroke-width: 1.75; }
.kr-moves__head { fill: var(--kr-color-text); }
/* A wide band along the line, unseen, so a thin arrow is easy to put the pointer on. */
.kr-moves__hit { fill: none; stroke: transparent; stroke-width: 12; pointer-events: stroke; }
/* The light that runs from ring to head on a lit arrow; nothing until then. */
.kr-moves__pulse { fill: none; stroke: none; stroke-linecap: round; pointer-events: none; }
.kr-moves__dot { fill: var(--kr-color-text); }
.kr-moves__dotcount { font-size: var(--kr-font-xs); font-weight: 700; fill: var(--kr-color-surface); pointer-events: none; }
/* A group's count on a pill, not a circle, so it is not read as somewhere an arrow leaves. */
.kr-moves__tag { fill: var(--kr-color-surface); stroke: var(--kr-color-text); stroke-width: 1; }
.kr-moves__tagcount { font-size: var(--kr-font-xs); font-weight: 700; fill: var(--kr-color-text); pointer-events: none; }
.kr-moves__stay:hover .kr-moves__dot { fill: var(--kr-color-accent); }
.kr-moves__arrow:hover .kr-moves__line { stroke: var(--kr-color-accent); stroke-opacity: 1; }
.kr-moves__arrow:hover .kr-moves__start,
.kr-moves__arrow:hover .kr-moves__tag { stroke: var(--kr-color-accent); }
.kr-moves__arrow:hover .kr-moves__head { fill: var(--kr-color-accent); }

/* The heat map's pictures: the bubble heat, the categories, the bands, and the pitch and broadcast
   fields. Drawn by the server as SVG in the drawing's own units, so the sizes here are in those units;
   the drawing scales to the card. Every figure in it is a link that says in words what it opens. The
   type is the scale's, read as those units, so it follows the reader's text size: the counts sit in
   bubbles drawn for them, and the row names have 132 units or more to the left of the field. */
.kr-plot { overflow-x: auto; }
.kr-plot__drawing { display: block; width: 100%; min-width: 34rem; max-width: 60rem; height: auto; }
.kr-plot__field { fill: var(--kr-color-surface); }
.kr-plot--pitch .kr-plot__field { fill: var(--kr-color-pitch); }
.kr-plot--broadcast .kr-plot__field { fill: var(--kr-color-broadcast); }
.kr-plot__stripe { fill: var(--kr-color-pitch-stripe); }
.kr-plot__cell { fill: none; stroke: var(--kr-color-border); stroke-width: 1; }
.kr-plot--pitch .kr-plot__cell { stroke: var(--kr-color-pitch-line); stroke-opacity: 0.3; stroke-dasharray: 4 6; }
.kr-plot--broadcast .kr-plot__cell { stroke: var(--kr-color-pitch-line); stroke-opacity: 0.12; }
/* Where one band meets the next: dashed on the open grid, the pitch's white markings on the fields. */
.kr-plot__edge { stroke: var(--kr-color-text-muted); stroke-width: 1.5; stroke-dasharray: 6 5; stroke-linecap: round; }
.kr-plot--pitch .kr-plot__edge { stroke: var(--kr-color-pitch-line); stroke-width: 3; stroke-dasharray: none; stroke-opacity: 0.92; }
.kr-plot--broadcast .kr-plot__edge { stroke: var(--kr-color-pitch-line); stroke-width: 2; stroke-dasharray: none; stroke-opacity: 0.7; }
.kr-plot__frame { fill: none; stroke: var(--kr-color-border); stroke-width: 1.5; }
.kr-plot--pitch .kr-plot__frame { stroke: var(--kr-color-pitch-line); stroke-width: 3; }
.kr-plot--broadcast .kr-plot__frame { stroke: var(--kr-color-pitch-line); stroke-opacity: 0.35; }
.kr-plot__zone { font-size: var(--kr-font-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; fill: var(--kr-color-text-muted); }
.kr-plot--broadcast .kr-plot__zone { fill: var(--kr-color-pitch-line); fill-opacity: 0.6; }
.kr-plot__axis { font-size: var(--kr-font-xs); fill: var(--kr-color-text-muted); }
.kr-plot__hit { fill: transparent; }
.kr-plot__link:hover .kr-plot__hit,
.kr-plot__link:focus-visible .kr-plot__hit { stroke: var(--kr-color-pitch-line); stroke-width: 3; }
.kr-plot__link:focus-visible { outline: none; }
.kr-plot__bubble { stroke: var(--kr-color-surface); stroke-width: 2; }
.kr-plot__link:hover .kr-plot__bubble,
.kr-plot__link:focus-visible .kr-plot__bubble,
.kr-plot__link:hover .kr-plot__dot,
.kr-plot__link:focus-visible .kr-plot__dot { stroke: var(--kr-color-text); stroke-width: 2.5; }
/* A count in a bubble: white with a dark rim, which reads on any of the colours; dark on the palest
   three steps of the glow. */
.kr-plot__count {
  font-size: var(--kr-font-md);
  font-weight: 700;
  fill: var(--kr-color-plot-label);
  stroke: var(--kr-color-plot-halo);
  stroke-width: 2.5;
  stroke-opacity: 0.45;
  paint-order: stroke;
  pointer-events: none;
}
.kr-plot__count--dark { fill: var(--kr-color-glow-ink); stroke: none; }
.kr-plot__dot { stroke: var(--kr-color-surface); stroke-width: 1.5; }
.kr-tone--low .kr-plot__dot { fill: var(--kr-color-band-low); }
.kr-tone--medium .kr-plot__dot { fill: var(--kr-color-band-medium); }
.kr-tone--high .kr-plot__dot { fill: var(--kr-color-band-high); }
.kr-tone--extreme .kr-plot__dot { fill: var(--kr-color-band-extreme); }
.kr-plot__tick,
.kr-plot__rowline { stroke: var(--kr-color-border); stroke-width: 1; }
.kr-plot__rowlabel { font-size: var(--kr-font-body); font-weight: 700; fill: var(--kr-color-text); }
/* The glow and the series fill a bubble in the drawing and a swatch in the legend under it. */
.kr-glow--1 { fill: var(--kr-color-glow-1); background: var(--kr-color-glow-1); }
.kr-glow--2 { fill: var(--kr-color-glow-2); background: var(--kr-color-glow-2); }
.kr-glow--3 { fill: var(--kr-color-glow-3); background: var(--kr-color-glow-3); }
.kr-glow--4 { fill: var(--kr-color-glow-4); background: var(--kr-color-glow-4); }
.kr-glow--5 { fill: var(--kr-color-glow-5); background: var(--kr-color-glow-5); }
.kr-series--1 { fill: var(--kr-color-series-1); background: var(--kr-color-series-1); }
.kr-series--2 { fill: var(--kr-color-series-2); background: var(--kr-color-series-2); }
.kr-series--3 { fill: var(--kr-color-series-3); background: var(--kr-color-series-3); }
.kr-series--4 { fill: var(--kr-color-series-4); background: var(--kr-color-series-4); }
.kr-series--5 { fill: var(--kr-color-series-5); background: var(--kr-color-series-5); }
.kr-series--other { fill: var(--kr-color-series-other); background: var(--kr-color-series-other); }
/* The field's scale on the field's own colour, since the heat starts clear. */
.kr-plot__scale { width: 10rem; height: 0.6rem; border-radius: var(--kr-radius-sm); }
.kr-plot__scale--pitch { background: var(--kr-color-pitch); }
.kr-plot__scale--broadcast { background: var(--kr-color-broadcast); }
.kr-plot__keys {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kr-space-1) var(--kr-space-4);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
}
.kr-plot__keys li { display: inline-flex; align-items: center; gap: var(--kr-space-2); }
.kr-plot__key { display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: var(--kr-radius-round); }

/* Inherent to residual: the drawing and its table, one under the other, or side by side on a wide
   screen with the drawing kept in view, so a row lit in the table is seen lit in the drawing. */
.kr-moves-layout { display: grid; gap: var(--kr-space-5); }
.kr-moves-layout__drawing { display: grid; gap: var(--kr-space-3); min-width: 0; }
@media (min-width: 80rem) {
  .kr-moves-layout--beside { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
  .kr-moves-layout--beside .kr-moves-layout__drawing { position: sticky; top: calc(var(--kr-topbar-height) + var(--kr-space-3)); }
  .kr-moves-layout--beside .kr-moves__drawing { min-width: 0; }
  .kr-moves-layout--beside .kr-movetable__scroll { max-height: calc(100vh - var(--kr-topbar-height) - 12rem); }
  /* Beside the drawing the table has half the room: what the card or the opened row says anyway goes. */
  .kr-moves-layout--beside .kr-movetable__controls,
  .kr-moves-layout--beside .kr-movetable__owner,
  .kr-moves-layout--beside .kr-movetable__category { display: none; }
  .kr-moves-layout--beside .kr-movetable__track { width: 8rem; }
  .kr-moves-layout--beside .kr-movetable__risk { min-width: 11rem; }
}
/* Too narrow to sit side by side: the choice is not offered. */
@media not all and (min-width: 80rem) { .kr-movetable__beside { display: none; } }

/* A row lit from the drawing, or an arrow lit from the table: the rest step back, and the lit arrow runs
   from where the risks stood to where they stand. */
.kr-moves__arrow,
.kr-moves__stay { transition: opacity var(--kr-transition); }
.kr-moves__drawing.is-lit .kr-moves__arrow:not(.is-lit),
.kr-moves__drawing.is-lit .kr-moves__stay:not(.is-lit) { opacity: 0.12; }
.kr-moves__arrow.is-out,
.kr-moves__stay.is-out { opacity: 0.08; pointer-events: none; }
.kr-moves__arrow.is-lit .kr-moves__line { stroke: var(--kr-color-accent); stroke-opacity: 1; }
.kr-moves__arrow.is-lit .kr-moves__head { fill: var(--kr-color-accent); }
.kr-moves__arrow.is-lit .kr-moves__start { stroke: var(--kr-color-accent); stroke-width: 2.5; }
.kr-moves__arrow.is-lit .kr-moves__tag { stroke: var(--kr-color-accent); stroke-width: 2; }
.kr-moves__arrow.is-lit .kr-moves__pulse {
  stroke: var(--kr-color-surface);
  stroke-opacity: 0.85;
  stroke-width: 2;
  stroke-dasharray: 0.14 1;
  animation: kr-moves-run 1.1s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.kr-moves__stay.is-lit .kr-moves__dot {
  fill: var(--kr-color-accent);
  transform-box: fill-box;
  transform-origin: center;
  animation: kr-moves-pulse 1s ease-in-out infinite;
}
/* From just before the ring to past the head, so the light enters at the start and leaves at the end. */
@keyframes kr-moves-run { from { stroke-dashoffset: 0.14; } to { stroke-dashoffset: -1; } }
@keyframes kr-moves-pulse { 50% { transform: scale(1.25); } }

.kr-movetable { display: grid; gap: var(--kr-space-3); min-width: 0; }
.kr-movetable__choices { display: flex; flex-wrap: wrap; align-items: center; gap: var(--kr-space-2); }
.kr-movetable__gap { width: var(--kr-space-4); }
.kr-movetable__tools { padding: 0; border-bottom: 0; min-height: 0; }
.kr-movetable__show { display: inline-flex; border: var(--kr-border); border-radius: var(--kr-radius-pill); overflow: hidden; }
.kr-movetable__show button {
  padding: var(--kr-space-1) var(--kr-space-3);
  border: 0;
  background: none;
  font: inherit;
  font-size: var(--kr-font-md);
  color: var(--kr-color-text-muted);
  cursor: pointer;
}
.kr-movetable__show button[aria-pressed="true"] { background: var(--kr-color-accent); color: var(--kr-color-surface); }
.kr-movetable__count { margin-left: auto; font-size: var(--kr-font-md); color: var(--kr-color-text-muted); font-variant-numeric: tabular-nums; }
.kr-movetable__none { margin: 0; padding: var(--kr-space-5); text-align: center; color: var(--kr-color-text-muted); }

/* A set height, like the other long tables; the headings stay while the rows scroll under them. */
.kr-movetable__scroll {
  max-height: 28rem;
  overflow: auto;
  border: var(--kr-border);
  border-radius: var(--kr-radius-lg);
  scroll-behavior: smooth;
}
.kr-movetable__scroll .kr-table { margin: 0; }
.kr-movetable__scroll thead th { position: sticky; top: 0; z-index: 2; }
.kr-js .kr-movetable [data-kr-movetable-sort] { cursor: pointer; user-select: none; }
.kr-js .kr-movetable [data-kr-movetable-sort]::after { content: "↕"; margin-left: var(--kr-space-1-5); opacity: 0.35; font-size: var(--kr-font-xs); }
.kr-js .kr-movetable [aria-sort="ascending"]::after { content: "↑"; opacity: 1; }
.kr-js .kr-movetable [aria-sort="descending"]::after { content: "↓"; opacity: 1; }
.kr-js .kr-movetable [data-kr-movetable-sort]:hover { color: var(--kr-color-text); }
.kr-movetable [data-kr-movetable-row],
.kr-movetable__main { transition: background-color var(--kr-transition), box-shadow var(--kr-transition); }
.kr-movetable tr.is-lit,
.kr-movetable tbody.is-lit .kr-movetable__main {
  background: color-mix(in srgb, var(--kr-color-accent) 12%, transparent);
}
.kr-movetable mark { background: color-mix(in srgb, var(--kr-color-band-medium) 45%, transparent); color: inherit; border-radius: var(--kr-radius); }

.kr-movetable__risk { display: grid; gap: var(--kr-space-0-5); min-width: 14rem; }
.kr-movetable--rows .kr-movetable__risk { min-width: 16rem; }
.kr-movetable--track .kr-movetable__risk { max-width: 26rem; }
.kr-movetable__head { display: inline-flex; align-items: center; gap: var(--kr-space-1); }
.kr-movetable__sub { font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }
.kr-movetable__fall { display: inline-flex; align-items: center; gap: var(--kr-space-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.kr-movetable__bar { width: 4rem; height: 0.4rem; }
.kr-movetable__bartrack { fill: var(--kr-color-border); }
.kr-movetable__barfill { fill: var(--kr-color-band-low); transform-origin: left; transform-box: fill-box; }
[data-kr-movetable-row]:hover .kr-movetable__barfill { animation: kr-movetable-grow 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes kr-movetable-grow { from { transform: scaleX(0); } }

/* What the controls rate: a dot in its colour beside the words. */
.kr-movetable__eff { white-space: nowrap; }
.kr-movetable__eff::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: var(--kr-space-1-5);
  border-radius: var(--kr-radius-round);
  background: var(--kr-color-text-faint);
}
.kr-eff--effective::before { background: var(--kr-color-band-low); }
.kr-eff--partly::before { background: var(--kr-color-band-medium); }
.kr-eff--ineffective::before { background: var(--kr-color-band-extreme); }

/* The score track: the bands along a short line, a ring where the risk stood and a dot where it
   stands. Held under the pointer, the line draws itself from one to the other. */
.kr-movetable__journey { display: inline-flex; align-items: center; gap: var(--kr-space-2); white-space: nowrap; }
.kr-movetable__track { width: 12.5rem; height: 1.5rem; flex: none; }
.kr-movetable__zone { opacity: 0.55; }
.kr-movetable__zone.kr-tone--low { fill: var(--kr-color-band-low); }
.kr-movetable__zone.kr-tone--medium { fill: var(--kr-color-band-medium); }
.kr-movetable__zone.kr-tone--high { fill: var(--kr-color-band-high); }
.kr-movetable__zone.kr-tone--extreme { fill: var(--kr-color-band-extreme); }
.kr-movetable__run { fill: none; stroke: var(--kr-color-text); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 1; }
.kr-movetable__before { fill: var(--kr-color-surface); stroke: var(--kr-color-text); stroke-width: 2; }
.kr-movetable__after { fill: var(--kr-color-text); transform-box: fill-box; transform-origin: center; }
.kr-movetable__main:hover .kr-movetable__run,
.is-lit .kr-movetable__run { stroke: var(--kr-color-accent); }
.kr-movetable__main:hover .kr-movetable__after,
.is-lit .kr-movetable__after { fill: var(--kr-color-accent); }
.kr-movetable__main:hover .kr-movetable__before,
.is-lit .kr-movetable__before { stroke: var(--kr-color-accent); }
.kr-movetable__main:hover .kr-movetable__run { animation: kr-movetable-draw 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.kr-movetable__main:hover .kr-movetable__after { animation: kr-movetable-arrive 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes kr-movetable-draw { from { stroke-dashoffset: 1; } }
@keyframes kr-movetable-arrive { 0%, 60% { transform: scale(0); } 85% { transform: scale(1.3); } }

/* A risk's detail under its row: open with scripts off; with them, opened by the row's button, the
   height easing open. */
.kr-movetable__toggle {
  display: none;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: var(--kr-radius-sm);
  background: none;
  color: var(--kr-color-text-muted);
  cursor: pointer;
}
.kr-js .kr-movetable__toggle { display: inline-grid; place-items: center; }
.kr-movetable__toggle:hover { background: var(--kr-color-border); color: var(--kr-color-text); }
.kr-movetable__caret { display: inline-block; font-size: var(--kr-font-xl); line-height: 1; transition: transform var(--kr-transition); }
.kr-movetable__toggle[aria-expanded="true"] .kr-movetable__caret { transform: rotate(90deg); }
.kr-js .kr-movetable__main { cursor: pointer; }
.kr-movetable__detail > td { padding-top: 0; padding-bottom: 0; }
.kr-movetable__open { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.3s ease; }
.kr-js .kr-movetable__open { grid-template-rows: 0fr; }
.kr-js .is-open .kr-movetable__open { grid-template-rows: 1fr; }
.kr-movetable__open > div { overflow: hidden; }
.kr-movetable__detail .kr-moveabout { padding: var(--kr-space-1) 0 var(--kr-space-4) calc(var(--kr-space-6) + var(--kr-space-1)); }

/* What a risk is about: its causes, consequences, controls and owner, in a card or an opened row. */
.kr-moveabout { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: var(--kr-space-3) var(--kr-space-5); font-size: var(--kr-font-md); }
.kr-moveabout__label {
  margin: 0 0 var(--kr-space-0-5);
  font-size: var(--kr-font-sm);
  font-weight: 600;
  letter-spacing: var(--kr-tracking-caps);
  text-transform: uppercase;
  color: var(--kr-color-text-muted);
}
.kr-moveabout__label .kr-movetable__eff { text-transform: none; letter-spacing: 0; font-weight: 500; }
.kr-moveabout__text { margin: 0; }

/* The card a row of risks shows under the pointer: one card, filled from the row it is over. */
.kr-movecard[hidden] { display: none; }
.kr-movecard--floating {
  position: fixed;
  z-index: var(--kr-z-sheet);
  display: grid;
  gap: var(--kr-space-2);
  width: 23rem;
  max-width: calc(100vw - var(--kr-space-8));
  padding: var(--kr-space-4);
  background: var(--kr-color-surface-raised);
  border: var(--kr-border);
  border-radius: var(--kr-radius-lg);
  box-shadow: var(--kr-shadow-lg);
  font-size: var(--kr-font-md);
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  pointer-events: none;
  transition: opacity var(--kr-transition), transform var(--kr-transition);
}
.kr-movecard--floating.is-open { opacity: 1; transform: none; pointer-events: auto; }
.kr-movecard--floating .kr-moveabout { grid-template-columns: 1fr; gap: var(--kr-space-2); }
.kr-movecard--floating .kr-moveabout__text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}
.kr-movecard__ref { margin: 0; font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }
.kr-movecard__title { margin: 0; font-weight: 600; line-height: 1.35; }
.kr-movecard__move { display: flex; flex-wrap: wrap; align-items: center; gap: var(--kr-space-2); margin: 0; }
.kr-movecard__open { justify-self: start; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .kr-moves__arrow.is-lit .kr-moves__pulse,
  .kr-moves__stay.is-lit .kr-moves__dot,
  [data-kr-movetable-row]:hover .kr-movetable__barfill,
  .kr-movetable__main:hover .kr-movetable__run,
  .kr-movetable__main:hover .kr-movetable__after { animation: none; }
  .kr-movetable__scroll { scroll-behavior: auto; }
}

/* One part of a draft, a band or an impact dimension, in its own box: what it is at the top, with
   removing it there too, then its fields, then saving it. Two to a row on a wide screen, since a band
   is short; one to a row for a dimension, whose table needs the width. */
.kr-parts { display: grid; gap: var(--kr-space-4); }
.kr-parts--two { grid-template-columns: repeat(auto-fill, minmax(min(22rem, 100%), 1fr)); }
.kr-part {
  display: flex;
  flex-direction: column;
  gap: var(--kr-space-3);
  padding: var(--kr-space-4);
  border: var(--kr-border);
  border-radius: var(--kr-radius-lg);
  background: var(--kr-color-surface);
}
.kr-part--new { border-style: dashed; background: var(--kr-color-bg); }
.kr-part__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--kr-space-3);
  flex-wrap: wrap;
}
.kr-part__title { display: flex; align-items: center; gap: var(--kr-space-2); flex-wrap: wrap; margin: 0; font-size: var(--kr-font-body); font-weight: 600; }
.kr-part__meta { color: var(--kr-color-text-muted); font-size: var(--kr-font-sm); font-weight: 400; }
.kr-part__fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--kr-space-3); }
.kr-part__fields .kr-field--full { grid-column: 1 / -1; }
.kr-part .kr-form__actions { margin-top: 0; }

/* A table whose cells are fields: the level column only as wide as its words, the name and amount
   columns a set width, and the prose column takes the rest, as a box that grows with what is typed. */
.kr-edittable td { vertical-align: top; }
.kr-edittable .kr-col-level { width: 1%; white-space: nowrap; padding-top: var(--kr-space-4); font-weight: 500; }
.kr-edittable .kr-col-name { width: 13rem; }
.kr-edittable .kr-col-amount { width: 12rem; }
.kr-edittable .kr-field__textarea {
  width: 100%;
  min-height: 2.6rem;
  field-sizing: content;
  resize: vertical;
}
.kr-subhead { margin: 0 0 var(--kr-space-2); font-size: var(--kr-font-body); font-weight: 600; }

/* What each impact level means, read: a level a row, a dimension a column, the shape every risk
   policy prints. Each cell shows the start of what it says and the row opens all of it, so six
   dimensions fit across a screen without each column shrinking to a word a line. */
.kr-criteria td,
.kr-criteria th { vertical-align: top; }
.kr-criteria tbody th[scope="row"] { white-space: nowrap; }
/* Past four or five dimensions the table scrolls sideways; the level stays put, so a cell read at the
   far right still says which level it belongs to. */
.kr-criteria thead th:first-child,
.kr-criteria tbody th[scope="row"] {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--kr-color-surface);
  box-shadow: 1px 0 0 var(--kr-color-border);
}
.kr-criteria tbody tr:hover th[scope="row"] { background: var(--kr-color-bg); }
.kr-criteria td { min-width: 11rem; max-width: 18rem; }
.kr-criteria__amount {
  display: block;
  margin-bottom: var(--kr-space-0-5);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Words cut to a few lines, for a cell whose whole text is a click away. */
.kr-clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
.kr-clamp--2 { -webkit-line-clamp: 2; line-clamp: 2; }
.kr-clamp--1 { -webkit-line-clamp: 1; line-clamp: 1; }

/* --- The risk register ------------------------------------------------------------------------ */

/* A rating as recorded: the score, then the band's name, in the band's colour (.kr-badge--band-*). */
.kr-rating { gap: var(--kr-space-1); font-variant-numeric: tabular-nums; }
.kr-rating__score { font-weight: 700; }

/* Which way a risk moved: up is worse, so it takes the danger colour; down the success colour. */
.kr-trend { display: inline-flex; align-items: center; gap: var(--kr-space-1); font-size: var(--kr-font-sm); }
.kr-trend--up { color: var(--kr-color-danger); }
.kr-trend--down { color: var(--kr-color-success); }
.kr-trend--same { color: var(--kr-color-text-muted); }

/* The key process under a risk's title in the register. */
.kr-register__process { font-size: var(--kr-font-sm); }
.kr-register td { vertical-align: top; }
.kr-register__overdue { margin-left: var(--kr-space-1); color: var(--kr-color-danger); vertical-align: -0.15em; cursor: help; }

/* Where a risk stands now, at the top of its page: four short facts, each label over its value like
   the details under them, and narrow enough columns that all four sit on one row. A rating's badge
   and its "5 × 5" stay side by side. */
.kr-standing { grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 1fr)); margin-bottom: 0; }

/* An indicator's recent readings over its thresholds. The line is ink, recessive; a point carries the
   status colour and names itself in its tooltip; the thresholds are dashed in the status they mark and
   named at their right-hand end. The SVG scales to its column, so it never pushes the page sideways. */
.kr-kri-chart { margin: 0; }
.kr-kri-chart__svg { display: block; width: 100%; height: auto; max-height: 18rem; overflow: visible; }
.kr-kri-chart__grid line { stroke: var(--kr-color-border); stroke-width: 1; }
.kr-kri-chart__tick,
.kr-kri-chart__period,
.kr-kri-chart__label { fill: var(--kr-color-text-muted); font-size: var(--kr-font-xs); }
.kr-kri-chart__tick { text-anchor: end; }
.kr-kri-chart__period { text-anchor: middle; }
.kr-kri-chart__label { font-weight: 600; }
.kr-kri-chart__threshold { fill: none; stroke-width: 1.5; stroke-dasharray: 5 4; }
.kr-kri-chart__threshold--amber { stroke: var(--kr-color-warning); }
.kr-kri-chart__threshold--red { stroke: var(--kr-color-danger); }
.kr-kri-chart__line { fill: none; stroke: var(--kr-color-text-muted); stroke-width: 2; stroke-linejoin: round; }
.kr-kri-chart__point { stroke: var(--kr-color-surface); stroke-width: 2; }
.kr-kri-chart__point--green { fill: var(--kr-color-success); }
.kr-kri-chart__point--amber { fill: var(--kr-color-warning); }
.kr-kri-chart__point--red { fill: var(--kr-color-danger); }
.kr-kri-chart__point--none { fill: var(--kr-color-text-muted); }
/* On a phone the chart is drawn at half size, so its text is set twice as large to read at 10px or so.
   The threshold names give way: the standing band above says them in words. */
@media (max-width: 40rem) {
  .kr-kri-chart__tick,
  .kr-kri-chart__period { font-size: var(--kr-font-3xl); }
  .kr-kri-chart__label { display: none; }
  .kr-kri-chart__point { r: 8px; }
  .kr-kri-chart__line { stroke-width: 3; }
}

/* A reading that has been corrected stays in the list, struck through, beside its correction. */
.kr-kri-reading--corrected td:first-child,
.kr-kri-reading--corrected td:nth-child(2) > span:first-child { text-decoration: line-through; color: var(--kr-color-text-muted); }
.kr-standing .kr-detail__value { display: flex; flex-wrap: wrap; align-items: center; gap: var(--kr-space-2); }

/* Lines the register wrote one per line (causes, controls), as a list that keeps them apart. */
.kr-lines { margin: 0; padding-left: var(--kr-space-4); display: grid; gap: var(--kr-space-1); white-space: normal; }

/* What testing found, beside the assessor's own judgement of the controls: each linked control on a
   line, its name able to wrap, and the finding and its date kept together at the end. */
.kr-tested { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--kr-space-2); }
.kr-tested__item { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--kr-space-1) var(--kr-space-3); }
.kr-tested__name { flex: 1 1 12rem; min-width: 0; font-size: var(--kr-font-body); }
.kr-tested__name .kr-mono { margin-right: var(--kr-space-1); }
.kr-tested__found { display: inline-flex; align-items: baseline; gap: var(--kr-space-2); white-space: nowrap; font-size: var(--kr-font-body); }
/* Under a line, where it stands: an action's state badge and due date. */
.kr-lines__state { display: flex; flex-wrap: wrap; align-items: center; gap: var(--kr-space-2); margin-top: var(--kr-space-1); font-size: var(--kr-font-sm); }

/* Text typed with its own line breaks, kept. */
.kr-pre-line { white-space: pre-line; }

@media (max-width: 48rem) {
  .kr-part__fields { grid-template-columns: minmax(0, 1fr); }
}

/* A card set apart from the one before it — the preview's results below its inputs, for instance. */
.kr-card--spaced {
  margin-top: var(--kr-space-6);
}

/* A one-line input row — "set this threshold from this date" on an indicator. Fields sit in a
   row and wrap on a narrow screen; the button lines up with the inputs' baseline. */
.kr-inline-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kr-space-3);
  align-items: flex-end;
}
.kr-inline-row .kr-field {
  margin: 0;
}
/* A form's buttons start at the left of a column; in a row they sit on the inputs' line instead. */
.kr-inline-row > .kr-btn { align-self: flex-end; }
.kr-line__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--kr-space-3);
  flex-wrap: wrap;
}
.kr-line__head h3 {
  margin: 0;
}

/* A tighter inline row — for a cluster of small actions (End / Remove on a band). */
.kr-inline-row--tight {
  gap: var(--kr-space-2);
}

/* The band effective right now, in a dated timeline — tinted so the live row reads at a glance. */
.kr-row--current td {
  background: var(--kr-color-success-bg);
}

/* A history entry struck from the record (an assessment corrected or withdrawn): still listed, as what
   was recorded, but faded so the entries that count read first. Its badge says which. */
.kr-row--struck td { color: var(--kr-color-text-muted); }
.kr-row--struck .kr-rating { opacity: 0.55; }

/* The row being corrected: tinted so it is clear which history entry the edit form above is bound to. */
.kr-row--editing td {
  background: var(--kr-color-info-bg);
}

/* A wrapper (inside a table cell) holding more than one action (Edit, Remove): keep them on one line with
   an even gap. It sits in a normal <td> — setting display:flex on the cell itself drops table-cell layout
   and makes the row's bottom border render against the buttons, which reads as a stray underline. */
.kr-cell-actions {
  display: flex;
  gap: var(--kr-space-2);
  align-items: center;
  justify-content: flex-end;
}

/* A row of buttons that wraps onto more lines as it fills — a set of "set this up" actions that could be a
   handful or a dozen, so it must not overflow (unlike .kr-cell-actions, which is a couple of row actions). */
/* A row of buttons. It carries no margin of its own, but it does need separating from whatever it
   follows — a paragraph explaining the actions, or a subheading introducing them. Without this the
   buttons sat directly under the last line of text with only the line-height between them, which read
   as part of the sentence. */
.kr-actions-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--kr-space-2);
}
/* Flow spacing inside a card's body.

   Components carry no margins of their own, deliberately — a table should not decide what sits under
   it, and a margin baked into a component is one that has to be fought everywhere it is wrong. The
   consequence is that a card body has to supply the rhythm, and until it did, paragraphs ran into
   button rows and lists started immediately under the sentence introducing them.

   Stated as "every child after the first", not as a list of pairs. Enumerating pairs looks precise and
   is quietly incomplete: the audit list was missed because nobody had thought of a paragraph followed
   by an ordered list, and the next component would have been missed too. */
.kr-card__body > * + * { margin-top: var(--kr-space-4); }

/* A subheading is starting a new thought, so it takes more air above than an ordinary block — and
   nothing extra below, because it belongs to what follows it. */
.kr-card__body > .kr-form__subhead,
.kr-card__body > .kr-form__subnote { margin-top: var(--kr-space-6); }
.kr-card__body > .kr-form__subhead + *,
.kr-card__body > .kr-form__subnote + * { margin-top: var(--kr-space-3); }
.kr-card__body > :first-child { margin-top: 0; }

/* A compact field input for a dense grid cell (a month's KRI readings, a matrix's cells), where a full-size
   input per cell would make every row tall. Same look, smaller padding and type. */
.kr-field__input--sm {
  padding: 0.3rem 0.5rem;
  font-size: var(--kr-font-md);
}

/* A worked example inside an explainer modal: a short heading, a plain-language line, the calculation itself
   (.kr-calc), and a small table so the pattern is concrete. For showing a board member how a net loss or an
   indicator's ratio was arrived at — the figures people most often want the working for. The working is the
   server's, displayed; a band is a lookup on the matrix and never shown as arithmetic. */
.kr-worked { margin-top: var(--kr-space-6); }
.kr-worked__method { margin: 0 0 var(--kr-space-1); font-size: var(--kr-font-lg); font-weight: 600; color: var(--kr-color-text); }
.kr-worked p { margin: 0 0 var(--kr-space-3); color: var(--kr-color-text-muted); font-size: var(--kr-font-body); line-height: 1.5; }
/* Full width of whatever holds it. It was capped at 30rem when it was drawn against an imagined
   two-column working; its first real use in Kasonjola carried five inputs and what they came to, and six
   columns squeezed into 30rem inside a 52rem dialog wrap where the whitespace is. */
.kr-worked__table { width: 100%; min-width: 18rem; margin-top: var(--kr-space-3); }
.kr-worked__table .kr-num { font-variant-numeric: tabular-nums; }

/* A set of rules shown grouped by the authority that made them — the notification clocks by regulator, say.
   A heading per group, then its figures as the shared label/value grid, with anything that is rows of one
   shape (a band table) as a table. Only the grouping is new; the parts are the shared ones.
   Each group is a separate authority with its own rules, so a rule between them says where one ends and
   the next begins. Groups are rendered from data, so the separator has to come from the CSS — between
   siblings, never above the first or below the last, whatever the data turns out to carry. */
.kr-rates__group + .kr-rates__group {
  margin-top: var(--kr-space-5);
  padding-top: var(--kr-space-5);
  border-top: var(--kr-border);
}
.kr-rates__head {
  margin: 0 0 var(--kr-space-3);
  font-size: var(--kr-font-body);
  font-weight: 600;
  color: var(--kr-color-text);
}
/* Full width: the bands are the reference anyone came here to read, and a narrow table stranded beside white
   space reads as an aside. */
.kr-rates__bands { width: 100%; margin-top: var(--kr-space-4); }

/* A calculation written out the way it would be on paper: the formula in its own names, then the same line with
   this example's figures put in, then the answer — three lines aligned on the =, so it reads as one calculation
   rather than three sentences. Monospace, because a formula is not prose: it makes the working look like the
   definition it comes from, where the same names (gross, recovered, net) are typed in.
   Three columns — what is being worked out, the =, the expression. Only the first line of a step names the
   quantity; the lines under it leave that column empty and the = keeps them lined up. */
.kr-calc {
  display: grid;
  grid-template-columns: max-content max-content minmax(0, 1fr);
  column-gap: var(--kr-space-2);
  row-gap: 0;
  align-items: baseline;
  margin: 0 0 var(--kr-space-3);
  padding: var(--kr-space-3);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  background: var(--kr-color-bg);
  font-family: var(--kr-font-mono);
  font-size: var(--kr-font-mono-scale);
  /* Tighter than prose: the lines of one calculation belong together, and a modal explaining five methods
     must not run on for screens. */
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}
.kr-calc__label { color: var(--kr-color-text); }
/* A second (or third) quantity in the same block starts a new step — a small gap sets it apart from the
   working above it. Baseline alignment carries the whole row down with the label, not just the label. */
.kr-calc__label:not(:first-child) { margin-top: var(--kr-space-2); }

/* The example's own figures: three short givens, so they read across one line rather than down three. */
.kr-calc--inline {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--kr-space-6);
  row-gap: var(--kr-space-1);
}
/* Pinned to the middle column so a continuation line needs no empty cell to stay aligned. */
.kr-calc__eq { grid-column: 2; color: var(--kr-color-text-faint); }
.kr-calc__expr { color: var(--kr-color-text-muted); overflow-wrap: anywhere; }
/* A name the formula reads — the same tokens the definition uses, tinted so they read as
   names rather than words. */
.kr-calc__var { color: var(--kr-color-accent); }
/* The answer the step arrives at — the full text colour against the muted working is enough; a figure does not
   need bolding to be found. */
.kr-calc__result { color: var(--kr-color-text); }
.kr-calc sup { font-size: 0.7em; line-height: 0; }

/* Opt-in for a wide reference matrix — an indicator's readings by month, appetite by category — inside a
   normal-width card: cells stay on one line so the columns read at a glance, and as it scrolls sideways
   the header and the first column stay put so you keep your place. Only tables that ask for it
   (.kr-table--matrix) get this — most tables must not. Vertical stickiness rides the page scroll;
   horizontal rides the .kr-table-wrap. */
.kr-table--matrix th,
.kr-table--matrix td { white-space: nowrap; min-width: 7rem; }
.kr-table--matrix thead th { position: sticky; top: 0; z-index: 2; }
.kr-table--matrix th:first-child,
.kr-table--matrix td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 9rem;
  background: var(--kr-color-surface);
  box-shadow: 1px 0 0 var(--kr-color-border);
}
.kr-table--matrix thead th:first-child { z-index: 3; background: var(--kr-color-bg); }
.kr-table--matrix tbody tr:hover td:first-child { background: var(--kr-color-bg); }

/* Kasonjola's mark sheet (.kr-table--marksheet, both ends sticky) stood here. It was school-only and
   stayed behind; --matrix above covers a wide reference table, and a grid that needs its last column
   pinned as well can take the rule back from Kasonjola when one exists. */

/* A two-line table cell: the main value, then a muted second line tucked tight beneath it — a reference
   under a risk's title, a unit under an owner's name, a regulator under an incident's type. Each line
   clips to an ellipsis (the full text is on the element's title, shown on hover) so a long value never widens
   the column or wraps to two rows of its own. --lg for a full name, --num right-aligns a figure over its
   qualifier. */
.kr-stackcell { display: inline-flex; flex-direction: column; min-width: 8rem; max-width: 10.5rem; }
.kr-stackcell--lg { min-width: 10rem; max-width: 12.5rem; }
/* A form that is only a button beside others, confirmed before it posts. */
.kr-inline-form { display: inline-flex; margin: 0; }
/* The column that names the row: as wide as the table gives it, and a long name wraps rather than
   being cut off, since it is what the row is found by. */
.kr-stackcell--name { min-width: 12rem; max-width: 28rem; }
.kr-stackcell--name .kr-stackcell__main { white-space: normal; }
.kr-stackcell--num { align-items: flex-end; min-width: 7rem; max-width: 10rem; text-align: right; }
.kr-stackcell__main,
.kr-stackcell__sub { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kr-stackcell__sub {
  margin-top: 1px;
  font-size: var(--kr-font-sm);
  line-height: 1.15;
  color: var(--kr-color-text-muted);
}

/* A denser table for the dated history panels (a risk's assessments, an indicator's readings): smaller type and tighter padding
   so the columns and their row actions fit the narrower profile panel without wrapping, and the code chip
   in the first column doesn't dominate. */
.kr-table--compact { font-size: var(--kr-font-md); }
.kr-table--compact th,
.kr-table--compact td { padding: 0.45rem 0.55rem; }
.kr-table--compact .kr-code { font-size: 0.72em; padding: 0.04em 0.3em; }

/* A reference table read inside a panel or a dialog (the statutory bands): tighter again than --compact,
   which is sized for history rows carrying actions. These are short rows of figures meant to be taken in at
   once, so the rhythm comes in and the header sits down a size. Everything that gives a table its feel — the
   header fill, the row rules, the hover — is untouched, so it still reads as one of ours. */
.kr-table--dense { font-size: var(--kr-font-md); }
.kr-table--dense th,
.kr-table--dense td { padding: 0.3rem 0.6rem; }
.kr-table--dense thead th { font-size: var(--kr-font-xs); }

/* The live key check's verdict, tucked under the field: green when the key is free, amber-red when it
   is taken or malformed. It replaces the ordinary hint while the user is choosing a key. */
.kr-field__hint--ok {
  color: var(--kr-color-success);
}
.kr-field__hint--warn {
  color: var(--kr-color-danger);
}

/* A formula shown as a read-only value in the detail modal: monospace, its own line, wrapping instead of
   being clipped — so a long formula is never cut off the way a plain table cell would cut it. */
.kr-detail__value--code {
  font-family: var(--kr-font-mono);
  font-size: var(--kr-font-mono-scale);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: var(--kr-space-2) var(--kr-space-3);
  border-radius: var(--kr-radius-inner);
  background: var(--kr-color-bg);
  border: 1px solid var(--kr-color-border);
}

/* A table row that failed, with the reason on its own line — a risk in an import with no owner, a reading
   for an indicator that does not exist. Loud enough to spot in a long list, and the message replaces the
   values rather than sitting beside them, because there are no values to show. */
.kr-row--error td {
  background: var(--kr-color-danger-bg);
}
.kr-cell--error {
  color: var(--kr-color-danger);
  font-weight: 500;
}

/* The "what goes in each column" trigger above the import dropzone. */
.kr-import__help {
  margin: 0 0 var(--kr-space-4);
}

/* A section heading inside a modal body — separates the column table from the notes beneath it. */
.kr-modal__subhead {
  margin: var(--kr-space-6) 0 var(--kr-space-3);
  font-size: var(--kr-font-body);
  font-weight: 600;
  color: var(--kr-color-text);
}

/* A plain readable bulleted list — used in the import guide's notes. */
.kr-list {
  margin: 0;
  padding-left: var(--kr-space-4);
}
.kr-list li + li {
  margin-top: var(--kr-space-1);
}

/* The import column guide: a compact reference. Smaller type, a tight table and minimal padding, so the
   whole thing reads at a glance without a lot of whitespace. */
.kr-guide .kr-modal__body {
  padding: var(--kr-space-4);
  font-size: var(--kr-font-sm);
}
.kr-guide .kr-table {
  font-size: var(--kr-font-sm);
}
.kr-guide .kr-table th,
.kr-guide .kr-table td {
  padding: 0.28rem 0.5rem;
}
.kr-guide .kr-table thead th {
  font-size: var(--kr-font-xs);
}
.kr-guide .kr-modal__subhead {
  margin: var(--kr-space-4) 0 var(--kr-space-2);
  font-size: var(--kr-font-md);
}
.kr-guide .kr-list li {
  color: var(--kr-color-text-muted);
}
.kr-guide .kr-list li + li {
  margin-top: 0.2rem;
}
/* The Required column reads as a small badge; keep it from stretching the row. */
.kr-guide .kr-badge {
  padding: 0.05rem 0.4rem;
  font-size: var(--kr-font-xs);
}

/* Give a modal's own paragraphs breathing room from what follows (a table, a heading). */
.kr-modal__body > p {
  margin: 0 0 var(--kr-space-4);
}

.kr-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kr-space-2);
}

/* A suggested colour. Hover and the chosen state read via a ring, never a shift (design tokens). */
.kr-swatches__item {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--kr-color-swatch-border);
  border-radius: var(--kr-radius-round);
  cursor: pointer;
  box-shadow: 0 0 0 0 transparent;
  transition: box-shadow var(--kr-transition);
}
.kr-swatches__item:hover { box-shadow: 0 0 0 3px var(--kr-color-border); }
.kr-swatches__item--on { box-shadow: 0 0 0 3px var(--kr-color-text-faint); }

.kr-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--kr-space-4);
  padding: var(--kr-space-4);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  background: var(--kr-color-bg);
}

/* No .kr-preview__link. It existed, and it was a copy of the link style as it was before the link was
   redesigned — so the brand-colour preview showed a lookalike that had quietly stopped matching the
   real thing. A preview built from a copy is worse than no preview: it is confidently wrong.

   The preview uses .kr-link itself. That is the whole point of it. */

.kr-preview__nav {
  padding: var(--kr-space-2) var(--kr-space-3);
  border-radius: var(--kr-radius);
  background: var(--kr-color-accent-soft);
  color: var(--kr-color-accent);
  font-weight: 500;
  font-size: var(--kr-font-body);
}

.kr-preview__chip {
  padding: var(--kr-space-1) var(--kr-space-3);
  border-radius: var(--kr-radius-pill);
  background: var(--kr-color-accent);
  color: var(--kr-color-accent-contrast);
  font-size: var(--kr-font-sm);
  font-weight: 600;
}

/* Audit — change-history section (fragments/audit.html) -----------------------
   A record's changes as a timeline: each entry has an action badge, actor and time, then a field-by-
   field old → new diff. Reuses the profile card and the badge idiom. */

.kr-audit__empty,
.kr-audit__nochange {
  color: var(--kr-color-text-muted);
  font-size: var(--kr-font-body);
}

/* WHY IT HAPPENED, on its own line above the diff.
 *
 * Given the same label treatment as a field name, because that is what it is: the entry's answer to a
 * question, sitting alongside its answers to "what changed". Full strength rather than muted — on a
 * limit override or a support reset the reason is the most important thing on the entry, and it should
 * not be quieter than the field names underneath it. */
.kr-audit__reason {
  display: flex;
  gap: var(--kr-space-3);
  margin-bottom: var(--kr-space-2);
  font-size: var(--kr-font-body);
  line-height: 1.45;
}

/* The audit trail reads as a record, not as a changelog.

   A flat list of rows separated by hairlines is what every application shows for "recent activity",
   and it invites the same glance: skim it, believe it, move on. This is not that. It is the answer to
   "who authorised this?" in front of a trustee board, and it is the thing an auditor is handed. It
   has to look like it will hold.

   Three things do that work, and none of them is decoration:

   1. **A rail.** Events sit on a continuous line running down the card, so the trail reads as
      unbroken and in order. A gap in a rail is visible in a way that a gap between rows is not.
   2. **The sequence number.** Audit rows are numbered per company and gapless (uq_audit_sequence), so
      the number is not ornament: a missing one is itself the finding. It is set in mono, at the head
      of every entry, where it can be quoted.
   3. **The chain.** Each entry shows its own hash and the one it follows. That is what turns
      "append-only, we promise" into something a reader can check — and it is the difference between
      this and a table anybody with database access could edit unnoticed (decisions.md, roadmap 1.6b).

   Nothing in here is interactive. An audit trail with an Edit button is a contradiction. */
.kr-audit__list {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

/* The rail. Drawn behind the markers and stopped short at each end so it does not run off into the
   card's padding — a line that reaches the edge reads as a border, not as a spine. */
.kr-audit__list::before {
  content: "";
  position: absolute;
  left: calc(var(--kr-space-8) / 2 - 1px);
  top: var(--kr-space-3);
  bottom: var(--kr-space-3);
  width: 2px;
  background: var(--kr-color-border);
}

.kr-audit__entry {
  position: relative;
  padding: 0 0 var(--kr-space-5) calc(var(--kr-space-8) + var(--kr-space-4));
}
.kr-audit__entry:last-child { padding-bottom: 0; }

/* The marker sits on the rail with the card's own background behind it, so the line appears to pass
   underneath rather than stopping at each dot. Tinted by the action through a modifier on the entry. */
.kr-audit__marker {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--kr-radius-round);
  background: var(--kr-color-control);
  color: var(--kr-color-text-muted);
  box-shadow: 0 0 0 4px var(--kr-color-surface);
}
.kr-audit__marker .kr-icon { width: 1rem; height: 1rem; }

/* Created, authorised, edited, reversed and deleted take the status tones, under the badges. */
/* Somebody looked at something. Deliberately the quietest marker on the page: a read is worth
   recording where the law asks for it, and it must not crowd out the entries where money moved. */
.kr-audit__entry--read .kr-audit__marker {
  background: var(--kr-color-control);
  color: var(--kr-color-text-faint);
}

.kr-audit__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--kr-space-2) var(--kr-space-3);
  min-height: 2rem;
  margin-bottom: var(--kr-space-3);
}

/* Gapless and quotable. Mono because it is an identifier, not a quantity. */
.kr-audit__seq {
  font-family: var(--kr-font-mono);
  font-size: var(--kr-font-mono-scale);
  color: var(--kr-color-text-faint);
  letter-spacing: 0.02em;
}

.kr-audit__actor { font-weight: 600; }

/* WHAT WAS ACTED ON, and the reason the entry now reads as a sentence.
   The trail led with the action and the actor and never named the subject, so a column of entries read
   "Updated. Updated. Updated." and a reader scanning for one risk's ratings had to open each one. It is
   first in the flex row and carries the most weight on the line, because it is the word somebody is
   scanning for. */
.kr-audit__subject {
  font-weight: 600;
  color: var(--kr-color-text);
}

/* The day a group of entries happened on.
   A trail is read by day — somebody is looking for Tuesday — and fifty timestamps in one column make
   the reader do that grouping in their head. Sticky so the day stays legible while its entries scroll
   past, which is the whole use of the heading on a long page. */
.kr-trail__date {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: var(--kr-space-3);
  margin: var(--kr-space-5) 0 var(--kr-space-3);
  padding: var(--kr-space-2) 0;
  background: var(--kr-color-surface);
  border-bottom: var(--kr-border);
  font-size: var(--kr-font-md);
  font-weight: 600;
}
/* The first day's heading sits against the toolbar above it and needs no gap of its own. */
.kr-trail__date:first-child { margin-top: 0; }
.kr-trail__count {
  font-weight: 400;
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-faint);
  font-variant-numeric: tabular-nums;
}

.kr-audit__when {
  margin-left: auto;
  color: var(--kr-color-text-faint);
  font-size: var(--kr-font-sm);
  white-space: nowrap;
}

/* The changed fields sit in their own inset panel. It separates *what moved* from who moved it, and
   it gives the strike-through old values a ground of their own so a long history does not read as one
   continuous wall of text. */
.kr-audit__body {
  padding: var(--kr-space-3) var(--kr-space-4);
  background: var(--kr-color-bg);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
}

/* The chain line. Deliberately quiet — it is evidence, not content, and it is read only when somebody
   is checking rather than browsing. */
.kr-audit__chain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--kr-space-1) var(--kr-space-2);
  margin-top: var(--kr-space-2);
  font-family: var(--kr-font-mono);
  font-size: var(--kr-font-mono-scale);
  color: var(--kr-color-text-faint);
}
.kr-audit__chain .kr-icon { width: 0.85rem; height: 0.85rem; }
.kr-audit__hash { color: var(--kr-color-text-muted); }

/* The chain, folded away until somebody wants it.
   It is evidence rather than content: it has to stay reachable, because watching one entry's
   fingerprint follow the previous one's is what makes the chain a fact instead of a promise, and it
   must not be the loudest thing on a page of twenty-five entries where it is almost never what
   somebody came for. A <details>, so it needs no script and no nonce and keeps its own state. */
.kr-audit__proof > summary {
  display: flex;
  align-items: center;
  gap: var(--kr-space-1-5);
  width: fit-content;
  margin-top: var(--kr-space-2);
  cursor: pointer;
  color: var(--kr-color-text-faint);
  font-size: var(--kr-font-sm);
  /* The default triangle sits oddly against an icon; the icon is the affordance. */
  list-style: none;
}
.kr-audit__proof > summary::-webkit-details-marker { display: none; }
.kr-audit__proof > summary:hover { color: var(--kr-color-text-muted); }
.kr-audit__proof > summary .kr-icon { width: 0.85rem; height: 0.85rem; }
.kr-audit__proof > summary:focus-visible {
  outline: 2px solid var(--kr-color-accent);
  outline-offset: 2px;
  border-radius: var(--kr-radius-sm);
}
/* Open, the line below it is already .kr-audit__chain and needs no second margin. */
.kr-audit__proof[open] > summary { color: var(--kr-color-text-muted); }

/* The same chain in a table cell, where it has a column's width rather than a row's. Wrapping split a
   hash across four lines, which reads as damage — the one thing this element must never suggest, since
   a reader is looking at it precisely to judge whether the record has been damaged. Stacked and
   non-wrapping instead: two short lines that stay whole in a narrow column. */
.kr-audit__chain--stacked {
  flex-direction: column;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: 0;
  white-space: nowrap;
}

/* label → value grid, the same two-column reading as kr-detail. */
.kr-audit__changes {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr);
  gap: var(--kr-space-1) var(--kr-space-4);
}

.kr-audit__change { display: contents; }

.kr-audit__field {
  color: var(--kr-color-text-muted);
  font-size: var(--kr-font-md);
}

.kr-audit__move {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--kr-space-2);
  font-size: var(--kr-font-body);
  min-width: 0;
}

/* A hash or an id has no spaces to break at: on a phone it would push the page sideways. */
.kr-audit__from {
  color: var(--kr-color-text-muted);
  text-decoration: line-through;
  min-width: 0;
  overflow-wrap: anywhere;
}
.kr-audit__arrow { color: var(--kr-color-text-faint); }
.kr-audit__to { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* Empty state — teaching panel shown instead of a bare table (fragments/page :: emptyState) --------- */

.kr-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--kr-space-3);
  padding: var(--kr-space-8) var(--kr-space-4);
}

/* The icon sits in a soft circular badge, in the accent colour — an empty state should feel like an
   invitation, not a dead end. content-box so the padding grows the circle around a fixed-size glyph.

   Direct child only. As a descendant selector this also caught the icon inside the call-to-action
   button underneath, wrapping it in a 3rem circle and blowing the button up to twice its height. It
   went unnoticed while that button had no icon; the moment every button gained one, the component
   broke. A badge belongs to this element's own icon, not to every icon that happens to be inside it. */
.kr-empty > .kr-icon {
  box-sizing: content-box;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0.9rem;
  margin-bottom: var(--kr-space-2);
  border-radius: var(--kr-radius-round);
  background: var(--kr-color-accent-soft);
  color: var(--kr-color-accent);
}

/* Centred and set apart from the lead above it, so the call to action reads as the next step. */
.kr-empty .kr-btn {
  align-self: center;
  margin-top: var(--kr-space-3);
}

.kr-empty__title {
  font-size: var(--kr-font-lg);
  font-weight: 600;
}

.kr-empty__lead {
  max-width: 34rem;
  color: var(--kr-color-text-muted);
  font-size: var(--kr-font-body);
}

.kr-empty .kr-btn { margin-top: var(--kr-space-2); }

/* "Common ones:" quick-add row — a suggestion pre-fills the form; the user still saves it deliberately. */
.kr-empty__suggest {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--kr-space-2);
  margin-top: var(--kr-space-2);
}

.kr-empty__suggest-label {
  color: var(--kr-color-text-faint);
  font-size: var(--kr-font-sm);
}

.kr-chip {
  padding: var(--kr-space-1) var(--kr-space-3);
  border: var(--kr-border);
  border-radius: var(--kr-radius-pill);
  background: var(--kr-color-surface);
  color: var(--kr-color-text);
  font-size: var(--kr-font-md);
  transition: border-color var(--kr-transition), background var(--kr-transition);
}
.kr-chip:hover {
  border-color: var(--kr-color-accent);
  background: var(--kr-color-accent-soft);
}

/* The chosen chip in a filter bar: filled with the accent so the current view reads at a glance. */
.kr-chip--active {
  border-color: var(--kr-color-accent);
  background: var(--kr-color-accent-soft);
  color: var(--kr-color-accent);
  font-weight: 600;
}

/* A row of filter chips above a list (e.g. findings by status). */
.kr-filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--kr-space-2);
  margin: 0 0 var(--kr-space-4);
}
.kr-filterbar__label {
  color: var(--kr-color-text-muted);
  font-size: var(--kr-font-md);
}

/* ---- Assessing a risk, in the layout each person chose (risks/assess-layouts.html) -------------- */

/* The layout buttons come last in the form's markup, so Enter still presses Record, and are drawn
   first: order moves the box, not its place in the tab order or in implicit submission. */
.kr-assess__layouts {
  order: -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--kr-space-2);
}
.kr-assess__layouts-label {
  color: var(--kr-color-text-muted);
  font-size: var(--kr-font-md);
  margin-right: var(--kr-space-1);
}
.kr-assess__layouts .kr-chip { font: inherit; font-size: var(--kr-font-md); cursor: pointer; }

.kr-assess__section { display: grid; gap: var(--kr-space-3); }
.kr-assess__section .kr-subhead { margin: 0; }
.kr-assess__lead { margin: 0; color: var(--kr-color-text-muted); font-size: var(--kr-font-md); }
.kr-assess__dimension { font-weight: 600; }

/* The live rating under each rating's controls, and the impact said beside the impact. */
.kr-assess__rating { display: flex; flex-wrap: wrap; align-items: center; gap: var(--kr-space-2); margin: 0; }
/* Under the target's badge: the server's refusal, said while the target is being chosen. */
.kr-assess__warning { flex-basis: 100%; color: var(--kr-color-danger); font-size: var(--kr-font-sm); }
.kr-assess__impact { margin: var(--kr-space-2) 0 0; }
.kr-assess__descriptor {
  margin: var(--kr-space-1) 0 0;
  color: var(--kr-color-text-muted);
  font-size: var(--kr-font-sm);
}
.kr-assess__descriptor:empty { display: none; }

.kr-assess__dimensions {
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  padding: var(--kr-space-2) var(--kr-space-3);
}
.kr-assess__dimensions > summary { cursor: pointer; color: var(--kr-color-accent); font-weight: 600; }
.kr-assess__dimensions[open] > summary { margin-bottom: var(--kr-space-2); }
.kr-assess__dimensions .kr-assess__lead { margin-bottom: var(--kr-space-2); }
/* Fixed, so a long description chosen ellipsises inside its cell instead of widening the table and,
   with it, the page. Opened, the list shows each description whole. */
.kr-assess__working,
.kr-assess__worksheet { table-layout: fixed; width: 100%; }
.kr-assess__working thead th:first-child { width: 30%; }
.kr-assess__worksheet thead th:first-child { width: 22%; }

.kr-assess__worksheet td,
.kr-assess__worksheet th { vertical-align: top; }
.kr-assess__worksheet tbody th { text-align: left; white-space: nowrap; }
.kr-assess__worksheet .kr-assess__na { font-size: var(--kr-font-sm); }
.kr-assess__total th,
.kr-assess__total td { background: var(--kr-color-accent-soft); }

/* Pick the description: each cell is a choice, the radio inside it is what is posted. Wide, so it
   scrolls in its wrapper on a phone rather than squeezing the matrix's words into a column each. */
.kr-rubric { min-width: 46rem; table-layout: fixed; }
.kr-rubric th[scope="row"] { width: 9rem; text-align: left; vertical-align: top; }
.kr-rubric td { padding: var(--kr-space-1); vertical-align: top; }
.kr-rubric__choice {
  position: relative;
  display: block;
  height: 100%;
  min-height: 4.5rem;
  padding: var(--kr-space-2);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  background: var(--kr-color-surface);
  font-size: var(--kr-font-sm);
  line-height: 1.35;
  cursor: pointer;
  transition: border-color var(--kr-transition), background var(--kr-transition);
}
.kr-rubric__choice input { position: absolute; opacity: 0; pointer-events: none; }
.kr-rubric__choice:hover { border-color: var(--kr-color-accent); }
.kr-rubric__choice:has(input:focus-visible) { outline: 2px solid var(--kr-color-accent); outline-offset: 1px; }
.kr-rubric__choice:has(input:checked) {
  border-color: var(--kr-color-accent);
  background: var(--kr-color-accent-soft);
  box-shadow: inset 0 0 0 1px var(--kr-color-accent);
  font-weight: 600;
}
.kr-rubric__choice--none { min-height: 0; color: var(--kr-color-text-muted); text-align: center; }
.kr-rubric__range { display: block; margin-bottom: var(--kr-space-1); color: var(--kr-color-text-muted); font-weight: 600; }


/* ---- The audit plan, in the layout each person chose (assurance/plans/layouts.html) ------------
   Three drawings of the same audits. The capacity bar and the layout switch are shared; coverage is a
   table against the universe, quarters a board of four columns, the timeline a month grid with the
   team's load underneath. */
.kr-plan__capacity { display: grid; gap: var(--kr-space-2); }
.kr-plan__bar {
  display: block;
  width: 100%;
  height: 12px;
  border-radius: var(--kr-radius-pill);
  overflow: hidden;
  background: var(--kr-color-control);
}
.kr-plan__bar-planned { fill: var(--kr-color-accent); }
.kr-plan__bar-planned--over { fill: var(--kr-color-warning); }
.kr-plan__bar-reserve { fill: var(--kr-color-accent); fill-opacity: 0.35; }
.kr-plan__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kr-space-2) var(--kr-space-5);
  margin: 0;
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
}
.kr-plan__legend strong { color: var(--kr-color-text); font-variant-numeric: tabular-nums; }
.kr-plan__layouts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--kr-space-2); }
.kr-plan__layouts-label { font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); margin-right: var(--kr-space-1); }

/* Coverage: the universe, with this year's quarters and the next two years beside it. */
.kr-plan__cov td.kr-plan__cell,
.kr-plan__cov th.kr-plan__cell { text-align: center; width: 4.75rem; }
.kr-plan__cov .kr-plan__split { border-left: 2px solid var(--kr-color-border); }
.kr-plan__cov tr.kr-plan__gaprow > td { background: var(--kr-color-warning-bg); }
.kr-plan__dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  padding: var(--kr-space-0-5) var(--kr-space-2);
  border-radius: var(--kr-radius-pill);
  font-size: var(--kr-font-sm);
  font-weight: 600;
  background: var(--kr-color-accent-soft);
  color: var(--kr-color-accent);
  text-decoration: none;
  white-space: nowrap;
}
a.kr-plan__dot:hover { background: var(--kr-color-accent); color: var(--kr-color-accent-contrast); }
.kr-plan__dot--later { background: var(--kr-color-control); color: var(--kr-color-text-muted); }
.kr-plan__gap {
  display: inline-flex;
  align-items: center;
  gap: var(--kr-space-2);
  font-size: var(--kr-font-sm);
  font-weight: 600;
  color: var(--kr-color-warning);
  white-space: nowrap;
}
.kr-plan__gap--danger { color: var(--kr-color-danger); }

/* Quarters: four columns of cards. Two on a tablet, one on a phone. */
.kr-plan__board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--kr-space-3); }
@media (max-width: 64rem) { .kr-plan__board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 40rem) { .kr-plan__board { grid-template-columns: minmax(0, 1fr); } }
.kr-plan__quarter {
  display: grid;
  align-content: start;
  gap: var(--kr-space-2);
  padding: var(--kr-space-3);
  border-radius: var(--kr-radius-lg);
  background: var(--kr-color-control);
}
.kr-plan__quarter-head {
  display: flex;
  justify-content: space-between;
  gap: var(--kr-space-2);
  padding: 0 var(--kr-space-1);
  font-size: var(--kr-font-md);
  font-weight: 700;
}
.kr-plan__quarter-head span { font-weight: 500; color: var(--kr-color-text-muted); font-variant-numeric: tabular-nums; }
.kr-plan__card {
  display: grid;
  gap: var(--kr-space-2);
  padding: var(--kr-space-3);
  border: 1px solid var(--kr-color-border);
  border-radius: var(--kr-radius);
  background: var(--kr-color-surface);
  color: inherit;
  text-decoration: none;
}
a.kr-plan__card:hover { border-color: var(--kr-color-control-border-hover); }
.kr-plan__card-title { font-weight: 600; line-height: 1.3; }
.kr-plan__card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--kr-space-2);
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
}
.kr-plan__empty { padding: var(--kr-space-2); font-size: var(--kr-font-sm); color: var(--kr-color-text-faint); }

/* Timeline: a month grid. A bar is its run of filled cells, rounded at its two ends. */
.kr-plan__tl { table-layout: fixed; min-width: 46rem; }
.kr-plan__tl th.kr-plan__m,
.kr-plan__tl td.kr-plan__m {
  width: 4.75%;
  padding-left: 0;
  padding-right: 0;
  text-align: center;
  border-left: 1px solid var(--kr-color-border);
}
.kr-plan__tl .kr-plan__name { width: 24%; }
.kr-plan__tl th:nth-child(2) { width: 10%; }
.kr-plan__tl th:nth-child(3) { width: 7%; }
.kr-plan__run { display: block; height: 14px; }
.kr-plan__run--assurance { background: var(--kr-color-accent); }
.kr-plan__run--advisory { background: var(--kr-color-info); }
.kr-plan__run--follow_up {
  background: repeating-linear-gradient(135deg, var(--kr-color-accent) 0 4px, var(--kr-color-accent-soft) 4px 8px);
}
/* Drawn over the cell's left border, so a run of months reads as one bar. */
.kr-plan__run { position: relative; margin-left: -1px; }
.kr-plan__run--first { margin-left: var(--kr-space-1); border-top-left-radius: var(--kr-radius-inner); border-bottom-left-radius: var(--kr-radius-inner); }
.kr-plan__run--last { margin-right: var(--kr-space-1); border-top-right-radius: var(--kr-radius-inner); border-bottom-right-radius: var(--kr-radius-inner); }
.kr-plan__load td { border-bottom: 0; vertical-align: bottom; }
.kr-plan__load-col { display: grid; justify-items: center; gap: var(--kr-space-0-5); }
.kr-plan__load-svg { display: block; width: 100%; height: 40px; }
.kr-plan__load-bar { fill: var(--kr-color-accent); fill-opacity: 0.45; }
.kr-plan__load-bar--over { fill: var(--kr-color-warning); fill-opacity: 1; }
.kr-plan__load-days { font-size: var(--kr-font-xs); color: var(--kr-color-text-muted); font-variant-numeric: tabular-nums; }
.kr-plan__swatch { display: inline-block; width: 1.1rem; height: 0.5rem; border-radius: var(--kr-radius-sm); vertical-align: middle; margin-right: var(--kr-space-1); }

/* ---- Print: drop the app chrome, print only the document ------------------------------------
   A finding, a risk's page or the register for one unit gets printed, signed and filed — and in a
   Zambian board room most of what is discussed is on paper. The printed page must be the document and not
   a screenshot of an application. Anything a reader cannot act on from paper — nav, breadcrumb,
   action buttons — is marked .kr-noprint and disappears. */
@media print {
  .kr-sidebar,
  .kr-topbar,
  .kr-breadcrumb,
  .kr-noprint { display: none !important; }

  html, body, .kr-app, .kr-main { height: auto; overflow: visible; background: var(--kr-print-paper) !important; }
  .kr-app { display: block !important; }
  .kr-main { margin: 0 !important; }
  .kr-page { padding: 0 !important; }

  /* Printing from the document viewer: its pages alone, one to a sheet, edge to edge (the viewer
     takes the browser's own margin away while it prints, each page having its own). Nothing of the
     page behind, and not the viewer either. */
  body.kr-viewer-printing > :not(.kr-viewer-print),
  body.kr-viewer-printing dialog { display: none !important; }
  body.kr-viewer-printing .kr-viewer-print { display: block; }
  .kr-viewer-print img {
    display: block;
    width: 100%;
    height: 100vh;
    object-fit: contain;
    break-after: page;
  }
  .kr-viewer-print img:last-child { break-after: auto; }
}
/* Built only while printing, and never on the screen. */
@media screen {
  .kr-viewer-print { display: none; }
}

/* A caption-and-actions bar above a table — a label on the left, download buttons on the right. */
.kr-tablebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--kr-space-4);
  margin-bottom: var(--kr-space-3);
}
.kr-tablebar__label { font-size: var(--kr-font-md); font-weight: 600; color: var(--kr-color-text-muted); }
.kr-tablebar__actions { display: flex; gap: var(--kr-space-2); }

/* The brand mark at several sizes (styleguide) -------------------------------------------------
   Baseline-aligned rather than centred, so the row reads as one mark scaling up rather than as five
   unrelated squares — which is the comparison somebody is actually making when they look at it. */
.kr-marks {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--kr-space-6);
  margin-top: var(--kr-space-4);
}
.kr-mark {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--kr-space-2);
}
.kr-mark figcaption {
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-faint);
  font-variant-numeric: tabular-nums;
}

/* ---- An engagement's findings, in the layout each person chose (assurance/engagements/layouts.html) --
   Three drawings of the same findings. The report reads each in full with its rating as a coloured
   edge; the worksheet sets criteria beside condition so the gap reads across; the pane is a list and
   the one chosen. A finding's four attributes are headed the same way in all three. */
.kr-eng__tally { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--kr-space-2); }
.kr-eng__steps { margin: 0; padding: 0; }

.kr-eng__findinghead {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--kr-space-3);
}
.kr-eng__findingactions { display: flex; align-items: center; gap: var(--kr-space-2); }
.kr-eng__ref {
  margin: 0;
  font-family: var(--kr-font-mono);
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
}
.kr-eng__title { margin: var(--kr-space-1) 0 0; font-size: var(--kr-font-lg); line-height: 1.35; }
.kr-eng__attr { display: grid; gap: var(--kr-space-1); }
.kr-eng__label {
  margin: 0;
  font-size: var(--kr-font-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--kr-color-text-muted);
}
.kr-eng__text { margin: 0; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }

/* A table written into a finding's text (fragments/written.html): rows pasted from Excel or Word, or
   written with " | ". It scrolls inside its own frame, heading kept in view, so a long list of cases
   does not push the rest of the finding off the page. */
div.kr-eng__text { white-space: normal; }
.kr-written__text { margin: 0; white-space: pre-line; }
.kr-written__text + .kr-written__table,
.kr-written__lead-in + .kr-written__table,
.kr-written__table + .kr-written__text,
.kr-written__table + .kr-written__table { margin-top: var(--kr-space-2); }
.kr-written__table {
  max-height: 26rem;
  overflow: auto;
  border: 1px solid var(--kr-color-border);
  border-radius: var(--kr-radius-sm);
  white-space: normal;
  overflow-wrap: normal;
}
.kr-written__table table { width: 100%; border-collapse: collapse; font-size: var(--kr-font-sm); line-height: 1.4; }
.kr-written__table th {
  position: sticky;
  top: 0;
  text-align: left;
  font-weight: 600;
  color: var(--kr-color-text-muted);
  background: var(--kr-color-surface-raised);
  border-bottom: 1px solid var(--kr-color-border);
  padding: var(--kr-space-1) var(--kr-space-2);
}
.kr-written__table td {
  padding: var(--kr-space-1) var(--kr-space-2);
  border-bottom: 1px solid var(--kr-color-border);
  vertical-align: top;
}
.kr-written__table tbody tr:last-child td { border-bottom: 0; }
/* A table's title, written over it, as its caption: in a printed report it is numbered. */
.kr-written__cap { margin: var(--kr-space-2) 0 var(--kr-space-1); font-size: var(--kr-font-body); }
.kr-written__cap .kr-doc-cap__title { font-style: italic; }
/* A printed report numbers its captions into the empty number (PdfLists), and keeps a table's lead-in
   with its first rows by the room under it; on screen neither is wanted. */
.kr-doc-cap.kr-doc-cap--table .kr-doc-cap__no:empty, .kr-written__room { display: none; }
/* A table of seven columns or more, set smaller so it fits without scrolling sideways. */
.kr-written__table table.kr-written--wide { font-size: var(--kr-font-md); }
/* A group's title across its rows: an employer's name over that employer's statement. */
.kr-written__table tr.kr-written__group td { padding-top: var(--kr-space-3); font-weight: 600; }
.kr-written__table tfoot td {
  position: sticky;
  bottom: 0;
  font-weight: 600;
  background: var(--kr-color-surface-raised);
  border-top: 1px solid var(--kr-color-border);
  border-bottom: 0;
}
.kr-written__num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* A heading over numbers stands over them, at the right. */
.kr-written__table th.kr-written__num { text-align: right; }

/* Under a box while it is written: its tables as they will be saved. Set apart from the box on a sunken
   ground, so it is read as a picture of the text rather than another place to type. */
.kr-written-preview {
  display: grid;
  gap: var(--kr-space-2);
  margin-top: var(--kr-space-2);
  padding: var(--kr-space-3);
  border-radius: var(--kr-radius);
  background: var(--kr-color-bg);
}
.kr-written-preview[hidden] { display: none; }
.kr-written-preview .kr-written__table { max-height: 16rem; }
.kr-written-preview__said { margin: 0; font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }
.kr-written-preview__said + .kr-written__table { margin-top: 0; }

/* Past audits from a spreadsheet (assurance/engagements/import): three steps, numbered in a ring, each a
   title, a line on it and, where there is one, the button that does it. */
.kr-import { display: grid; gap: var(--kr-space-5); margin: 0; padding: 0; list-style: none; counter-reset: kr-import; }
.kr-import__step {
  position: relative;
  display: grid;
  gap: var(--kr-space-2);
  justify-items: start;
  padding-left: calc(var(--kr-space-8) + var(--kr-space-3));
  counter-increment: kr-import;
}
.kr-import__step::before {
  content: counter(kr-import);
  position: absolute;
  left: 0;
  top: calc(-1 * var(--kr-space-0-5));
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 2px solid var(--kr-color-accent);
  border-radius: var(--kr-radius-round);
  font-weight: 700;
  color: var(--kr-color-accent);
}
.kr-import__title { margin: 0; font-weight: 600; }
.kr-import__text { margin: 0; max-width: 46rem; color: var(--kr-color-text-muted); }

/* A finding's schedules (assurance/engagements/layouts :: schedules): under its four attributes. */
.kr-eng__schedules { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--kr-space-4); justify-items: start; }
.kr-schedule { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--kr-space-2); width: 100%; }
.kr-schedule__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--kr-space-2); }
.kr-schedule__title { margin: 0; font-weight: 600; }
.kr-schedule__actions { display: flex; align-items: center; gap: var(--kr-space-2); }
.kr-schedule__rows { font-family: var(--kr-font-mono, ui-monospace, monospace); font-size: var(--kr-font-sm); white-space: pre; }
.kr-eng__prompt { margin: 0; font-size: var(--kr-font-sm); font-style: italic; color: var(--kr-color-text-faint); }
.kr-eng__recs { margin: 0; padding-left: var(--kr-space-5); display: grid; gap: var(--kr-space-1); line-height: 1.5; }
.kr-eng__links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--kr-space-2); font-size: var(--kr-font-sm); }
.kr-eng__chip {
  padding: var(--kr-space-0-5) var(--kr-space-2);
  border-radius: var(--kr-radius-pill);
  background: var(--kr-color-control);
  color: var(--kr-color-text);
}
.kr-eng__chip--gap { background: var(--kr-color-warning-bg); color: var(--kr-color-warning); font-weight: 600; }

/* Report: one card per finding, its rating as the left edge. */
.kr-eng__report { display: grid; gap: var(--kr-space-4); }
.kr-eng__finding {
  display: grid;
  /* minmax(0, 1fr), not the implicit auto column: a table in a finding's text, or a schedule, is as wide
     as its widest row, and an auto column took that width, pushing the whole finding off a phone's
     screen. The table scrolls in its own frame instead. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--kr-space-3);
  padding: var(--kr-space-4) var(--kr-space-5);
  border: var(--kr-border);
  border-radius: var(--kr-radius-lg);
  background: var(--kr-color-surface);
}
/* A rated finding's heading sits on its band's tint, the way a callout does; never a coloured edge. Only
   the heading: a finding runs long, with tables, and a whole card on the tint reads as one heavy block. */
.kr-eng__finding > .kr-eng__findinghead {
  margin: calc(-1 * var(--kr-space-4)) calc(-1 * var(--kr-space-5)) 0;
  padding: var(--kr-space-4) var(--kr-space-5) var(--kr-space-3);
  border-radius: var(--kr-radius-lg) var(--kr-radius-lg) 0 0;
  background: var(--kr-finding-tint, transparent);
}
.kr-eng__finding--low { --kr-finding-tint: var(--kr-color-band-low-bg); }
.kr-eng__finding--medium { --kr-finding-tint: var(--kr-color-band-medium-bg); }
.kr-eng__finding--high { --kr-finding-tint: var(--kr-color-band-high-bg); }
.kr-eng__finding--extreme { --kr-finding-tint: var(--kr-color-band-extreme-bg); }
.kr-eng__body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--kr-space-3); }

/* Worksheet: the chosen row marked, and the four attributes as two rows of two. */
.kr-eng__row--open > td { background: var(--kr-color-accent-soft); }
.kr-eng__sheet {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: var(--kr-border);
  border-radius: var(--kr-radius-lg);
  overflow: hidden;
}
.kr-eng__cell { display: grid; gap: var(--kr-space-1); align-content: start; padding: var(--kr-space-4); }
.kr-eng__cell:nth-of-type(odd) { border-right: var(--kr-border); }
.kr-eng__cell--criteria { background: var(--kr-color-accent-soft); }
.kr-eng__cell--condition { background: var(--kr-color-warning-bg); }
.kr-eng__gap {
  grid-column: 1 / -1;
  margin: 0;
  padding: var(--kr-space-1) var(--kr-space-4);
  text-align: center;
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
  background: var(--kr-color-control);
  border-top: var(--kr-border);
  border-bottom: var(--kr-border);
}

/* Reading pane: the list beside the finding chosen; one column on a narrow screen. */
.kr-eng__split {
  display: grid;
  grid-template-columns: minmax(16rem, 20rem) 1fr;
  border: var(--kr-border);
  border-radius: var(--kr-radius-lg);
  /* clip, not hidden: hidden makes this a scroller of its own, and the list's sticky would stick to it
     rather than to the page. */
  overflow: clip;
}
.kr-eng__list { display: flex; flex-direction: column; border-right: var(--kr-border); }
/* The rule between list and finding drawn by both, so it runs the full height whichever is longer. */
.kr-eng__split > .kr-eng__pane { border-left: var(--kr-border); margin-left: -1px; }
.kr-eng__item {
  display: grid;
  gap: var(--kr-space-1);
  padding: var(--kr-space-3) var(--kr-space-4);
  border-bottom: var(--kr-border);
  color: var(--kr-color-text);
  text-decoration: none;
}
.kr-eng__item:hover { background: var(--kr-color-control); }
.kr-eng__item--open,
.kr-eng__item--open:hover { background: var(--kr-color-accent-soft); }
.kr-eng__itemtop { display: flex; align-items: center; gap: var(--kr-space-2); }
.kr-eng__itemtitle { font-weight: 600; line-height: 1.3; }
.kr-eng__itemsub { font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }
.kr-eng__pane { display: grid; gap: var(--kr-space-4); align-content: start; padding: var(--kr-space-4) var(--kr-space-5); }
.kr-eng__ruled { display: grid; gap: var(--kr-space-3); }
.kr-eng__ruled > .kr-eng__attr { padding-bottom: var(--kr-space-3); border-bottom: var(--kr-border); }

/* Management's answer under a finding, set off by a dashed rule as the head's word rather than audit's. */
.kr-eng__answer {
  display: grid;
  gap: var(--kr-space-2);
  justify-items: start;
  padding-top: var(--kr-space-3);
  border-top: 1px dashed var(--kr-color-border);
}
.kr-eng__answer > .kr-answer__stale { justify-self: stretch; }
.kr-eng__sent { display: flex; flex-wrap: wrap; gap: var(--kr-space-1) var(--kr-space-3); margin: 0; }
.kr-eng__askedlist { display: grid; gap: var(--kr-space-2); margin: 0; padding: 0; list-style: none; }
/* The finding's number, its title, and who answers it on the line below: the same shape for every
   finding, whatever the length of its title. */
.kr-eng__askedlist > li { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); align-items: baseline; column-gap: var(--kr-space-2); row-gap: var(--kr-space-0-5); }
.kr-eng__askedlist > li > :first-child { grid-row: span 2; }
.kr-eng__askedlist > li > :nth-child(n+3) { grid-column: 2; justify-self: start; }

/* The scale's levels, one row each: name, colour, meaning. */
.kr-eng__levels { display: grid; gap: var(--kr-space-3); margin: 0; padding: 0; border: 0; }
.kr-eng__levelrow { display: grid; grid-template-columns: 12rem 10rem 1fr; gap: var(--kr-space-3); align-items: start; }

/* A list beside the item open in it (the reading pane, a head's side-by-side draft): held in view at the
   screen's height and scrolled on its own, with a search over it, so a long list never makes the page as
   long as itself. The search filters in the page; the open item is scrolled into the list's view. */
.kr-panelist {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: calc(100dvh - var(--kr-topbar-height));
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.kr-panelist__search { flex: none; padding: var(--kr-space-3); border-bottom: var(--kr-border); }
.kr-panelist__search > .kr-field__input { width: 100%; }
.kr-panelist__items {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.kr-panelist__none { margin: 0; padding: var(--kr-space-3) var(--kr-space-4); font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }
/* The items set their own display, which would otherwise outrank the hidden attribute. */
.kr-panelist [hidden] { display: none; }

@media (max-width: 48rem) {
  .kr-panelist { position: static; max-height: 24rem; }
  .kr-eng__split > .kr-eng__pane { border-left: 0; margin-left: 0; }
  .kr-eng__sheet,
  .kr-eng__split,
  .kr-eng__levelrow { grid-template-columns: 1fr; }
  .kr-eng__cell:nth-of-type(odd) { border-right: 0; }
  .kr-eng__list { border-right: 0; border-bottom: var(--kr-border); }
}

/* ---- A draft report as a unit head answers it (answers/draft.html, parts.html) -------------------------
   Three layouts of the same findings and the same form: one at a time with a step line, side by side
   with the list down the left, and the whole draft with a bar counting what is left. A finding's four
   attributes read as two rows of two, in plain words rather than audit's terms. */
.kr-answer__finding { display: grid; gap: var(--kr-space-4); }
.kr-answer__attrs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--kr-space-3) var(--kr-space-5); }
.kr-answer__attrs > .kr-eng__attr { align-content: start; }
/* Side by side the finding has a third of the width: one attribute under another. */
.kr-answer__side .kr-answer__attrs { grid-template-columns: minmax(0, 1fr); }
.kr-answer__unit { margin: 0; font-size: var(--kr-font-sm); }

/* The three stances as choices a person can see at once, not a dropdown: each a bordered box, the one
   ticked ringed and tinted as the appearance choices are. The radio stays visible inside it. */
.kr-answer__stances {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 1fr));
  gap: var(--kr-space-2);
  margin-top: var(--kr-space-1);
}
.kr-check.kr-answer__stance {
  padding: var(--kr-space-2) var(--kr-space-3);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  background: var(--kr-color-surface);
}
.kr-check.kr-answer__stance:has(input:checked) {
  border-color: var(--kr-color-accent);
  background: var(--kr-color-accent-soft);
  color: var(--kr-color-accent);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--kr-color-accent);
}

/* The answer given: its stance and words, who and by when, and when it is out of date, why. */
.kr-answer__given { display: grid; gap: var(--kr-space-2); }
.kr-answer__said { display: grid; justify-items: start; gap: var(--kr-space-1); }
/* The recommendations a partly agreed answer does not accept, one to a line under their label. */
.kr-answer__declined { display: grid; justify-items: start; gap: var(--kr-space-0-5); margin: 0; }
.kr-answer__who { margin: 0; font-size: var(--kr-font-sm); }
/* Its colours are the warning tone, under the badges. */
.kr-answer__stale {
  margin: 0;
  padding: var(--kr-space-2) var(--kr-space-3);
  border-radius: var(--kr-radius);
  font-size: var(--kr-font-sm);
  font-weight: 600;
}

/* One at a time: the step line, each finding a chip with its number and whether it is answered. */
.kr-answer__steps { display: flex; flex-wrap: wrap; gap: var(--kr-space-2); }
.kr-answer__step {
  display: inline-flex;
  align-items: center;
  gap: var(--kr-space-2);
  min-width: 0;
  max-width: 100%;
  padding: var(--kr-space-2) var(--kr-space-3);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  background: var(--kr-color-surface);
  color: var(--kr-color-text);
  font-size: var(--kr-font-sm);
  text-decoration: none;
}
.kr-answer__step:hover { border-color: var(--kr-color-control-border-hover); }
.kr-answer__step--on { border-color: var(--kr-color-accent); box-shadow: inset 0 -2px 0 var(--kr-color-accent); font-weight: 600; }
.kr-answer__steptitle { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Side by side: the list, the finding and the answer in three columns on a desk. */
.kr-answer__side {
  display: grid;
  grid-template-columns: minmax(13rem, 17rem) minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--kr-space-4);
  align-items: start;
}
/* By when, or "to be confirmed" with what it waits on; whichever is off is greyed. */
.kr-answer__tbc { margin-top: var(--kr-space-2); }
.kr-answer__wait { display: grid; gap: var(--kr-space-1); margin-top: var(--kr-space-2); }
.kr-answer__date[data-kr-disabled],
.kr-answer__wait[data-kr-disabled] { opacity: 0.5; }

.kr-answer__list { display: grid; gap: var(--kr-space-2); }
/* Flex, as a panelist is: the grid above would let the items grow past the list's height. */
.kr-answer__list.kr-panelist { display: flex; }
.kr-answer__list > .kr-panelist__items { display: grid; gap: var(--kr-space-2); align-content: start; padding: var(--kr-space-0-5); }
.kr-answer__list > .kr-panelist__search { padding: 0 0 var(--kr-space-1); border-bottom: 0; }
.kr-answer__item {
  display: grid;
  gap: var(--kr-space-2);
  padding: var(--kr-space-3);
  border: var(--kr-border);
  border-radius: var(--kr-radius-lg);
  background: var(--kr-color-surface);
  color: var(--kr-color-text);
  text-decoration: none;
}
.kr-answer__item:hover { border-color: var(--kr-color-control-border-hover); }
.kr-answer__item--open,
.kr-answer__item--open:hover { border-color: var(--kr-color-accent); background: var(--kr-color-accent-soft); }

/* The whole draft: how far through, kept in view while the page scrolls. */
.kr-answer__progress {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--kr-space-2) var(--kr-space-4);
  padding: var(--kr-space-3) var(--kr-space-4);
  border: var(--kr-border);
  border-radius: var(--kr-radius-lg);
  background: var(--kr-color-surface);
  font-size: var(--kr-font-sm);
}
.kr-answer__meter {
  flex: 1 1 8rem;
  max-width: 12rem;
  height: 0.4rem;
  border: 0;
  border-radius: var(--kr-radius-pill);
  background: var(--kr-color-control);
  appearance: none;
  -webkit-appearance: none;
  overflow: hidden;
}
.kr-answer__meter::-webkit-progress-bar { background: var(--kr-color-control); }
.kr-answer__meter::-webkit-progress-value { background: var(--kr-color-accent); }
.kr-answer__meter::-moz-progress-bar { background: var(--kr-color-accent); }
.kr-answer__whole { scroll-margin-top: calc(var(--kr-topbar-height) + var(--kr-space-5)); }
.kr-answer__under { display: grid; justify-items: start; gap: var(--kr-space-3); padding-top: var(--kr-space-4); border-top: 1px dashed var(--kr-color-border); }
.kr-answer__under > .kr-answer__given,
.kr-answer__under > .kr-answer__form { justify-self: stretch; }

@media (max-width: 64rem) {
  .kr-answer__side { grid-template-columns: minmax(12rem, 15rem) minmax(0, 1fr); }
  .kr-answer__side > :last-child { grid-column: 2; }
}

@media (max-width: 48rem) {
  .kr-answer__side,
  .kr-answer__attrs { grid-template-columns: minmax(0, 1fr); }
  .kr-answer__side > :last-child { grid-column: auto; }
}

/* ── What each state means ──────────────────────────────────────────────────────────────────────
   A badge that names its state (data-kr-state) opens a note beside itself: what the state means, who
   it is with, its family's other states, and the way to the full page (/states). The colours come
   from StateGlossary, so the note, the page and every screen agree. */
[data-kr-state] { cursor: help; }
[data-kr-state]:focus-visible { outline: 2px solid var(--kr-color-accent); outline-offset: 2px; }

.kr-statenote {
  position: fixed;
  z-index: var(--kr-z-note);
  width: 22rem;
  max-width: calc(100vw - var(--kr-space-8));
  padding: var(--kr-space-4);
  background: var(--kr-color-surface-raised);
  border: var(--kr-border);
  border-radius: var(--kr-radius-lg);
  box-shadow: var(--kr-shadow-lg);
  animation: kr-toast-in var(--kr-transition);
}
.kr-statenote:focus { outline: none; }
.kr-statenote__family { margin: 0 0 var(--kr-space-1); font-size: var(--kr-font-xs); color: var(--kr-color-text-muted); text-transform: uppercase; letter-spacing: var(--kr-tracking-caps); }
.kr-statenote__title { margin: 0 0 var(--kr-space-2); font-size: var(--kr-font-md); font-weight: 600; }
.kr-statenote__means { margin: 0 0 var(--kr-space-2); line-height: 1.45; }
.kr-statenote__with { margin: 0 0 var(--kr-space-3); font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }
.kr-statenote__life {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kr-space-1) var(--kr-space-2);
  margin: 0 0 var(--kr-space-3);
  padding: var(--kr-space-2) var(--kr-space-3);
  border-radius: var(--kr-radius-sm);
  background: var(--kr-color-control);
}
/* The family's other states, there for the order, not to be read as this one. */
.kr-statenote__other { opacity: 0.5; }
.kr-statenote__more { font-size: var(--kr-font-sm); }

.kr-states {
  display: grid;
  grid-template-columns: minmax(12rem, 15rem) minmax(0, 1fr);
  gap: var(--kr-space-4);
  align-items: start;
}
.kr-states__nav {
  position: sticky;
  top: var(--kr-space-4);
  display: grid;
  gap: var(--kr-space-0-5);
  padding: var(--kr-space-2);
}
.kr-states__navlink {
  padding: var(--kr-space-2) var(--kr-space-3);
  border-radius: var(--kr-radius-sm);
  color: inherit;
  text-decoration: none;
}
.kr-states__navlink:hover { background: var(--kr-color-control); }
.kr-states section { scroll-margin-top: calc(var(--kr-topbar-height) + var(--kr-space-5)); }
.kr-states__table { width: 100%; border-collapse: collapse; }
.kr-states__table td { padding: var(--kr-space-2) var(--kr-space-2); border-top: var(--kr-border); vertical-align: top; line-height: 1.45; }
.kr-states__table tr:first-child td { border-top: 0; }
.kr-states__badge { width: 13rem; }
.kr-states__badge .kr-badge { white-space: normal; }
.kr-states__with { display: block; margin-top: var(--kr-space-0-5); font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }
.kr-states__row { scroll-margin-top: calc(var(--kr-topbar-height) + var(--kr-space-8) + var(--kr-space-1)); }
/* The row a note's link landed on, lit with a tinted ground. */
.kr-states__row:target td { background: var(--kr-color-accent-soft); }

@media (max-width: 48rem) {
  .kr-states { grid-template-columns: minmax(0, 1fr); }
  .kr-states__nav { position: static; }
  .kr-states__badge { width: 9rem; }
}

/* --- External audit ------------------------------------------------------------------------
   external/detail.html lists a report's observations as the report reads: the paragraph, what was
   found, the recommendation and management's response, and who is to act. external/observation.html
   has the strip of those entered above its form; external/paste.html the pasted rows as a sheet. */

.kr-prewrap { white-space: pre-wrap; }

.kr-obs {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr) 15rem;
  gap: var(--kr-space-4);
  padding: var(--kr-space-4) 0;
  border-top: 1px solid var(--kr-color-border);
}
.kr-obs:first-of-type { border-top: 0; padding-top: 0; }
.kr-obs__para { margin: 0; font-weight: 600; }
/* A grid item's minimum width is its content's, so a long unbroken reference would widen the column. */
.kr-obs__body { min-width: 0; }
.kr-obs__title { margin: 0 0 var(--kr-space-1); font-size: var(--kr-font-lg); }
.kr-obs__text { margin: 0 0 var(--kr-space-2); line-height: 1.5; }
.kr-obs__label {
  margin: var(--kr-space-2) 0 var(--kr-space-1);
  font-size: var(--kr-font-sm);
  letter-spacing: var(--kr-tracking-caps);
  text-transform: uppercase;
  color: var(--kr-color-text-muted);
}
.kr-obs__tools { display: flex; gap: var(--kr-space-2); margin-top: var(--kr-space-2); }
.kr-obs__who { display: flex; flex-direction: column; align-items: flex-start; gap: var(--kr-space-1); font-size: var(--kr-font-body); }
.kr-obs__due { color: var(--kr-color-text-muted); }
.kr-obs__action { font-size: var(--kr-font-md); }

.kr-obsfile__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--kr-space-3);
}
.kr-obsfile__actions form { margin: 0; }
.kr-obsfile__actions .kr-field__hint { margin: 0; }

.kr-obsstrip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--kr-space-3);
}
.kr-obsstrip__list { display: flex; flex-wrap: wrap; gap: var(--kr-space-2); }
.kr-obsstrip__item {
  display: inline-flex;
  align-items: center;
  gap: var(--kr-space-1);
  padding: var(--kr-space-1) var(--kr-space-2);
  border-radius: var(--kr-radius-sm);
  background: var(--kr-color-bg);
  color: var(--kr-color-text);
  font-size: var(--kr-font-md);
  text-decoration: none;
}
.kr-obsstrip__item:hover { background: var(--kr-color-control-hover); }
.kr-obsstrip__item.is-current { background: var(--kr-color-accent-soft); color: var(--kr-color-accent); font-weight: 600; }
.kr-obsstrip__item--next { color: var(--kr-color-text-muted); }

.kr-pastebox { font-family: var(--kr-font-mono); font-size: var(--kr-font-md); min-height: 12rem; }

/* Each pasted row is a block of two lines: the short fields, then the three long texts side by side.
   Rows are told apart by their ground; one that is wrong is tinted, with what is wrong said in words. */
.kr-sheet { display: flex; flex-direction: column; }
.kr-sheet__row {
  display: flex;
  flex-direction: column;
  gap: var(--kr-space-2);
  padding: var(--kr-space-4) var(--kr-space-3);
  border-radius: var(--kr-radius);
}
.kr-sheet__row + .kr-sheet__row { border-top: 1px solid var(--kr-color-border); border-radius: 0; }
.kr-sheet__row.is-wrong + .kr-sheet__row,
.kr-sheet__row + .kr-sheet__row.is-wrong { border-top-color: transparent; }
.kr-sheet__row.is-wrong { background: var(--kr-color-danger-bg); }
.kr-sheet__line {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 2fr) minmax(10rem, 0.9fr) minmax(0, 1.5fr) 9rem auto;
  gap: var(--kr-space-3);
  align-items: end;
}
/* What was found is usually the longest of the three, and gets the most room. */
.kr-sheet__line--texts {
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1.2fr);
  align-items: start;
}
.kr-sheet__field { display: flex; flex-direction: column; gap: var(--kr-space-1); min-width: 0; }
.kr-sheet__field .kr-field__input,
.kr-sheet__field .kr-select,
.kr-sheet__field .kr-field__textarea { width: 100%; }
/* Each text is as tall as what it holds, within reason, so a paragraph is read whole, not through a slot. */
.kr-sheet__field .kr-field__textarea {
  field-sizing: content;
  min-height: 6rem;
  max-height: 18rem;
  line-height: 1.45;
}
.kr-sheet__label { font-size: var(--kr-font-sm); font-weight: 600; color: var(--kr-color-text-muted); }
.kr-sheet__remove { align-self: end; margin-bottom: var(--kr-space-1); }
.kr-sheet__problem { margin: 0; color: var(--kr-color-danger); font-size: var(--kr-font-md); }
.kr-sheet__problem .kr-icon { vertical-align: -0.15em; margin-right: var(--kr-space-1); }

@media (max-width: 64rem) {
  .kr-sheet__line { grid-template-columns: 5rem minmax(0, 1fr) auto; }
  .kr-sheet__line--texts { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 48rem) {
  .kr-obs { grid-template-columns: minmax(0, 1fr); gap: var(--kr-space-2); }
}

/* What each report counts (Settings): per report, who it goes to on the left; on the right the
   ready-made rules as cards, each with the findings it would count, then stage by stage. */
.kr-counts { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: var(--kr-space-6);
  padding: var(--kr-space-5) 0; border-bottom: 1px solid var(--kr-color-border); }
.kr-counts:first-child { padding-top: 0; }
.kr-counts:last-of-type { border-bottom: 0; }
.kr-counts__title { margin: 0 0 var(--kr-space-1); font-size: var(--kr-font-lg); }
.kr-counts__note { margin: 0 0 var(--kr-space-1); font-size: var(--kr-font-md); color: var(--kr-color-text-muted); }
.kr-counts__form { display: grid; gap: var(--kr-space-3); }
.kr-counts__presets { display: grid; gap: var(--kr-space-2); }
.kr-counts__preset { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--kr-space-3);
  align-items: start; padding: var(--kr-space-3); border: 1px solid var(--kr-color-border);
  border-radius: var(--kr-radius-lg); background: var(--kr-color-surface); cursor: pointer; }
.kr-counts__preset:has(input:checked) { border-color: var(--kr-color-text); background: var(--kr-color-bg); }
.kr-counts__preset > input { margin-top: var(--kr-space-0-5); }
.kr-counts__name { display: block; font-weight: 500; }
.kr-counts__hint { display: block; margin-top: var(--kr-space-0-5); font-size: var(--kr-font-md); color: var(--kr-color-text-muted); }
.kr-counts__n { font-variant-numeric: tabular-nums; white-space: nowrap; }
.kr-counts__n small { font-size: var(--kr-font-md); color: var(--kr-color-text-muted); }
.kr-counts__adjust > summary { cursor: pointer; padding: var(--kr-space-1) 0; font-size: var(--kr-font-body);
  color: var(--kr-color-text-muted); }
.kr-counts__ladder { list-style: none; margin: var(--kr-space-2) 0 0; padding: 0; display: grid; gap: var(--kr-space-0-5); }
.kr-counts__ladder label { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--kr-space-3);
  align-items: start; padding: var(--kr-space-2) var(--kr-space-3); border-radius: var(--kr-radius); cursor: pointer; }
.kr-counts__ladder label:hover { background: var(--kr-color-bg); }
.kr-counts__ladder input:not(:checked) ~ span .kr-counts__name { color: var(--kr-color-text-muted); }
.kr-counts__answers { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--kr-space-3);
  align-items: start; padding: 0 var(--kr-space-3); cursor: pointer; }
/* What a report counts, said under its page's lead. */
.kr-counts__line { margin: calc(-1 * var(--kr-space-3)) 0 0; }
.kr-counts__fixed { margin: var(--kr-space-4) 0 0; font-size: var(--kr-font-md); color: var(--kr-color-text-muted); }
.kr-counts__fixed b { color: var(--kr-color-text); font-weight: 600; }

@media (max-width: 48rem) {
  .kr-counts { grid-template-columns: minmax(0, 1fr); gap: var(--kr-space-3); }
}

/* --- Daily digest ---------------------------------------------------------------------------------
   A dated letter. The page head and the letter share one column, narrow enough to read as a letter
   rather than a report, so the button above sits over the letter's edge and not out at the screen's.

   The date is the heading. Under it a row of figures, tinted as the dashboard's tiles are, so whether
   the day matters is seen before anything is read. Then a section for each kind with anything in it, a
   rule between them, the state as a badge on the right so the eye runs down the badges. */

.kr-digest { max-width: 56rem; }
.kr-digest__letter { padding: var(--kr-space-6) var(--kr-space-8) var(--kr-space-4); }

.kr-digest__mast { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--kr-space-4); }
.kr-digest__dateline { min-width: 0; }
.kr-digest__date { margin: 0; font-size: var(--kr-font-3xl); font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
.kr-digest__part { margin: var(--kr-space-1) 0 0; color: var(--kr-color-text-muted); line-height: 1.45; }
.kr-digest__earlier { margin: var(--kr-space-2) 0 0; font-size: var(--kr-font-md); color: var(--kr-color-text-muted); }
.kr-digest__days { display: flex; flex: none; gap: var(--kr-space-2); }
/* The lengths over the heading: a day to a year, the one shown filled. */
.kr-digest__lengths { display: flex; flex-wrap: wrap; gap: var(--kr-space-2); margin: 0 0 var(--kr-space-5); }
.kr-digest__sofar { font-weight: 400; color: var(--kr-color-text-muted); }

/* Four at most, so four across. auto-fill, not auto-fit: a person who may read only what waits on them
   has one figure, and it keeps a figure's width rather than stretching across the letter. */
.kr-digest__figs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: var(--kr-space-2);
  margin: var(--kr-space-5) 0 0; padding: 0; list-style: none;
}
.kr-digest__figs > li { display: flex; }
.kr-digest__fig {
  display: flex; flex: 1; flex-direction: column; gap: var(--kr-space-1);
  padding: var(--kr-space-3) var(--kr-space-4); border-radius: var(--kr-radius-lg);
  background: var(--kr-color-bg); color: inherit; text-decoration: none;
}
.kr-digest__fig.bad { background: var(--kr-color-band-extreme-bg); }
.kr-digest__fig.warn { background: var(--kr-color-band-medium-bg); }
.kr-digest__n { font-size: var(--kr-font-figure); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.kr-digest__fig.bad .kr-digest__n { color: var(--kr-color-band-extreme); }
.kr-digest__fig.warn .kr-digest__n { color: var(--kr-color-band-medium); }
.kr-digest__fig.is-nought .kr-digest__n { color: var(--kr-color-text-muted); font-weight: 600; }
.kr-digest__label { font-size: var(--kr-font-md); line-height: 1.3; }
.kr-digest__fig.is-nought .kr-digest__label { color: var(--kr-color-text-muted); }
/* A figure is not a link; its label is, an ordinary .kr-link. */
.kr-digest__fig .kr-link { align-self: flex-start; }
/* The second line: what of it is worst, such as a notice to a regulator overdue. */
.kr-digest__figsaid { margin-top: auto; padding-top: var(--kr-space-1); font-size: var(--kr-font-sm);
  line-height: 1.35; color: var(--kr-color-text-muted); }

.kr-digest__quiet {
  display: flex; align-items: center; gap: var(--kr-space-3);
  margin-top: var(--kr-space-5); padding-top: var(--kr-space-5); border-top: var(--kr-border);
}
.kr-digest__quiet > .kr-icon {
  box-sizing: content-box; flex: none; width: 1.1rem; height: 1.1rem; padding: var(--kr-space-2); border-radius: var(--kr-radius-round);
  background: var(--kr-color-accent-soft); color: var(--kr-color-accent);
}
.kr-digest__quiet p { margin: 0; color: var(--kr-color-text-muted); }
.kr-digest__quiet strong { color: var(--kr-color-text); }

.kr-digest__sec { margin-top: var(--kr-space-4); padding-top: var(--kr-space-4); border-top: var(--kr-border); }
.kr-digest__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--kr-space-3);
  margin-bottom: var(--kr-space-2); }
.kr-digest__title { margin: 0; font-size: var(--kr-font-lg); font-weight: 600; }
.kr-digest__all { font-size: var(--kr-font-md); white-space: nowrap; }
.kr-digest__sub { margin: var(--kr-space-3) 0 var(--kr-space-1); font-size: var(--kr-font-md); font-weight: 600;
  color: var(--kr-color-text-muted); }
.kr-digest__head + .kr-digest__sub { margin-top: 0; }
/* A part of a section with its own "All": the heading and the link on one line. */
.kr-digest__head--sub { margin: var(--kr-space-3) 0 var(--kr-space-1); }
.kr-digest__head--sub > .kr-digest__sub { margin: 0; }
.kr-digest__head + .kr-digest__head--sub { margin-top: 0; }
/* The list behind a figure has no figures over it, so nothing to rule off. */
.kr-digest__letter > .kr-digest__quiet:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.kr-digest__table { width: 100%; border-collapse: collapse; font-size: var(--kr-font-body); }
.kr-digest__table td { padding: var(--kr-space-3) var(--kr-space-3) var(--kr-space-3) 0; vertical-align: top;
  border-top: var(--kr-border); }
.kr-digest__table tr:first-of-type td { border-top: 0; padding-top: var(--kr-space-2); }
.kr-digest__table tr:last-of-type td { padding-bottom: 0; }
.kr-digest__table td.kr-digest__state { padding-right: 0; text-align: right; white-space: nowrap; width: 1%; }
/* Two lines at most: an action as agreed can run to a paragraph, and the digest names it, it does not
   quote it. The action's own page has the rest. */
.kr-digest__what { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  line-height: 1.4; }
.kr-digest__ref { margin-right: var(--kr-space-1-5); color: var(--kr-color-text-muted); font-variant-numeric: tabular-nums;
  white-space: nowrap; }
.kr-digest__said { display: block; margin-top: var(--kr-space-1); font-size: var(--kr-font-md); line-height: 1.4;
  color: var(--kr-color-text-muted); }
.kr-digest__more, .kr-digest__standing { margin: var(--kr-space-2) 0 0; font-size: var(--kr-font-md);
  color: var(--kr-color-text-muted); }
.kr-digest__standing:empty { display: none; }

@media (max-width: 48rem) {
  .kr-digest__letter { padding: var(--kr-space-5) var(--kr-space-4) var(--kr-space-3); }
  .kr-digest__mast { flex-direction: column; gap: var(--kr-space-3); }
  .kr-digest__date { font-size: var(--kr-font-2xl); }
  .kr-digest__figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* An odd figure out takes the row, rather than leaving a hole beside it. */
  .kr-digest__figs > li:last-child:nth-child(odd):not(:first-child) { grid-column: 1 / -1; }
  .kr-digest__n { font-size: var(--kr-font-3xl); }
}

/* --- Dashboard ------------------------------------------------------------------------------------
   Each person's home screen, in the layout they chose. A tone tints a figure's number, or the whole
   ground of a tile or a question card, in the heat map's own band colours: red here is red there. */

.kr-dash__choose { display: flex; flex-wrap: wrap; gap: var(--kr-space-3) var(--kr-space-6); }
.kr-dash__choose .kr-chip { font: inherit; font-size: var(--kr-font-md); cursor: pointer; }

.kr-dash__head {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--kr-space-3);
  margin-bottom: var(--kr-space-2);
}
.kr-dash__head a, .kr-dash__foot a { font-size: var(--kr-font-md); }
.kr-dash__title { margin: 0; font-size: var(--kr-font-md); font-weight: 600; color: var(--kr-color-text-muted); }
.kr-dash__none, .kr-dash__note { margin: var(--kr-space-3) 0 0; font-size: var(--kr-font-md); color: var(--kr-color-text-muted); }
/* What to set up first, on a dashboard with no figure to show yet. */
.kr-dash__start { margin: var(--kr-space-3) 0 0; padding-left: var(--kr-space-5); display: grid; gap: var(--kr-space-2);
    font-size: var(--kr-font-md); color: var(--kr-color-text-muted); }
.kr-dash__startcard { margin-bottom: var(--kr-space-4); }
.kr-dash__sub { display: block; font-size: var(--kr-font-md); color: var(--kr-color-text-muted); }
.kr-dash__ref { font-family: var(--kr-font-mono); font-size: var(--kr-font-md); font-weight: 600; }

.kr-dash__n { font-size: var(--kr-font-figure); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.kr-dash__n.bad, .bad > .kr-dash__n, .kr-dash__strong.bad { color: var(--kr-color-band-extreme); }
.kr-dash__n.warn, .warn > .kr-dash__n, .kr-dash__strong.warn { color: var(--kr-color-band-medium); }
.kr-dash__n.good, .good > .kr-dash__n, .kr-dash__strong.good { color: var(--kr-color-band-low); }
.kr-dash__label { font-weight: 600; }
.kr-dash__said { font-size: var(--kr-font-md); color: var(--kr-color-text-muted); }

/* Waiting on you: the list two parts wide, the figures one. */
.kr-dash__waiting {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--kr-space-5); align-items: start;
}
.kr-dash__todo { list-style: none; margin: 0; padding: 0; }
.kr-dash__todo li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--kr-space-1) var(--kr-space-4);
  padding: var(--kr-space-3) 0; border-top: var(--kr-border);
}
.kr-dash__todo li:first-child { border-top: 0; }
/* What waits is an ordinary .kr-link, held to its own width in the row. */
.kr-dash__what { justify-self: start; }
.kr-dash__why { grid-column: 1; font-size: var(--kr-font-md); color: var(--kr-color-text-muted); }
.kr-dash__when { grid-row: 1 / span 2; grid-column: 2; text-align: right; }
.kr-dash__fig {
  display: grid; grid-template-columns: 3.75rem minmax(0, 1fr); gap: var(--kr-space-0-5) var(--kr-space-3); align-items: baseline;
  padding: var(--kr-space-3) 0; border-top: var(--kr-border);
}
.kr-dash__head + .kr-dash__fig { border-top: 0; }
.kr-dash__fig .kr-dash__n { grid-row: 1 / span 2; }
/* A figure's label is its link, an ordinary .kr-link; the figure itself is not a link. */
.kr-dash__fig .kr-link { justify-self: start; }

/* Figures, then lists. A tile is a card, not a link: its label is the link. */
.kr-dash__tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--kr-space-3); }
.kr-dash__tile {
  display: flex; flex-direction: column; gap: var(--kr-space-1); padding: var(--kr-space-4) var(--kr-space-5);
}
.kr-dash__tile .kr-link { align-self: flex-start; }
.kr-dash__tile.bad { background: var(--kr-color-band-extreme-bg); border-color: transparent; box-shadow: none; }
.kr-dash__tile.warn { background: var(--kr-color-band-medium-bg); border-color: transparent; box-shadow: none; }
.kr-dash__tile.good { background: var(--kr-color-band-low-bg); border-color: transparent; box-shadow: none; }
.kr-dash__lists {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--kr-space-4); align-items: start;
}
.kr-dash__table { width: 100%; border-collapse: collapse; }
.kr-dash__table th, .kr-dash__table td {
  text-align: left; padding: var(--kr-space-2) var(--kr-space-2) var(--kr-space-2) 0; border-top: var(--kr-border);
  vertical-align: top;
}
.kr-dash__table th { border-top: 0; padding-top: 0; font-size: var(--kr-font-sm); font-weight: 600; color: var(--kr-color-text-muted); }
.kr-dash__table .is-num { text-align: right; padding-right: 0; white-space: nowrap; }
.kr-dash__cal { list-style: none; margin: 0; padding: 0; }
.kr-dash__cal li {
  display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); gap: var(--kr-space-3);
  padding: var(--kr-space-2) 0; border-top: var(--kr-border);
}
.kr-dash__cal li:first-child { border-top: 0; }
.kr-dash__day {
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--kr-space-1) 0;
  background: var(--kr-color-bg); border-radius: var(--kr-radius); line-height: 1.1;
}
.kr-dash__day b { font-size: var(--kr-font-xl); }
.kr-dash__day span { font-size: var(--kr-font-xs); color: var(--kr-color-text-muted); text-transform: uppercase; }
.kr-dash__cal-what { font-weight: 600; }

/* The questions, answered: each card tinted by its answer. */
.kr-dash__questions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--kr-space-4); }
.kr-dash__q { display: flex; flex-direction: column; gap: var(--kr-space-2); padding: var(--kr-space-5); }
.kr-dash__q.bad { background: var(--kr-color-band-extreme-bg); border-color: transparent; box-shadow: none; }
.kr-dash__q.warn { background: var(--kr-color-band-medium-bg); border-color: transparent; box-shadow: none; }
.kr-dash__q.good { background: var(--kr-color-band-low-bg); border-color: transparent; box-shadow: none; }
.kr-dash__ask { margin: 0; font-size: var(--kr-font-md); font-weight: 600; color: var(--kr-color-text-muted); }
.kr-dash__ans { margin: 0; font-size: var(--kr-font-lg); font-weight: 600; line-height: 1.35; }
.kr-dash__more { margin: 0; font-size: var(--kr-font-body); }
.kr-dash__foot {
  display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: var(--kr-space-2);
  font-size: var(--kr-font-md);
}
.kr-dash__verdict { font-weight: 700; }
.bad > .kr-dash__foot .kr-dash__verdict { color: var(--kr-color-band-extreme); }
.warn > .kr-dash__foot .kr-dash__verdict { color: var(--kr-color-band-medium); }
.good > .kr-dash__foot .kr-dash__verdict { color: var(--kr-color-band-low); }

@media (max-width: 64rem) {
  .kr-dash__waiting, .kr-dash__lists, .kr-dash__questions { grid-template-columns: minmax(0, 1fr); }
  .kr-dash__tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- Scorecard targets: a figure with its bound and unit, the standard rule beside it ---- */
.kr-target { display: inline-flex; align-items: center; gap: var(--kr-space-2); white-space: nowrap; }
.kr-target__bound { min-width: 4.2em; color: var(--kr-color-text-muted); font-size: var(--kr-font-body); }
.kr-target__input.kr-field__input { width: 6.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.kr-target__unit { min-width: 2.2em; color: var(--kr-color-text-muted); font-size: var(--kr-font-body); }
.kr-target__rule { color: var(--kr-color-text-muted); font-size: var(--kr-font-body); min-width: var(--kr-row-head-min); }
/* A measure whose target the request leaves as it is: shown, but quieter than what changes. */
.kr-target__same td { color: var(--kr-color-text-muted); }
.kr-target__kept + .kr-target__kept { margin-top: var(--kr-space-4); padding-top: var(--kr-space-4); border-top: var(--kr-border); }
.kr-target__from { margin: 0; font-weight: 600; }
.kr-target__lines { margin: var(--kr-space-1-5) 0 0; padding-left: var(--kr-space-5); font-size: var(--kr-font-body); }


/* --- Board and committees -------------------------------------------------------------------------
   A meeting's page reads as its agenda: each item numbered in a disc, its title and purpose beside it,
   what the body is asked to do in a line under, then its papers, any interest declared in it and the
   resolutions passed on it, each on a tinted ground of its own, never a stripe down one side. */

/* A card's sentence here says what the record is and how it behaves, too long to sit beside the title
   in a column a few words wide: it goes under the title, as it does on a phone everywhere. */
.kr-board .kr-card__head:has(> .kr-card__text) { flex-direction: column; align-items: flex-start; gap: var(--kr-space-1); }

/* A body's or a meeting's name is the thing read in these tables, and they have the room: it wraps
   rather than being cut off at the narrow width a stacked cell keeps elsewhere. */
.kr-board .kr-stackcell { max-width: 46rem; }
.kr-board .kr-stackcell__main,
.kr-board .kr-stackcell__sub { white-space: normal; }

/* A form that is a whole dialog: head, body and foot keep their places and only the body scrolls. */
.kr-modal__form { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; margin: 0; }

.kr-board__long { min-height: 14rem; font-size: var(--kr-font-md); line-height: 1.55; }

/* A meeting's facts: each a label and its value on one line, read down like the head of minutes; who
   attends by invitation beside them on a wide screen, below them on a narrow one. */
.kr-board__facts { display: grid; gap: var(--kr-space-5) var(--kr-space-8); }
@media (min-width: 64rem) {
  .kr-board__facts { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}
.kr-detail--rows { grid-template-columns: minmax(0, 1fr); gap: var(--kr-space-2); align-content: start; }
.kr-detail--rows .kr-detail__item { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); column-gap: var(--kr-space-4); align-items: baseline; }
.kr-detail--rows .kr-detail__label { font-size: var(--kr-font-sm); }
.kr-board__terms {
  max-height: 28rem; overflow-y: auto; padding: var(--kr-space-4); border-radius: var(--kr-radius-lg);
  background: var(--kr-color-bg); font-size: var(--kr-font-md); line-height: 1.55;
}

/* What sits under an item's title lines up with the title: the number's disc and the gap after it. */
.kr-board__item {
  --kr-board-indent: calc(var(--kr-space-8) + var(--kr-space-3));
  display: flex; flex-direction: column; gap: var(--kr-space-3);
  scroll-margin-top: calc(var(--kr-topbar-height) + var(--kr-space-5));
}
.kr-board__item + .kr-board__item { padding-top: var(--kr-space-5); border-top: var(--kr-border); }
.kr-board__itemhead { display: flex; align-items: flex-start; gap: var(--kr-space-3); }
.kr-board__number {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: var(--kr-space-8); height: var(--kr-space-8); border-radius: var(--kr-radius-round);
  background: var(--kr-color-accent-soft); color: var(--kr-color-accent);
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.kr-board__itemtitle { flex: 1; min-width: 0; }
.kr-board__itemtitle h3 { margin: 0.15rem 0 0; font-size: var(--kr-font-lg); font-weight: 600; line-height: 1.3; }
.kr-board__itemtitle p { margin: var(--kr-space-1) 0 0; }
.kr-board__itemactions { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: var(--kr-space-1); }
.kr-board__itemactions form { margin: 0; }
.kr-board__up .kr-icon { transform: rotate(-90deg); }
.kr-board__down .kr-icon { transform: rotate(90deg); }
.kr-board__asked { margin: 0 0 0 var(--kr-board-indent); font-style: italic; color: var(--kr-color-text-muted); }

.kr-board__papers { display: flex; flex-direction: column; gap: var(--kr-space-2); margin: 0 0 0 var(--kr-board-indent); padding: 0; list-style: none; }
.kr-board__papers li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--kr-space-2); }
.kr-board__papers li > .kr-icon { flex: none; color: var(--kr-color-text-muted); }
.kr-board__papers form { margin: 0; }
.kr-board__item > .kr-muted,
.kr-board__item > div:not([class]),
.kr-board__item > .kr-form,
.kr-board__item > .kr-board__minutes,
.kr-board__item > .kr-board__note,
.kr-board__item > .kr-board__resolution { margin-left: var(--kr-board-indent); }

.kr-board__note {
  display: flex; align-items: flex-start; gap: var(--kr-space-2);
  padding: var(--kr-space-2) var(--kr-space-3); border-radius: var(--kr-radius);
  background: var(--kr-color-warning-bg); font-size: var(--kr-font-md);
}
.kr-board__note > .kr-icon { flex: none; margin-top: 0.1rem; color: var(--kr-color-warning); }

.kr-board__resolution {
  display: flex; flex-direction: column; gap: var(--kr-space-1);
  padding: var(--kr-space-3) var(--kr-space-4); border-radius: var(--kr-radius-lg);
  background: var(--kr-color-accent-soft);
}
.kr-board__resolution p { margin: 0; line-height: 1.5; }
.kr-board__resref { display: flex; align-items: center; gap: var(--kr-space-2); font-weight: 600; }
.kr-board__minutes {
  padding: var(--kr-space-3) var(--kr-space-4); border-radius: var(--kr-radius-lg);
  background: var(--kr-color-bg); line-height: 1.55;
}

/* Who was there: a chip each, present full, apologies and absent quieter. */
.kr-board__attendance {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: var(--kr-space-2);
  margin: 0; padding: 0; list-style: none;
}
.kr-board__attendance li {
  display: grid; grid-template-columns: 1fr auto; gap: 0 var(--kr-space-2);
  padding: var(--kr-space-2) var(--kr-space-3); border-radius: var(--kr-radius);
  background: var(--kr-color-success-bg);
}
.kr-board__attname { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.kr-board__attseat { grid-column: 1; font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }
.kr-board__attpresence { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: var(--kr-font-sm); font-weight: 600; color: var(--kr-color-success); }
.kr-board__attendance li.kr-board__attendance--apologies { background: var(--kr-color-bg); }
.kr-board__attendance li.kr-board__attendance--absent { background: var(--kr-color-danger-bg); }
.kr-board__attendance--apologies .kr-board__attpresence { color: var(--kr-color-text-muted); }
.kr-board__attendance--absent .kr-board__attpresence { color: var(--kr-color-danger); }

/* Short choices, one per member: in a row, each as wide as its word. .kr-checks is a grid of columns
   wide enough for a sentence, which stacks three words down a narrow table cell. */
.kr-checks.kr-board__votes { display: flex; flex-wrap: wrap; gap: var(--kr-space-2) var(--kr-space-4); }

.kr-board__docs { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: var(--kr-space-5); }
.kr-board__doc { display: flex; flex-direction: column; gap: var(--kr-space-2); }
.kr-board__doc .kr-subhead { margin: 0; }
.kr-board__doc .kr-linklist li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--kr-space-2); }

/* The evaluation: a statement, then six choices in a row, the ends named under. */
.kr-board__statement { display: flex; flex-direction: column; gap: var(--kr-space-2); }
.kr-board__statement + .kr-board__statement { padding-top: var(--kr-space-4); border-top: var(--kr-border); }
.kr-board__area { margin: 0; font-size: var(--kr-font-sm); font-weight: 600; text-transform: uppercase; letter-spacing: var(--kr-tracking-caps); color: var(--kr-color-text-muted); }
.kr-board__said { margin: 0; font-weight: 600; line-height: 1.4; }
.kr-board__scale { display: grid; grid-template-columns: repeat(5, minmax(2.75rem, 4rem)) auto; gap: var(--kr-space-2); }
.kr-board__point { position: relative; display: flex; }
.kr-board__point input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.kr-board__point span {
  flex: 1; display: flex; align-items: center; justify-content: center; min-height: 2.75rem;
  padding: 0 var(--kr-space-3); border: var(--kr-border); border-radius: var(--kr-radius);
  background: var(--kr-color-control-face); font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer;
}
.kr-board__point--none span { font-weight: 400; color: var(--kr-color-text-muted); }
.kr-board__point input:hover + span { border-color: var(--kr-color-control-border-hover); }
.kr-board__point input:focus-visible + span { outline: 2px solid var(--kr-color-focus); outline-offset: 2px; }
.kr-board__point input:checked + span { background: var(--kr-color-accent); border-color: var(--kr-color-accent); color: var(--kr-color-accent-contrast); }
.kr-board__ends {
  display: flex; justify-content: space-between; width: calc(5 * 4rem + 4 * var(--kr-space-2)); max-width: 100%;
  font-size: var(--kr-font-sm); color: var(--kr-color-text-muted);
}

/* Results: a count under each rating, the cell tinted by how many gave it. */
.kr-board__counts { display: flex; gap: var(--kr-space-1); }
.kr-board__count {
  display: flex; flex-direction: column; align-items: center; min-width: 2.25rem;
  padding: var(--kr-space-1) 0; border-radius: var(--kr-radius); background: var(--kr-color-bg);
}
.kr-board__countn { font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }
.kr-board__countv { font-weight: 700; font-variant-numeric: tabular-nums; }
.kr-board__comments { margin: var(--kr-space-2) 0 0; padding-left: 1.1rem; font-size: var(--kr-font-md); color: var(--kr-color-text-muted); }
.kr-board__comments li + li { margin-top: var(--kr-space-1); }

@media (max-width: 40rem) {
  .kr-board__itemhead { flex-wrap: wrap; }
  .kr-board__itemactions { width: 100%; margin-left: var(--kr-board-indent); }
  .kr-board__asked, .kr-board__papers,
  .kr-board__item > .kr-muted, .kr-board__item > div:not([class]), .kr-board__item > .kr-form,
  .kr-board__item > .kr-board__minutes, .kr-board__item > .kr-board__note,
  .kr-board__item > .kr-board__resolution { margin-left: 0; }
  .kr-board__scale { grid-template-columns: repeat(5, 1fr); }
  .kr-board__point--none { grid-column: 1 / -1; }
}

/* ---- Business continuity: a process's impact analysis (continuity/processes/layouts.html) ------------ */

/* The times impact is rated at: short words, so more to a row than a choice with a sentence. */
.kr-checks--times { grid-template-columns: repeat(auto-fill, minmax(min(8rem, 100%), 1fr)); }

/* A stat that asks to be looked at: its icon takes the danger tint, as --net takes success's (the
   status tones, under the badges). */

/* The grid: dimensions down, time across. One hue, light to dark, over five shades whatever the matrix's
   size (AnalysisView.shade), mixed into the surface so dark mode follows. Every cell also says its level. */
.kr-bia {
  width: 100%;
  border-collapse: separate;
  border-spacing: 3px;
  font-size: var(--kr-font-sm);
}
.kr-bia th {
  font-weight: 600;
  color: var(--kr-color-text-muted);
  text-align: left;
  padding: var(--kr-space-1) var(--kr-space-2);
  white-space: nowrap;
}
.kr-bia th.kr-bia__time { text-align: center; }
.kr-bia__cell {
  text-align: center;
  padding: var(--kr-space-2) var(--kr-space-1);
  border-radius: var(--kr-radius-sm);
  white-space: nowrap;
}
.kr-shade--1 { background: color-mix(in srgb, var(--kr-color-text) 5%, var(--kr-color-surface)); color: var(--kr-color-text-muted); }
.kr-shade--2 { background: color-mix(in srgb, var(--kr-color-band-extreme) 16%, var(--kr-color-surface)); color: var(--kr-color-text); }
.kr-shade--3 { background: color-mix(in srgb, var(--kr-color-band-extreme) 36%, var(--kr-color-surface)); color: var(--kr-color-text); }
.kr-shade--4 { background: color-mix(in srgb, var(--kr-color-band-extreme) 72%, var(--kr-color-surface)); color: var(--kr-color-danger-contrast); font-weight: 600; }
.kr-shade--5 { background: var(--kr-color-band-extreme); color: var(--kr-color-danger-contrast); font-weight: 600; }
.kr-bia__tolerable { outline: 2px solid var(--kr-color-text); outline-offset: -2px; }
.kr-bia--compact .kr-bia__cell { padding: var(--kr-space-1); font-variant-numeric: tabular-nums; }

/* RTO and MTPD named in the column they fall in. */
.kr-bia__tag {
  display: inline-block;
  margin-left: var(--kr-space-1);
  padding: 0 var(--kr-space-1-5);
  border-radius: var(--kr-radius-pill);
  background: var(--kr-color-text);
  color: var(--kr-color-surface);
  font-size: var(--kr-font-xs);
  font-weight: 600;
  text-decoration: none;
  cursor: help;
}
.kr-bia__tag--rto { background: var(--kr-color-accent); color: var(--kr-color-accent-contrast); }

.kr-bia__key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--kr-space-2) var(--kr-space-4);
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
}
.kr-bia__key-title { font-weight: 600; }
.kr-bia__key-item { display: inline-flex; align-items: center; gap: var(--kr-space-1); }
.kr-bia__swatch { display: inline-block; width: 0.9rem; height: 0.9rem; border-radius: var(--kr-radius-sm); }
.kr-bia__key .kr-bia__tag { margin-left: 0; }

/* The form's grid: a select in each cell. */
.kr-bia--edit td { padding: 0; min-width: 9rem; }

/* Impact over time: the worst level as a step line, the objectives drawn across it. */
.kr-bia__figure { margin: 0; }
/* Drawn in a 720-wide view box and scaled to the card, so the text below is set small to read at the
   page's own size once scaled; capped so a wide screen does not blow it up. Its type is the scale's
   smallest step read as the drawing's units: 11 at the 16px base and 12.4 at the largest text size,
   inside the 102 units the level names have to the left of the axis. */
.kr-bia__curve { display: block; width: 100%; max-width: 60rem; height: auto; }
.kr-bia__intolerable { fill: var(--kr-color-band-extreme); opacity: 0.08; }
.kr-bia__grid line { stroke: var(--kr-color-border); }
.kr-bia__axis text { font-size: var(--kr-font-xs); fill: var(--kr-color-text-muted); }
.kr-bia__line { fill: none; stroke: var(--kr-color-text); stroke-width: 2; }
.kr-bia__points circle { fill: var(--kr-color-text); stroke: var(--kr-color-surface); stroke-width: 2; }
.kr-bia__mark { stroke: var(--kr-color-text); stroke-width: 2; }
.kr-bia__mark--rto { stroke: var(--kr-color-accent); stroke-dasharray: 5 4; }
.kr-bia__mark-label { font-size: var(--kr-font-xs); font-weight: 600; fill: var(--kr-color-text); }
.kr-bia__mark-label--rto { fill: var(--kr-color-accent); }
.kr-bia__caption { margin-top: var(--kr-space-2); font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }

.kr-bia__more > summary {
  cursor: pointer;
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
  margin-bottom: var(--kr-space-3);
}

/* The gaps lead: the objectives beside a compact grid, then a bar for each dependency. */
.kr-bia__pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: var(--kr-space-4);
  align-items: start;
}
.kr-bia__bars { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--kr-space-3); }
.kr-bia__bar {
  display: grid;
  grid-template-columns: minmax(0, 16rem) minmax(0, 1fr) minmax(0, 12rem);
  gap: var(--kr-space-3);
  align-items: center;
  font-size: var(--kr-font-md);
}
.kr-bia__bar-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kr-bia__bar-said { display: inline-flex; align-items: center; gap: var(--kr-space-2); white-space: nowrap; }
.kr-bia__track { display: block; width: 100%; height: 18px; overflow: visible; }
.kr-bia__bed { fill: color-mix(in srgb, var(--kr-color-text) 7%, var(--kr-color-surface)); }
.kr-bia__fill { fill: var(--kr-color-text-muted); }
.kr-bia__fill--short { fill: var(--kr-color-danger); }
.kr-bia__objective { fill: var(--kr-color-accent); }

@media (max-width: 48rem) {
  .kr-bia__pair { grid-template-columns: minmax(0, 1fr); }
  /* Scaled to a phone the drawing's text would be some 4px, so it keeps its drawn width and scrolls
     sideways in the card, as a table does, with its text at the size its spacing was drawn for. */
  .kr-bia__figure { overflow-x: auto; }
  .kr-bia__curve { min-width: 720px; }
  .kr-bia__bar { grid-template-columns: 1fr; gap: var(--kr-space-1); }
}

/* A plan's call tree: each person after whoever calls them, set in a step for each call away from the
   top. Steps rather than a computed indent, because the page's style policy refuses a style attribute;
   past the fourth step the tree is read by its order. */
.kr-calltree__who { display: inline-block; }
.kr-calltree__who--1 { padding-inline-start: var(--kr-space-5); }
.kr-calltree__who--2 { padding-inline-start: calc(2 * var(--kr-space-5)); }
.kr-calltree__who--3 { padding-inline-start: calc(3 * var(--kr-space-5)); }
.kr-calltree__who--4 { padding-inline-start: calc(4 * var(--kr-space-5)); }

/* --- A finding checked by AI ------------------------------------------------------------------------
   The check's summary over the form, and its points under the boxes they are about. A point is a tinted
   ground, never a stripe down one side: warning for a point to change, info for one to consider. The same
   pieces draw the report's check, whose table counts the points by part. */
.kr-checkbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--kr-space-3);
  flex-wrap: wrap;
  padding: var(--kr-space-3) var(--kr-space-4);
  border: 1px solid var(--kr-color-border);
  border-radius: var(--kr-radius-lg);
  background: var(--kr-color-surface);
}
.kr-checkbar__text { min-width: 0; }
.kr-checkbar__title {
  display: flex;
  align-items: center;
  gap: var(--kr-space-2);
  margin: 0;
  font-weight: 600;
}
.kr-checkbar__meta,
.kr-checkbar__progress {
  margin: var(--kr-space-0-5) 0 0;
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
}
.kr-checkbar__meta:empty { display: none; }
.kr-checkbar__stale {
  margin: var(--kr-space-1) 0 0;
  font-size: var(--kr-font-sm);
  color: var(--kr-color-warning-contrast);
}

.kr-checkpoint {
  margin-top: var(--kr-space-2);
  padding: var(--kr-space-2) var(--kr-space-3);
  border-radius: var(--kr-radius);
  font-size: var(--kr-font-sm);
  line-height: 1.5;
}
.kr-checkpoint--change { background: var(--kr-color-warning-bg); }
.kr-checkpoint--consider { background: color-mix(in srgb, var(--kr-color-info) 10%, var(--kr-color-surface)); }
.kr-checkpoint__head { margin: 0; font-weight: 600; }
.kr-checkpoint__weight {
  margin-inline-end: var(--kr-space-2);
  font-size: var(--kr-font-xs);
  font-weight: 600;
  letter-spacing: var(--kr-tracking-caps);
  text-transform: uppercase;
  color: var(--kr-color-text-muted);
}
.kr-checkpoint__why { margin: var(--kr-space-1) 0 0; }
.kr-checkpoint__wording {
  margin: var(--kr-space-2) 0 0;
  padding: var(--kr-space-2) var(--kr-space-3);
  border: 1px dashed var(--kr-color-border);
  border-radius: var(--kr-radius-sm);
  background: var(--kr-color-surface);
}
.kr-checkpoint__text { white-space: pre-wrap; }
.kr-checkpoint__label {
  display: block;
  margin-bottom: var(--kr-space-0-5);
  font-size: var(--kr-font-xs);
  font-weight: 600;
  color: var(--kr-color-text-muted);
}
.kr-checkpoint__actions { margin: var(--kr-space-2) 0 0; }
.kr-checknone {
  margin: var(--kr-space-1) 0 0;
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
}

/* AI's check of management's answer, under the answer: its points, then the button. Stretched to the
   answer's width, since the points are as wide as their sentences. */
.kr-answercheck { display: grid; gap: var(--kr-space-2); justify-self: stretch; justify-items: start; }
.kr-answercheck > .kr-checkpoint,
.kr-answercheck > .kr-checkbar__stale,
.kr-answercheck > .kr-checknone { justify-self: stretch; margin-top: 0; }
.kr-answercheck__label { margin: 0; font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }

/* A finding drafted from the auditor's notes: the notes folded above the boxes, and the drafted wording
   under each box as a check's point with no headline, so its wording comes first. */
.kr-checkpoint__wording--first { margin-top: 0; }
.kr-draftnotes { margin: 0; }
.kr-draftnotes__body {
  display: grid;
  gap: var(--kr-space-3);
  padding: 0 var(--kr-space-4) var(--kr-space-4);
}
.kr-draftnotes__actions { display: flex; flex-wrap: wrap; gap: var(--kr-space-2); margin: 0; }

/* Risks suggested by AI for a unit (risks/suggest.html): a check's point each, its causes, consequences
   and the controls usually expected under small labels. */
.kr-suggestions { display: grid; gap: var(--kr-space-3); }
.kr-suggestions > .kr-suggestion { margin-top: 0; }
.kr-suggestion__meta { margin: var(--kr-space-0-5) 0 0; color: var(--kr-color-text-muted); }
.kr-suggestion__part { margin: var(--kr-space-2) 0 0; }
.kr-suggestion__part ul { margin: 0; padding-inline-start: var(--kr-space-5); }

/* The week outside (risks/outside.html): the items kept under a heading a category, each as a suggestion
   is; one decided loses its tint and says what was done. */
.kr-outside__group { display: grid; gap: var(--kr-space-2); }
.kr-outside__heading { margin: 0; font-size: var(--kr-font-body); font-weight: 600; }
.kr-outside__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--kr-space-2); }
.kr-outside__actions form { margin: 0; }

.kr-checktable .kr-checktable__mark { width: 6.5rem; text-align: center; white-space: nowrap; }
.kr-checktable__when { white-space: nowrap; font-size: var(--kr-font-sm); }
.kr-checktable__toggle { margin: var(--kr-space-1) 0 0; }
.kr-checktable__points > td { background: var(--kr-color-bg); }
/* A finding is a tbody of its row and its points, so the table's "no rule under the last row" would leave
   a finding without points no rule at all. The rule is drawn between findings instead. */
.kr-checktable tbody + tbody > tr:first-child > td { border-top: var(--kr-border); }
.kr-checktable__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: var(--kr-space-2);
}
.kr-checktable__grid .kr-checkpoint { margin-top: 0; }

.kr-checkmark {
  display: inline-block;
  min-width: 1.6rem;
  padding: 1px var(--kr-space-1-5);
  border-radius: var(--kr-radius-pill);
  font-size: var(--kr-font-xs);
  font-weight: 600;
  text-align: center;
}
.kr-checkmark + .kr-checkmark { margin-inline-start: var(--kr-space-1); }
.kr-checkmark--change {
  background: color-mix(in srgb, var(--kr-color-warning) 22%, var(--kr-color-surface));
  color: var(--kr-color-text);
}
.kr-checkmark--consider {
  background: color-mix(in srgb, var(--kr-color-info) 16%, var(--kr-color-surface));
  color: var(--kr-color-text);
}
.kr-checkmark--none { color: var(--kr-color-text-muted); }
.kr-checkkey {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kr-space-2) var(--kr-space-4);
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
}
.kr-checkkey__title { font-weight: 600; color: var(--kr-color-text); }

/* The operator's table of tiers: a column per tier, the chosen one on a tinted ground (never a stripe),
   a row per paid part, and a last column ticking what is added on top. */
.kr-tiertable { width: 100%; }
.kr-tiertable tbody th[scope="row"] { min-width: var(--kr-row-head-min); text-align: start; }
/* Scoped to the table: .kr-table th/td sets text-align itself and would outrank a lone class. */
.kr-tiertable .kr-tiertable__tier, .kr-tiertable .kr-tiertable__cell { text-align: center; white-space: nowrap; }
.kr-tiertable__pick { display: inline-flex; gap: var(--kr-space-1); align-items: center; cursor: pointer; }
.kr-tiertable__chosen { background: var(--kr-color-success-bg); }
.kr-tiertable__yes { color: var(--kr-color-success); font-weight: 600; }
.kr-tiertable__no { color: var(--kr-color-text-muted); }
.kr-tiertable__meaning {
  display: block;
  max-width: var(--kr-measure);
  font-weight: 400;
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
}
.kr-tiertable__key { margin: var(--kr-space-2) 0 0; font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }
/* A row head is a cell like the others: ruled under, the last row left open. */
.kr-tiertable tbody th { border-bottom: var(--kr-border); }
.kr-tiertable tbody:last-child tr:last-child th { border-bottom: none; }
/* The organisation's Subscription page reads the same table: the tier that brings each block of parts
   heads it, the organisation's column says "Yours", and what a tier can have added is said, not ticked. */
/* Each group is its own tbody, whose last row the table leaves open; the heading below rules across the
   whole width, so the line between two groups is never drawn under some columns and not others. */
.kr-tiertable__group th {
  border-top: var(--kr-border);
  background: var(--kr-color-bg);
  font-size: var(--kr-font-xs);
  font-weight: 700;
  letter-spacing: var(--kr-tracking-caps);
  text-transform: uppercase;
  color: var(--kr-color-text-muted);
}
.kr-tiertable__can { font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }
.kr-tiertable__added { font-size: var(--kr-font-sm); font-weight: 600; color: var(--kr-color-success); }
.kr-tiertable__plain { font-variant-numeric: tabular-nums; }
.kr-tiertable__strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.kr-tiertable__full { font-weight: 600; color: var(--kr-color-danger); }
/* A tier's head: its mark, its name, then "Your plan" or the step up to it. The organisation's own
   column is ruled across its top as well as tinted, so it is found before the tint is noticed. */
.kr-tiertable__head { display: inline-grid; justify-items: center; gap: var(--kr-space-1); }
.kr-tiertable__name { font-size: var(--kr-font-md); font-weight: 700; }
.kr-tiertable thead .kr-tiertable__chosen { box-shadow: inset 0 var(--kr-space-0-5) 0 var(--kr-color-success); }

/* A tier's mark: its insaka icon on its own ground (fragments/tiermark.html). */
.kr-tiermark {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--kr-control-height-lg);
  height: var(--kr-control-height-lg);
  border-radius: var(--kr-radius);
}
.kr-tiermark .kr-icon { width: 62%; height: 62%; }
.kr-tiermark--large { width: calc(var(--kr-control-height-lg) * 1.75); height: calc(var(--kr-control-height-lg) * 1.75); border-radius: var(--kr-radius-lg); }
.kr-tiermark--stool { background: var(--kr-color-tier-stool-bg); color: var(--kr-color-tier-stool); }
.kr-tiermark--circle { background: var(--kr-color-tier-circle-bg); color: var(--kr-color-tier-circle); }
.kr-tiermark--shelter { background: var(--kr-color-tier-shelter-bg); color: var(--kr-color-tier-shelter); }

/* The organisation's plan, on Settings → Subscription: its mark, what it is and what it costs, its people
   against the limit, and the one step up. */
.kr-plan__body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--kr-space-4);
  align-items: start;
}
.kr-plan__what { display: grid; justify-items: start; gap: var(--kr-space-1); }
.kr-plan__title { margin: 0; font-size: var(--kr-font-xl); }
.kr-plan__summary { margin: 0; color: var(--kr-color-text-muted); }
.kr-plan__facts { display: flex; flex-wrap: wrap; gap: var(--kr-space-3) var(--kr-space-5); margin: var(--kr-space-2) 0 0; }
.kr-plan__facts dt { font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }
.kr-plan__facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.kr-plan__people { min-width: calc(var(--kr-row-head-min) * 0.8); }
.kr-plan__full { color: var(--kr-color-danger); }
.kr-plan__meter {
  display: block;
  width: 100%;
  height: var(--kr-space-1);
  margin-top: var(--kr-space-1);
  border: 0;
  border-radius: var(--kr-radius-pill);
  background: var(--kr-color-control);
  appearance: none;
  -webkit-appearance: none;
  overflow: hidden;
}
.kr-plan__meter::-webkit-progress-bar { background: var(--kr-color-control); }
.kr-plan__meter::-webkit-progress-value { background: var(--kr-color-accent); }
.kr-plan__meter::-moz-progress-bar { background: var(--kr-color-accent); }
.kr-plan__meter--full::-webkit-progress-value { background: var(--kr-color-warning); }
.kr-plan__meter--full::-moz-progress-bar { background: var(--kr-color-warning); }
.kr-plan__note { margin: 0; font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }
.kr-plan__next { display: grid; justify-items: end; gap: var(--kr-space-2); }
.kr-plan__said {
  margin: 0;
  padding: var(--kr-space-2) var(--kr-space-4);
  border-top: var(--kr-border);
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
}
@media (max-width: 48rem) {
  .kr-plan__body { grid-template-columns: 1fr; }
  .kr-plan__next { justify-items: start; }
}

/* The hosted installation's public prices and checkout (public/prices.html, public/signup.html). */
.kr-pricefor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--kr-space-2) var(--kr-space-3);
}
.kr-pricefor .kr-field__label { margin: 0; }
/* While the page asks the browser where it is, the prices it would replace are not shown. */
.kr-js .kr-pricefor[data-kr-locate] ~ * { visibility: hidden; }
.kr-pricefor .kr-select { width: min(100%, calc(var(--kr-row-head-min) * 1.2)); }

.kr-offers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, calc(var(--kr-row-head-min) * 1.1)), 1fr));
  gap: var(--kr-space-4);
  align-items: stretch;
}
.kr-offer { display: flex; flex-direction: column; }
.kr-offer__body { flex: 1; display: flex; flex-direction: column; gap: var(--kr-space-3); height: 100%; }
/* The middle tier, the one most organisations want, on a tinted ground and ringed, never striped. */
.kr-offer--picked { background: var(--kr-color-accent-soft); box-shadow: 0 0 0 var(--kr-space-0-5) var(--kr-color-accent); }
.kr-offer--picked .kr-tiermark { background: var(--kr-color-surface); }
.kr-offer__head { display: flex; align-items: center; gap: var(--kr-space-3); }
.kr-offer__name { margin: 0; font-size: var(--kr-font-xl); }
.kr-offer__summary { margin: 0; color: var(--kr-color-text-muted); }
.kr-offer__price {
  margin: 0;
  font-size: var(--kr-font-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.kr-offer__price small { font-size: var(--kr-font-body); font-weight: 400; color: var(--kr-color-text-muted); }
.kr-offer__list { margin: 0; padding-left: var(--kr-space-5); display: grid; gap: var(--kr-space-1); }
.kr-offer__adds { margin: 0; font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }
.kr-offer__go { margin-top: auto; align-self: flex-start; }

.kr-talkstrip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--kr-space-3);
  padding: var(--kr-space-4);
  border-radius: var(--kr-radius-lg);
  background: var(--kr-color-surface);
  border: var(--kr-border);
}
.kr-talkstrip span { color: var(--kr-color-text-muted); }

.kr-checkout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, calc(var(--kr-row-head-min) * 1.6));
  gap: var(--kr-space-4);
  align-items: start;
}
.kr-checkout__sum { position: sticky; top: var(--kr-space-4); }
.kr-checkout__pay { display: grid; gap: var(--kr-space-2); }
.kr-checkout__pay .kr-btn { justify-content: center; }
@media (max-width: 56rem) {
  .kr-checkout { grid-template-columns: minmax(0, 1fr); }
  .kr-checkout__sum { position: static; }
}

.kr-signedup { max-width: var(--kr-measure); margin: 0 auto; }
/* The stack spaces the card's parts; their own margins would double it. */
.kr-signedup .kr-card__body > * { margin: 0; }
.kr-talk { max-width: calc(var(--kr-measure) * 1.5); margin: 0 auto; }

/* The hosted installation's terms, drawn from their Markdown files (billing.TermsService): a page of
   their own and the same text in a dialog at sign-up. Read as a document, so set to a line a person can
   follow, with numbered clauses spaced as paragraphs and the schedules as plain ruled tables. */
.kr-terms { max-width: calc(var(--kr-measure) * 1.5); margin: 0 auto; }
.kr-terms__text { font-size: var(--kr-font-body); line-height: var(--kr-line-height); }
.kr-terms__text > :first-child { margin-top: 0; }
.kr-terms__text h1 { display: none; } /* the page's or the dialog's own title says it */
.kr-terms__text h2 {
  margin: var(--kr-space-6) 0 var(--kr-space-2);
  font-size: var(--kr-font-lg);
  font-weight: 600;
}
.kr-terms__text p,
.kr-terms__text ul { margin: 0 0 var(--kr-space-3); }
.kr-terms__text ul { padding-inline-start: var(--kr-space-5); }
.kr-terms__text li + li { margin-top: var(--kr-space-1); }
.kr-terms__text table { width: 100%; margin: 0 0 var(--kr-space-3); border-collapse: collapse; }
.kr-terms__text th,
.kr-terms__text td {
  padding: var(--kr-space-2) var(--kr-space-3) var(--kr-space-2) 0;
  border-bottom: var(--kr-border);
  text-align: start;
  vertical-align: top;
}
.kr-terms__text td:first-child { white-space: nowrap; }
/* A schedule's first row is empty when the Markdown table has no head: nothing to rule off. */
.kr-terms__text thead:has(th:empty:only-child, th:empty + th:empty) { display: none; }
.kr-terms__version { margin: 0; color: var(--kr-color-text-muted); font-size: var(--kr-font-sm); }
.kr-modal__body .kr-terms__version { margin-bottom: var(--kr-space-4); }
/* A dialog's paragraphs are muted asides; the terms are the text itself. */
.kr-modal__body .kr-terms__text p { color: var(--kr-color-text); margin: 0 0 var(--kr-space-3); }
@media (max-width: 40rem) {
  .kr-terms__text td:first-child { white-space: normal; }
}
.kr-signedup__mark {
  display: inline-grid;
  place-items: center;
  width: var(--kr-control-height-lg);
  height: var(--kr-control-height-lg);
  border-radius: var(--kr-radius-round);
  background: var(--kr-color-success-bg);
  color: var(--kr-color-success);
}

/* Each screen's layouts, folded under the table: one small card a screen, how many of its layouts can be
   chosen, and a pip for each. Replaced a table of struck-through names that said the same thing louder. */
.kr-layoutfold { padding: 0; }
.kr-layoutfold__summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kr-space-1) var(--kr-space-3);
  align-items: baseline;
  padding: var(--kr-space-3) var(--kr-space-4);
  cursor: pointer;
}
.kr-layoutfold__title { font-weight: 600; }
.kr-layoutfold__said { font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }
.kr-layoutfold__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(calc(var(--kr-row-head-min) * 1.2), 1fr));
  gap: var(--kr-space-2);
  margin: 0;
  padding: 0 var(--kr-space-4) var(--kr-space-4);
  list-style: none;
}
.kr-layoutfold__screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--kr-space-0-5) var(--kr-space-2);
  padding: var(--kr-space-2) var(--kr-space-3);
  border: var(--kr-border);
  border-radius: var(--kr-radius);
  font-size: var(--kr-font-sm);
}
.kr-layoutfold__screen strong { grid-row: 1; grid-column: 1; }
.kr-layoutfold__count { grid-row: 1; grid-column: 2; font-weight: 600; color: var(--kr-color-text-muted); font-variant-numeric: tabular-nums; }
.kr-layoutfold__first { grid-column: 1 / -1; color: var(--kr-color-text-muted); }
.kr-layoutfold__pips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--kr-space-0-5); }
.kr-layoutfold__pip {
  width: var(--kr-space-4);
  height: var(--kr-space-2);
  border-radius: var(--kr-radius-sm);
  background: var(--kr-color-control);
}
.kr-layoutfold__pip--open { background: var(--kr-color-success); }

/* A payment's amounts: what each line is for, and its amount in a right-aligned column of figures; the
   total in the foot, ruled above. (admin/settings/upgrade, payment, payments; platform/payments) */
.kr-table .kr-paytable__amount { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kr-paytable tfoot th, .kr-paytable tfoot td { border-top: var(--kr-border); font-weight: 700; text-align: start; }
.kr-paytable tfoot .kr-paytable__amount { text-align: end; }
/* A reference is read and quoted whole: never broken at its hyphens. */
.kr-paytable .kr-mono { white-space: nowrap; }
/* A cell with more than one line (a state with who recorded it, a rate with where it was read) reads from
   the top, each further line beneath the first, smaller and muted. The first lines share a baseline, so a
   reference or a rate in the narrower monospace face sits on the same line as the date beside it. */
.kr-paytable td { vertical-align: baseline; }
.kr-paytable__sub {
  display: block;
  margin-top: var(--kr-space-1);
  font-size: var(--kr-font-sm);
  color: var(--kr-color-text-muted);
}
.kr-paytable form { margin-top: var(--kr-space-2); }

/* A payment's document: a receipt once paid, a pro-forma invoice before. */
.kr-paydoc__head { display: flex; justify-content: space-between; gap: var(--kr-space-3); align-items: start; }
.kr-paydoc__kind { margin: 0; font-size: var(--kr-font-sm); font-weight: 700; letter-spacing: var(--kr-tracking-caps); text-transform: uppercase; color: var(--kr-color-text-muted); }
.kr-paydoc__ref { margin: var(--kr-space-1) 0 0; font-size: var(--kr-font-lg); }
.kr-paydoc__facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(calc(var(--kr-row-head-min) * 1.2), 1fr));
  gap: var(--kr-space-3) var(--kr-space-5);
  margin: var(--kr-space-4) 0;
}
.kr-paydoc__facts dt { font-size: var(--kr-font-sm); color: var(--kr-color-text-muted); }
.kr-paydoc__facts dd { margin: 0; font-weight: 600; }
.kr-paydoc__transfer { margin-top: var(--kr-space-4); }
.kr-paydoc__subhead { margin: 0 0 var(--kr-space-1); font-size: var(--kr-font-md); }
/* Stand-in particulars on a test or development installation: said where the account is shown. */
.kr-paydoc__sample {
  margin: 0;
  font-size: var(--kr-font-sm);
  font-weight: 600;
  color: var(--kr-color-warning);
  text-transform: uppercase;
  letter-spacing: var(--kr-tracking-caps);
}

/* Paying by Lenco: the button that opens its window, and what the page heard back. */
.kr-lenco { display: flex; flex-wrap: wrap; gap: var(--kr-space-3); align-items: center; }
.kr-lenco__said { margin: 0; color: var(--kr-color-text-muted); }
.kr-lenco__said:empty { display: none; }
