/*
  The BSFT UI default theme. Built entirely on design tokens: applications re-skin by
  overriding the custom properties below (or by replacing this stylesheet), never by
  touching component behavior.

  Consumed via: <link rel="stylesheet" href="_content/Bsft.UI.Theme/bsft-ui.css" />

  Everything below sits in the cascade layer `bsft`, so a host stylesheet overrides any rule
  here — tokens included — by stating its own, unlayered one, whatever the selector's
  specificity. A host that layers its own styles declares them after `bsft`. The colour tokens are
  light/dark pairs resolved by light-dark() against the document's color-scheme, so no activation
  rule has to win against a host's token to switch the scheme.

  The file is cut into named sections ("--- name ---"). Some are still empty: they reserve the
  place of components that are added later, so that work on two components never edits the same
  lines of this file.
*/

@layer bsft {
  /* --- design tokens --------------------------------------------------------- */

  /* Every colour token is a light/dark pair resolved by light-dark() against the document's
     color-scheme, so the three-state model is three rules: without a data-bsft-theme attribute on
     <html> the operating system preference decides (color-scheme: light dark), and
     data-bsft-theme="light"|"dark" pins it either way. The dark palette lives once in the
     --bsft-dark-* tokens below; a re-skin overrides a pair's dark half without restating the light
     one, and a host that scopes color-scheme to a subtree flips every token inside it. Only the
     colours and the shadow tints change between the two — spacing, radius and typography are
     theme-independent. */
  :root {
    color-scheme: light dark;
    --bsft-color-text: light-dark(#0f172a, var(--bsft-dark-color-text));
    --bsft-color-muted: light-dark(#475569, var(--bsft-dark-color-muted));
    --bsft-color-surface: light-dark(#ffffff, var(--bsft-dark-color-surface));
    --bsft-color-border: light-dark(#e2e8f0, var(--bsft-dark-color-border));
    /* The three primary tokens read a brand source first. The brand sources (--bsft-brand-primary,
       --bsft-brand-primary-contrast, --bsft-brand-primary-surface and their three --bsft-brand-dark-*
       twins) are never declared here: a brand applier writes them, and without one the literal
       fallback is the theme's own colour. */
    --bsft-color-primary: light-dark(var(--bsft-brand-primary, #526780), var(--bsft-dark-color-primary));
    --bsft-color-primary-contrast: light-dark(var(--bsft-brand-primary-contrast, #ffffff), var(--bsft-dark-color-primary-contrast));
    /* The primary colour as a surface: what a bubble, a chip or a row takes when it is the
       reader's own rather than merely selected. Its own token beside the info surface it
       resembles, because a re-skin that tints information must not tint ownership with it. */
    --bsft-color-primary-surface: light-dark(var(--bsft-brand-primary-surface, #eef4f9), var(--bsft-dark-color-primary-surface));
    /* The plain-link palette (#5292). A rest colour of the primary itself, a hover/focus colour a
       quarter of the way towards the text colour (darkening it on the light surface, lightening it
       on the dark one) and a visited colour a little further still — distinguishable from both,
       never the browser's default purple. Derived from the two tokens that already carry a dark
       counterpart rather than given literal colours of their own, so a brand override of
       --bsft-color-primary reaches every link without a second place to tune. */
    --bsft-color-link: var(--bsft-color-primary);
    --bsft-color-link-hover: color-mix(in srgb, var(--bsft-color-primary) 75%, var(--bsft-color-text));
    --bsft-color-link-visited: color-mix(in srgb, var(--bsft-color-primary) 82%, var(--bsft-color-text));
    --bsft-color-danger: light-dark(#dd0150, var(--bsft-dark-color-danger));
    --bsft-color-danger-surface: light-dark(#fffafa, var(--bsft-dark-color-danger-surface));
    /* The text colour a filled danger surface carries. Its own token rather than the primary's
       contrast token, since a brand's primary can turn dark without affecting it. No rule of the
       theme fills a surface in danger any more; the token stays for a host that does. */
    --bsft-color-danger-contrast: light-dark(#ffffff, var(--bsft-dark-color-danger-contrast));
    --bsft-color-warning: light-dark(#986424, var(--bsft-dark-color-warning));
    --bsft-color-warning-surface: light-dark(#fffbeb, var(--bsft-dark-color-warning-surface));
    --bsft-color-success: light-dark(#06805e, var(--bsft-dark-color-success));
    --bsft-color-success-surface: light-dark(#f0fdf4, var(--bsft-dark-color-success-surface));
    /* The text colour a filled success surface carries, for the reason --bsft-color-danger-contrast
       exists: the success green is luminous, too light to carry white. No rule of the theme fills a
       surface in success any more; the token stays for a host that does. */
    --bsft-color-success-contrast: light-dark(#0f172a, var(--bsft-dark-color-success-contrast));
    --bsft-color-info: light-dark(#9815fa, var(--bsft-dark-color-info));
    --bsft-color-info-surface: light-dark(#eef2ff, var(--bsft-dark-color-info-surface));
    /* A status drawn rather than written: the badge's fill is the status surface, and the accent
       — a tile's edge, a meter's bar, a segment, a sparkline — is a luminous colour of the same
       family, darker than that fill and bright enough to glow on it in either scheme. The five
       accents are one palette, chosen together so that bars side by side read as one set: green,
       magenta, orange, violet and teal, the same hex in both schemes. The four status text
       colours above are these tones taken to 4.5:1 against the page, the canvas and their own
       surface where the accent falls short of it (the green, the orange and, in the dark scheme,
       the violet), so a badge's word stays legible while a bar in the same status keeps glowing;
       the two tokens stay apart for that reason. The
       primary colour is not a status and keeps its own text colour: it is a link, a focus edge
       and the accent of "chosen" too, which teal is not. */
    --bsft-color-primary-accent: light-dark(#00becb, var(--bsft-dark-color-primary-accent));
    --bsft-color-danger-accent: light-dark(#e60052, var(--bsft-dark-color-danger-accent));
    --bsft-color-warning-accent: light-dark(#ef9520, var(--bsft-dark-color-warning-accent));
    --bsft-color-success-accent: light-dark(#00bd7d, var(--bsft-dark-color-success-accent));
    --bsft-color-info-accent: light-dark(#9815fa, var(--bsft-dark-color-info-accent));
    /* The resting colour of a placeholder standing in for content that has not arrived. Its own
       token rather than the border colour it happens to resemble: a skeleton is a surface, and a
       re-skin that darkens borders must not darken every loading page with them. */
    --bsft-color-skeleton: light-dark(#e5e7eb, var(--bsft-dark-color-skeleton));
    /* The categorical palette of the charts: series without an explicit variant take these in order
       and repeat (dashed) after the eighth. Distinct from the semantic colors on purpose, so a series
       never reads as a warning. */
    --bsft-chart-1: light-dark(#2563eb, var(--bsft-dark-chart-1));
    --bsft-chart-2: light-dark(#d97706, var(--bsft-dark-chart-2));
    --bsft-chart-3: light-dark(#059669, var(--bsft-dark-chart-3));
    --bsft-chart-4: light-dark(#7c3aed, var(--bsft-dark-chart-4));
    --bsft-chart-5: light-dark(#db2777, var(--bsft-dark-chart-5));
    --bsft-chart-6: light-dark(#0891b2, var(--bsft-dark-chart-6));
    --bsft-chart-7: light-dark(#65a30d, var(--bsft-dark-chart-7));
    --bsft-chart-8: light-dark(#475569, var(--bsft-dark-chart-8));
    /* The border of an interactive control: a step darker than a card's border, so a field reads
       as something to type into and not as another box. */
    --bsft-control-border: light-dark(#64748b, var(--bsft-dark-control-border));
    /* The track behind a toggle's thumb and a meter's bar: darker than the card border, so an
       "off" switch is still a switch on a white card. */
    --bsft-color-track: light-dark(#cbd5e1, var(--bsft-dark-color-track));
    /* The page behind the cards: one step darker than the surface, so a card reads as a card. */
    --bsft-color-canvas: light-dark(#f1f5f9, var(--bsft-dark-color-canvas));
    --bsft-color-selection: light-dark(#dceaf5, var(--bsft-dark-color-selection));
    --bsft-color-selection-text: light-dark(#0f172a, var(--bsft-dark-color-selection-text));
    /* Hover and selection share one tint: a row, a tab and a menu item the pointer rests on look
       like the thing they become when chosen. */
    --bsft-color-hover: var(--bsft-color-selection);
    /* One focus ring for everything that is pressed or chosen: dark slate, outside the element
       with a gap. A chosen option is marked inside — a tint and an inset accent — so "the keyboard
       is here" and "this is chosen" differ in shape as well as in colour, and the ring stays well
       above 3:1 against both the surface and the canvas. */
    --bsft-color-focus: light-dark(#1e293b, var(--bsft-dark-color-focus));
    /* A text field is the one exception: it is focused to be typed into, never chosen, so it takes
       the quieter picture of a field in use — its border in the primary colour and a soft halo of
       the same colour hugging it — instead of a ring standing off it. */
    --bsft-field-focus-border: var(--bsft-color-primary);
    --bsft-field-focus-ring: 0 0 0 3px color-mix(in srgb, var(--bsft-color-primary) 25%, transparent);
    /* The same halo in grey while the pointer rests on a field: a field answers the pointer
       before it is chosen, as every other clickable thing does, and the shape is the one the
       focus halo takes so the two read as one field in two states. */
    --bsft-field-hover-ring: 0 0 0 3px color-mix(in srgb, var(--bsft-color-text) 12%, transparent);
    /* The one picture of "chosen", whatever is chosen: a tinted surface plus an accent in the
       primary colour. Only the accent's shape follows the geometry — a bar on the start edge of a
       row, a ring inside a card or a pill. The fill of a calendar day is the one exception, for a
       dense grid whose ends of a span have to read at a glance. */
    --bsft-selected-surface: var(--bsft-color-selection);
    --bsft-selected-accent: var(--bsft-color-primary);
    --bsft-color-backdrop: rgb(15 23 42 / 60%);
    /* The fill of a primary control, its own token beside the primary colour. In light mode they
       are the same value; in dark mode the primary colour is light enough to read as text on the
       dark surface, which is too light to carry white text as a fill, so the fill stays dark. */
    --bsft-action-primary: light-dark(#526780, var(--bsft-dark-action-primary));
    --bsft-color-primary-hover: light-dark(#42566e, var(--bsft-dark-color-primary-hover));
    /* Shadows are geometry plus a tint; only the tint is a light/dark pair, because a shadow on a
       dark page has to be darker to be seen at all. */
    --bsft-shadow-tint-weak: light-dark(rgb(0 0 0 / 5%), rgb(0 0 0 / 30%));
    --bsft-shadow-tint: light-dark(rgb(0 0 0 / 10%), rgb(0 0 0 / 40%));
    --bsft-shadow-tint-strong: light-dark(rgb(0 0 0 / 15%), rgb(0 0 0 / 55%));
    --bsft-shadow-sm: 0 1px 2px 0 var(--bsft-shadow-tint-weak);
    --bsft-shadow-md: 0 4px 6px -1px var(--bsft-shadow-tint), 0 2px 4px -2px var(--bsft-shadow-tint);
    --bsft-shadow-lg: 0 20px 25px -5px var(--bsft-shadow-tint-strong), 0 8px 10px -6px var(--bsft-shadow-tint);
    --bsft-shadow-inset: inset 0 2px 4px rgb(0 0 0 / 20%);
    --bsft-spacing: 0.5rem;
    --bsft-radius: 0.5rem;
    --bsft-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    /* Local system faces only, like --bsft-font: nothing on this page is fetched from elsewhere. */
    --bsft-font-mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
    /* The three floating layers, ordered as one contract: an anchored popup never outranks a
       modal, and nothing outranks the toasts. */
    --bsft-z-popup: 10;
    --bsft-z-dialog: 100;
    --bsft-z-toast: 1000;
    /* Durations are tokens for the same reason colours are: a host toning the theme's motion down
       without turning it off should not have to find every transition in the file. The reduced
       -motion guard below is the other half of that and is not a substitute for it — it answers a
       stated user preference, while these answer a designer's. */
    --bsft-motion-fast: 150ms;
    --bsft-motion-spin: 800ms;
    --bsft-motion-pulse: 1500ms;
    /* The scales the theme is laid out on. Space and radius derive from the two base tokens above,
       so a host that overrides --bsft-spacing or --bsft-radius rescales every step with it instead
       of having to restate the whole ladder. */
    --bsft-space-1: calc(var(--bsft-spacing) / 2);
    --bsft-space-2: var(--bsft-spacing);
    --bsft-space-3: calc(var(--bsft-spacing) * 1.5);
    --bsft-space-4: calc(var(--bsft-spacing) * 2);
    --bsft-space-6: calc(var(--bsft-spacing) * 3);
    --bsft-space-8: calc(var(--bsft-spacing) * 4);
    --bsft-text-2xs: 0.6875rem;
    --bsft-text-xs: 0.75rem;
    --bsft-text-sm: 0.875rem;
    --bsft-text-base: 1rem;
    --bsft-text-lg: 1.125rem;
    --bsft-text-xl: 1.25rem;
    --bsft-text-2xl: 1.5rem;
    --bsft-text-3xl: 1.875rem;
    --bsft-text-4xl: 2.25rem;
    --bsft-leading-body: 1.5;
    --bsft-leading-heading: 1.25;
    --bsft-leading-control: 1.25;
    --bsft-weight-medium: 500;
    --bsft-weight-semibold: 600;
    --bsft-weight-bold: 700;
    --bsft-radius-sm: calc(var(--bsft-radius) / 2);
    --bsft-radius-md: var(--bsft-radius);
    --bsft-radius-lg: calc(var(--bsft-radius) * 1.5);
    --bsft-radius-xl: calc(var(--bsft-radius) * 2);
    --bsft-radius-pill: 999px;
    /* A button's own corner, two steps rounder than a field's: the two sit side by side, and the
       rounder one is the one that acts. At the default control height this is just short of a
       capsule; --bsft-radius-pill here makes every button one. */
    --bsft-radius-button: var(--bsft-radius-xl);
    /* One control height for every text field, select and button, so a row of them lines up. */
    --bsft-control-height: 2.25rem;
    --bsft-control-height-compact: 2rem;
    --bsft-control-padding-block: calc(var(--bsft-spacing) * 0.75);
    --bsft-control-padding-inline: var(--bsft-space-3);
    --bsft-button-padding-inline: calc(var(--bsft-spacing) * 1.75);
    --bsft-focus-width: 2px;
    --bsft-focus-offset: 2px;
    --bsft-disabled-opacity: 0.6;
    /* The application bar's height, a token because three things other than the bar read it: the
       toast stack starts below it, the wide sidebar is pinned below it, and a host's anchor targets
       scroll to rest below it rather than under it. A host without the shell sets it to 0. */
    --bsft-shell-header-height: 3.5rem;
    /* The pill radius under its older name, kept for hosts that read it; the stylesheet itself
       reads --bsft-radius-pill. */
    --bsft-radius-full: var(--bsft-radius-pill);
    /* An earlier type scale. No rule of the theme reads it any more, every font-size in rem below
       is a --bsft-text-* step; the tokens stay for a host that reads them. */
    --bsft-font-size-2xs: 0.6875rem;
    --bsft-font-size-xs: 0.75rem;
    --bsft-font-size-sm: 0.875rem;
    --bsft-font-size-md: 1rem;
    --bsft-font-size-lg: 1.125rem;
    --bsft-font-size-xl: 1.25rem;
    --bsft-font-size-2xl: 1.5rem;
    --bsft-font-size-3xl: 1.75rem;
    --bsft-line-height-tight: 1.25;
    --bsft-line-height-normal: 1.5;
    /* Elevation, lowest first. Shadows carry a colour, so each is a pair like the colour tokens:
       a shadow on a dark surface needs more opacity to read as depth at all. */
    --bsft-shadow-1: 0 1px 2px light-dark(rgb(15 23 42 / 8%), rgb(0 0 0 / 40%));
    --bsft-shadow-2: 0 2px 8px light-dark(rgb(15 23 42 / 10%), rgb(0 0 0 / 45%)), 0 1px 2px light-dark(rgb(15 23 42 / 6%), rgb(0 0 0 / 30%));
    --bsft-shadow-3: 0 12px 32px light-dark(rgb(15 23 42 / 16%), rgb(0 0 0 / 55%)), 0 2px 6px light-dark(rgb(15 23 42 / 8%), rgb(0 0 0 / 35%));
    /* The inner shadow at the end of a scrolled list that hides entries there: its depth and its
       colour. It is deliberately faint: muted text that a sideways scroll has cut off at a shadowed
       edge drops from 5.4:1 to about 4.2:1 there, the cost of a cue that is seen at all; the text is
       legible again once the column is scrolled into view. */
    --bsft-scroll-cue-size: 1rem;
    --bsft-scroll-cue-color: light-dark(rgb(15 23 42 / 28%), rgb(148 163 184 / 45%));
    /* What hides that shadow at an end a sideways scrolling container has reached, where the cue is
       a background: the colour the container sits on. It reads the surface, so it follows the dark
       theme with it; a host that places such a container on another background sets it there. */
    --bsft-scroll-cover-color: var(--bsft-color-surface);
    /* The smallest box a finger hits reliably (44 CSS px). Every control that is tapped takes at
       least this height; a compact size exists only where the pointer is fine. */
    --bsft-touch-target: 2.75rem;
    /* The smallest pointer target WCAG 2.2 allows (24 CSS px, success criterion 2.5.8). A control
       drawn smaller than this, such as the info hint's icon, extends its hit area to it without
       taking the room in the layout. */
    --bsft-target-size-min: 1.5rem;
    /* A button's height (36 CSS px) where the pointer is fine, so a toolbar or a table row of
       buttons stays compact on a desktop. Under a coarse pointer it is the touch target; see the
       pointer query after the token sections. */
    --bsft-button-height: 2.25rem;
    /* The widest a column of reading content grows before lines get too long to follow. */
    --bsft-content-width: 60rem;
    /* Entrance, exit and movement of whole surfaces, and the delay between siblings that enter one
       after another. Exits are shorter than entrances: what leaves is no longer being read. */
    --bsft-motion-entrance: 250ms;
    --bsft-motion-exit: 200ms;
    --bsft-motion-move: 300ms;
    --bsft-motion-stagger: 50ms;
    --bsft-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    /* Effects (bsft-ui-effects.css). The glow is a share of the primary colour: --bsft-glow-max at
       full intensity, scaled by the intensity an effects applier writes as a source token. Glass is
       the surface's opacity and blur behind a translucent panel. Without bsft-ui-effects.css none of
       these is read. Intensity and opacity are numbers, which light-dark() cannot pair, so the dark
       half is switched by the two rules after the palette. */
    --bsft-glow-max: 70%;
    --bsft-glow-intensity: var(--bsft-effects-light-intensity, 0.5);
    --bsft-glow: calc(var(--bsft-glow-max) * var(--bsft-glow-intensity));
    --bsft-glass-opacity: 72%;
    --bsft-glass-blur: 12px;
  }

  /* --- dark palette ----------------------------------------------------------- */

  /* The dark half of every pair above, declared once and only ever read through light-dark(). */
  :root {
    --bsft-dark-color-text: #f1f5f9;
    --bsft-dark-color-muted: #94a3b8;
    --bsft-dark-color-surface: #0f172a;
    --bsft-dark-color-border: #334155;
    --bsft-dark-color-primary: var(--bsft-brand-dark-primary, #9fb3c8);
    --bsft-dark-color-primary-contrast: var(--bsft-brand-dark-primary-contrast, #ffffff);
    --bsft-dark-color-primary-surface: var(--bsft-brand-dark-primary-surface, #1a2a3a);
    --bsft-dark-color-danger: #ff3d7a;
    --bsft-dark-color-danger-surface: #450a0a;
    --bsft-dark-color-danger-contrast: #0f172a;
    --bsft-dark-color-warning: #ef9520;
    --bsft-dark-color-warning-surface: #451a03;
    --bsft-dark-color-success: #00bd7d;
    --bsft-dark-color-success-surface: #052e16;
    --bsft-dark-color-success-contrast: #0f172a;
    --bsft-dark-color-info: #b55ffa;
    --bsft-dark-color-info-surface: #1e1b4b;
    /* The accents glow on a dark surface as they do on a pale one, so the dark half repeats the
       light palette; a re-skin that wants them dimmer overrides the dark half alone. */
    --bsft-dark-color-primary-accent: #00becb;
    --bsft-dark-color-danger-accent: #e60052;
    --bsft-dark-color-warning-accent: #ef9520;
    --bsft-dark-color-success-accent: #00bd7d;
    --bsft-dark-color-info-accent: #9815fa;
    --bsft-dark-color-skeleton: #1f2937;
    --bsft-dark-chart-1: #60a5fa;
    --bsft-dark-chart-2: #fbbf24;
    --bsft-dark-chart-3: #34d399;
    --bsft-dark-chart-4: #a78bfa;
    --bsft-dark-chart-5: #f472b6;
    --bsft-dark-chart-6: #22d3ee;
    --bsft-dark-chart-7: #a3e635;
    --bsft-dark-chart-8: #94a3b8;
    --bsft-dark-glow-intensity: var(--bsft-effects-dark-intensity, 0.8);
    --bsft-dark-glass-opacity: 64%;
    --bsft-dark-control-border: #64748b;
    --bsft-dark-color-track: #475569;
    --bsft-dark-color-canvas: #020617;
    --bsft-dark-color-selection: #1c3145;
    --bsft-dark-color-selection-text: #f1f5f9;
    --bsft-dark-action-primary: #526780;
    --bsft-dark-color-primary-hover: #5d758f;
    --bsft-dark-color-focus: #cbd5e1;
  }

  /* The two explicit selections. The attribute is written by the theme state and, before the first
     paint, by the bootstrap snippet; its absence is the third state, and nothing else is needed for
     it because light-dark() already follows the preference. */
  :root[data-bsft-theme="light"] {
    color-scheme: light;
  }

  /* The numbers no colour pair can carry follow the scheme through the same two selections. */
  @media (prefers-color-scheme: dark) {
    :root:not([data-bsft-theme="light"]) {
      --bsft-glow-intensity: var(--bsft-dark-glow-intensity);
      --bsft-glass-opacity: var(--bsft-dark-glass-opacity);
    }
  }

  :root[data-bsft-theme="dark"] {
    color-scheme: dark;
    --bsft-glow-intensity: var(--bsft-dark-glow-intensity);
    --bsft-glass-opacity: var(--bsft-dark-glass-opacity);
  }

  /* --- shared ------------------------------------------------------------- */

  /* The document itself takes the surface and text tokens. Without this the tokens turn dark under a
     dark system preference (or data-bsft-theme="dark") while the browser keeps its white canvas, and
     text the theme does not style itself becomes light text on white. color-scheme tells the browser
     which palette its own chrome (scrollbars, form controls, autofill, the canvas before the
     stylesheet's colours apply) has to match: both while the system decides, the chosen one when the
     attribute does. A host rule on html or body still wins by coming later or naming body. */
  :root {
    background-color: var(--bsft-color-surface);
    color: var(--bsft-color-text);
  }

  /* A finger needs the full touch target; a mouse or a pen does not. The control height is what the
     text fields, the selects and the rows of the menus and trees read, the button height what the
     buttons read, so both rise. */
  @media (pointer: coarse) {
    :root {
      --bsft-control-height: var(--bsft-touch-target);
      --bsft-button-height: var(--bsft-touch-target);
    }
  }

  /* The error banner is the failure notice (Rule 27) under its older name: one rule below draws
     both, so the sign-in's refusal and a console's failed load cannot drift apart. */

  .bsft-empty,
  .bsft-busy,
  .bsft-empty-state {
    color: var(--bsft-color-muted);
    font-family: var(--bsft-font);
  }

  .bsft-empty,
  .bsft-busy {
    padding: var(--bsft-space-2);
  }

  /* --- plain links --------------------------------------------------------- */

  /* The standing-alone half of Rule 41 (docs/ui-rules.md), for a host's bare anchor outside every
     theme element: before it, such an <a> in a table cell, a list or a card fell back to the
     browser's blue underline and purple :visited colour, and a keyboard user got no focus ring at
     all (#5292). The selectors below are wrapped in :where() so the rule weighs nothing (0,0,0): a
     host's own link rule and every themed component keep winning by selector weight alone, never
     merely by coming later in the cascade. A link beside text, or among entries that are not
     links, is the other half of Rule 41 and is underlined at rest: the `links` section below for
     the theme's own, `.bsft-prose a` for a host's.

     Rest takes the --bsft-color-link token (the primary colour) without an underline — the table
     cell, the list or the card it sits in already says it is a link. Hover and keyboard focus
     underline it and move it towards --bsft-color-link-hover, a shade closer to the text colour,
     which reads as a darkening on the light surface and a lightening on the dark one. A visited
     link moves a little further still towards the text colour than resting: distinguishable from
     both, never the browser's own purple. Focus adds the ring of Rule 10, in the focus colour and
     never the primary one, so the ring can be told from the accent of a chosen option here as on
     every other control. */
  :where(a) {
    color: var(--bsft-color-link);
    text-decoration-line: none;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    border-radius: 2px;
  }

  :where(a:visited) {
    color: var(--bsft-color-link-visited);
  }

  :where(a:hover),
  :where(a:focus-visible) {
    color: var(--bsft-color-link-hover);
    text-decoration-line: underline;
  }

  :where(a:focus-visible) {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  /* Opt-in for running text (a paragraph of rendered markdown, prose copy): inside a sentence a
     link has to be told apart from the words around it by more than colour (WCAG 1.4.1), so the
     underline stays on at rest, drawn as a soft tint of the link's own colour rather than a solid
     line, and turns solid on hover or focus. Higher specificity than the :where(a) rules above, so
     it wins over them regardless of source order; a table cell, a list or a card is not running
     text and keeps the plain rest state above instead. */
  .bsft-prose a {
    text-decoration-line: underline;
    text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  }

  .bsft-prose a:hover,
  .bsft-prose a:focus-visible {
    text-decoration-color: currentColor;
  }

  /* --- busy affordance ------------------------------------------------------ */

  /* The busy region lays its affordance out beside the label rather than under it. The label is
     visually hidden and the affordance is aria-hidden, so what the viewer sees and what a screen
     reader hears are two disjoint halves of one region — which is why neither may be styled away:
     display:none on the label would take the announcement with it. */
  .bsft-busy {
    display: flex;
    align-items: center;
    gap: var(--bsft-space-2);
  }

  /* The skeleton fills the width it was given, because it stands in for content that will. */
  .bsft-busy-skeleton {
    display: block;
  }

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

  /* Opacity rather than a travelling highlight: a gradient sweep needs a background-position
     animation that composites on every frame, and the pulse says the same thing for less. */
  @keyframes bsft-skeleton-pulse {
    50% {
      opacity: 0.5;
    }
  }

  /* A ring with one coloured quadrant, sized off the surrounding text so it scales with whatever
     it stands in for, and a step larger than the text because it stands alone. Frozen by the
     reduced-motion guard into exactly this shape, which is why the coloured quadrant is drawn at
     rest rather than only appearing mid-spin. */
  .bsft-spinner {
    flex-shrink: 0;
    box-sizing: border-box;
    width: 1.25em;
    height: 1.25em;
    border: 2px solid var(--bsft-color-border);
    border-top-color: var(--bsft-color-primary);
    border-radius: 50%;
    animation: bsft-spin var(--bsft-motion-spin) linear infinite;
  }

  .bsft-skeleton {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-1);
    width: 100%;
  }

  .bsft-skeleton-line {
    height: 0.75rem;
    border-radius: var(--bsft-radius);
    background: var(--bsft-color-skeleton);
    animation: bsft-skeleton-pulse var(--bsft-motion-pulse) ease-in-out infinite;
  }

  /* The last line is short, the way a paragraph's last line is: a block of equal bars reads as a
     table that failed to load rather than as text on its way. */
  .bsft-skeleton-line:last-child {
    width: 60%;
  }

  /* The shapes of BsftSkeletonShape. Each borrows the padding, radius and border of what it stands
     in for, so the page keeps its height and nothing moves when the content lands. They all pulse
     through the same keyframes as a line, which the reduced-motion guard below stops as a whole. */
  .bsft-skeleton-rows {
    gap: 0;
  }

  .bsft-skeleton-row {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-1);
    padding: var(--bsft-space-2) 0;
    border-bottom: 1px solid var(--bsft-color-border);
  }

  .bsft-skeleton-row .bsft-skeleton-line:first-child {
    width: 75%;
  }

  .bsft-skeleton-panel {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-1);
    padding: var(--bsft-space-4);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius);
  }

  .bsft-skeleton-heading {
    height: 1rem;
    width: 40%;
    margin-bottom: var(--bsft-space-1);
  }

  .bsft-skeleton-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
    gap: var(--bsft-space-2);
  }

  .bsft-skeleton-tile {
    aspect-ratio: 4 / 3;
    border-radius: var(--bsft-radius);
    background: var(--bsft-color-skeleton);
    animation: bsft-skeleton-pulse var(--bsft-motion-pulse) ease-in-out infinite;
  }

  .bsft-notice {
    color: var(--bsft-color-warning);
    background: var(--bsft-color-warning-surface);
    border: 1px solid var(--bsft-color-warning);
    border-radius: var(--bsft-radius);
    padding: var(--bsft-space-2);
    font-family: var(--bsft-font);
  }

  /* A notice that reports a failure rather than a caveat takes the danger surface; the markup
     keeps .bsft-notice because it is still a notice and not a field error. The error banner
     (.bsft-error, the sign-in's refusal, a screen's failed write) is the same picture and shares
     the rule, shape included. */
  .bsft-error,
  .bsft-notice-error {
    color: var(--bsft-color-danger);
    background: var(--bsft-color-danger-surface);
    border: 1px solid var(--bsft-color-danger);
    border-radius: var(--bsft-radius);
    padding: var(--bsft-space-2);
    font-family: var(--bsft-font);
  }

  /* A notice that states a plain fact — this file has no preview, nothing is selected — is
     neutral: text on the canvas inside a hairline. The warning surface is kept for a caveat the
     reader should weigh, the danger surface for a failure. */
  .bsft-notice-neutral {
    color: var(--bsft-color-text);
    background: var(--bsft-color-canvas);
    border-color: var(--bsft-color-border);
  }

  /* --- controls ------------------------------------------------------------ */

  /* One chrome for every text control the theme renders — the plain .bsft-input the consoles use,
     the fields of a form, a list's filters, the pickers, the search boxes and the drafts — stated
     once, so a field looks the same wherever it stands and a re-skin changes it in one place. A
     component that needs more (a draft that grows, a search box that fills its row) adds to this
     rule in its own section rather than restating it. Checkboxes and radios keep their native
     rendering: boxing them in the same border and padding would break their layout next to a
     label. CSS has no way to name a selector list once, so the list below is repeated verbatim for
     each shared state and kept in this order.

     The first entry of every list is the floor under all the others: any text control inside the
     shell, named here or not, takes the chrome at specificity zero (:where), so a control a new
     component renders is styled before anyone remembers to list it, and any class rule still
     wins over the floor. The rule of docs/ui-rules.md. The native kinds — checkbox, radio, file,
     range, colour, the button-like types — stay native for the reason above. */
  :where(.bsft-shell) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="reset"]):not([type="button"]):not([type="image"]), select, textarea),
  .bsft-input,
  .bsft-list-filter :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea),
  .bsft-list-pagesize select,
  .bsft-local-settings-row :is(input, select),
  .bsft-combobox-input,
  .bsft-datepicker-input,
  .bsft-daterangepicker-input,
  .bsft-timepicker-input,
  .bsft-log-viewer-search input,
  .bsft-chat-search-input,
  .bsft-chat-draft,
  .bsft-command-palette-input,
  .bsft-form-field input:not([type="checkbox"]):not([type="radio"]),
  .bsft-form-field select,
  .bsft-form-field textarea {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    min-height: var(--bsft-control-height);
    padding: var(--bsft-control-padding-block) var(--bsft-control-padding-inline);
    border: 1px solid var(--bsft-control-border);
    border-radius: var(--bsft-radius-md);
    background: var(--bsft-color-surface);
    color: var(--bsft-color-text);
    font: inherit;
    font-family: var(--bsft-font);
    font-size: var(--bsft-text-base);
    line-height: var(--bsft-leading-control);
    transition: border-color var(--bsft-motion-fast) ease;
  }

  :where(.bsft-shell) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="reset"]):not([type="button"]):not([type="image"]), select, textarea)::placeholder,
  .bsft-input::placeholder,
  .bsft-list-filter :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea)::placeholder,
  .bsft-list-pagesize select::placeholder,
  .bsft-local-settings-row :is(input, select)::placeholder,
  .bsft-combobox-input::placeholder,
  .bsft-datepicker-input::placeholder,
  .bsft-daterangepicker-input::placeholder,
  .bsft-timepicker-input::placeholder,
  .bsft-log-viewer-search input::placeholder,
  .bsft-chat-search-input::placeholder,
  .bsft-chat-draft::placeholder,
  .bsft-command-palette-input::placeholder,
  .bsft-form-field input:not([type="checkbox"]):not([type="radio"])::placeholder,
  .bsft-form-field select::placeholder,
  .bsft-form-field textarea::placeholder {
    color: var(--bsft-color-muted);
    opacity: 1;
  }

  :where(.bsft-shell) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="reset"]):not([type="button"]):not([type="image"]), select, textarea)::selection,
  .bsft-input::selection,
  .bsft-list-filter :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea)::selection,
  .bsft-list-pagesize select::selection,
  .bsft-local-settings-row :is(input, select)::selection,
  .bsft-combobox-input::selection,
  .bsft-datepicker-input::selection,
  .bsft-daterangepicker-input::selection,
  .bsft-timepicker-input::selection,
  .bsft-log-viewer-search input::selection,
  .bsft-chat-search-input::selection,
  .bsft-chat-draft::selection,
  .bsft-command-palette-input::selection,
  .bsft-form-field input:not([type="checkbox"]):not([type="radio"])::selection,
  .bsft-form-field select::selection,
  .bsft-form-field textarea::selection {
    background: var(--bsft-color-selection);
    color: var(--bsft-color-selection-text);
  }

  /* Hover only where a pointer can hover, as for the buttons: a touch device is not left with a
     halo stuck on the last field it tapped. The list is the chrome's, in the chrome's order. */
  @media (hover: hover) {
    :where(.bsft-shell) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="reset"]):not([type="button"]):not([type="image"]), select, textarea):not(:disabled):hover,
    .bsft-input:not(:disabled):hover,
    .bsft-list-filter :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea):not(:disabled):hover,
    .bsft-list-pagesize select:not(:disabled):hover,
    .bsft-local-settings-row :is(input, select):not(:disabled):hover,
    .bsft-combobox-input:not(:disabled):hover,
    .bsft-datepicker-input:not(:disabled):hover,
    .bsft-daterangepicker-input:not(:disabled):hover,
    .bsft-timepicker-input:not(:disabled):hover,
    .bsft-log-viewer-search input:not(:disabled):hover,
    .bsft-chat-search-input:not(:disabled):hover,
    .bsft-chat-draft:not(:disabled):hover,
    .bsft-command-palette-input:not(:disabled):hover,
    .bsft-form-field input:not([type="checkbox"]):not([type="radio"]):not(:disabled):hover,
    .bsft-form-field select:not(:disabled):hover,
    .bsft-form-field textarea:not(:disabled):hover {
      box-shadow: var(--bsft-field-hover-ring);
    }
  }

  :where(.bsft-shell) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="reset"]):not([type="button"]):not([type="image"]), select, textarea):focus-visible,
  .bsft-input:focus-visible,
  .bsft-list-filter :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea):focus-visible,
  .bsft-list-pagesize select:focus-visible,
  .bsft-local-settings-row :is(input, select):focus-visible,
  .bsft-combobox-input:focus-visible,
  .bsft-datepicker-input:focus-visible,
  .bsft-daterangepicker-input:focus-visible,
  .bsft-timepicker-input:focus-visible,
  .bsft-log-viewer-search input:focus-visible,
  .bsft-chat-search-input:focus-visible,
  .bsft-chat-draft:focus-visible,
  .bsft-command-palette-input:focus-visible,
  .bsft-form-field input:not([type="checkbox"]):not([type="radio"]):focus-visible,
  .bsft-form-field select:focus-visible,
  .bsft-form-field textarea:focus-visible {
    border-color: var(--bsft-field-focus-border);
    /* The halo is a shadow, which forced colours drops; a transparent outline becomes the system
       highlight there, so the focused field keeps a visible indicator (WCAG 2.4.7). */
    outline: 2px solid transparent;
    box-shadow: var(--bsft-field-focus-ring);
  }

  /* The invalid state keys off aria-invalid rather than :invalid, so an untouched required field
     is not painted as an error before anybody typed into it. */
  :where(.bsft-shell) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="reset"]):not([type="button"]):not([type="image"]), select, textarea)[aria-invalid="true"],
  .bsft-input[aria-invalid="true"],
  .bsft-list-filter :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea)[aria-invalid="true"],
  .bsft-list-pagesize select[aria-invalid="true"],
  .bsft-local-settings-row :is(input, select)[aria-invalid="true"],
  .bsft-combobox-input[aria-invalid="true"],
  .bsft-datepicker-input[aria-invalid="true"],
  .bsft-daterangepicker-input[aria-invalid="true"],
  .bsft-timepicker-input[aria-invalid="true"],
  .bsft-log-viewer-search input[aria-invalid="true"],
  .bsft-chat-search-input[aria-invalid="true"],
  .bsft-chat-draft[aria-invalid="true"],
  .bsft-command-palette-input[aria-invalid="true"],
  .bsft-form-field input:not([type="checkbox"]):not([type="radio"])[aria-invalid="true"],
  .bsft-form-field select[aria-invalid="true"],
  .bsft-form-field textarea[aria-invalid="true"],
  .bsft-form-field:has(> .bsft-form-field-errors) :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    border-color: var(--bsft-color-danger);
  }

  :where(.bsft-shell) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="reset"]):not([type="button"]):not([type="image"]), select, textarea):disabled,
  .bsft-input:disabled,
  .bsft-list-filter :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea):disabled,
  .bsft-list-pagesize select:disabled,
  .bsft-local-settings-row :is(input, select):disabled,
  .bsft-combobox-input:disabled,
  .bsft-datepicker-input:disabled,
  .bsft-daterangepicker-input:disabled,
  .bsft-timepicker-input:disabled,
  .bsft-log-viewer-search input:disabled,
  .bsft-chat-search-input:disabled,
  .bsft-chat-draft:disabled,
  .bsft-command-palette-input:disabled,
  .bsft-form-field input:not([type="checkbox"]):not([type="radio"]):disabled,
  .bsft-form-field select:disabled,
  .bsft-form-field textarea:disabled {
    opacity: var(--bsft-disabled-opacity);
    cursor: not-allowed;
  }

  /* A multi-line control starts a few lines tall and lets the user pull it longer. */
  :where(.bsft-shell) :where(textarea),
  textarea.bsft-input,
  .bsft-form-field textarea {
    min-height: 5rem;
    resize: vertical;
  }

  /* A single-line select draws its own box and ignores the line height, so it is given the control
     height directly; otherwise it ends up a pixel taller than the text input beside it. */
  :where(.bsft-shell) :where(select:not([multiple]):not([size])),
  select.bsft-input:not([multiple]):not([size]),
  .bsft-list-filter select:not([multiple]):not([size]),
  .bsft-list-pagesize select:not([multiple]):not([size]),
  .bsft-local-settings-row select:not([multiple]):not([size]),
  .bsft-form-field select:not([multiple]):not([size]) {
    height: var(--bsft-control-height);
  }

  /* The list a single-line select drops down is the browser's to draw — square, in the system's
     highlight — unless the browser lets the page draw it: under appearance: base-select
     (Chromium 135 and later; Firefox and Safari ignore it and keep the native list) the list is a
     popup the stylesheet reaches, and it takes the picture the combobox's list has (Rules 9 and
     13): the surface in a hairline with the large radius and the middle shadow, the row the
     pointer or the keyboard is on in the hover tint, the chosen row in the selected tint with the
     accent bar on its start edge and no check mark, the arrow a chevron on currentColor
     (Rule 11). The closed field keeps the chrome above; the floor and the class entry mirror the
     chrome's own pair, so every single-line select in the shell drops the same list. */
  :where(.bsft-shell) :where(select:not([multiple]):not([size])),
  :where(.bsft-shell) :where(select:not([multiple]):not([size]))::picker(select),
  select.bsft-input:not([multiple]):not([size]),
  select.bsft-input:not([multiple]):not([size])::picker(select) {
    appearance: base-select;
  }

  /* The closed field lays out as the combobox trigger does: the text on the start edge, the
     chevron on the end edge, both centred on the line, half a step between them at the least. */
  :where(.bsft-shell) :where(select:not([multiple]):not([size])),
  select.bsft-input:not([multiple]):not([size]) {
    align-items: center;
    gap: var(--bsft-space-2);
  }

  :where(.bsft-shell) :where(select:not([multiple]):not([size]))::picker(select),
  select.bsft-input:not([multiple]):not([size])::picker(select) {
    margin: var(--bsft-space-1) 0 0;
    padding: 0;
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    background: var(--bsft-color-surface);
    color: var(--bsft-color-text);
    box-shadow: var(--bsft-shadow-md);
    font-family: var(--bsft-font);
    font-size: var(--bsft-text-base);
  }

  :where(.bsft-shell) :where(select:not([multiple]):not([size])) option,
  select.bsft-input:not([multiple]):not([size]) option {
    display: flex;
    align-items: center;
    min-height: var(--bsft-control-height);
    padding: var(--bsft-space-2) var(--bsft-space-4);
    color: var(--bsft-color-text);
    cursor: pointer;
  }

  /* Where the keyboard is, not what is chosen: the hover tint, as in the combobox's list. */
  :where(.bsft-shell) :where(select:not([multiple]):not([size])) option:focus-visible,
  select.bsft-input:not([multiple]):not([size]) option:focus-visible {
    background: var(--bsft-color-hover);
    outline: none;
  }

  @media (hover: hover) {
    :where(.bsft-shell) :where(select:not([multiple]):not([size])) option:not(:disabled):hover,
    select.bsft-input:not([multiple]):not([size]) option:not(:disabled):hover {
      background: var(--bsft-color-hover);
    }
  }

  :where(.bsft-shell) :where(select:not([multiple]):not([size])) option:checked,
  select.bsft-input:not([multiple]):not([size]) option:checked {
    background: var(--bsft-selected-surface);
    box-shadow: inset 3px 0 var(--bsft-selected-accent);
  }

  :where(.bsft-shell) :where(select:not([multiple]):not([size])) option:disabled,
  select.bsft-input:not([multiple]):not([size]) option:disabled {
    cursor: not-allowed;
    opacity: var(--bsft-disabled-opacity);
  }

  :where(.bsft-shell) :where(select:not([multiple]):not([size])) option::checkmark,
  select.bsft-input:not([multiple]):not([size]) option::checkmark {
    display: none;
  }

  /* The chevron of the pickers (BsftPickerIcons), drawn as a mask on currentColor in the muted
     colour, turning while the list is open as the combobox trigger's does. */
  :where(.bsft-shell) :where(select:not([multiple]):not([size]))::picker-icon,
  select.bsft-input:not([multiple]):not([size])::picker-icon {
    content: "";
    flex: none;
    width: 1rem;
    height: 1rem;
    margin-inline-start: auto;
    background: currentColor;
    color: var(--bsft-color-muted);
    mask: 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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  :where(.bsft-shell) :where(select:not([multiple]):not([size])):open::picker-icon,
  select.bsft-input:not([multiple]):not([size]):open::picker-icon {
    rotate: 180deg;
  }

  /* Every native check control the theme renders — a form field's, a list's, a schema form's
     switch, the theme's own .bsft-check — keeps its native shape (and with it the platform's
     focus and high-contrast rendering) in the one accent of "chosen" (Rule 9), stated once as a
     floor, so a checkbox a new component renders is coloured before anyone remembers to list it. */
  .bsft-check,
  :where(.bsft-shell) :where(input[type="checkbox"], input[type="radio"]) {
    accent-color: var(--bsft-selected-accent);
  }

  /* --- form controls ------------------------------------------------------- */

  /* The theme's own form controls — BsftTextField, BsftTextArea, BsftSelect, BsftCheckbox,
     BsftRadio, BsftRadioGroup — render the chrome above; only what is specific to one of them is
     stated here. */
  .bsft-textarea {
    width: 100%;
    resize: vertical;
  }

  .bsft-select {
    cursor: pointer;
  }

  .bsft-check {
    flex: none;
    width: 1rem;
    height: 1rem;
    margin: 0;
  }

  /* The keyboard ring every pressed or chosen control of the theme shows (Rule 10), as the list
     draws it on its own check controls. */
  .bsft-check:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  /* The label around a check control is its touch target: the box and its text together, one
     control high, which a coarse pointer raises to the touch target as it does every control. */
  .bsft-check-label {
    display: inline-flex;
    align-items: center;
    gap: var(--bsft-space-1);
    min-height: var(--bsft-control-height);
    color: var(--bsft-color-text);
    font-family: var(--bsft-font);
    cursor: pointer;
  }

  .bsft-check-label:has(> .bsft-check:disabled) {
    opacity: var(--bsft-disabled-opacity);
    cursor: default;
  }

  .bsft-radio-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    min-width: 0;
    margin: 0;
    padding: var(--bsft-space-1) var(--bsft-space-2);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-md);
    font-family: var(--bsft-font);
  }

  .bsft-radio-group-inline {
    flex-direction: row;
    flex-wrap: wrap;
    column-gap: var(--bsft-space-4);
  }

  /* The legend's type is the one caption rule's (Rule 8), stated with the form field's label. */
  .bsft-radio-group-legend {
    padding: 0 var(--bsft-space-1);
  }

  /* --- links --------------------------------------------------------------- */

  /* The beside-text half of Rule 41 (docs/ui-rules.md): a link that stands beside text, or among
     entries that are not links, is the primary colour with an underline at rest, because colour
     alone does not tell it from the word next to it. Inside any theme element that is: the ones
     the components name — the sign-in page's secondary links, a notification's "open", the billing
     redirect — any bare anchor a host writes into a themed region, and the two references that
     may or may not be a link, the entity link and the IDE link, whose plain siblings would
     otherwise differ from them by colour alone. An anchor styled as a button carries .bsft-button
     and is not one of these; a link standing alone in a surface that already says it is a link
     (a nav item, a breadcrumb, a menu command, a tile) draws itself with a class of its own and
     is not one either. */
  .bsft-link,
  .bsft-idp-secondary-link,
  .bsft-notification-open,
  .bsft-billing-redirect-link,
  .bsft-entity-link,
  a.bsft-ide-link,
  .bsft-action-result,
  .bsft-circuit-error-reload,
  .bsft-chat-link,
  .bsft-log-entry-link,
  :where([class^="bsft-"], [class*=" bsft-"]) a:not([class]) {
    color: var(--bsft-color-primary);
    text-decoration: underline;
    text-underline-offset: 0.15em;
    text-decoration-thickness: 1px;
  }

  @media (hover: hover) {
    :is(.bsft-link, .bsft-idp-secondary-link, .bsft-notification-open, .bsft-billing-redirect-link,
      .bsft-entity-link, a.bsft-ide-link, .bsft-action-result, .bsft-circuit-error-reload,
      .bsft-chat-link, .bsft-log-entry-link,
      :where([class^="bsft-"], [class*=" bsft-"]) a:not([class])):hover {
      text-decoration-thickness: 2px;
    }
  }

  /* --- form --------------------------------------------------------------- */

  .bsft-form {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-4);
    font-family: var(--bsft-font);
    color: var(--bsft-color-text);
    font-size: var(--bsft-text-base);
    line-height: var(--bsft-leading-body);
    padding: var(--bsft-space-4);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    background: var(--bsft-color-surface);
    box-shadow: var(--bsft-shadow-sm);
  }

  /* A form inside a panel that is already a card — a dialog, a widget, a popover, a tab panel, a
     settings group or one of the sign-in pages — does not get a second frame. */
  .bsft-dialog .bsft-form,
  .bsft-dialog-panel .bsft-form,
  .bsft-dashboard-widget .bsft-form,
  .bsft-popover-panel .bsft-form,
  .bsft-tabs-panel .bsft-form,
  .bsft-local-settings-group .bsft-form,
  :is(.bsft-idp-login, .bsft-idp-registration, .bsft-idp-reset, .bsft-idp-redemption, .bsft-idp-factor,
    .bsft-idp-enrollment, .bsft-idp-consent, .bsft-idp-device-consent) .bsft-form {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  /* A form that stands for something — the editor of a screen — names it above its fields, in
     the section heading's size, so a reader knows what the fields will save. */
  .bsft-form-title {
    margin: 0;
    font-size: var(--bsft-text-lg);
    font-weight: var(--bsft-weight-semibold);
    line-height: var(--bsft-leading-heading);
  }

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

  /* One caption for every control, whoever renders it: a form layout's field, a radio group's
     legend and every input component's own Label share this rule rather than each choosing a
     size and a weight. A check control's own label is not a caption but the control's text, so it
     keeps the body size; :where() keeps the exclusion at the rule's own weight. */
  .bsft-field-label,
  .bsft-radio-group-legend,
  .bsft-schema-group > legend,
  .bsft-form-field label:where(:not(.bsft-check-label)) {
    font-size: var(--bsft-text-sm);
    font-weight: var(--bsft-weight-medium);
    line-height: var(--bsft-leading-body);
    color: var(--bsft-color-text);
  }

  /* A caption above the control it names: the list of choices and the chip group stack theirs. */
  .bsft-field {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-1);
    font-family: var(--bsft-font);
  }

  /* The required marker is presentational (aria-hidden); requiredness reaches assistive
     technology through the host's input. */
  .bsft-form-field-required {
    color: var(--bsft-color-danger);
    margin-inline-start: 0.25em;
  }

  /* The field's controls take the shared chrome and the check accent from the controls section
     above; only what is specific to a form field is stated here. */
  .bsft-form-field-hint {
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
    margin: 0;
  }

  .bsft-form-field-errors {
    color: var(--bsft-color-danger);
    font-size: var(--bsft-text-sm);
    margin: 0;
    padding-inline-start: 1.25em;
  }

  .bsft-form-actions {
    display: flex;
    gap: var(--bsft-space-2);
    flex-wrap: wrap;
    padding-top: var(--bsft-space-3);
    border-top: 1px solid var(--bsft-color-border);
  }

  /* --- button ---------------------------------------------------------------- */

  /* The height counts the border and the padding (border-box), whatever element carries the class: a
     <button> sizes its border box by default, an <a> its content box, which made a link button 10px
     taller than the button beside it. A link button is also laid out as one (inline-flex, its label
     centred on both axes as a button centres its own), since min-height does not apply to an inline
     box at all, and it loses the link underline, at rest and under the pointer. Its text is centred
     too, so a label that wraps lines up as a button's does. :where() keeps that rule at the class's
     own specificity, so a host rule on .bsft-button still decides. */
  .bsft-button {
    box-sizing: border-box;
    font-family: var(--bsft-font);
    border: 1px solid var(--bsft-control-border);
    border-radius: var(--bsft-radius-button);
    background: var(--bsft-color-surface);
    color: var(--bsft-color-text);
    padding: var(--bsft-control-padding-block) var(--bsft-button-padding-inline);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--bsft-space-2);
    min-height: var(--bsft-button-height);
    font-size: var(--bsft-text-sm);
    font-weight: var(--bsft-weight-semibold);
    line-height: var(--bsft-leading-control);
    text-align: center;
    box-shadow: var(--bsft-shadow-sm);
    transition: background-color var(--bsft-motion-fast) ease, border-color var(--bsft-motion-fast) ease,
      box-shadow var(--bsft-motion-fast) ease;
  }

  /* An anchor that stands as a button is a button: no underline. */
  a.bsft-button {
    text-decoration: none;
  }

  /* The quiet button: the same shape without surface, border or shadow, for an action beside the
     primary one that should not compete with it. It takes the hover tint like a plain button. */
  .bsft-button-secondary {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }

  /* One definition of the primary surface: the one action a view asks for. A switcher's active
     option is not that and takes the quieter pressed state in the segmented section instead. */
  .bsft-button-primary {
    background: var(--bsft-action-primary);
    border-color: var(--bsft-action-primary);
    color: var(--bsft-color-primary-contrast);
  }

  /* One picture of "disabled" for the plain button and the action button alike (Rule 23): the
     surface fades, the cursor refuses. The action button is aria-disabled rather than natively
     disabled, so it stays in the tab order with its reason; the attribute selects it here, the one
     thing the button's own rules do not say of it. */
  .bsft-button:disabled,
  .bsft-action-button:is(:disabled, [aria-disabled="true"]) {
    opacity: var(--bsft-disabled-opacity);
    cursor: not-allowed;
  }

  /* The keyboard ring every pressed or chosen control of the theme shows (Rule 23): outside the
     button, with a gap, so a button reached by Tab is never left to the browser's own outline. */
  .bsft-button:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  /* Hover only where a pointer can hover, so a touch device is not left with a tint stuck on the
     last thing it tapped. A plain button takes the hover tint and a filled one darkens, and both lift
     by one shadow step; the destructive one takes its danger surface and stays flat, as it is at rest. */
  @media (hover: hover) {
    .bsft-button:not(.bsft-button-secondary):not(.bsft-button-danger):not([aria-pressed="true"]):not(:disabled):not([aria-disabled="true"]):hover {
      box-shadow: var(--bsft-shadow-md);
    }

    .bsft-button:not(.bsft-button-primary):not(.bsft-button-danger):not([aria-pressed="true"]):not(:disabled):not([aria-disabled="true"]):hover {
      background: var(--bsft-color-hover);
    }

    .bsft-button-primary:not(:disabled):not([aria-disabled="true"]):hover {
      border-color: var(--bsft-color-primary-hover);
      background: var(--bsft-color-primary-hover);
    }

    .bsft-button-danger:not(:disabled):not([aria-disabled="true"]):hover {
      border-color: var(--bsft-color-danger);
      background: var(--bsft-color-danger-surface);
      box-shadow: none;
    }
  }

  .bsft-button:not(:disabled):not([aria-disabled="true"]):active {
    box-shadow: var(--bsft-shadow-inset);
  }

  /* A button that is a toggle — "include revoked", "unread only", "follow" — shows its on-state
     as pressed in: the selection tint and the inset shadow the :active state uses, so "on" and
     "being pressed" read as the same thing. Read off aria-pressed alone, so a theme cannot style
     as on what assistive technology reads as off. The segmented switchers restate the state for
     their track below. */
  .bsft-button[aria-pressed="true"] {
    background: var(--bsft-color-selection);
    border-color: var(--bsft-control-border);
    color: var(--bsft-color-selection-text);
    box-shadow: var(--bsft-shadow-inset);
  }

  /* --- copy affordance ----------------------------------------------------- */

  /* The affordance is a button plus the region that announces the verdict, laid out inline so it
     sits beside the value it copies rather than under it. It joins .bsft-button rather than
     restating a surface of its own: a copy button is an ordinary button that happens to have two
     more states to show. */
  .bsft-copy {
    display: inline-flex;
    align-items: center;
    gap: var(--bsft-space-1);
  }

  /* The copy button is a button and keeps the one chrome (Rule 23): no compact height of its own. */
  .bsft-copy-button:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  /* The two outcomes are tokenized like every other themed surface, and — the point of colouring
     them at all — never the only carrier of the verdict: the text beside the button says it too,
     for anyone who cannot tell the two tokens apart. */
  .bsft-copy-button-copied {
    border-color: var(--bsft-color-success-accent);
    color: var(--bsft-color-success);
  }

  .bsft-copy-button-failed {
    border-color: var(--bsft-color-danger-accent);
    color: var(--bsft-color-danger);
  }

  .bsft-copy-status {
    font-size: var(--bsft-text-sm);
    color: var(--bsft-color-muted);
  }

  /* --- list --------------------------------------------------------------- */

  /* The table scrolls sideways inside the list on every width, never widens the page: a list
     dropped into a column narrower than its columns is an ordinary case, not a phone's. The
     frame is the scroll container, so the corner cells below still round its corners, and it
     shows the scroll cue (see the cue's own section) over its surface. */
  .bsft-list {
    font-family: var(--bsft-font);
    color: var(--bsft-color-text);
    font-size: var(--bsft-text-base);
    line-height: var(--bsft-leading-body);
    min-width: 0;
    overflow-x: auto;
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    background: var(--bsft-scroll-cue-layers), var(--bsft-color-surface);
    box-shadow: var(--bsft-shadow-sm);
  }

  .bsft-list table {
    width: 100%;
    border-collapse: collapse;
  }

  .bsft-list th,
  .bsft-list td {
    text-align: start;
    padding: var(--bsft-space-2);
    border-bottom: 1px solid var(--bsft-color-border);
  }

  .bsft-list th {
    background: var(--bsft-color-canvas);
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-xs);
    font-weight: var(--bsft-weight-semibold);
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .bsft-list td {
    font-size: var(--bsft-text-sm);
    font-variant-numeric: tabular-nums;
  }

  /* A number is read against the numbers above and below it, so a numeric column ends at the
     cell's end edge, header and cells alike. The markup says which columns are numbers. */
  :is(.bsft-list, .bsft-operator-table, .bsft-chart-table, .bsft-bar-table, .bsft-graph-tables) :is(th, td)[data-bsft-numeric] {
    text-align: end;
  }

  .bsft-list tbody tr:last-child td {
    border-bottom: 0;
  }

  /* The header cells and a tinted last row paint their own background, which would otherwise
     square off the frame's rounded corners. The corners are handed to the corner cells instead of
     clipping the list, because a row's own popup has to be able to leave the frame. */
  .bsft-list thead tr:first-child > :first-child {
    border-start-start-radius: calc(var(--bsft-radius-lg) - 1px);
  }

  .bsft-list thead tr:first-child > :last-child {
    border-start-end-radius: calc(var(--bsft-radius-lg) - 1px);
  }

  .bsft-list > :last-child > table tbody tr:last-child > :first-child,
  .bsft-list > table tbody tr:last-child > :first-child {
    border-end-start-radius: calc(var(--bsft-radius-lg) - 1px);
  }

  .bsft-list > :last-child > table tbody tr:last-child > :last-child,
  .bsft-list > table tbody tr:last-child > :last-child {
    border-end-end-radius: calc(var(--bsft-radius-lg) - 1px);
  }

  /* The roomier cells are for the paged table and the plain table (BsftTable, whose table is the
     list's direct child), never for the windowed one. The window is the wrapper element around the
     table, not the list itself, which is why the selector walks the wrapper: a windowed row has to
     stay as tall as RowHeight says, because that is the number the spacers are placed by. */
  .bsft-list > :not(.bsft-list-window) > table :is(th, td),
  .bsft-list > table :is(th, td) {
    padding: var(--bsft-space-3) var(--bsft-space-4);
  }

  .bsft-list > :not(.bsft-list-window) > table td,
  .bsft-list > table td {
    padding-block: var(--bsft-space-4);
  }

  /* The list's own controls take the one focus ring; its text fields keep the field's halo from
     the control chrome, so the two pictures of focus never stack on one input. */
  .bsft-list :is(input[type="checkbox"], input[type="radio"], button, a):focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  .bsft-list th button {
    all: unset;
    cursor: pointer;
    font: inherit;
  }

  /* The sort glyphs live here, not in markup, so a theme override (or an RTL layout)
     re-skins them without touching the component. */
  .bsft-list-sort-asc::after {
    content: " ▲";
  }

  .bsft-list-sort-desc::after {
    content: " ▼";
  }

  .bsft-list-loaded {
    color: var(--bsft-color-muted);
  }

  /* The scrolling container a windowed list needs: something with a height for the browser to
     scroll, and spacer rows inside it standing in for the rows that are not drawn. Both numbers
     arrive as custom properties written by the rendering itself — the same row height it placed
     the spacers by — so the stylesheet and the arithmetic cannot disagree about how tall a row is.
     The fallbacks are the rendering's own defaults and exist for a host that styles a window of
     its own rather than as a second opinion. */
  .bsft-list-window {
    overflow-y: auto;
    max-height: var(--bsft-list-window-height, 480px);
    background: var(--bsft-scroll-cue-layers);
  }

  /* A list without a focusable control of its own makes its table container a focusable region, so
     a keyboard can scroll the frame around it, and a windowed list's grid takes the focus itself inside
     its scrolling window. Either scrolls with the table, and the grid's ring is clipped by the window and
     covered by its sticky header, so a ring of their own would slide off the frame or hide; the frame,
     which stays put, draws the ring instead, inside its edge as BsftTable's does; over the region the cue's
     shadows carry the ring's inner line (see the cue's own section). The focused element
     gives up its own ring only where the browser can draw the frame's: without :has it keeps it. */
  @supports selector(:has(*)) {
    .bsft-list-scroll:focus-visible,
    .bsft-list-window > table:focus-visible {
      outline: none;
    }
  }

  .bsft-list:has(> .bsft-list-scroll:focus-visible) {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: calc(-1 * var(--bsft-focus-width));
  }

  /* An outline is painted under the positioned content inside the box, and the window's header cells
     stick, so the frame's outline would hide behind them along its top edge. The windowed frame, which
     does not scroll itself (its window does), draws the ring as a layer over its content instead, just
     inside the frame's border: a layer reaching over the border would overflow the frame and give it a
     scroll range of its own. The layer takes the scroll cue's level (z-index 1) and comes after the
     cue's shadows and the sticky header cells in the frame, so it paints over both and keeps the focus
     colour at a shadowed edge, and stays under the shell's header one level up. The windowed frame is
     positioned whether or not it has the focus, so the focus never changes what an absolutely
     positioned element inside it is placed against. */
  .bsft-list:has(> .bsft-list-window) {
    position: relative;
  }

  .bsft-list:has(> .bsft-list-window > table:focus-visible)::after {
    content: "";
    position: absolute;
    z-index: 1;
    inset: 0;
    border: var(--bsft-focus-width) solid var(--bsft-color-focus);
    border-radius: calc(var(--bsft-radius-lg) - 1px);
    pointer-events: none;
  }

  /* Uniform rows are the premise of the whole arrangement, so the window states the height rather
     than hoping the content agrees on one. The spacers carry their own inline height and override
     this, which is exactly what they are for. */
  .bsft-list-window tbody tr {
    height: var(--bsft-list-row-height, 40px);
  }

  /* Inside the window the cells keep the original padding, and a tighter line and a 22px button
     keep a row within the default 40px, its collapsed border included. */
  .bsft-list-window td {
    line-height: var(--bsft-leading-control);
  }

  .bsft-list-window .bsft-button {
    min-height: 1.375rem;
    padding: 0 var(--bsft-space-2);
    line-height: var(--bsft-leading-control);
  }

  /* The header stays put while the rows scroll under it — a windowed list is the one place a user
     can lose sight of what the columns mean without leaving the screen. It needs its own background
     because the rows would otherwise show through it. */
  .bsft-list-window thead th {
    position: sticky;
    top: 0;
    background: var(--bsft-color-canvas);
  }

  /* Where the keyboard is. Painted only inside a window, because that is where the grid itself
     holds the focus and the cursor is the only thing saying which row the arrow keys are on; in a
     paged list every row's own controls are still in the tab order and a second cursor beside the
     focus ring would be two answers to one question. */
  .bsft-list-window .bsft-list-row-active > td {
    background: var(--bsft-color-selection);
    color: var(--bsft-color-selection-text);
  }

  /* A selected row, in either kind of list, is the one picture of "chosen" (Rule 9): the selected
     tint, which the cursor shares, and the accent bar on the row's start edge. */
  .bsft-list tbody tr[aria-selected="true"] > td {
    background: var(--bsft-selected-surface);
    color: var(--bsft-color-selection-text);
  }

  .bsft-list tbody tr[aria-selected="true"] > td:first-child {
    box-shadow: inset 3px 0 var(--bsft-selected-accent);
  }

  :root[dir="rtl"] .bsft-list tbody tr[aria-selected="true"] > td:first-child {
    box-shadow: inset -3px 0 var(--bsft-selected-accent);
  }

  @media (hover: hover) {
    .bsft-list tbody tr:not(.bsft-list-row-active):hover > td {
      background: var(--bsft-color-hover);
    }
  }

  .bsft-list-pager {
    display: flex;
    align-items: center;
    gap: var(--bsft-space-2);
    flex-wrap: wrap;
    padding: var(--bsft-space-4);
    border-top: 1px solid var(--bsft-color-border);
  }

  /* The page-size chooser sits at the far end of the pager, away from the previous/next
     pair, so a mis-aimed click changes the page rather than the whole page size. */
  .bsft-list-pagesize {
    display: flex;
    align-items: center;
    gap: var(--bsft-space-1);
    margin-inline-start: auto;
  }

  .bsft-list-select {
    width: 1px;
    white-space: nowrap;
  }

  /* The filter bar wraps rather than scrolls: a filter the user cannot see is a filter they
     cannot take off again, and a narrow viewport is exactly where that bites. */
  .bsft-list-filterbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--bsft-space-2);
    padding: var(--bsft-space-4);
  }

  .bsft-list-filter {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-1);
  }

  .bsft-list-bulk {
    display: flex;
    align-items: center;
    gap: var(--bsft-space-2);
    /* Reserves its height even while nothing is selected, so the table does not jump down the
       page the moment the first row is ticked. */
    min-height: 2rem;
    padding: var(--bsft-space-4);
  }

  .bsft-list-bulk-count {
    color: var(--bsft-color-muted);
  }

  /* Hidden from sight, kept for assistive technology — never display:none, which takes the text
     out of the accessibility tree along with the pixels. */
  .bsft-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  /* --- crud screen ------------------------------------------------------------- */

  /* The assembled screen is a column of its parts — the toolbar, an open editor or the delete
     question, the list — with one step of space between them, and it never grows wider than the
     column it stands in: the list inside scrolls instead. */
  .bsft-crud {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-4);
    min-width: 0;
  }

  /* The toolbar is a row of the screen's commands, not an action bar: it closes nothing, so it
     draws neither the bar's hairline nor its inset. */
  .bsft-crud-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--bsft-space-2);
  }

  /* A row's actions stand in one line, a step apart, so a row stays one control high: a table
     too narrow for them scrolls inside its frame (Rule 21) rather than stacking them. */
  .bsft-crud-actions {
    white-space: nowrap;
  }

  .bsft-crud-actions > .bsft-button + .bsft-button {
    margin-inline-start: var(--bsft-space-2);
  }

  /* --- schema form ------------------------------------------------------------- */

  /* A form composed from a schema is a form: its fields stand one step of space apart as a
     layout's fields do, a switch stands beside its caption, a group is a framed set with its
     caption on the frame, and a list is a column of rows that each hold a value and its remove. */
  .bsft-schema-form {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-4);
  }

  /* A switch stands beside its caption (Rule 8): the schema form's toggle, and a bare .bsft-check
     a field wraps without a text of its own, take the same row. */
  .bsft-form-field:has(> .bsft-check),
  .bsft-form-field:has(> .bsft-schema-toggle) {
    flex-direction: row-reverse;
    justify-content: flex-end;
    align-items: center;
    gap: var(--bsft-space-2);
  }

  .bsft-schema-toggle {
    flex: none;
    width: 1rem;
    height: 1rem;
    margin: 0;
  }

  .bsft-schema-group {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-4);
    min-width: 0;
    margin: 0;
    padding: var(--bsft-space-4);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius);
  }

  .bsft-schema-group > legend {
    padding: 0 var(--bsft-space-1);
  }

  .bsft-schema-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--bsft-space-2);
  }

  .bsft-schema-list-item {
    display: flex;
    align-items: center;
    gap: var(--bsft-space-2);
    width: 100%;
  }

  .bsft-schema-list-item > .bsft-input {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* BsftTable: a plain table for rows the caller writes itself. Its container is a .bsft-list, so
     the frame, the head, the cells, the numeric columns, the hover tint and the print rules above
     are the list's and never a second table (Rule 30, Rule 42); nothing here restates them. With a
     label the container is a focusable region and shows the theme's focus ring (Rule 10), drawn
     inside the frame, so a card that clips its content does not cut it off; the cue's shadows
     carry its inner line over them (see the cue's own section). */
  .bsft-table:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: calc(-1 * var(--bsft-focus-width));
  }

  /* A filter field in a header cell takes its column's width instead of the browser's 20 characters. */
  .bsft-table-grid th .bsft-input {
    width: 100%;
    min-width: 4rem;
    font-weight: normal;
  }

  /* --- detail ------------------------------------------------------------- */

  .bsft-detail {
    font-family: var(--bsft-font);
    color: var(--bsft-color-text);
    font-size: var(--bsft-text-base);
    line-height: var(--bsft-leading-body);
  }

  /* Compact filter choices wrap instead of scrolling sideways. Single-select chips announce
     radio state; multi-select chips announce pressed state, and the same visible surface is keyed
     from those two accessibility states. */
  .bsft-chip-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--bsft-space-1);
    font-family: var(--bsft-font);
  }

  .bsft-chip {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: var(--bsft-space-1);
    padding: var(--bsft-space-1) var(--bsft-space-2);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-pill);
    background: var(--bsft-color-surface);
    color: var(--bsft-color-text);
    font: inherit;
    line-height: 1;
    cursor: pointer;
    font-weight: var(--bsft-weight-medium);
  }

  /* A chosen chip is tinted and ringed rather than filled — the one picture of "chosen" a pill
     takes: a filter is a state the reader set, not the action the view asks for, and a row of
     filled chips would shout over the list. The ring is inset, so choosing a chip does not change
     its size. */
  .bsft-chip[aria-checked="true"],
  .bsft-chip[aria-pressed="true"],
  .bsft-chat-reaction-mine,
  .bsft-chat-reactor-key-open {
    border-color: var(--bsft-selected-accent);
    background: var(--bsft-selected-surface);
    box-shadow: inset 0 0 0 1px var(--bsft-selected-accent);
    color: var(--bsft-color-text);
  }

  @media (hover: hover) {
    .bsft-chip:not([aria-checked="true"]):not([aria-pressed="true"]):not([disabled]):hover {
      background: var(--bsft-color-hover);
    }
  }

  .bsft-chip:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  .bsft-chip[disabled] {
    cursor: not-allowed;
    opacity: var(--bsft-disabled-opacity);
  }

  .bsft-chip-count {
    font-size: 0.75em;
    font-variant-numeric: tabular-nums;
  }

  /* The title block and actions are peers so actions move beneath the title as soon as the row no
     longer fits. Badges stay with the heading they qualify. */
  .bsft-detail-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--bsft-space-2);
    margin-bottom: var(--bsft-space-4);
    font-family: var(--bsft-font);
    color: var(--bsft-color-text);
  }

  .bsft-detail-header-main {
    min-width: 0;
  }

  .bsft-detail-header-title-row,
  .bsft-detail-header-badges,
  .bsft-detail-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--bsft-space-2);
  }

  .bsft-detail-header-title {
    margin: 0;
    font-size: var(--bsft-text-xl);
    font-weight: var(--bsft-weight-semibold);
    line-height: var(--bsft-leading-heading);
    letter-spacing: -0.025em;
  }

  .bsft-detail-header-subtitle {
    margin: var(--bsft-space-1) 0 0;
    color: var(--bsft-color-muted);
  }

  /* Each grid cell remains one dt/dd pair. auto-fit chooses the column count from the minimum the
     component writes, so the same markup collapses naturally from a dashboard to a phone. */
  .bsft-metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--bsft-metadata-min-column-width)), 1fr));
    gap: var(--bsft-space-2) var(--bsft-space-4);
    margin: 0;
    font-family: var(--bsft-font);
    color: var(--bsft-color-text);
  }

  .bsft-metadata-item {
    min-width: 0;
  }

  .bsft-metadata-item dt {
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
  }

  .bsft-metadata-item dd {
    margin: var(--bsft-space-1) 0 0;
    overflow-wrap: anywhere;
  }

  /* --- dialog -------------------------------------------------------------- */

  /* One chrome for the two dialogs the theme renders: the inline confirmation (.bsft-dialog,
     standing in the page where the question arose) and the modal panel (.bsft-dialog-panel,
     floating over the page). Stated once, so a confirmation looks the same whichever way it is
     asked; the modal's own sizing and scrolling live in its section below. */
  .bsft-dialog,
  .bsft-dialog-panel {
    padding: var(--bsft-space-8);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-xl);
    background: var(--bsft-color-surface);
    color: var(--bsft-color-text);
    font-family: var(--bsft-font);
    font-size: var(--bsft-text-base);
    line-height: var(--bsft-leading-body);
    box-shadow: var(--bsft-shadow-lg);
  }

  .bsft-dialog {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-4);
  }

  /* The gap is the whole of the spacing between a question and its actions: a paragraph's own
     block margins would add to it at the top and not at the bottom, since the actions row has
     none, and the dialog would sit lower on the page than it reads. */
  .bsft-dialog > * {
    margin-block: 0;
  }

  .bsft-dialog::backdrop {
    background: var(--bsft-color-backdrop);
  }

  /* A destructive action is an outline in the danger colour rather than a red fill: findable,
     but not the loudest thing on the screen. */
  .bsft-button-danger {
    background: var(--bsft-color-surface);
    border-color: var(--bsft-control-border);
    color: var(--bsft-color-danger);
    box-shadow: none;
  }

  /* --- segmented switchers ------------------------------------------------------ */

  /* The theme and org-scope switchers are one segmented control: a track on the canvas
     colour holding borderless options, the active one lifted onto the surface by a shadow rather
     than filled with the primary colour, so the bar's chrome stays quieter than the page's
     actions. The state is read off aria-pressed alone, so a theme cannot style an option as
     active that assistive technology reads as inactive. One set of rules for all three, because
     they ask the same kind of question and must not drift; the scope switcher's leave button
     rides in the same track as a quiet last option. The track turns the plain button's hover
     tint and lift off through the two tokens they are read from, which no specificity can
     outrank. The theme options are icon-only — their label is the hidden text and the tooltip —
     and so square; the scope options keep their words. The track has a hairline edge: on the
     dark surface the canvas fill alone all but vanishes, and the options would float free. The
     track stands exactly one control high: an option is the control height less the 2px of
     padding and the 1px of edge on either side. */
  .bsft-theme-switcher,
  .bsft-transfer-kinds,
  .bsft-scope-switcher {
    --bsft-color-hover: transparent;
    --bsft-shadow-md: none;
    display: inline-flex;
    /* The track is as wide as its options wherever it stands: a stretching column would
       otherwise pull it across the whole line. */
    width: fit-content;
    align-items: center;
    gap: var(--bsft-space-1);
    padding: 2px;
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-pill);
    background: var(--bsft-color-canvas);
    font-family: var(--bsft-font);
  }

  .bsft-transfer-kind-toggle,
  .bsft-scope-option,
  .bsft-theme-option {
    min-height: calc(var(--bsft-control-height) - 6px);
    padding: 0 var(--bsft-space-3);
    border-color: transparent;
    border-radius: var(--bsft-radius-pill);
    background: transparent;
    color: var(--bsft-color-muted);
    font-weight: var(--bsft-weight-medium);
    box-shadow: none;
  }

  .bsft-theme-option {
    min-width: calc(var(--bsft-control-height) - 6px);
    padding: 0 var(--bsft-space-2);
  }

  .bsft-transfer-kind-toggle[aria-pressed="true"],
  .bsft-scope-option[aria-pressed="true"],
  .bsft-theme-option[aria-pressed="true"] {
    background: var(--bsft-color-surface);
    border-color: var(--bsft-color-border);
    color: var(--bsft-color-text);
    box-shadow: var(--bsft-shadow-sm);
  }

  @media (hover: hover) {
    :is(.bsft-scope-option, .bsft-theme-option):not([aria-pressed="true"]):not(:disabled):hover {
      color: var(--bsft-color-text);
    }
  }

  /* The scope switcher's row: the track of options and, beside it, the leave action as a plain
     button — an action is not one of the track's options (Rule 14). */
  .bsft-scope {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--bsft-space-2);
  }

  .bsft-theme-option:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  /* --- language menu --------------------------------------------------------------- */

  /* The locale switcher is a menu: a quiet trigger — the globe, the locale in effect, a chevron —
     and the menu's radio commands, the one in effect drawn as every chosen row (the menu section,
     Rule 9). The trigger is the secondary button (Rule 23); only its spacing, its muted colour and
     its weight are the switcher's own, and the pointer or the open panel return the text colour. */
  .bsft-locale-switcher > .bsft-popover-trigger {
    gap: var(--bsft-space-1);
    padding-inline: var(--bsft-space-2);
    color: var(--bsft-color-muted);
    font-weight: var(--bsft-weight-medium);
  }

  @media (hover: hover) {
    .bsft-locale-switcher > .bsft-button.bsft-popover-trigger:not(:disabled):not([aria-disabled="true"]):hover {
      color: var(--bsft-color-text);
    }
  }

  .bsft-locale-switcher > .bsft-popover-trigger[aria-expanded="true"] {
    color: var(--bsft-color-text);
  }

  /* --- popover, menu and user menu -------------------------------------------- */

  /* Anchored popup: the trigger stays in flow, the panel floats off the corner the placement
     attribute names. One block for the plain popover, the dropdown menu and the user menu, since
     all three render the same markup. */
  .bsft-popover {
    position: relative;
    display: inline-flex;
    /* The wrapper is as wide as its trigger wherever it stands, as the segmented track is: in a
       stretching column or a grid cell an "end" placement would otherwise hang the panel off the
       far edge of the line, nowhere near the control that opened it. */
    width: fit-content;
    font-family: var(--bsft-font);
  }

  .bsft-popover-trigger:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  /* The outside-click dismissal: an invisible layer under the popup and over the page, so a
     click anywhere else closes it without a document-level script. */
  .bsft-popover-backdrop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--bsft-z-popup) - 1);
  }

  /* Wide enough for a sentence, narrow enough to stay a note beside its trigger. */
  .bsft-popover-panel {
    position: absolute;
    min-width: 16rem;
    max-width: 24rem;
    display: flex;
    flex-direction: column;
    background: var(--bsft-color-surface);
    color: var(--bsft-color-text);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    padding: var(--bsft-space-2);
    gap: var(--bsft-space-1);
    z-index: var(--bsft-z-popup);
    font-family: var(--bsft-font);
    font-size: var(--bsft-text-base);
    line-height: var(--bsft-leading-body);
    box-shadow: var(--bsft-shadow-md);
  }

  /* The four placements, written as the tokens BsftPopover emits rather than as CSS-side names,
     so the two cannot drift. Logical properties throughout: "start" is the left edge in a
     left-to-right locale and the right edge in a right-to-left one. */
  .bsft-popover[data-bsft-placement="bottom-start"] > .bsft-popover-panel {
    top: 100%;
    inset-inline-start: 0;
  }

  .bsft-popover[data-bsft-placement="bottom-end"] > .bsft-popover-panel {
    top: 100%;
    inset-inline-end: 0;
  }

  .bsft-popover[data-bsft-placement="top-start"] > .bsft-popover-panel {
    bottom: 100%;
    inset-inline-start: 0;
  }

  .bsft-popover[data-bsft-placement="top-end"] > .bsft-popover-panel {
    bottom: 100%;
    inset-inline-end: 0;
  }

  /* What a popover holds is a short note: its paragraphs and plain lists drop the document's
     outer margins, since the panel's padding and gap already space them, and a key cap reads as
     one. A list with a class of its own — a menu's — is a control and keeps its rule. */
  .bsft-popover-panel :is(p, ul, ol):not([class]) {
    margin: 0;
  }

  .bsft-popover-panel :is(ul, ol):not([class]) {
    padding-inline-start: 1.25em;
  }

  .bsft-popover-panel kbd {
    padding: 0 0.375em;
    border: 1px solid var(--bsft-color-border);
    border-bottom-width: 2px;
    border-radius: var(--bsft-radius-sm);
    background: var(--bsft-color-canvas);
    font-family: var(--bsft-font-mono);
    font-size: var(--bsft-text-xs);
  }

  /* A menu is never narrower than the trigger it drops from — the wrapper above is exactly the
     trigger's width, so 100% is that — and never narrower than a short list of commands needs; a
     note's reading width is the plain popover's and not a menu's. */
  .bsft-menu > .bsft-popover-panel {
    min-width: max(10rem, 100%);
  }

  .bsft-menu-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
  }

  .bsft-menu-item {
    appearance: none;
    /* Every command spans the menu, so the hover and the checked tint are one width down the
       list rather than each ending with its own text. */
    width: 100%;
    background: none;
    border: 0;
    display: flex;
    align-items: center;
    gap: calc(var(--bsft-spacing) / 2);
    text-align: start;
    color: var(--bsft-color-text);
    font: inherit;
    padding: var(--bsft-space-2) var(--bsft-space-3);
    border-radius: var(--bsft-radius-md);
    cursor: pointer;
    min-height: var(--bsft-control-height);
    font-size: var(--bsft-text-sm);
  }

  /* The chosen value of a radio group is a chosen row (Rule 9): the selected tint and the accent
     bar on the start edge, as the select's list draws it (Rule 13), with no mark and no change of
     weight. A checked checkbox item is an option that is on, so it shows the check instead, in the
     accent every native check control of the theme is painted in. */
  .bsft-menu-item[role="menuitemradio"][aria-checked="true"] {
    background: var(--bsft-selected-surface);
    color: var(--bsft-color-selection-text);
    box-shadow: inset 3px 0 var(--bsft-selected-accent);
  }

  :root[dir="rtl"] .bsft-menu-item[role="menuitemradio"][aria-checked="true"] {
    box-shadow: inset -3px 0 var(--bsft-selected-accent);
  }

  /* A command that is a link — the user menu's way to the account console — is drawn as the
     command, not as a link in the text. */
  a.bsft-menu-item {
    text-decoration: none;
  }

  /* A group is structure only: its items stack exactly like the menu's own. */
  .bsft-menu-group {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
  }

  .bsft-menu-separator {
    block-size: 0;
    margin: calc(var(--bsft-spacing) / 2) 0;
    border-block-start: 1px solid var(--bsft-color-border);
  }

  /* The checkmark's slot is reserved on every checkable item, checked or not and radio or checkbox,
     so a label does not move when its item becomes the chosen one and the labels of a radio group
     and a checkbox group line up. The icon slot holds whatever the host drew. */
  .bsft-menu-item-check,
  .bsft-menu-item-icon {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    inline-size: 1rem;
  }

  .bsft-menu-item-check {
    color: var(--bsft-selected-accent);
  }

  .bsft-menu-item-label {
    flex: 1 1 auto;
    min-inline-size: 0;
  }

  /* A destructive command reads in the danger colour, the menu's counterpart of
     bsft-button-danger; the checkmark and an icon follow through currentColor. */
  .bsft-menu-item-danger {
    color: var(--bsft-color-danger);
  }

  .bsft-menu-item:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  /* Refused rather than removed, so the menu keeps its shape: the pointer says so and the
     contrast drops, while aria-disabled says the same thing to assistive technology. */
  .bsft-menu-item[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: var(--bsft-disabled-opacity);
  }

  @media (hover: hover) {
    .bsft-menu-item:not(:disabled):not([aria-disabled="true"]):hover {
      background: var(--bsft-color-hover);
    }
  }

  /* --- disclosure ------------------------------------------------------------- */

  /* A stack of sections with a hairline between them, so where one ends and the next begins is
     drawn rather than guessed from the headings' weight; two stacks side by side stay two. */
  .bsft-disclosure {
    display: flex;
    flex-direction: column;
    font-family: var(--bsft-font);
  }

  .bsft-disclosure-section + .bsft-disclosure-section {
    border-top: 1px solid var(--bsft-color-border);
  }

  /* Two stacks set one under the other read as one stack, so they are divided as its sections
     are; otherwise the last section of one runs into the first of the next. */
  .bsft-disclosure + .bsft-disclosure {
    border-top: 1px solid var(--bsft-color-border);
  }

  .bsft-disclosure-heading {
    margin: 0;
    font-size: inherit;
  }

  /* The trigger is a control-height row carrying the one disclosure marker — the tree's twisty,
     turned while open — so a section that opens looks like every other thing that opens. */
  .bsft-disclosure-trigger {
    appearance: none;
    display: flex;
    align-items: center;
    gap: var(--bsft-space-2);
    width: 100%;
    min-height: var(--bsft-control-height);
    text-align: start;
    background: none;
    border: 0;
    border-radius: var(--bsft-radius-md);
    color: var(--bsft-color-text);
    font: inherit;
    font-weight: var(--bsft-weight-semibold);
    padding: var(--bsft-space-1) var(--bsft-space-2);
    cursor: pointer;
  }

  .bsft-disclosure-trigger::before {
    content: "\25B8";
    display: inline-block;
    flex: none;
    width: 1em;
    text-align: center;
    color: var(--bsft-color-muted);
    transition: transform var(--bsft-motion-fast) ease-in-out;
  }

  .bsft-disclosure-trigger[aria-expanded="true"]::before {
    transform: rotate(90deg);
  }

  :root[dir="rtl"] .bsft-disclosure-trigger[aria-expanded="false"]::before {
    transform: rotate(180deg);
  }

  .bsft-disclosure-trigger:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  .bsft-disclosure-trigger:disabled {
    cursor: not-allowed;
    opacity: var(--bsft-disabled-opacity);
  }

  @media (hover: hover) {
    .bsft-disclosure-trigger:not(:disabled):hover {
      background: var(--bsft-color-hover);
    }
  }

  /* The panel's text lines up with the trigger's label, past the marker and its gap. */
  .bsft-disclosure-panel {
    padding: 0 var(--bsft-space-2) var(--bsft-space-3) calc(var(--bsft-space-2) + 1em + var(--bsft-space-2));
  }

  /* --- breadcrumbs ------------------------------------------------------------ */

  .bsft-breadcrumbs {
    font-family: var(--bsft-font);
  }

  .bsft-breadcrumbs-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--bsft-space-1);
  }

  /* The separator is drawn rather than written into the markup: a literal slash between two list
     items is read aloud once per step and adds nothing the ordered list has not already said. */
  .bsft-breadcrumbs-step + .bsft-breadcrumbs-step::before {
    content: "/";
    margin-inline-end: var(--bsft-space-1);
    color: var(--bsft-color-muted);
  }

  .bsft-breadcrumbs-label {
    color: var(--bsft-color-primary);
    text-decoration: none;
  }

  .bsft-breadcrumbs-label[aria-current="page"] {
    color: var(--bsft-color-text);
    font-weight: var(--bsft-weight-semibold);
  }

  .bsft-breadcrumbs-label:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  @media (hover: hover) {
    .bsft-breadcrumbs-label[href]:hover {
      text-decoration: underline;
      text-underline-offset: 0.2em;
    }
  }

  /* --- shell ------------------------------------------------------------------- */

  /* The shell fills the page through a chain of percentages and flex growth rather than a viewport
     unit: the document is the initial containing block's height, the body at least the document's,
     and the application root (the body's child holding the shell, whatever the host calls it) and
     the shell each grow into what is left. The initial containing block does not change height
     while a mobile URL bar collapses, so the shell neither reflows with the bar nor forces a
     scrollbar, which is what the former small-viewport height achieved — without a viewport unit that a
     sheet or a keyboard inset would have to be reconciled with. */
  html {
    height: 100%;
  }

  body {
    display: flex;
    flex-direction: column;
    min-height: 100%;
  }

  body > :has(> .bsft-shell) {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
  }

  .bsft-shell {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    gap: 0;
    font-family: var(--bsft-font);
    color: var(--bsft-color-text);
    font-size: var(--bsft-text-base);
    line-height: var(--bsft-leading-body);
    background: var(--bsft-color-canvas);
  }

  .bsft-shell-header {
    /* It stays at the top while the page scrolls, above the page so a menu opened from it paints
       over the content; the modal and toast layers sit far above this. Two layers up, because the
       scroll cue's shadows of a container in the page are lifted one layer (z-index 1) to paint
       over its sticky header cells, and they must slide under the bar, not over it. */
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--bsft-space-3);
    /* An application bar, not a hero: one control row high, a hairline and no shadow, with the
       page title at the size of a section heading rather than a document title. */
    min-height: var(--bsft-shell-header-height);
    padding: var(--bsft-space-2) var(--bsft-space-6);
    border-bottom: 1px solid var(--bsft-color-border);
    background: var(--bsft-color-surface);
  }

  /* The brand: a mark and a name, the first thing in the bar. It owns the bar's flexible spacer
     unless a page title follows it, which then takes the spacer and is set off by a hairline as
     the quieter of the two. */
  .bsft-shell-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--bsft-space-2);
    min-width: 0;
    margin-inline-end: auto;
    color: var(--bsft-color-text);
    font-size: var(--bsft-text-base);
    font-weight: var(--bsft-weight-semibold);
    letter-spacing: -0.01em;
    white-space: nowrap;
  }

  .bsft-shell-header--titled .bsft-shell-brand {
    margin-inline-end: 0;
  }

  .bsft-shell-page-title {
    min-width: 0;
    margin: 0;
    margin-inline-end: auto;
    overflow: hidden;
    font-size: var(--bsft-text-xl);
    line-height: var(--bsft-leading-heading);
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: var(--bsft-weight-semibold);
    letter-spacing: -0.025em;
  }

  .bsft-shell-header--branded .bsft-shell-page-title {
    padding-inline-start: var(--bsft-space-3);
    border-inline-start: 1px solid var(--bsft-color-border);
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-base);
    font-weight: var(--bsft-weight-medium);
    letter-spacing: 0;
  }

  .bsft-shell-header-actions {
    display: flex;
    align-items: center;
    gap: var(--bsft-space-2);
  }

  /* The user menu is the last thing in the bar, set off from the switchers by a hairline, its
     trigger a quiet control: the name is the control, not a button-shaped box around it. */
  .bsft-shell-header .bsft-user-menu {
    margin-inline-start: var(--bsft-space-2);
    padding-inline-start: var(--bsft-space-3);
    border-inline-start: 1px solid var(--bsft-color-border);
  }

  /* A user menu in the bar is quiet through BsftUserMenu.IsQuietTrigger, the secondary button
     (Rule 23); the bar states no chrome of its own for it. */

  .bsft-shell-nav {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-4);
    padding: var(--bsft-space-6) var(--bsft-space-4);
    border-inline-end: 1px solid var(--bsft-color-border);
    background: var(--bsft-color-surface);
  }

  .bsft-shell-sidebar-footer {
    margin-top: auto;
    padding-top: var(--bsft-space-2);
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
  }

  .bsft-shell-main {
    flex: 1;
    min-width: 0;
    padding: var(--bsft-space-8);
  }

  /* The drawer toggle. It sits first in the header and is pushed to the start edge, because the
     control that opens the navigation belongs where the navigation is. Above the shell breakpoint
     the responsive block takes it out of the document entirely — display:none rather than a
     visual hide, so a keyboard user is not handed a control for a drawer that is not there. */
  .bsft-shell-nav-toggle {
    margin-inline-end: auto;
    padding-inline: var(--bsft-space-2);
  }

  /* With a title, the title owns the header's one flexible spacer. Without one, the toggle keeps
     its original auto margin and therefore the exact pre-title mobile layout. */
  .bsft-shell-header--titled .bsft-shell-nav-toggle,
  .bsft-shell-header--branded .bsft-shell-nav-toggle {
    margin-inline-end: 0;
  }

  /* The glyph is drawn here rather than written into the markup, exactly as the list's sort
     markers are: the button carries an aria-label instead, so a re-skin swapping this for an icon
     font changes nothing about what the control is announced as. */
  .bsft-shell-nav-toggle::before {
    content: "\2261";
  }

  .bsft-shell-nav-toggle:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  /* --- navigation ------------------------------------------------------------ */

  .bsft-nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--bsft-space-2);
    font-family: var(--bsft-font);
  }

  /* Inside the shell the navigation is always a column: the sidebar above the breakpoint and the
     drawer below it are both one item per line. A navigation that asks for the column itself
     (Orientation Vertical, .bsft-nav-vertical) takes the same rule, so the gallery's second
     mount and a host's own sidebar look like the shell's. */
  .bsft-nav-vertical,
  .bsft-nav-vertical .bsft-nav-list,
  .bsft-shell-nav .bsft-nav,
  .bsft-shell-nav .bsft-nav-list {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: var(--bsft-space-2);
  }

  .bsft-nav-item {
    color: var(--bsft-color-muted);
    text-decoration: none;
    /* The block padding stays under the control height, so a one-line item is exactly one
       control high — as the trigger beside it and a tree row are — and not a pixel over it. */
    padding: var(--bsft-space-1) var(--bsft-space-3);
    border-radius: var(--bsft-radius-md);
    display: flex;
    align-items: center;
    gap: var(--bsft-space-3);
    min-height: var(--bsft-control-height);
    font-size: var(--bsft-text-sm);
    font-weight: var(--bsft-weight-medium);
    /* The room a current entry brought into view keeps to its scroll container's edge, so the
       overflow cue below never sits on its label. */
    scroll-margin-block: var(--bsft-scroll-cue-size);
  }

  .bsft-nav-item:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  /* The current location, marked by the same attribute that announces it: the selection tint
     and a bar on the start edge, so it does not rest on colour alone. */
  .bsft-nav-item[aria-current="page"] {
    background: var(--bsft-selected-surface);
    font-weight: var(--bsft-weight-semibold);
    color: var(--bsft-color-text);
    box-shadow: inset 3px 0 var(--bsft-selected-accent);
  }

  :root[dir="rtl"] .bsft-nav-item[aria-current="page"] {
    box-shadow: inset -3px 0 var(--bsft-selected-accent);
  }

  .bsft-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--bsft-space-1);
  }

  /* A nested level stacks and indents instead of wrapping: a group's children are a list under a
     heading, not more entries of the bar above them. */
  .bsft-nav-group > .bsft-nav-list {
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    padding-inline-start: var(--bsft-space-2);
    border-inline-start: 1px solid var(--bsft-color-border);
  }

  /* Stretched, not centred: a label that wraps makes its link taller, and the trigger beside it
     has to grow with it or the row's one bar gets a notch at each end. The entry wraps for one
     thing only, the group's list under the row (its basis is the whole width); the link and the
     trigger share the first line, which the link's zero basis below guarantees. */
  .bsft-nav-entry {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
  }

  /* A group's link takes the row, so its trigger sits at the far end of it rather than wherever
     the label happens to stop. The basis is zero, not auto, on purpose: flexbox breaks lines on
     the items' natural widths, so a label too long for the row would otherwise send the trigger
     under it before the link ever shrank (Rule 7). With zero, the label wraps inside its link and
     the trigger stays on its line. */
  .bsft-nav-entry > .bsft-nav-item {
    flex: 1 1 0%;
    min-width: 0;
  }

  /* The trigger is one control-height square at the end of the row, or the whole row for a group
     that leads nowhere and carries its label itself. The markup leaves it empty for a linked
     group, so the marker is drawn here, the tree's twisty and its quarter turn. */
  .bsft-nav-group-trigger {
    appearance: none;
    display: flex;
    flex: none;
    box-sizing: border-box;
    align-items: center;
    justify-content: space-between;
    gap: var(--bsft-space-2);
    min-width: var(--bsft-control-height);
    min-height: var(--bsft-control-height);
    padding: 0 var(--bsft-space-3);
    background: none;
    border: 0;
    border-radius: var(--bsft-radius-md);
    color: var(--bsft-color-muted);
    font: inherit;
    font-size: var(--bsft-text-sm);
    font-weight: var(--bsft-weight-medium);
    cursor: pointer;
  }

  .bsft-nav-group-trigger:not([aria-label]) {
    flex: 1;
  }

  .bsft-nav-group-trigger::after {
    content: "\25B8";
    display: inline-block;
    width: 1em;
    text-align: center;
    transition: transform var(--bsft-motion-fast) ease-in-out;
  }

  .bsft-nav-group-trigger[aria-expanded="true"]::after {
    transform: rotate(90deg);
  }

  :root[dir="rtl"] .bsft-nav-group-trigger[aria-expanded="false"]::after {
    transform: rotate(180deg);
  }

  /* The tint under the pointer is the row's, stated below; the trigger only
     brightens its glyph here. */
  @media (hover: hover) {
    .bsft-nav-group-trigger:hover {
      color: var(--bsft-color-text);
    }
  }

  /* A group's row is one bar, as a tree row is: the link and the trigger beside it give up the
     corners where they meet, the trigger beside the current link takes the link's tint, and the
     pointer on either of the two tints both. The tint cannot sit on the entry itself, which also
     holds the group's opened children; a row that is the current location keeps its one picture
     and does not answer the pointer on top of it. */
  .bsft-nav-entry:has(> .bsft-nav-group-trigger) > .bsft-nav-item {
    border-start-end-radius: 0;
    border-end-end-radius: 0;
  }

  .bsft-nav-entry > .bsft-nav-item + .bsft-nav-group-trigger {
    border-start-start-radius: 0;
    border-end-start-radius: 0;
  }

  .bsft-nav-entry:has(> .bsft-nav-item[aria-current="page"]) > .bsft-nav-group-trigger {
    background: var(--bsft-selected-surface);
    color: var(--bsft-color-text);
  }

  @media (hover: hover) {
    .bsft-nav-entry:not(:has(> .bsft-nav-item[aria-current="page"])):has(> :is(.bsft-nav-item, .bsft-nav-group-trigger):hover)
      > :is(.bsft-nav-item:not([aria-disabled="true"]), .bsft-nav-group-trigger) {
      background: var(--bsft-color-hover);
    }
  }

  .bsft-nav-group-trigger:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  /* The group's list is the one thing in an entry that wraps: a whole row of its own under the
     link and the trigger. */
  .bsft-nav-group {
    flex-basis: 100%;
  }

  /* A navigation list taller than the room it is given scrolls, and its scroll container (the
     navigation itself or the drawer around it) is marked by bsft-navigation-scroll.js with the ends
     that hide entries. Each such end gets an inner shadow, so nothing has to be scrolled to learn the
     list goes on; an end with nothing beyond it gets none. The shadow does not move, so there is no
     motion for a reduced-motion preference to turn off. */
  [data-bsft-nav-overflow="start"] {
    box-shadow: inset 0 var(--bsft-scroll-cue-size) var(--bsft-scroll-cue-size)
      calc(var(--bsft-scroll-cue-size) * -1) var(--bsft-scroll-cue-color);
  }

  [data-bsft-nav-overflow="end"] {
    box-shadow: inset 0 calc(var(--bsft-scroll-cue-size) * -1) var(--bsft-scroll-cue-size)
      calc(var(--bsft-scroll-cue-size) * -1) var(--bsft-scroll-cue-color);
  }

  [data-bsft-nav-overflow="both"] {
    box-shadow:
      inset 0 var(--bsft-scroll-cue-size) var(--bsft-scroll-cue-size)
        calc(var(--bsft-scroll-cue-size) * -1) var(--bsft-scroll-cue-color),
      inset 0 calc(var(--bsft-scroll-cue-size) * -1) var(--bsft-scroll-cue-size)
        calc(var(--bsft-scroll-cue-size) * -1) var(--bsft-scroll-cue-color);
  }

  /* --- org scope -------------------------------------------------------------- */

  /* The group itself is one of the segmented switchers above; only its focus rings live here. */
  .bsft-scope-option:focus-visible,
  .bsft-scope-leave:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  /* --- toasts -------------------------------------------------------------- */

  /* The stack is fixed to the top end corner, where notifications are looked for, and starts
     below the application bar so it never covers the bar's own controls; the host can live
     anywhere in the shell markup. Only the toasts themselves take pointer events — an empty
     stack never covers the screen it floats over. */
  .bsft-toasts {
    position: fixed;
    inset-block-start: calc(var(--bsft-shell-header-height) + var(--bsft-space-2));
    inset-inline-end: var(--bsft-space-2);
    z-index: var(--bsft-z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-2);
    pointer-events: none;
    font-family: var(--bsft-font);
  }

  .bsft-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: var(--bsft-space-2);
    max-width: 24rem;
    padding: var(--bsft-space-4);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    background: var(--bsft-color-surface);
    color: var(--bsft-color-text);
    box-shadow: var(--bsft-shadow-md);
  }

  .bsft-toast-message {
    flex: 1;
  }

  .bsft-toast-dismiss {
    all: unset;
    cursor: pointer;
    line-height: 1;
    font-size: 1.25em;
    color: inherit;
  }

  /* `all: unset` drops the user agent's focus ring with everything else, so it is put back
     here: the dismiss button is reachable by keyboard and must show where the focus is, in the
     theme's one focus colour (Rule 10). */
  .bsft-toast-dismiss:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  /* The notice Blazor shows once an error ended the page's connection (BsftCircuitErrorNotice). It is the
     failure notice (.bsft-notice-error, Rule 27), which gives its colours and its edge; this rule states
     only its place and its shape. Hidden until Blazor's script sets display: block on it as an inline
     style; then a bar across the bottom of the viewport, above the toasts, whose edge is the top one. The
     end padding keeps the text clear of the dismiss button in its corner. */
  .bsft-circuit-error {
    display: none;
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: calc(var(--bsft-z-toast) + 1);
    box-sizing: border-box;
    padding-block: var(--bsft-space-3);
    padding-inline: var(--bsft-space-4) calc(var(--bsft-touch-target) + var(--bsft-space-2));
    border-width: 1px 0 0;
    border-radius: 0;
    box-shadow: var(--bsft-shadow-3);
  }

  /* A text link like any other (Rule 41); only its place beside the sentence is its own. */
  .bsft-circuit-error-reload {
    margin-inline-start: var(--bsft-space-2);
  }

  .bsft-circuit-error-reload:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  .bsft-circuit-error-dismiss {
    all: unset;
    position: absolute;
    top: 0;
    inset-inline-end: 0;
    display: inline-grid;
    place-items: center;
    width: var(--bsft-touch-target);
    height: var(--bsft-touch-target);
    cursor: pointer;
    color: inherit;
    font-size: 1.25em;
    line-height: 1;
  }

  /* Drawn inside the button, which sits in the corner of a bar that ends at the viewport's edge:
     the ring's own colour and width, pulled in by twice its usual gap. */
  .bsft-circuit-error-dismiss:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: calc(-2 * var(--bsft-focus-offset));
  }

  @media (hover: hover) {
    .bsft-circuit-error-dismiss:hover {
      background: var(--bsft-color-hover);
    }
  }

  .bsft-toast-info {
    color: var(--bsft-color-info);
    background: var(--bsft-color-info-surface);
    border-color: var(--bsft-color-info);
  }

  .bsft-toast-success {
    color: var(--bsft-color-success);
    background: var(--bsft-color-success-surface);
    border-color: var(--bsft-color-success);
  }

  .bsft-toast-warning {
    color: var(--bsft-color-warning);
    background: var(--bsft-color-warning-surface);
    border-color: var(--bsft-color-warning);
  }

  .bsft-toast-error {
    color: var(--bsft-color-danger);
    background: var(--bsft-color-danger-surface);
    border-color: var(--bsft-color-danger);
  }

  /* --- tabs ----------------------------------------------------------------- */

  /* A strip wider than its container scrolls inside itself instead of widening the page, and every label
     stays on one line (a wrapped label made the tabs uneven and still overflowed at 375px). The ends that
     hide tabs carry the inner shadow the navigation draws (--bsft-scroll-cue-size and -color), driven by
     the strip's own scroll position, so nothing has to be scrolled to learn the strip goes on; a strip
     that fits, or a browser without scroll-driven animations, draws none, and the thin scrollbar is the
     cue there. The shadow follows the scroll position and does not move by itself, so the reduced-motion
     guard leaves it in place. */
  @property --bsft-tabs-cue-start {
    syntax: "<length>";
    inherits: false;
    initial-value: 0px;
  }

  @property --bsft-tabs-cue-end {
    syntax: "<length>";
    inherits: false;
    initial-value: 0px;
  }

  @keyframes bsft-tabs-cue {
    from {
      --bsft-tabs-cue-start: 0px;
      --bsft-tabs-cue-end: var(--bsft-scroll-cue-size);
    }

    5% {
      --bsft-tabs-cue-start: var(--bsft-scroll-cue-size);
    }

    95% {
      --bsft-tabs-cue-end: var(--bsft-scroll-cue-size);
    }

    to {
      --bsft-tabs-cue-start: var(--bsft-scroll-cue-size);
      --bsft-tabs-cue-end: 0px;
    }
  }

  .bsft-tabs-list {
    /* 1 where the strip's start is its left edge, -1 where it is its right edge. */
    --bsft-tabs-cue-direction: 1;
    display: flex;
    gap: var(--bsft-space-1);
    border-bottom: 1px solid var(--bsft-color-border);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    box-shadow:
      inset calc(var(--bsft-tabs-cue-start) * var(--bsft-tabs-cue-direction)) 0 var(--bsft-tabs-cue-start)
        calc(var(--bsft-tabs-cue-start) * -1) var(--bsft-scroll-cue-color),
      inset calc(var(--bsft-tabs-cue-end) * var(--bsft-tabs-cue-direction) * -1) 0 var(--bsft-tabs-cue-end)
        calc(var(--bsft-tabs-cue-end) * -1) var(--bsft-scroll-cue-color);
  }

  /* Only where the scroll position can drive it: without a scroll timeline the animation would run once
     by time and leave the start cue on every strip. */
  @supports (animation-timeline: scroll()) {
    .bsft-tabs-list {
      animation: bsft-tabs-cue linear both;
      animation-timeline: scroll(self inline);
    }
  }

  .bsft-tabs-list:dir(rtl) {
    --bsft-tabs-cue-direction: -1;
  }

  .bsft-tab {
    all: unset;
    flex: none;
    white-space: nowrap;
    cursor: pointer;
    padding: var(--bsft-space-2) var(--bsft-space-4);
    color: var(--bsft-color-muted);
    border-bottom: 2px solid transparent;
    font-family: var(--bsft-font);
    min-height: var(--bsft-control-height);
    border-radius: var(--bsft-radius-md) var(--bsft-radius-md) 0 0;
    font-size: var(--bsft-text-sm);
    font-weight: var(--bsft-weight-medium);
    /* The room a selected tab brought into view keeps to the strip's edge, so the overflow cue never
       sits on its label. */
    scroll-margin-inline: var(--bsft-scroll-cue-size);
  }

  /* Drawn inside the tab: the strip is a scroll container, which clips a ring drawn outside it. */
  .bsft-tab:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: calc(-1 * var(--bsft-focus-width));
  }

  /* The chosen tab is the one picture of "chosen" (Rule 9): the selected tint and the accent, whose
     shape on a tab is the bar on its bottom edge. */
  .bsft-tab-active,
  .bsft-tab[aria-selected="true"] {
    color: var(--bsft-color-text);
    border-bottom-color: var(--bsft-selected-accent);
    background: var(--bsft-selected-surface);
    font-weight: var(--bsft-weight-semibold);
  }

  @media (hover: hover) {
    .bsft-tab:not(:disabled):not([aria-disabled="true"]):hover {
      background: var(--bsft-color-hover);
    }
  }

  .bsft-tabs-panel {
    padding: var(--bsft-space-4) 0;
  }

  /* --- dialog overlay --------------------------------------------------------- */

  .bsft-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--bsft-z-dialog);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--bsft-space-4);
    background: var(--bsft-color-backdrop);
    font-family: var(--bsft-font);
  }

  /* The panel's chrome is the one it shares with the inline dialog, in the dialog section above;
     only what a floating panel needs over an inline one is here: a reading width and its own
     scrolling, so a long dialog scrolls inside the panel and never behind the backdrop. */
  .bsft-dialog-panel {
    max-width: 32rem;
    width: 100%;
    max-height: 100%;
    overflow: auto;
  }

  /* A confirmation's overlay is declared next to the control that asks (BsftConfirmDialog inside a
     table cell, a card footer, a toolbar), so it inherits that place's text settings although it is
     drawn over the whole page. The ones a cell or a toolbar typically sets are put back, so the
     question wraps and reads like any other dialog. */
  .bsft-confirm-overlay {
    font-size: var(--bsft-text-base);
    font-weight: normal;
    font-style: normal;
    line-height: var(--bsft-line-height-normal);
    letter-spacing: normal;
    text-align: start;
    text-transform: none;
    white-space: normal;
    cursor: default;
  }

  /* The stacked host's own content. Every overlay of a stack carries the same --bsft-z-dialog
     layer deliberately: the newest is painted last because it is rendered last, which is what
     puts it on top among equally-layered siblings. A z-index computed per stack entry would be
     the one way a dialog could eventually climb over a toast, and the three layers above are a
     contract, not a suggestion. */

  /* The title look is given by position as well as by class: a heading that opens either dialog
     is its title, whether or not the content that carries it knows the class. */
  .bsft-dialog-title,
  .bsft-dialog > :is(h1, h2, h3):first-child,
  .bsft-dialog-panel > :is(h1, h2, h3):first-child {
    margin: 0 0 var(--bsft-space-2);
    font-size: var(--bsft-text-2xl);
    font-weight: var(--bsft-weight-semibold);
    line-height: var(--bsft-leading-heading);
    letter-spacing: -0.025em;
  }

  .bsft-dialog-message {
    margin: 0 0 var(--bsft-space-4);
    color: var(--bsft-color-muted);
  }

  /* --- info hint -------------------------------------------------------------- */

  /* BsftInfoHint: an (i) beside a page or card title. The icon is 1em of the font the hint inherits
     (the text of the row it sits in, not the heading's; a class on the button that sets font-size
     resizes it). The wrapper is a flex container with line-height 0, so it holds no line box and no
     strut of its own. Its baseline is the icon's bottom edge, and in a line or a baseline-aligned
     row it takes 0.75em above the baseline and nothing below: the negative top margin gives back
     the icon's top quarter. A line height of 1 still leaves any common font more than 0.8em of
     ascent, so text at least as large as the hint's own reaches higher, and the hint never makes
     its line or its row taller. It is drawn 0.125em lower than it sits, by a relative offset that
     takes no room, so the icon centres on the text.

     The hit target is the ::before box, at least --bsft-target-size-min (24 CSS px) wide and high
     and centred on the icon; an absolutely positioned pseudo-element takes no room. The button's
     inline margins are at least half the difference between that box and the icon, so the box never
     reaches into the heading before it or a control after it. It stays 24 px under a coarse pointer
     too: a 44 px box would cover the heading and the controls beside a title.

     `all: unset` drops the user agent's button chrome and focus ring, so the ring is put back on
     :focus-visible. */
  .bsft-info-hint {
    position: relative;
    inset-block-start: 0.125em;
    display: inline-flex;
    margin-block-start: -0.25em;
    line-height: 0;
  }

  .bsft-info-hint-button {
    all: unset;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 1em;
    block-size: 1em;
    margin-inline: max(0.25em, (var(--bsft-target-size-min) - 1em) / 2);
    border-radius: var(--bsft-radius-pill);
    color: var(--bsft-color-muted);
    cursor: pointer;
  }

  .bsft-info-hint-button::before {
    content: "";
    position: absolute;
    inset: min(0px, (100% - var(--bsft-target-size-min)) / 2);
  }

  /* A heading and what sits beside it, such as an info hint, on one row that wraps when it runs out
     of room. The items share their first baseline, so a heading's margins (asymmetric ones
     included) do not move the icon, and the hint sits on the heading's baseline as it would in a
     line of text. */
  .bsft-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
  }

  /* The pointer darkens the glyph as it does a picker's trigger (Rule 11). */
  @media (hover: hover) {
    .bsft-info-hint-button:hover {
      color: var(--bsft-color-text);
    }
  }

  /* The theme's one keyboard ring (Rule 10). */
  .bsft-info-hint-button:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  .bsft-info-hint-icon {
    inline-size: 100%;
    block-size: 100%;
  }

  /* The dialog is declared beside a title, perhaps inside a heading, so it would inherit that
     place's text settings although it is drawn over the page. They are put back here, as on the
     confirmation's overlay. */
  .bsft-info-hint-dialog {
    font-family: var(--bsft-font);
    font-size: var(--bsft-text-base);
    font-weight: normal;
    font-style: normal;
    line-height: var(--bsft-line-height-normal);
    letter-spacing: normal;
    text-align: start;
    text-transform: none;
    white-space: normal;
    cursor: default;
  }

  .bsft-info-hint-content {
    margin: 0 0 var(--bsft-space-4);
  }

  .bsft-info-hint-content > :first-child {
    margin-block-start: 0;
  }

  .bsft-info-hint-content > :last-child {
    margin-block-end: 0;
  }

  /* The static fallback: the browser's own popover takes the panel's look (Rule 3), .bsft-dialog-panel
     being one of its classes. The user agent centres it in the top layer and hides it while closed;
     its backdrop and the spacing gutter it keeps from the viewport's edges (the overlay's padding, for
     the modal) are the theme's. */
  .bsft-info-hint-popover {
    box-sizing: border-box;
    width: calc(100% - 2 * var(--bsft-space-2));
    max-height: calc(100% - 2 * var(--bsft-space-2));
  }

  /* The dialog's one backdrop (Rule 3), so the static fallback dims the page as the modal does. */
  .bsft-info-hint-popover::backdrop {
    background: var(--bsft-color-backdrop);
  }

  /* Without the popover API the panel would render inline beside the title and push the row apart;
     it stays hidden there, and the interactive dialog is unaffected. */
  @supports not selector(:popover-open) {
    .bsft-info-hint-popover {
      display: none;
    }
  }

  /* --- toggle ----------------------------------------------------------------- */

  /* The geometry is three numbers the travel is computed from, so the thumb always ends flush with
     the far edge: the thumb is as tall as the track's inside, and the distance it moves is the
     track's width less its height. `all: unset` resets the sizing model with everything else, so
     border-box is restated after it. */
  .bsft-toggle {
    --bsft-toggle-width: 2.5rem;
    --bsft-toggle-height: 1.5rem;
    --bsft-toggle-inset: 2px;
    all: unset;
    box-sizing: border-box;
    cursor: pointer;
    display: inline-flex;
    flex: none;
    align-items: center;
    width: var(--bsft-toggle-width);
    height: var(--bsft-toggle-height);
    padding: var(--bsft-toggle-inset);
    border-radius: var(--bsft-radius-pill);
    background: var(--bsft-color-track);
    transition: background-color var(--bsft-motion-fast) ease;
  }

  /* The switch and its label on one line, the label after it as a checkbox's text follows the
     box; the label is a click target for the switch, so it shows the pointer the switch does. */
  .bsft-toggle-field {
    display: inline-flex;
    align-items: center;
    gap: var(--bsft-space-2);
    font-family: var(--bsft-font);
  }

  .bsft-toggle-field > .bsft-field-label {
    cursor: pointer;
  }

  /* A switch the user cannot flip says so on its label too, not only on the track. */
  .bsft-toggle[disabled] + .bsft-field-label {
    cursor: not-allowed;
    opacity: var(--bsft-disabled-opacity);
  }

  .bsft-toggle:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  .bsft-toggle[disabled] {
    cursor: not-allowed;
    opacity: var(--bsft-disabled-opacity);
  }

  .bsft-toggle-on {
    background: var(--bsft-action-primary);
  }

  .bsft-toggle-thumb {
    width: calc(var(--bsft-toggle-height) - 2 * var(--bsft-toggle-inset));
    height: calc(var(--bsft-toggle-height) - 2 * var(--bsft-toggle-inset));
    border-radius: 50%;
    background: var(--bsft-color-surface);
    box-shadow: var(--bsft-shadow-sm);
    transition: transform var(--bsft-motion-fast) ease;
  }

  .bsft-toggle-on .bsft-toggle-thumb {
    transform: translateX(calc(var(--bsft-toggle-width) - var(--bsft-toggle-height)));
  }

  :root[dir="rtl"] .bsft-toggle-on .bsft-toggle-thumb {
    transform: translateX(calc(var(--bsft-toggle-height) - var(--bsft-toggle-width)));
  }

  /* --- wizard ----------------------------------------------------------------- */

  /* A stepper: every step is a numbered circle and its label, joined to the next by a line. The
     number comes from a CSS counter, so the markup stays the plain ordered list it is; the
     current step's circle is filled, a completed one carries a check and its line fills with it,
     an invalid one turns the danger colour. */
  .bsft-wizard-steps {
    counter-reset: bsft-wizard-step;
    display: flex;
    gap: var(--bsft-space-3);
    list-style: none;
    padding: 0;
    margin: 0 0 var(--bsft-space-4);
    font-family: var(--bsft-font);
  }

  .bsft-wizard-step {
    counter-increment: bsft-wizard-step;
    display: flex;
    align-items: center;
    gap: var(--bsft-space-2);
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
    font-weight: var(--bsft-weight-medium);
  }

  .bsft-wizard-step::before {
    content: counter(bsft-wizard-step);
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 1.75rem;
    height: 1.75rem;
    border: 2px solid var(--bsft-color-track);
    border-radius: 50%;
    background: var(--bsft-color-surface);
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-xs);
    font-weight: var(--bsft-weight-semibold);
    line-height: 1;
  }

  /* The line to the next step takes whatever width the row has left. */
  .bsft-wizard-step:not(:last-child) {
    flex: 1;
  }

  .bsft-wizard-step:not(:last-child)::after {
    content: "";
    flex: 1;
    min-width: var(--bsft-space-4);
    height: 2px;
    border-radius: 1px;
    background: var(--bsft-color-track);
  }

  .bsft-wizard-step-completed {
    color: var(--bsft-color-text);
  }

  .bsft-wizard-step-completed::before {
    content: "\2713";
    border-color: var(--bsft-action-primary);
    background: var(--bsft-color-primary-surface);
    color: var(--bsft-color-primary);
  }

  .bsft-wizard-step-completed::after {
    background: var(--bsft-action-primary);
  }

  .bsft-wizard-step-current {
    color: var(--bsft-color-text);
    font-weight: var(--bsft-weight-semibold);
  }

  .bsft-wizard-step-current::before {
    border-color: var(--bsft-action-primary);
    background: var(--bsft-action-primary);
    color: var(--bsft-color-primary-contrast);
  }

  .bsft-wizard-step-invalid {
    color: var(--bsft-color-danger);
  }

  .bsft-wizard-step-invalid::before {
    border-color: var(--bsft-color-danger);
    background: var(--bsft-color-danger-surface);
    color: var(--bsft-color-danger);
  }

  /* The reachable markers are buttons; they are styled back down to reading as part of the
     step list rather than as a control, because what they say is where the user is in a
     sequence and only secondarily that it can be jumped to. The pointer and the underline on
     hover are what say it can. */

  .bsft-wizard-step-link {
    border: 0;
    padding: 0;
    background: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
  }

  @media (hover: hover) {
    .bsft-wizard-step-link:hover {
      text-decoration: underline;
      text-underline-offset: 0.2em;
    }
  }

  .bsft-wizard-content {
    margin-bottom: var(--bsft-space-4);
  }

  /* --- badge ----------------------------------------------------------------- */

  .bsft-badge,
  .bsft-idp-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    max-width: 100%;
    height: 1.25rem;
    padding: 0 0.375rem;
    border-radius: var(--bsft-radius-pill);
    font-family: var(--bsft-font);
    font-size: var(--bsft-text-xs);
    line-height: 1;
    color: var(--bsft-color-text);
    background: var(--bsft-color-border);
    font-weight: var(--bsft-weight-medium);
  }

  /* The label is its own element: the pill is a flex container, and text directly in it is an
     anonymous flex item that text-overflow never reaches. Its line is the font's own height
     (line-height: normal) rather than the pill's 1: overflow: hidden, which the ellipsis needs, clips
     at the label's box, and a line of exactly 1em cut off the descenders of g, j, p, q and y. The pill
     keeps its fixed height, which that line fits inside. */
  .bsft-badge-label {
    min-width: 0;
    line-height: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* A dot has no text to carry the severity, so it is filled with the variant's strong colour (the
     badge's own text colour) taken a third of the way towards the text colour, not the pale surface
     tint behind a label, which is about 1.05:1 against a white page and fails the 3:1 a graphic
     needs; the luminous green and orange of the palette would fail it undarkened. The variant rules below only set the colour and a
     background this selector's specificity outranks. */
  .bsft-badge:empty {
    min-width: 0.5rem;
    width: 0.5rem;
    height: 0.5rem;
    padding: 0;
    background: color-mix(in srgb, currentColor 70%, var(--bsft-color-text));
  }

  .bsft-badge-info {
    color: var(--bsft-color-info);
    background: var(--bsft-color-info-surface);
  }

  .bsft-badge-success {
    color: var(--bsft-color-success);
    background: var(--bsft-color-success-surface);
  }

  .bsft-badge-warning {
    color: var(--bsft-color-warning);
    background: var(--bsft-color-warning-surface);
  }

  .bsft-badge-danger {
    color: var(--bsft-color-danger);
    background: var(--bsft-color-danger-surface);
  }

  @keyframes bsft-badge-pulse {
    50% {
      opacity: 0.35;
      transform: scale(1.35);
    }
  }

  .bsft-badge-running {
    gap: var(--bsft-space-1);
  }

  .bsft-badge-running-dot {
    flex: none;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: currentColor;
    animation: bsft-badge-pulse var(--bsft-motion-pulse) ease-in-out infinite;
  }

  /* --- choice list ----------------------------------------------------------------- */

  .bsft-choice-list {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-2);
    font-family: var(--bsft-font);
  }

  .bsft-choice {
    all: unset;
    box-sizing: border-box;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--bsft-space-2);
    width: 100%;
    /* A full-width card at comfortable touch-target height: the option list is the mobile
       replacement for a native select whose options cannot carry a badge. */
    min-height: var(--bsft-touch-target);
    padding: var(--bsft-space-2) var(--bsft-space-4);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius);
    background: var(--bsft-color-surface);
    color: var(--bsft-color-text);
  }

  .bsft-choice:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  .bsft-choice[disabled] {
    cursor: not-allowed;
    opacity: var(--bsft-disabled-opacity);
  }

  /* The card's picture of "chosen": the selected tint and an inset ring in the accent — inset
     rather than a wider border, so selecting an option does not change its size and shift the
     cards below it. */
  .bsft-choice-selected {
    border-color: var(--bsft-selected-accent);
    background: var(--bsft-selected-surface);
    box-shadow: inset 0 0 0 1px var(--bsft-selected-accent);
  }

  @media (hover: hover) {
    .bsft-choice:not(.bsft-choice-selected):not([disabled]):hover {
      background: var(--bsft-color-hover);
    }
  }

  .bsft-choice-text {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-1);
    text-align: start;
  }

  .bsft-choice-description {
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
  }

  .bsft-choice-badge {
    flex-shrink: 0;
  }

  /* --- combobox -------------------------------------------------------------------- */

  .bsft-combobox {
    /* The popup is positioned against this wrapper rather than the input, so the chip row above
       the input never shifts it out from under the control it belongs to. */
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-1);
    font-family: var(--bsft-font);
  }

  /* The outside-click dismissal, the popover's own mechanism: an invisible layer under the
     popup and over the page. The input and the chips are lifted above it while the list is open,
     so a click back into the field keeps typing and a chip's remove control still answers. */
  .bsft-combobox-backdrop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--bsft-z-popup) - 1);
  }

  .bsft-combobox-open > .bsft-picker-field,
  .bsft-combobox-open > .bsft-combobox-input,
  .bsft-combobox-open > .bsft-combobox-chips,
  .bsft-combobox-open > .bsft-combobox-trigger {
    position: relative;
    z-index: var(--bsft-z-popup);
  }

  /* Token mode's trigger: the field chrome on a button, so it reads as a select — its text on the
     start edge in the muted colour of a placeholder, the chevron on the end edge turning while
     the list is open. */
  .bsft-combobox-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--bsft-space-2);
    width: 100%;
    text-align: start;
    cursor: pointer;
  }

  /* The trigger is a button in a field's clothes, and a button answers the pointer: the hover
     tint, as every other button takes it, and not the field's grey halo as well (Rule 1), which
     the .bsft-input hover rule would otherwise add on top. The chip's remove control answers with
     its colour, the way the pickers' trigger glyph does. */
  @media (hover: hover) {
    .bsft-combobox-trigger:not(:disabled):hover {
      background: var(--bsft-color-hover);
      box-shadow: none;
    }

    .bsft-combobox-chip-remove:hover {
      color: var(--bsft-color-text);
    }
  }

  .bsft-combobox-trigger-text {
    overflow: hidden;
    color: var(--bsft-color-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bsft-combobox-trigger > .bsft-icon {
    color: var(--bsft-color-muted);
    transition: transform var(--bsft-motion-fast) ease-in-out;
  }

  .bsft-combobox-trigger[aria-expanded="true"] > .bsft-icon {
    transform: rotate(180deg);
  }

  /* Token mode's popup: the search input on top and the list under it, in one floating panel.
     The list inside it is part of the panel, not a popup of its own, so it gives up its own
     position, frame and shadow. */
  .bsft-combobox-panel {
    position: absolute;
    top: 100%;
    inset-inline: 0;
    z-index: var(--bsft-z-popup);
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-2);
    margin-top: var(--bsft-space-1);
    padding: var(--bsft-space-2);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    background: var(--bsft-color-surface);
    box-shadow: var(--bsft-shadow-md);
  }

  /* The input itself is the shared control chrome; it only has to fill the wrapper's width. */
  .bsft-combobox-input {
    width: 100%;
  }

  .bsft-combobox-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--bsft-space-1);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .bsft-combobox-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--bsft-space-1);
    padding: var(--bsft-space-1) var(--bsft-space-2);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-pill);
    background: var(--bsft-color-surface);
    color: var(--bsft-color-text);
    font-weight: var(--bsft-weight-medium);
  }

  .bsft-combobox-chip-remove {
    all: unset;
    cursor: pointer;
    color: var(--bsft-color-muted);
    line-height: 1;
  }

  .bsft-combobox-chip-remove:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  .bsft-combobox-listbox {
    position: absolute;
    top: 100%;
    inset-inline: 0;
    /* The popup floats over the content under it and must stay below a modal and the toasts —
       the one ordered contract the three layer tokens carry. */
    z-index: var(--bsft-z-popup);
    max-height: 16rem;
    overflow-y: auto;
    margin: var(--bsft-space-1) 0 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    background: var(--bsft-color-surface);
    box-shadow: var(--bsft-shadow-md);
  }

  .bsft-combobox-panel > .bsft-combobox-listbox {
    position: static;
    max-height: 14rem;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  /* Without a search field the list is what the keyboard holds, so it takes the ring — inset, so
     the panel's edge does not clip it — while the active row says where the walk is. */
  .bsft-combobox-panel > .bsft-combobox-listbox:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: calc(-1 * var(--bsft-focus-width));
  }

  .bsft-combobox-option {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-1);
    min-height: var(--bsft-touch-target);
    padding: var(--bsft-space-2) var(--bsft-space-4);
    cursor: pointer;
    color: var(--bsft-color-text);
  }

  /* Where the keyboard is, not what is chosen: the row the pointer would rest on looks the same,
     so the keyboard and the pointer point alike. Chosen is the accent bar below, which is what
     tells the two apart when they land on different rows. */
  .bsft-combobox-option-active {
    background: var(--bsft-color-hover);
  }

  /* A row's picture of "chosen": the selected tint and the accent bar on its start edge. */
  .bsft-combobox-option-selected {
    background: var(--bsft-selected-surface);
    box-shadow: inset 3px 0 var(--bsft-selected-accent);
  }

  .bsft-combobox-option[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: var(--bsft-disabled-opacity);
  }

  @media (hover: hover) {
    .bsft-combobox-option:not(.bsft-combobox-option-active):not([aria-disabled="true"]):hover {
      background: var(--bsft-color-hover);
    }
  }

  .bsft-combobox-option-description {
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
  }

  .bsft-combobox-create {
    color: var(--bsft-color-primary);
  }

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

  /* The picker is the combobox with a pin button beside each option, so it reads the combobox's own
     rules for the input, the popup and the options. A row holds the option and its pin side by side;
     the option takes the room, the pin keeps its touch target. */
  .bsft-picker-row {
    display: flex;
    align-items: stretch;
  }

  .bsft-picker-row .bsft-combobox-option {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* A row is one bar (Rule 13): where the keyboard is, what is chosen and what the pointer rests on
     are tinted from the row's start edge to its end, the pin included. The option paints the same
     opaque tint on itself, and its accent bar stands on the row's start edge anyway. */
  .bsft-picker-row:has(> .bsft-combobox-option-active) {
    background: var(--bsft-color-hover);
  }

  .bsft-picker-row:has(> .bsft-combobox-option-selected) {
    background: var(--bsft-selected-surface);
  }

  @media (hover: hover) {
    .bsft-picker-row:not(:has(> .bsft-combobox-option-selected, > [aria-disabled="true"])):hover {
      background: var(--bsft-color-hover);
    }
  }

  .bsft-picker-group {
    padding: var(--bsft-space-2) var(--bsft-space-4) var(--bsft-space-1);
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-xs);
    font-weight: var(--bsft-weight-semibold);
    text-transform: uppercase;
  }

  .bsft-picker-group-list {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  /* The pin is a pointer affordance, not a control: it is out of the tab order and hidden from
     assistive technology, since the keyboard pins with Alt+Enter on the active option. */
  .bsft-picker-pin {
    box-sizing: border-box;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: var(--bsft-touch-target);
    min-height: var(--bsft-touch-target);
    cursor: pointer;
    color: var(--bsft-color-muted);
  }

  .bsft-picker-pin svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
  }

  .bsft-picker-pin-active {
    color: var(--bsft-color-primary);
  }

  .bsft-picker-pin-active svg {
    fill: currentColor;
  }

  /* The input and its clear button (AllowClear) stand in the pickers' field (.bsft-picker-field,
     Rule 11): the field fills the picker's width, the input takes the field, and the clear button is
     the quiet glyph inside the input's end edge that the date pickers' trigger is: the secondary
     button (Rule 23), positioned, sized and coloured by that section's rule, which names it. */
  .bsft-picker {
    position: relative;
  }

  /* The chosen entry stands in the placeholder, so that the next open lists the groups: it reads as
     a value, not as the muted prompt of a field nothing was chosen in. */
  .bsft-picker-chosen .bsft-input::placeholder {
    color: var(--bsft-color-text);
  }

  /* --- action button ------------------------------------------------------------------- */

  .bsft-action {
    /* The containing block of .bsft-action-progress, which is visually hidden and so absolutely positioned:
       without it the status region resolves against a distant ancestor, escapes any overflow scroller and
       widens the page. */
    position: relative;
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--bsft-space-2);
    font-family: var(--bsft-font);
  }

  .bsft-action-icon {
    width: 0.8rem;
    height: 0.8rem;
    fill: currentColor;
  }

  /* The spinner of a busy action stands where the glyph stands, at its size, so the button keeps its
     width. It is drawn in the button's own text colour, because the spinner's primary quadrant would
     vanish on the primary surface. */
  .bsft-action-button .bsft-spinner {
    width: 0.8rem;
    height: 0.8rem;
    border-color: color-mix(in srgb, currentColor 30%, transparent);
    border-top-color: currentColor;
  }

  /* The caller's glyph (BsftActionButton.Icon) is one flex item of the button, centred at the button's
     gap like the ▶ it replaces. An svg the host left unsized would otherwise take the 300 x 150 px
     default and stretch the button. Only a dimension the svg does not state itself is set, since a
     presentation attribute (width="20") loses to any rule; :where() keeps it at zero specificity, so a
     host rule on the icon wins too. */
  .bsft-action-icon-slot {
    display: inline-flex;
    flex: none;
    align-items: center;
  }

  :where(.bsft-action-icon-slot > svg:not([width])) {
    width: 1em;
  }

  :where(.bsft-action-icon-slot > svg:not([height])) {
    height: 1em;
  }

  .bsft-action-note,
  .bsft-action-result,
  .bsft-action-error {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: var(--bsft-text-sm);
  }

  .bsft-action-note {
    color: var(--bsft-color-muted);
  }

  .bsft-action-error {
    color: var(--bsft-color-danger);
  }

  .bsft-action-command {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
    font-family: var(--bsft-font-mono);
  }

  .bsft-action-detail {
    display: block;
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
  }

  /* --- freshness chip ------------------------------------------------------------------ */

  .bsft-freshness {
    display: inline-flex;
    align-items: center;
    gap: var(--bsft-space-1);
    padding: calc(var(--bsft-space-1) / 2) var(--bsft-space-2);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-pill);
    background: var(--bsft-color-surface);
    color: var(--bsft-color-text);
    font-family: var(--bsft-font);
    font-size: var(--bsft-text-xs);
    white-space: nowrap;
  }

  /* The dot and the stale frame are drawn, so they take the status accent; the stale word is
     written and takes the status colour (Rule 16). */
  .bsft-freshness-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: var(--bsft-radius-pill);
    background: var(--bsft-color-muted);
  }

  .bsft-freshness-live .bsft-freshness-dot,
  .bsft-freshness-fresh .bsft-freshness-dot {
    background: var(--bsft-color-success-accent);
  }

  .bsft-freshness-stale {
    border-color: var(--bsft-color-warning-accent);
    background: var(--bsft-color-warning-surface);
    color: var(--bsft-color-warning);
  }

  .bsft-freshness-stale .bsft-freshness-dot {
    background: var(--bsft-color-warning-accent);
  }

  .bsft-freshness-flag {
    font-weight: var(--bsft-weight-semibold);
  }

  /* --- ide link ------------------------------------------------------------------------ */

  .bsft-ide-link {
    font-family: var(--bsft-font-mono);
    font-size: var(--bsft-text-sm);
    overflow-wrap: anywhere;
  }

  /* --- empty state ----------------------------------------------------------------- */

  /* The empty shape's larger form (Rule 27): its colour and font are the one empty rule's, only
     the room it takes and its centring are its own. */
  .bsft-empty-state {
    padding: var(--bsft-space-8) var(--bsft-space-2);
    text-align: center;
  }

  .bsft-empty-state-title {
    margin: 0;
    color: var(--bsft-color-text);
    font-weight: var(--bsft-weight-semibold);
    font-size: var(--bsft-text-xl);
    line-height: var(--bsft-leading-heading);
  }

  .bsft-empty-state-description {
    margin: var(--bsft-space-1) 0 0;
  }

  /* The actions are a row of buttons half a step apart (Rule 34), never a run of inline boxes
     separated by whatever whitespace the markup happens to hold. */
  .bsft-empty-state-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--bsft-space-2);
    margin-top: var(--bsft-space-4);
  }

  /* --- scroll region ----------------------------------------------------------------- */

  /* The transcript container. Its height is the surrounding layout's to give — a scroll region
     only scrolls once something bounds it — and overscroll containment keeps a reader flicking
     through the transcript from dragging the page behind it along. */
  .bsft-scroll-region {
    overflow-y: auto;
    overscroll-behavior: contain;
    /* The region keeps the reading position itself, in its browser module, so it behaves the same
       in every browser. Chrome's own scroll anchoring would compensate a second time on top of
       that; iOS Safari has none at all. One mechanism, not two. */
    overflow-anchor: none;
  }

  /* --- file transfer ----------------------------------------------------------------- */

  /* --- progress meter ---------------------------------------------------------------- */

  .bsft-progress-meter-label {
    margin-bottom: var(--bsft-space-1);
    color: var(--bsft-color-text);
    font-family: var(--bsft-font);
    font-size: var(--bsft-text-sm);
  }

  /* One track for every bar the theme draws — the meter, the segmented bar, the phase timeline
     and the transfer progress bars: half a line high, a pill, filled with the track token and
     without an edge of its own, so the empty part of a budget reads on a white card and on a dark
     one alike. The width of a bar or a segment reaches the stylesheet as a custom property on the
     element (Rule 49), because it is state (the bytes sent, the share of a total), not style. */
  .bsft-progress-meter,
  .bsft-segmented-bar-track,
  .bsft-phase-timeline-track,
  .bsft-file-upload-progress,
  .bsft-transfer-submit-progress,
  .bsft-file-drop-progress {
    display: flex;
    height: 0.5rem;
    overflow: hidden;
    border-radius: var(--bsft-radius-pill);
    background: var(--bsft-color-track);
  }

  /* A bar is the accent of its status — the luminous shade the tile's edge takes — never the
     status's text colour. */
  .bsft-progress-meter-bar,
  .bsft-file-upload-progress-bar,
  .bsft-transfer-submit-progress-bar,
  .bsft-file-drop-progress-bar {
    width: var(--bsft-bar-width);
    height: 100%;
    border-radius: inherit;
    background: var(--bsft-color-primary-accent);
    transition: width var(--bsft-motion-fast) ease;
  }

  .bsft-progress-meter-success .bsft-progress-meter-bar {
    background: var(--bsft-color-success-accent);
  }

  .bsft-progress-meter-warning .bsft-progress-meter-bar {
    background: var(--bsft-color-warning-accent);
  }

  .bsft-progress-meter-danger .bsft-progress-meter-bar {
    background: var(--bsft-color-danger-accent);
  }

  .bsft-progress-meter-info .bsft-progress-meter-bar {
    background: var(--bsft-color-info-accent);
  }

  @keyframes bsft-progress-indeterminate {
    from {
      transform: translateX(-100%);
    }

    to {
      transform: translateX(250%);
    }
  }

  .bsft-progress-meter-indeterminate .bsft-progress-meter-bar {
    width: 40%;
    animation: bsft-progress-indeterminate var(--bsft-motion-pulse) ease-in-out infinite;
  }

  .bsft-file-upload {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-1);
  }

  /* The track under the moving bar and the bar itself are the one track and bar of the progress
     meter section above, and the cancel and download buttons are the one button of the buttons
     section: a button has one chrome, so they only decline to stretch across their column. */
  .bsft-file-upload > .bsft-button,
  .bsft-file-download > .bsft-button,
  .bsft-transfer-submit > .bsft-button {
    align-self: flex-start;
  }

  .bsft-file-download {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-1);
  }

  /* --- dashboard --------------------------------------------------------------- */

  .bsft-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
    gap: var(--bsft-space-6);
    font-family: var(--bsft-font);
    font-size: var(--bsft-text-base);
    line-height: var(--bsft-leading-body);
    color: var(--bsft-color-text);
  }

  .bsft-dashboard-widget {
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    background: var(--bsft-color-surface);
    padding: var(--bsft-space-4);
    box-shadow: var(--bsft-shadow-sm);
  }

  .bsft-dashboard-widget-title {
    margin: 0 0 var(--bsft-space-2);
    font-size: var(--bsft-text-lg);
    font-weight: var(--bsft-weight-semibold);
    color: var(--bsft-color-text);
  }

  /* --- metric tile ------------------------------------------------------------------- */

  /* position: relative anchors the visually hidden description (absolutely positioned) to the tile, so it
     never lands against a distant positioned ancestor or widens a scrolling container. It sets no offset and
     no z-index, so the tile itself does not move and opens no stacking context. */
  .bsft-metric-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-2);
    box-sizing: border-box;
    min-width: 0;
    padding: var(--bsft-space-4);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    background: var(--bsft-color-surface);
    color: var(--bsft-color-text);
    font-family: var(--bsft-font);
    box-shadow: var(--bsft-shadow-sm);
  }

  /* A tile that is a link: the anchor is the tile, so the link chrome is removed. */
  a.bsft-metric-tile-link {
    color: var(--bsft-color-text);
    text-decoration: none;
  }

  /* A tile that is a link answers the pointer and the keyboard as every link does (Rule 41): its
     label underlines, and the focus ring is the one every theme element falls back to (Rule 10). */
  @media (hover: hover) {
    a.bsft-metric-tile-link:hover .bsft-metric-tile-label {
      text-decoration: underline;
    }
  }

  a.bsft-metric-tile-link:focus-visible .bsft-metric-tile-label {
    text-decoration: underline;
  }

  .bsft-metric-tile-label,
  .bsft-metric-tile-subtext {
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
  }

  .bsft-metric-tile-value {
    overflow-wrap: anywhere;
    font-size: var(--bsft-text-4xl);
    font-weight: var(--bsft-weight-semibold);
    line-height: 1.1;
    letter-spacing: -0.035em;
  }

  /* A tile in a status is the badge's picture, enlarged: the status surface as its fill — the
     badge's own — and the status accent as its edge, luminous, of the same family as the fill.
     A meter the tile holds draws its bar in that same accent. */
  .bsft-metric-tile-primary {
    border-color: var(--bsft-color-primary-accent);
    background: var(--bsft-color-primary-surface);
  }

  .bsft-metric-tile-success {
    border-color: var(--bsft-color-success-accent);
    background: var(--bsft-color-success-surface);
  }

  .bsft-metric-tile-warning {
    border-color: var(--bsft-color-warning-accent);
    background: var(--bsft-color-warning-surface);
  }

  .bsft-metric-tile-danger {
    border-color: var(--bsft-color-danger-accent);
    background: var(--bsft-color-danger-surface);
  }

  .bsft-metric-tile-info {
    border-color: var(--bsft-color-info-accent);
    background: var(--bsft-color-info-surface);
  }

  /* Emphasis completes the badge's picture: the value itself is set in the status's text colour,
     as the badge sets its text. */
  .bsft-metric-tile-emphasized.bsft-metric-tile-primary .bsft-metric-tile-value {
    color: var(--bsft-color-primary);
  }

  .bsft-metric-tile-emphasized.bsft-metric-tile-success .bsft-metric-tile-value {
    color: var(--bsft-color-success);
  }

  .bsft-metric-tile-emphasized.bsft-metric-tile-warning .bsft-metric-tile-value {
    color: var(--bsft-color-warning);
  }

  .bsft-metric-tile-emphasized.bsft-metric-tile-danger .bsft-metric-tile-value {
    color: var(--bsft-color-danger);
  }

  .bsft-metric-tile-emphasized.bsft-metric-tile-info .bsft-metric-tile-value {
    color: var(--bsft-color-info);
  }

  /* --- date and time pickers ------------------------------------------------------- */

  /* The three pickers share a shape: a caption, then the field — the text input (or two of them)
     with the popup trigger inside its end edge — then any refusal. Only the panel's contents
     differ — a month grid for the two date pickers, a listbox for the time picker — which is why
     the grid is styled once here and rendered by one component. */

  .bsft-datepicker,
  .bsft-daterangepicker,
  .bsft-timepicker {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--bsft-space-1);
    font-family: var(--bsft-font);
  }

  /* The field: the box the trigger sits inside and the popup is anchored to. The popover's own
     wrapper steps out of positioning, so its panel opens under the whole field, start edges
     aligned, rather than under the trigger. */
  .bsft-picker-field {
    position: relative;
    display: inline-flex;
    align-items: center;
  }

  .bsft-picker-field > .bsft-popover {
    position: static;
  }

  /* Room for the trigger inside the input's end edge, so typed text never runs under it. */
  .bsft-picker-field > .bsft-input {
    padding-inline-end: var(--bsft-control-height);
  }

  /* The grouped picker's field fills the picker, as its input did before it stood in a field, and
     its input takes the field; the date pickers' fields keep their own width. */
  .bsft-picker > .bsft-picker-field {
    display: flex;
  }

  .bsft-picker > .bsft-picker-field > .bsft-input {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* The trigger is a quiet glyph inside the field rather than a second control beside it: no
     border, surface or shadow, the muted colour, the hover tint, and centred on the input's
     height. */
  .bsft-picker-field > .bsft-picker-clear,
  .bsft-picker-field .bsft-popover-trigger {
    position: absolute;
    top: 50%;
    inset-inline-end: var(--bsft-space-1);
    width: calc(var(--bsft-control-height) - 2 * var(--bsft-space-1));
    min-height: 0;
    height: calc(var(--bsft-control-height) - 2 * var(--bsft-space-1));
    padding: 0;
    border-radius: var(--bsft-radius-md);
    color: var(--bsft-color-muted);
    transform: translateY(-50%);
  }

  @media (hover: hover) {
    .bsft-picker-field > .bsft-picker-clear:hover,
    .bsft-picker-field .bsft-popover-trigger:hover {
      color: var(--bsft-color-text);
    }
  }

  .bsft-picker-field .bsft-popover-trigger[aria-expanded="true"] {
    color: var(--bsft-color-text);
  }

  .bsft-picker-field > .bsft-popover > .bsft-popover-panel {
    margin-block: var(--bsft-space-1);
  }

  /* The time list spans its field, as the combobox's list spans its trigger: a popup narrower than
     the control it belongs to reads as belonging to something else. The calendars are wider than
     their field by nature and keep their own width. */
  .bsft-picker-field > .bsft-timepicker-popup > .bsft-popover-panel {
    box-sizing: border-box;
    min-width: 100%;
  }

  /* The range's two ends side by side under the range's caption, each a captioned field of its
     own. Top-aligned, because a refused date adds its message under one input only. */
  .bsft-daterangepicker-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--bsft-space-2);
  }

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

  /* "From" and "To" are captions under a caption: the same element, a step quieter, so the
     range's own caption stays the one that names the question. */
  .bsft-daterangepicker-field > .bsft-field-label {
    color: var(--bsft-color-muted);
    font-weight: normal;
  }

  /* --- the month grid --------------------------------------------------------------- */

  .bsft-calendar {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-2);
    min-width: 18rem;
    font-family: var(--bsft-font);
    color: var(--bsft-color-text);
  }

  .bsft-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--bsft-space-2);
  }

  .bsft-calendar-heading {
    font-weight: var(--bsft-weight-semibold);
  }

  .bsft-calendar-page {
    all: unset;
    min-width: 2rem;
    padding: var(--bsft-space-1);
    border-radius: var(--bsft-radius);
    cursor: pointer;
    text-align: center;
    color: var(--bsft-color-text);
  }

  .bsft-calendar-page:focus-visible {
    /* `all: unset` drops the user agent's focus ring, so the visible focus is stated here. */
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  .bsft-calendar-grid {
    border-collapse: collapse;
    width: 100%;
  }

  .bsft-calendar-weekday {
    padding: var(--bsft-space-1);
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
    font-weight: var(--bsft-weight-medium);
  }

  .bsft-calendar-day {
    padding: var(--bsft-space-1);
    border-radius: var(--bsft-radius);
    cursor: pointer;
    text-align: center;
  }

  .bsft-calendar-day:focus-visible {
    /* The cell itself is the focusable element of the grid pattern, so the ring goes on the cell
       and not on a control inside it. */
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: calc(0px - var(--bsft-focus-width));
  }

  /* The leading and trailing days of the grid are real, selectable dates rather than padding, so
     they are dimmed rather than hidden. */
  .bsft-calendar-day-outside {
    color: var(--bsft-color-muted);
  }

  /* Today is a quiet landmark, not a second selection: the number is set in a heavier weight and
     nothing is drawn around the cell, so the chosen day is the only one that looks marked.
     Assistive technology hears it through aria-current="date". */
  .bsft-calendar-day-today {
    font-weight: var(--bsft-weight-semibold);
  }

  .bsft-calendar-day-selected {
    background: var(--bsft-action-primary);
    color: var(--bsft-color-primary-contrast);
  }

  /* The inset primary ring of a focused cell disappears into the selection fill (1:1). A second ring
     inside it, in the fill's contrast colour, carries the focus on the fill, while the primary ring
     keeps its edge against the surface around the cell: the two-tone ring a filled selection needs
     wherever an outward ring would be clipped. */
  .bsft-calendar-day-selected:focus-visible {
    box-shadow: inset 0 0 0 4px var(--bsft-color-primary-contrast);
  }

  /* Everything between a range's ends, the ends themselves excluded — they carry the selection
     fill above, and this is the weaker surface that joins them up. It is also what the
     provisional span is painted with while the pointer is choosing the second end, so the user
     sees what the next click produces before making it. */
  .bsft-calendar-day-inrange {
    background: var(--bsft-selected-surface);
  }

  @media (hover: hover) {
    .bsft-calendar-day:not(.bsft-calendar-day-selected):not([aria-disabled="true"]):hover {
      background: var(--bsft-color-hover);
    }
  }

  /* A cell outside the window is still announced and still a date; what it is not is choosable,
     and a td has no native disabled attribute to lean on. */
  .bsft-calendar-day[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: var(--bsft-disabled-opacity);
  }

  /* --- the time list ---------------------------------------------------------------- */

  .bsft-timepicker-listbox {
    max-height: 16rem;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .bsft-timepicker-option {
    min-height: var(--bsft-touch-target);
    display: flex;
    align-items: center;
    padding: var(--bsft-space-1) var(--bsft-space-2);
    cursor: pointer;
    color: var(--bsft-color-text);
  }

  /* The same two states as the combobox's rows, drawn the same way: hover tint for where the
     keyboard is, selected tint and accent bar for what is chosen. */
  .bsft-timepicker-option-active {
    background: var(--bsft-color-hover);
  }

  .bsft-timepicker-option-selected {
    background: var(--bsft-selected-surface);
    box-shadow: inset 3px 0 var(--bsft-selected-accent);
  }

  @media (hover: hover) {
    .bsft-timepicker-option:not(.bsft-timepicker-option-active):hover {
      background: var(--bsft-color-hover);
    }
  }

  /* --- tree --------------------------------------------------------------------- */

  .bsft-tree {
    /* How far one level indents, as a token of the tree's own. BsftTree writes only the level
       number onto a row (--bsft-tree-level); the length that number is multiplied by belongs to
       the theme, so a host restyles the whole hierarchy by overriding this one value instead of
       the markup carrying a computed padding no stylesheet can reach. */
    --bsft-tree-indent: var(--bsft-space-3);
    display: flex;
    flex-direction: column;
    font-family: var(--bsft-font);
  }

  .bsft-tree-item {
    display: flex;
    align-items: center;
    gap: var(--bsft-space-1);
    /* One control high, as a navigation group's row is: the two disclose the same way and stand
       the same height. */
    min-height: var(--bsft-control-height);
    padding: var(--bsft-space-1) var(--bsft-space-2);
    /* Logical rather than left, so a right-to-left document indents from the side it reads from.
       It follows the shorthand above deliberately: the shorthand sets the block padding and the
       inline end, and this overrides the one side that carries the depth. */
    padding-inline-start: calc(var(--bsft-tree-level, 1) * var(--bsft-tree-indent));
    border-radius: var(--bsft-radius);
    color: var(--bsft-color-text);
    cursor: pointer;
  }

  .bsft-tree-item:focus-visible {
    /* Inset, because a row spans the tree's full width and an outward ring would be clipped by
       the container that scrolls it. */
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: calc(0px - var(--bsft-focus-width));
  }

  /* A tree is a list of rows, so it takes a row's picture of "chosen" rather than a fill. */
  .bsft-tree-selected {
    background: var(--bsft-selected-surface);
    box-shadow: inset 3px 0 var(--bsft-selected-accent);
  }

  /* Every row's bar sits on the edge the row reads from. */
  :root[dir="rtl"] :is(.bsft-combobox-option-selected, .bsft-timepicker-option-selected, .bsft-tree-selected) {
    box-shadow: inset -3px 0 var(--bsft-selected-accent);
  }

  /* A row answers the pointer as every clickable thing does, with the one hover tint, across its
     whole width, twisty included; the chosen row keeps its own picture instead. */
  @media (hover: hover) {
    .bsft-tree-item:not(.bsft-tree-selected):hover {
      background: var(--bsft-color-hover);
    }
  }

  /* The twisty stands at the end of the row, where the navigation group keeps its marker: the
     markers line up in one column whatever the labels' lengths, and a leaf, which has none, still
     starts its label where its branch siblings start theirs. The markup writes the twisty before
     the label — a reader with the row's aria-expanded needs no marker at all — and the order is
     the stylesheet's alone. */
  .bsft-tree-twisty {
    display: inline-block;
    flex: none;
    order: 1;
    width: 1em;
    margin-inline-start: auto;
    text-align: center;
    transition: transform var(--bsft-motion-fast) ease-in-out;
  }

  .bsft-tree-twisty::before {
    content: "\25B8";
  }

  .bsft-tree-item[aria-expanded="true"] > .bsft-tree-twisty {
    transform: rotate(90deg);
  }

  .bsft-tree-item[aria-busy="true"] > .bsft-tree-twisty {
    opacity: 0.5;
  }

  .bsft-tree-label {
    /* A flex item refuses to shrink below its content by default, which is what makes a long node
       name push the row wider than the tree instead of wrapping inside it. */
    min-width: 0;
    overflow-wrap: anywhere;
  }

  /* --- split panes ------------------------------------------------------------------ */

  /* Positioned, because the surface a pointer drag runs on is an absolutely placed child of this
     element and has to cover exactly the split and nothing else. */
  .bsft-split {
    position: relative;
    display: flex;
    align-items: stretch;
    min-height: 0;
  }

  /* A drag that crosses two panes would otherwise paint a text selection behind the divider, which
     reads as the page breaking rather than as a pane resizing. */
  .bsft-split[data-bsft-split-drag="true"] {
    user-select: none;
  }

  /* The basis is the separator's announced value applied verbatim: no max-width, no percentage
     ceiling and no shrinking, because a divider whose aria-valuenow says something other than what
     is on screen is worse than a pane somebody made too narrow. The range is the caller's
     MinPosition/MaxPosition and is enforced there, once. */
  .bsft-split-primary {
    flex: 0 0 var(--bsft-split-basis, 20rem);
    min-width: 0;
    overflow: auto;
  }

  .bsft-split-secondary {
    flex: 1 1 0;
    min-width: 0;
    overflow: auto;
  }

  /* A pane keeps its content off the divider and off its own edges by the inset a form, a toast
     and the list's bars give theirs, so text never starts on the line that splits the two. */
  .bsft-split-primary,
  .bsft-split-secondary {
    padding: var(--bsft-space-4);
  }

  /* touch-action is load-bearing rather than cosmetic: without it a touch pointer on the divider is
     claimed by the browser's own panning and the component never sees a pointermove at all. */
  .bsft-split-divider {
    flex: 0 0 auto;
    inline-size: 0.375rem;
    cursor: col-resize;
    background: var(--bsft-color-border);
    touch-action: none;
  }

  .bsft-split-divider:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: 1px;
  }

  /* Only on screen while a gesture is in flight. It sits above the panes so every move lands on one
     element, and below the floating layers so a dialog opened over a split still covers it. */
  .bsft-split-drag-surface {
    position: absolute;
    inset: 0;
    z-index: calc(var(--bsft-z-popup) - 1);
    cursor: col-resize;
  }

  /* The swap is the one button, declining only to stretch across the pane. */
  .bsft-split-swap {
    align-self: flex-start;
  }

  /* --- visualization primitives ---------------------------------------------------- */

  .bsft-segmented-bar,
  .bsft-phase-timeline {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-2);
    color: var(--bsft-color-text);
    font-family: var(--bsft-font);
  }

  /* The segmented bar's and the timeline's tracks are the one track of the progress meter
     section; only the segments are theirs. */
  .bsft-segmented-bar-segment {
    flex: 0 0 auto;
    width: var(--bsft-segment-width);
    min-width: 0;
  }

  .bsft-phase-timeline-phase {
    flex: var(--bsft-phase-weight) 1 0;
    min-width: var(--bsft-phase-min-width);
  }

  /* A legend is a caption, set in the caption's size: the meter's label, the tile's label and the
     legend under a bar are one size, so a dashboard's small print is one small print. */
  .bsft-visual-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--bsft-space-2) var(--bsft-space-4);
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--bsft-color-text);
    font-family: var(--bsft-font);
    font-size: var(--bsft-text-sm);
  }

  .bsft-visual-legend li {
    display: inline-flex;
    align-items: center;
    gap: var(--bsft-space-1);
  }

  .bsft-visual-legend-swatch {
    width: 0.75rem;
    height: 0.75rem;
    flex: 0 0 auto;
    border-radius: var(--bsft-radius-sm);
  }

  .bsft-visual-legend-value {
    color: var(--bsft-color-muted);
  }

  .bsft-visual-neutral {
    background: var(--bsft-color-muted);
  }

  /* A segment, a phase and a legend swatch are the accent of their status, as a meter's bar is. */
  .bsft-visual-primary {
    background: var(--bsft-color-primary-accent);
  }

  .bsft-visual-info {
    background: var(--bsft-color-info-accent);
  }

  .bsft-visual-success {
    background: var(--bsft-color-success-accent);
  }

  .bsft-visual-warning {
    background: var(--bsft-color-warning-accent);
  }

  .bsft-visual-danger {
    background: var(--bsft-color-danger-accent);
  }

  @keyframes bsft-visual-pulse {
    50% {
      opacity: 0.55;
    }
  }

  .bsft-phase-timeline-running {
    animation: bsft-visual-pulse var(--bsft-motion-pulse) ease-in-out infinite;
  }

  .bsft-sparkline {
    display: block;
    max-width: 100%;
    overflow: visible;
  }

  .bsft-sparkline-line {
    stroke: var(--bsft-color-primary-accent);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
  }

  .bsft-sparkline-threshold {
    stroke: var(--bsft-color-warning-accent);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
  }

  /* --- event timeline ---------------------------------------------------------------- */

  .bsft-event-timeline {
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--bsft-color-text);
    font-family: var(--bsft-font);
  }

  /* One column that never scrolls sideways: the marker has a fixed width, the body takes the rest and
     breaks long titles, and the connecting line is the item's own pseudo-element, so it follows the
     item's height however much the text wraps. */
  .bsft-event-timeline-item {
    position: relative;
    display: flex;
    gap: calc(var(--bsft-spacing) * 1.5);
    padding-bottom: calc(var(--bsft-spacing) * 2);
    min-width: 0;
  }

  .bsft-event-timeline-item:last-child {
    padding-bottom: 0;
  }

  .bsft-event-timeline-item::before {
    content: "";
    position: absolute;
    inset-block: 1.125rem 0;
    inset-inline-start: calc(0.375rem - 1px);
    width: 2px;
    background: var(--bsft-color-border);
  }

  .bsft-event-timeline-item:last-child::before {
    display: none;
  }

  .bsft-event-timeline-marker {
    flex: 0 0 auto;
    width: 0.75rem;
    height: 0.75rem;
    margin-top: 0.25rem;
    border-radius: 50%;
  }

  .bsft-event-timeline-body {
    flex: 1 1 0;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .bsft-event-timeline-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: calc(var(--bsft-spacing) / 2) var(--bsft-spacing);
  }

  .bsft-event-timeline-time {
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-xs);
  }

  .bsft-event-timeline-state {
    height: auto;
    min-height: 1.25rem;
    padding-block: 0.125rem;
    line-height: 1.2;
  }

  /* A linked title is a text link beside text: colour, underline and ring come from the links
     section (Rule 41, Rule 10), nothing is restated here. */
  .bsft-event-timeline-title {
    margin-top: calc(var(--bsft-spacing) / 2);
    font-weight: var(--bsft-weight-semibold);
  }

  .bsft-event-timeline-description {
    margin: calc(var(--bsft-spacing) / 2) 0 0;
    color: var(--bsft-color-muted);
  }

  /* --- status dot strip --------------------------------------------------------------- */

  /* The strip is the positioning context of every tooltip, which hangs below it at its own width at
     most: a tooltip anchored to a dot near the right edge would run past a 375 px viewport and make
     the page scroll sideways. Dots wrap onto further lines instead of scrolling. */
  .bsft-status-dot-strip {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    max-width: 100%;
    width: fit-content;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--bsft-color-text);
    font-family: var(--bsft-font);
  }

  .bsft-status-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: var(--bsft-radius);
  }

  /* The ring of Rule 10, drawn inside the dot's box: a ring outside it would run into the
     neighbouring dot. */
  .bsft-status-dot:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: calc(-1 * var(--bsft-focus-width));
  }

  .bsft-status-dot-glyph {
    display: block;
    width: 0.75rem;
    height: 0.75rem;
  }

  /* The shape carries the state next to the color, so a reader who cannot tell the colors apart still
     can tell a failure from a pass. The double class outweighs the shared color classes, which set a
     background. */
  .bsft-status-dot-glyph.bsft-status-dot-shape-circle {
    border-radius: 50%;
  }

  .bsft-status-dot-glyph.bsft-status-dot-shape-ring {
    box-sizing: border-box;
    border: 2px solid var(--bsft-color-muted);
    border-radius: 50%;
    background: transparent;
  }

  .bsft-status-dot-glyph.bsft-status-dot-shape-diamond {
    transform: rotate(45deg) scale(0.85);
  }

  .bsft-status-dot-glyph.bsft-status-dot-shape-square {
    border-radius: 1px;
  }

  .bsft-status-dot-glyph.bsft-status-dot-shape-triangle {
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
  }

  .bsft-status-dot-tooltip {
    position: absolute;
    inset-block-start: 100%;
    inset-inline-start: 0;
    z-index: var(--bsft-z-popup);
    display: none;
    box-sizing: border-box;
    width: max-content;
    max-width: 100%;
    margin-top: calc(var(--bsft-spacing) / 2);
    padding: calc(var(--bsft-spacing) / 2) var(--bsft-spacing);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius);
    background: var(--bsft-color-surface);
    color: var(--bsft-color-text);
    font-size: var(--bsft-text-xs);
    overflow-wrap: anywhere;
  }

  .bsft-status-dot-strip-item:hover > .bsft-status-dot-tooltip,
  .bsft-status-dot-strip-item:focus-within > .bsft-status-dot-tooltip {
    display: block;
  }

  /* Escape on the focused dot dismissed its tooltip (WCAG 1.4.13); the same specificity as the
     focus rule above, so the later rule wins while the dot keeps the focus. */
  .bsft-status-dot-strip-item.bsft-status-dot-dismissed > .bsft-status-dot-tooltip {
    display: none;
  }

  .bsft-status-dot-tooltip-detail {
    display: block;
    color: var(--bsft-color-muted);
  }

  /* --- charts ----------------------------------------------------------------------- */

  .bsft-line-chart,
  .bsft-day-bars,
  .bsft-bar-table {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-spacing);
    min-width: 0;
    color: var(--bsft-color-text);
    font-family: var(--bsft-font);
  }

  /* The series color of a chart: one custom property per series class, read by the line, the point,
     the bar segment and the legend swatch alike, so a series cannot be drawn in two colors. */
  /* The fallback comes first: it and the palette classes share one element and one specificity. */
  .bsft-line-chart-series {
    --bsft-chart-color: var(--bsft-color-muted);
  }

  .bsft-chart-series-1 { --bsft-chart-color: var(--bsft-chart-1); }
  .bsft-chart-series-2 { --bsft-chart-color: var(--bsft-chart-2); }
  .bsft-chart-series-3 { --bsft-chart-color: var(--bsft-chart-3); }
  .bsft-chart-series-4 { --bsft-chart-color: var(--bsft-chart-4); }
  .bsft-chart-series-5 { --bsft-chart-color: var(--bsft-chart-5); }
  .bsft-chart-series-6 { --bsft-chart-color: var(--bsft-chart-6); }
  .bsft-chart-series-7 { --bsft-chart-color: var(--bsft-chart-7); }
  .bsft-chart-series-8 { --bsft-chart-color: var(--bsft-chart-8); }

  .bsft-visual-legend-swatch[class*="bsft-chart-series-"],
  .bsft-day-bars-segment[class*="bsft-chart-series-"],
  .bsft-bar-table-fill[class*="bsft-chart-series-"] {
    background: var(--bsft-chart-color);
  }

  .bsft-line-chart-svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
  }

  .bsft-line-chart-grid {
    stroke: var(--bsft-color-border);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
  }

  .bsft-line-chart-tick,
  .bsft-line-chart-label {
    fill: var(--bsft-color-muted);
    font-size: var(--bsft-text-2xs);
    font-family: var(--bsft-font);
  }

  /* A limit is drawn, so it takes an accent (Rule 16): the warning accent the sparkline's threshold
     takes, so a limit is one picture in both charts; the dash pattern keeps it apart from a series. */
  .bsft-line-chart-threshold {
    stroke: var(--bsft-color-warning-accent);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
  }

  /* A series with a status is drawn, so its line, its points and its legend swatch take the status's
     accent (Rule 16), never the status's text colour: the swatch beside the line is the same colour. */
  .bsft-line-chart-series.bsft-visual-primary { --bsft-chart-color: var(--bsft-color-primary-accent); }
  .bsft-line-chart-series.bsft-visual-info { --bsft-chart-color: var(--bsft-color-info-accent); }
  .bsft-line-chart-series.bsft-visual-success { --bsft-chart-color: var(--bsft-color-success-accent); }
  .bsft-line-chart-series.bsft-visual-warning { --bsft-chart-color: var(--bsft-color-warning-accent); }
  .bsft-line-chart-series.bsft-visual-danger { --bsft-chart-color: var(--bsft-color-danger-accent); }

  .bsft-line-chart-line {
    stroke: var(--bsft-chart-color);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
  }

  .bsft-chart-series-repeat .bsft-line-chart-line {
    stroke-dasharray: 6 3;
  }

  .bsft-line-chart-point {
    fill: var(--bsft-chart-color);
  }

  .bsft-day-bars-chart {
    display: flex;
    align-items: stretch;
    gap: 2px;
    height: 10rem;
    overflow-x: auto;
    /* The baseline, which sits on top of the label strip, under the bars, then the scroll cue for a
       month of days that does not fit. The baseline comes first, so the cue's covers at the chart's
       ends do not paint over it. */
    background:
      linear-gradient(var(--bsft-color-border), var(--bsft-color-border)) 0 calc(100% - 1.25rem) / 100% 1px no-repeat,
      var(--bsft-scroll-cue-layers);
  }

  .bsft-day-bars-day {
    position: relative;
    display: flex;
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
    padding: 0 0 1.25rem;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
  }

  /* A touchable day is at least 24 px wide (WCAG 2.5.8); the chart scrolls when that does not fit. */
  .bsft-day-bars-interactive .bsft-day-bars-day {
    flex: 1 0 1.5rem;
  }

  button.bsft-day-bars-day {
    cursor: pointer;
  }

  /* A day the pointer rests on lights its track in the one hover tint (Rule 42); the bar on it
     keeps its own colour, so the value stays readable while the day says it can be chosen. */
  @media (hover: hover) {
    button.bsft-day-bars-day:hover .bsft-day-bars-track {
      background: var(--bsft-color-hover);
    }
  }

  .bsft-day-bars-day:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  .bsft-day-bars-track {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: flex-end;
    min-width: 0;
  }

  .bsft-day-bars-stack {
    display: flex;
    flex-direction: column-reverse;
    height: var(--bsft-day-height);
    min-height: var(--bsft-day-min-height, 0);
  }

  .bsft-day-bars-segment {
    flex: var(--bsft-day-weight) 1 0;
    min-height: 1px;
  }

  /* The label spans its day and centres its text, so it needs no side to hang from (Rule 43); a label
     at an edge of the chart aligns to that edge instead, so it stays inside the drawing. */
  .bsft-day-bars-label {
    position: absolute;
    bottom: 0;
    inset-inline: 0;
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-2xs);
    text-align: center;
    white-space: nowrap;
  }

  .bsft-day-bars-label-start {
    text-align: start;
  }

  .bsft-day-bars-label-end {
    text-align: end;
  }

  .bsft-chart-table {
    max-width: 100%;
    overflow-x: auto;
    background: var(--bsft-scroll-cue-layers);
  }

  /* The data table opens in place under its chart, so its summary carries the one disclosure
     marker (Rule 7) in place of the browser's own triangle, as the log entry's summary does. */
  .bsft-chart-table > summary {
    display: flex;
    align-items: center;
    gap: var(--bsft-space-1);
    list-style: none;
    cursor: pointer;
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-xs);
  }

  .bsft-chart-table > summary::-webkit-details-marker {
    display: none;
  }

  .bsft-chart-table > summary::before {
    content: "\25B8";
    display: inline-block;
    flex: none;
    width: 1em;
    text-align: center;
    transition: transform var(--bsft-motion-fast) ease-in-out;
  }

  .bsft-chart-table[open] > summary::before {
    transform: rotate(90deg);
  }

  /* A figure's table is the list's table at the extra-small size (Rule 30): the same tokens for
     its text and its inset, one step tighter; a number ends at the end edge because the markup
     marks it (Rule 25), never because of where its column stands. */
  .bsft-chart-table table {
    border-collapse: collapse;
    font-size: var(--bsft-text-xs);
  }

  .bsft-chart-table th,
  .bsft-chart-table td {
    padding: var(--bsft-space-1) var(--bsft-space-2);
    border-bottom: 1px solid var(--bsft-color-border);
    text-align: start;
    white-space: nowrap;
  }

  /* A table inside a figure — a chart's data table, the bar table, the graph's tables — has the one
     head of Rule 30 at the extra-small size: small, semibold, upper-case and muted on the canvas, so a
     figure's table and a list read as one kind of table. The row headers keep the body's picture. */
  .bsft-chart-table thead th,
  .bsft-bar-table thead th,
  .bsft-graph-tables thead th {
    background: var(--bsft-color-canvas);
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-xs);
    font-weight: var(--bsft-weight-semibold);
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .bsft-bar-table {
    overflow-x: auto;
    background: var(--bsft-scroll-cue-layers);
  }

  .bsft-bar-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--bsft-text-xs);
  }

  .bsft-bar-table th,
  .bsft-bar-table td {
    padding: var(--bsft-space-1) var(--bsft-space-2);
    border-bottom: 1px solid var(--bsft-color-border);
    text-align: start;
    vertical-align: middle;
  }

  .bsft-bar-table tbody th {
    font-weight: normal;
  }

  /* A width limit on a table cell is ignored by the automatic table layout, so the limit sits on
     the block inside the cell. */
  .bsft-bar-table-label-text {
    display: block;
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bsft-bar-table-bar {
    display: block;
    width: 8rem;
    height: 0.5rem;
    margin-bottom: 0.125rem;
    overflow: hidden;
    border-radius: var(--bsft-radius-pill);
    /* The one track of Rule 17, so the empty part of a bar reads the same as a meter's. */
    background: var(--bsft-color-track);
  }

  .bsft-bar-table-fill {
    display: block;
    width: var(--bsft-bar-width);
    height: 100%;
  }

  .bsft-bar-table-number {
    font-variant-numeric: tabular-nums;
  }

  .bsft-bar-table .bsft-bar-table-extra {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .bsft-bar-table-more td {
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-xs);
  }

  @media (max-width: 24rem) {
    .bsft-bar-table-label-text {
      max-width: 8rem;
    }

    .bsft-bar-table-bar {
      width: 4rem;
    }
  }

  /* --- graph ------------------------------------------------------------------------ */

  /* The graph renderer's palette and surfaces. They are declared on the graph, not on :root, so a
     host that re-skins a region (its own --bsft-color-* on a container) reaches the graphs inside it
     as well; the dark theme comes through the tokens they name, so no dark twin is declared. A node
     is coloured by the five biggest groups, the rest share the muted "other" slot. The neutral
     outline and the edges are the muted text colour, which keeps them at 3:1 or better against the
     canvas in both themes (edges at 85 % opacity: 3.6:1 light, 5.4:1 dark). */
  .bsft-graph {
    --bsft-graph-group-1: var(--bsft-chart-1);
    --bsft-graph-group-2: var(--bsft-chart-2);
    --bsft-graph-group-3: var(--bsft-chart-3);
    --bsft-graph-group-4: var(--bsft-chart-4);
    --bsft-graph-group-5: var(--bsft-chart-5);
    --bsft-graph-group-other: var(--bsft-color-muted);
    --bsft-graph-node-fill: var(--bsft-color-surface);
    --bsft-graph-node-stroke: var(--bsft-color-muted);
    --bsft-graph-edge: var(--bsft-color-muted);
    --bsft-graph-edge-highlight: var(--bsft-color-primary);
    --bsft-graph-edge-danger: var(--bsft-color-danger);
    --bsft-graph-canvas: var(--bsft-color-surface);
    --bsft-graph-edge-opacity: 0.85;
    --bsft-graph-dim-node-opacity: 0.25;
    --bsft-graph-dim-edge-opacity: 0.12;
  }

  .bsft-graph {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-spacing);
    min-width: 0;
    color: var(--bsft-color-text);
    font-family: var(--bsft-font);
  }

  .bsft-graph-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--bsft-space-2);
  }

  /* The presentation toggle is a .bsft-button (Rule 23); .bsft-graph-presentation-toggle only names
     it for tests and hosts and draws nothing. */

  /* One column; the side panel stacks under the canvas. The column is minmax(0, 1fr) so a wide
     drawing scrolls inside its canvas instead of stretching the page. From 48rem a body with a side
     panel wraps instead; see the end of the graph section. */
  .bsft-graph-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: calc(var(--bsft-spacing) * 2);
  }


  .bsft-graph-canvas {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius);
    /* A drawing wider than the card scrolls inside it under the scroll cue, covered in the canvas
       colour it sits on. */
    --bsft-scroll-cover-color: var(--bsft-graph-canvas);
    background: var(--bsft-scroll-cue-layers), var(--bsft-graph-canvas);
  }

  .bsft-graph-svg {
    display: block;
    width: 100%;
    height: auto;
  }

  .bsft-graph-backdrop {
    fill: transparent;
  }

  .bsft-graph-edge {
    fill: none;
    stroke: var(--bsft-graph-edge);
    opacity: var(--bsft-graph-edge-opacity);
    vector-effect: non-scaling-stroke;
    transition: opacity var(--bsft-motion-fast) ease;
  }

  .bsft-graph-edge-hl {
    stroke: var(--bsft-graph-edge-highlight);
    opacity: 1;
  }

  .bsft-graph-edge-danger {
    stroke: var(--bsft-graph-edge-danger);
    opacity: 1;
  }

  /* Dimming wins over emphasis: a danger edge away from the selection recedes like any other, and
     the doubled class lets it beat the danger rule above whatever the source order. */
  .bsft-graph-edge.bsft-graph-edge-dim {
    opacity: var(--bsft-graph-dim-edge-opacity);
  }

  .bsft-graph-arrow {
    fill: var(--bsft-graph-edge);
  }

  .bsft-graph-arrow-hl {
    fill: var(--bsft-graph-edge-highlight);
  }

  .bsft-graph-arrow-danger {
    fill: var(--bsft-graph-edge-danger);
  }

  .bsft-graph-edge-label {
    fill: var(--bsft-color-muted);
    font-size: var(--bsft-text-2xs);
    font-family: var(--bsft-font);
    paint-order: stroke;
    stroke: var(--bsft-graph-canvas);
    stroke-width: 3px;
  }

  .bsft-graph-edge-label-danger {
    fill: var(--bsft-graph-edge-danger);
    font-weight: var(--bsft-weight-semibold);
  }

  .bsft-graph-edge-label.bsft-graph-edge-label-dim {
    opacity: var(--bsft-graph-dim-edge-opacity);
  }

  /* The colour of a group or tone, read by the node shape and the legend swatch alike. */
  .bsft-graph-group-1 { --bsft-graph-color: var(--bsft-graph-group-1); }
  .bsft-graph-group-2 { --bsft-graph-color: var(--bsft-graph-group-2); }
  .bsft-graph-group-3 { --bsft-graph-color: var(--bsft-graph-group-3); }
  .bsft-graph-group-4 { --bsft-graph-color: var(--bsft-graph-group-4); }
  .bsft-graph-group-5 { --bsft-graph-color: var(--bsft-graph-group-5); }
  .bsft-graph-group-other { --bsft-graph-color: var(--bsft-graph-group-other); }
  /* A node without a group or tone that the legend names: drawn like a coloured one, in the grey of
     its legend swatch. */
  .bsft-graph-neutral { --bsft-graph-color: var(--bsft-graph-group-other); }
  /* A tone is drawn — a node's stroke or fill — so it takes the status's accent (Rule 16). */
  .bsft-graph-tone-success { --bsft-graph-color: var(--bsft-color-success-accent); }
  .bsft-graph-tone-warning { --bsft-graph-color: var(--bsft-color-warning-accent); }
  .bsft-graph-tone-danger { --bsft-graph-color: var(--bsft-color-danger-accent); }

  .bsft-graph-node {
    outline: none;
    cursor: pointer;
    transition: opacity var(--bsft-motion-fast) ease;
  }

  .bsft-graph-node-shape {
    fill: var(--bsft-graph-node-fill);
    stroke: var(--bsft-graph-node-stroke);
    stroke-width: 1.2;
    vector-effect: non-scaling-stroke;
  }

  /* A box keeps the neutral fill so its label keeps text contrast on the surface colour, and takes
     the group or tone colour as its stroke. A circle is filled with it and keeps a halo in the canvas
     colour so neighbouring circles stay apart. */
  .bsft-graph-node-box.bsft-graph-group-1 .bsft-graph-node-shape,
  .bsft-graph-node-box.bsft-graph-group-2 .bsft-graph-node-shape,
  .bsft-graph-node-box.bsft-graph-group-3 .bsft-graph-node-shape,
  .bsft-graph-node-box.bsft-graph-group-4 .bsft-graph-node-shape,
  .bsft-graph-node-box.bsft-graph-group-5 .bsft-graph-node-shape,
  .bsft-graph-node-box.bsft-graph-group-other .bsft-graph-node-shape,
  .bsft-graph-node-box.bsft-graph-neutral .bsft-graph-node-shape,
  .bsft-graph-node-box.bsft-graph-tone-success .bsft-graph-node-shape,
  .bsft-graph-node-box.bsft-graph-tone-warning .bsft-graph-node-shape,
  .bsft-graph-node-box.bsft-graph-tone-danger .bsft-graph-node-shape {
    stroke: var(--bsft-graph-color);
    stroke-width: 2;
  }

  /* An uncoloured circle takes the neutral group colour: the surface fill would vanish in the dark
     theme, where the surface and the canvas are close. */
  .bsft-graph-node-circle .bsft-graph-node-shape {
    fill: var(--bsft-graph-group-other);
    stroke: var(--bsft-graph-canvas);
    stroke-width: 2;
  }

  .bsft-graph-node-circle.bsft-graph-group-1 .bsft-graph-node-shape,
  .bsft-graph-node-circle.bsft-graph-group-2 .bsft-graph-node-shape,
  .bsft-graph-node-circle.bsft-graph-group-3 .bsft-graph-node-shape,
  .bsft-graph-node-circle.bsft-graph-group-4 .bsft-graph-node-shape,
  .bsft-graph-node-circle.bsft-graph-group-5 .bsft-graph-node-shape,
  .bsft-graph-node-circle.bsft-graph-group-other .bsft-graph-node-shape,
  .bsft-graph-node-circle.bsft-graph-neutral .bsft-graph-node-shape,
  .bsft-graph-node-circle.bsft-graph-tone-success .bsft-graph-node-shape,
  .bsft-graph-node-circle.bsft-graph-tone-warning .bsft-graph-node-shape,
  .bsft-graph-node-circle.bsft-graph-tone-danger .bsft-graph-node-shape {
    fill: var(--bsft-graph-color);
    stroke: var(--bsft-graph-canvas);
    stroke-width: 2;
  }

  .bsft-graph-node.bsft-graph-node-centre .bsft-graph-node-shape {
    fill: var(--bsft-color-primary-surface);
    stroke: var(--bsft-color-primary);
    stroke-width: 2;
  }

  .bsft-graph-node.bsft-graph-node-selected .bsft-graph-node-shape {
    stroke: var(--bsft-color-primary);
    stroke-width: 2.4;
  }

  /* A selected node is told by its stroke; its label keeps the regular weight, because bold glyphs are
     wider than the estimate the layouts reserve room by. */

  /* A dimmed node fades its shape and its texts, never the group: the focus ring is a child of the
     group, so it keeps full opacity and a dimmed node the keyboard is on stays visibly focused. */
  .bsft-graph-node-dim .bsft-graph-node-shape,
  .bsft-graph-node-dim .bsft-graph-node-label,
  .bsft-graph-node-dim .bsft-graph-node-detail,
  .bsft-graph-node-dim .bsft-graph-node-badge {
    opacity: var(--bsft-graph-dim-node-opacity);
  }

  /* The ring sits outside the shape and takes the focus colour (Rule 10), so focus and selection
     stay distinguishable in shape and in colour. */
  .bsft-graph-focus-ring {
    fill: none;
    stroke: var(--bsft-color-focus);
    stroke-width: 2;
    visibility: hidden;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
  }

  .bsft-graph-node:focus-visible .bsft-graph-focus-ring {
    visibility: visible;
  }

  .bsft-graph-node-label {
    fill: var(--bsft-color-text);
    font-size: var(--bsft-text-xs);
    font-family: var(--bsft-font);
  }

  .bsft-graph-node-detail {
    fill: var(--bsft-color-muted);
    font-size: var(--bsft-text-2xs);
    font-family: var(--bsft-font);
    /* Haloed like the edge labels, so an edge that leaves a box downwards does not cross the detail line. */
    paint-order: stroke;
    stroke: var(--bsft-graph-canvas);
    stroke-width: 3px;
  }

  .bsft-graph-node-badge {
    fill: var(--bsft-color-danger);
    font-size: var(--bsft-text-2xs);
    font-family: var(--bsft-font);
    font-weight: var(--bsft-weight-semibold);
  }

  .bsft-visual-legend-swatch.bsft-graph-group-1 { background: var(--bsft-graph-group-1); }
  .bsft-visual-legend-swatch.bsft-graph-group-2 { background: var(--bsft-graph-group-2); }
  .bsft-visual-legend-swatch.bsft-graph-group-3 { background: var(--bsft-graph-group-3); }
  .bsft-visual-legend-swatch.bsft-graph-group-4 { background: var(--bsft-graph-group-4); }
  .bsft-visual-legend-swatch.bsft-graph-group-5 { background: var(--bsft-graph-group-5); }
  .bsft-visual-legend-swatch.bsft-graph-group-other { background: var(--bsft-graph-group-other); }
  .bsft-visual-legend-swatch.bsft-graph-tone-success { background: var(--bsft-color-success-accent); }
  .bsft-visual-legend-swatch.bsft-graph-tone-warning { background: var(--bsft-color-warning-accent); }
  .bsft-visual-legend-swatch.bsft-graph-tone-danger { background: var(--bsft-color-danger-accent); }
  /* The nodes a colour mode leaves without a group or tone carry .bsft-graph-neutral once the legend
     names them: a circle is filled and a box stroked with the "other" grey, as for any legend colour. */
  .bsft-visual-legend-swatch.bsft-graph-neutral { background: var(--bsft-graph-group-other); }

  /* A legend is a caption (Rule 18): the edge legend is the small text, like the colour legend. */
  .bsft-graph-edge-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--bsft-spacing) calc(var(--bsft-spacing) * 2);
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--bsft-color-text);
    font-family: var(--bsft-font);
    font-size: var(--bsft-text-sm);
  }

  .bsft-graph-edge-legend li {
    display: inline-flex;
    align-items: center;
    gap: calc(var(--bsft-spacing) / 2);
  }

  .bsft-graph-edge-legend .bsft-graph-edge {
    stroke-width: 2;
    opacity: 1;
  }

  .bsft-graph-tables {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-2);
    max-width: 100%;
    overflow-x: auto;
    background: var(--bsft-scroll-cue-layers);
  }

  .bsft-graph-tables table {
    border-collapse: collapse;
    font-size: var(--bsft-text-xs);
  }

  .bsft-graph-tables caption {
    padding: 0 var(--bsft-space-2) var(--bsft-space-1);
    color: var(--bsft-color-muted);
    font-weight: var(--bsft-weight-semibold);
    text-align: start;
  }

  .bsft-graph-tables th,
  .bsft-graph-tables td {
    padding: var(--bsft-space-1) var(--bsft-space-2);
    border-bottom: 1px solid var(--bsft-color-border);
    text-align: start;
    white-space: nowrap;
  }

  /* The chosen node's row, and the rows of its edges, take the one picture of "chosen" (Rule 9):
     the selected tint and the accent bar on the start edge. */
  .bsft-graph-row-selected {
    background: var(--bsft-selected-surface);
    box-shadow: inset 3px 0 var(--bsft-selected-accent);
  }

  :root[dir="rtl"] .bsft-graph-row-selected {
    box-shadow: inset -3px 0 var(--bsft-selected-accent);
  }

  /* The name cell holds a toggle (the selection) and, for a node that can be opened, an open control. */
  .bsft-graph-row-select,
  .bsft-graph-row-open {
    appearance: none;
    padding: 0;
    border: 0;
    background: none;
    color: var(--bsft-color-primary);
    font: inherit;
    cursor: pointer;
  }

  .bsft-graph-row-open {
    margin-inline-start: var(--bsft-spacing);
  }

  .bsft-graph-row-select[aria-pressed="true"] {
    font-weight: var(--bsft-weight-semibold);
  }

  @media (hover: hover) {
    .bsft-graph-row-open:hover,
    .bsft-graph-row-select[aria-pressed="true"]:hover {
      text-decoration: underline;
    }
  }

  .bsft-graph-row-select:focus-visible,
  .bsft-graph-row-open:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  .bsft-graph-aside {
    min-width: 0;
  }

  /* From 48rem (spelled with "screen and" so the shell and split-pane tests, which look for the first
     bare 48rem query, still find their own) a body with a side panel wraps instead: the canvas asks
     for the drawing's readable width (--bsft-graph-readable-width, set inline: three quarters of the
     drawing's width, below which its 12 unit labels would drop under 9 px) and the panel for 18rem.
     While both fit on one line they sit side by side and the canvas takes nearly all the spare room
     (flex-grow 999 against 1); when they do not, the panel wraps below and grows to the full width,
     so the drawing gets the whole width before it scrolls. A canvas alone on a line narrower than
     its readable width shrinks to the line (min-width: 0) and scrolls inside itself. The canvas is
     content-box, so its line takes the readable width plus its 2px border; the gap is 1rem (16px).

     Worked through for the browser suite's page (Fixtures/graph-aside.html): a radial type
     neighbourhood of 31 nodes (drawing 1168 wide, readable width ceil(1168 * 0.75) = 876) and a
     radial of three nodes (drawing 120, readable 90), each with a side panel:
     - 1280px desktop, 963px content column: 876 + 2 + 16 + 288 = 1182 > 963, so the panel wraps
       below. The canvas line is 963, the SVG 961 wide (961 >= 876: no scroll), scale
       961 / 1168 = 0.82, a label 9.9px high. The small one: 90 + 2 + 16 + 288 = 396 <= 963, so the
       panel stays beside; the canvas line gets 963 - 16 - 288 = 659 (less a fraction of a pixel for
       the panel's share of flex-grow) and the SVG stops at its own 120 (max-width), unscaled.
     - 375px phone, under 48rem: one grid column of 375 - 2 * 16 = 343, the SVG 341 wide. The
       31-node drawing scrolls inside its canvas from its 876 readable width, the page does not; the
       small one fits at full size (341 >= 120). */
  @media screen and (min-width: 48rem) {
    .bsft-graph-has-aside .bsft-graph-body {
      display: flex;
      flex-wrap: wrap;
    }

    .bsft-graph-has-aside .bsft-graph-canvas {
      flex: 999 1 var(--bsft-graph-readable-width, 0px);
      min-width: 0;
    }

    .bsft-graph-has-aside .bsft-graph-tables {
      flex: 999 1 0%;
      min-width: 0;
    }

    .bsft-graph-has-aside .bsft-graph-aside {
      flex: 1 1 18rem;
    }
  }

  /* --- log viewer ------------------------------------------------------------------- */

  /* One column as wide as the viewer, never wider: the implicit auto column grew to the toolbar's widest
     chip, so a long filter value widened the page at 375px instead of ending in its ellipsis. */
  .bsft-log-viewer {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--bsft-spacing);
    min-width: 0;
    font-family: var(--bsft-font);
  }

  .bsft-log-viewer-toolbar {
    display: flex;
    align-items: center;
    gap: var(--bsft-space-2);
    flex-wrap: wrap;
  }

  .bsft-log-viewer-search {
    flex: 1 1 16rem;
    min-width: 10rem;
  }

  .bsft-log-viewer-search input {
    width: 100%;
  }

  .bsft-log-viewer-correlation {
    display: inline-flex;
    align-items: center;
    gap: calc(var(--bsft-spacing) / 4);
    min-width: 0;
  }

  /* A block, not the chip's inline-flex: the text of a flex container sits in an anonymous flex item, which
     draws no ellipsis. The title carries the whole text. */
  .bsft-log-viewer-correlation-value {
    display: block;
    min-width: 0;
    max-width: 24rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: default;
  }

  .bsft-log-viewer-scope {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: calc(var(--bsft-spacing) / 4);
    min-width: 0;
  }

  .bsft-log-viewer-scope-chip {
    display: inline-flex;
    align-items: center;
    gap: calc(var(--bsft-spacing) / 4);
    min-width: 0;
  }

  .bsft-log-viewer-scope-value {
    display: block;
    min-width: 0;
    max-width: 24rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: default;
  }

  .bsft-log-viewer-scope-remove {
    min-block-size: 1.5rem;
    cursor: pointer;
  }

  .bsft-log-viewer .bsft-scroll-region {
    height: var(--bsft-log-viewer-height, 32rem);
    overflow-x: hidden;
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius);
    background: var(--bsft-color-surface);
  }

  .bsft-log-entry {
    display: grid;
    grid-template-columns: max-content max-content minmax(8rem, 14rem) minmax(0, 1fr);
    gap: calc(var(--bsft-space-1) / 2) var(--bsft-space-1);
    align-items: start;
    padding: calc(var(--bsft-space-1) / 2) var(--bsft-space-1);
    border-block-end: 1px solid var(--bsft-color-border);
    font-family: var(--bsft-font-mono);
    font-size: var(--bsft-text-sm);
    line-height: 1.45;
  }

  .bsft-log-entry time,
  .bsft-log-entry-category {
    color: var(--bsft-color-muted);
  }

  .bsft-log-entry-level {
    min-width: 4.5rem;
    font-weight: var(--bsft-weight-bold);
  }

  .bsft-log-entry-information .bsft-log-entry-level {
    color: var(--bsft-color-primary);
  }

  .bsft-log-entry-warning .bsft-log-entry-level {
    color: var(--bsft-color-warning);
  }

  .bsft-log-entry-error .bsft-log-entry-level,
  .bsft-log-entry-critical .bsft-log-entry-level {
    color: var(--bsft-color-danger);
  }

  .bsft-log-entry-message,
  .bsft-log-entry details,
  .bsft-log-entry pre {
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
  }

  .bsft-log-entry details {
    grid-column: 4;
  }

  /* The message and the id button share the message column: the button follows the text on the same line
     and wraps beneath it only when the line is full, so a correlated log does not double in height. */
  .bsft-log-entry-body {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 calc(var(--bsft-spacing) / 2);
    min-width: 0;
  }

  .bsft-log-entry-correlation {
    appearance: none;
    min-width: 0;
    min-block-size: 1.5rem;
    max-width: 100%;
    padding: 0 calc(var(--bsft-spacing) / 4);
    overflow: hidden;
    border: 0;
    background: none;
    color: var(--bsft-color-muted);
    font: inherit;
    text-decoration: underline dotted;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
  }

  .bsft-log-entry-correlation[aria-pressed="true"] {
    color: var(--bsft-color-primary);
    font-weight: var(--bsft-weight-semibold);
  }

  @media (hover: hover) {
    .bsft-log-entry-correlation:hover,
    .bsft-log-entry-scope-property:hover {
      color: var(--bsft-color-primary);
    }
  }

  /* A row that is live — the newest entries arriving while the viewer follows — is a state, not a
     choice: it takes the info status's surface and accent bar (Rule 16), never the chosen row's
     tint and bar (Rule 9). */
  .bsft-list-row-live {
    background: var(--bsft-color-info-surface);
    box-shadow: inset 3px 0 var(--bsft-color-info-accent);
  }

  :root[dir="rtl"] .bsft-list-row-live {
    box-shadow: inset -3px 0 var(--bsft-color-info-accent);
  }

  /* The entry's link is drawn by the links section (Rule 41); only its box is stated here. */
  .bsft-log-entry-link {
    min-width: 0;
    min-block-size: 1.5rem;
    max-width: 100%;
    padding: 0 calc(var(--bsft-space-1) / 2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bsft-log-entry-scope {
    grid-column: 4;
    min-width: 0;
  }

  .bsft-log-entry-scope summary {
    color: var(--bsft-color-muted);
    cursor: pointer;
  }

  .bsft-log-entry-scope-property {
    appearance: none;
    min-width: 0;
    min-block-size: 1.5rem;
    max-width: 100%;
    margin-inline-end: calc(var(--bsft-spacing) / 2);
    padding: 0 calc(var(--bsft-spacing) / 4);
    overflow: hidden;
    border: 0;
    background: none;
    color: var(--bsft-color-muted);
    font: inherit;
    text-decoration: underline dotted;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
  }

  .bsft-log-entry-scope-property[aria-pressed="true"] {
    color: var(--bsft-color-primary);
    font-weight: var(--bsft-weight-semibold);
  }

  .bsft-log-entry-scope-truncated {
    margin: calc(var(--bsft-spacing) / 4) 0 0;
    color: var(--bsft-color-muted);
    font-style: italic;
  }

  .bsft-log-entry pre {
    max-height: 20rem;
    margin: calc(var(--bsft-space-1) / 2) 0 0;
    overflow: auto;
    color: var(--bsft-color-danger);
  }

  /* The last entry ends on the transcript's own frame, not on a hairline of its own above it. */
  .bsft-log-entry:last-of-type {
    border-block-end: 0;
  }

  /* An entry's exception opens in place, so its summary carries the one disclosure marker — the
     tree's twisty, turned while open — in place of the browser's own triangle (Rule 7). */
  .bsft-log-entry summary {
    display: flex;
    align-items: center;
    gap: var(--bsft-space-1);
    list-style: none;
    cursor: pointer;
  }

  .bsft-log-entry summary::-webkit-details-marker {
    display: none;
  }

  .bsft-log-entry summary::before {
    content: "\25B8";
    display: inline-block;
    flex: none;
    width: 1em;
    text-align: center;
    color: var(--bsft-color-muted);
    transition: transform var(--bsft-motion-fast) ease-in-out;
  }

  .bsft-log-entry details[open] > summary::before {
    transform: rotate(90deg);
  }

  .bsft-log-viewer-load-older {
    margin: var(--bsft-space-1);
  }

  /* The way back to the newest entry is wanted exactly while the reader is away from it, so the
     button sticks to the bottom edge of the transcript instead of waiting at its end, where only
     a reader who is already there would find it. */
  .bsft-log-viewer-jump {
    position: sticky;
    inset-block-end: var(--bsft-space-1);
    margin: var(--bsft-space-1);
  }

  /* --- reduced motion --------------------------------------------------------------- */

  /* The guard is deliberately universal rather than a list of the rules that animate today. A
     guard that enumerates what it knows about is the guard that misses the next transition
     somebody adds, and a half-covered reduced-motion story is worse than none: it reads as
     handled. Durations are collapsed rather than set to zero so that transitionend and
     animationend still fire — a rendering that waits for one would otherwise hang forever — and
     an infinite animation is cut to a single iteration, which is what leaves the spinner standing
     as the static ring it draws at rest.

     It applies to the host's own rules too, on purpose: the preference is the user's statement
     about the page, not about one stylesheet on it. A host that wants motion back for its own
     surfaces states that in its own reduced-motion block. */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 1ms !important;
      animation-delay: 0ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 1ms !important;
      transition-delay: 0ms !important;
      scroll-behavior: auto !important;
    }
  }

  /* --- shell switch ------------------------------------------------------------------ */

  /* One breakpoint, at 48rem — the width below which a sidebar and a content column stop both
     being readable. It is written as a literal in both queries because a media query cannot read a
     custom property, which is a limitation of the cascade and not a token this file forgot to
     declare; the two halves are stated as a max/min pair around the same number so they can never
     both apply and never both fail to. */

  @media (max-width: 47.999rem) {
    .bsft-log-entry {
      grid-template-columns: max-content max-content minmax(0, 1fr);
    }

    .bsft-log-entry-category {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .bsft-log-entry-body,
    .bsft-log-entry details {
      grid-column: 1 / -1;
      overflow-wrap: anywhere;
    }

    .bsft-log-entry pre {
      overflow-wrap: anywhere;
    }

    /* A header with page-specific actions may carry more controls than one phone-width row can hold.
       It wraps instead of widening the shell. The action group moves visually after every other
       control, then takes a full-width scrollable row without changing the semantic DOM order.
       Titled headers without actions keep their existing wrapping behavior. */
    .bsft-shell-header--titled,
    .bsft-shell-header--with-actions {
      min-width: 0;
      flex-wrap: wrap;
    }

    .bsft-shell-header--with-actions .bsft-shell-header-actions {
      order: 1;
      flex-basis: 100%;
      max-width: 100%;
      overflow-x: auto;
      background: var(--bsft-scroll-cue-layers);
    }

    /* The scroll cue over the content (see the cue's own section) for the header's action row, which
       only scrolls at this width: a flex row whose buttons, each filled with the surface, would cover
       a background cue completely. Each shadow is an item there that hands back its own width and the
       gap after it. */
    @supports (animation-timeline: scroll()) {
      .bsft-shell-header--with-actions .bsft-shell-header-actions::before,
      .bsft-shell-header--with-actions .bsft-shell-header-actions::after {
        content: "";
        position: sticky;
        z-index: 1;
        flex: none;
        align-self: stretch;
        inline-size: var(--bsft-scroll-cue-size);
        pointer-events: none;
        opacity: 0;
      }

      .bsft-shell-header--with-actions .bsft-shell-header-actions::before {
        inset-inline-start: 0;
        margin-inline-end: calc(-1 * (var(--bsft-scroll-cue-size) + var(--bsft-space-2)));
        background: linear-gradient(to right, var(--bsft-scroll-cue-color), transparent);
        animation: bsft-scroll-cue-start linear both;
        animation-timeline: scroll(nearest inline);
        animation-range: 1px calc(var(--bsft-scroll-cue-size) + 1px);
      }

      .bsft-shell-header--with-actions .bsft-shell-header-actions::after {
        inset-inline-end: 0;
        margin-inline-start: calc(-1 * (var(--bsft-scroll-cue-size) + var(--bsft-space-2)));
        background: linear-gradient(to left, var(--bsft-scroll-cue-color), transparent);
        animation: bsft-scroll-cue-end linear both;
        animation-timeline: scroll(nearest inline);
        animation-range: calc(100% - var(--bsft-scroll-cue-size) - 1px) calc(100% - 1px);
      }

      .bsft-shell-header--with-actions .bsft-shell-header-actions:dir(rtl)::before {
        background: linear-gradient(to left, var(--bsft-scroll-cue-color), transparent);
        animation-name: bsft-scroll-cue-start-rtl;
      }

      .bsft-shell-header--with-actions .bsft-shell-header-actions:dir(rtl)::after {
        background: linear-gradient(to right, var(--bsft-scroll-cue-color), transparent);
        animation-name: bsft-scroll-cue-end-rtl;
      }
    }

    /* Off-canvas: the navigation leaves the flow and becomes a drawer over the content, disclosed
       by the header's toggle. It is hidden with visibility rather than display, for two reasons
       that both matter — visibility takes it out of the accessibility tree exactly as display
       would, and unlike display it is a transitionable property, so the drawer slides instead of
       appearing. The transition is one of the ones the reduced-motion guard above collapses. */
    .bsft-shell-nav {
      position: fixed;
      inset-block: 0;
      inset-inline-start: 0;
      width: min(18rem, 80vw);
      padding: var(--bsft-space-6) var(--bsft-space-4);
      overflow-y: auto;
      overscroll-behavior: contain;
      background: var(--bsft-color-surface);
      border-inline-end: 1px solid var(--bsft-color-border);
      /* Above the modal layer's backdrop and below the modal itself: a drawer is dismissed by the
         next thing the user does, so a dialog opened from it still has to cover it. */
      z-index: calc(var(--bsft-z-dialog) - 1);
      visibility: hidden;
      transform: translateX(-100%);
      transition: transform var(--bsft-motion-fast) ease, visibility var(--bsft-motion-fast);
    }

    /* The state lives on the shell rather than on the drawer, because the backdrop is a sibling
       and has to react to the same fact. */
    .bsft-shell[data-bsft-nav="open"] .bsft-shell-nav {
      visibility: visible;
      transform: translateX(0);
    }

    .bsft-shell-nav-backdrop {
      position: fixed;
      inset: 0;
      z-index: calc(var(--bsft-z-dialog) - 2);
      background: var(--bsft-color-backdrop);
    }

    /* The pager wraps onto a second line and gives up its far-end alignment, which only ever
       made sense on a row wide enough to have two ends; the table already scrolls inside the
       list on every width. */
    .bsft-list-pagesize {
      margin-inline-start: 0;
    }

    .bsft-list-pager {
      flex-wrap: wrap;
    }

    /* A split pane on a phone is not a split pane. There is room for one column, so the column is
       the pane the caller nominated and the other is reached through the swap control — which is
       the same trade the navigation makes one breakpoint above: the second thing on screen becomes
       the second thing you ask for. */
    .bsft-split {
      flex-direction: column;
    }

    /* The pane that is not showing and the control that would resize it are both gone, which takes
       them out of the accessibility tree along with the pixels. */
    .bsft-split-divider,
    .bsft-split[data-bsft-split-pane="primary"] .bsft-split-secondary,
    .bsft-split[data-bsft-split-pane="secondary"] .bsft-split-primary {
      display: none;
    }

    /* Whatever basis the wide shape persisted means nothing in one column: the pane that is showing
       takes the height it is given. */
    .bsft-split-primary,
    .bsft-split-secondary {
      flex: 1 1 auto;
    }

    /* One column has no room for the wide layout's generous padding. */
    .bsft-shell-header,
    .bsft-shell-main {
      padding: var(--bsft-space-4);
    }

    .bsft-shell-page-title {
      font-size: var(--bsft-text-lg);
    }

    .bsft-dialog,
    .bsft-dialog-panel {
      padding: var(--bsft-space-4);
    }
  }

  /* A toast on a phone keeps a margin to both edges instead of its fixed reading width. */
  @media (max-width: 30rem) {
    .bsft-toast {
      max-width: calc(100vw - var(--bsft-space-8));
    }
  }

  @media (min-width: 48rem) {
    /* Wide: the navigation is a sidebar beside the content instead of a band above it. Grid
       rather than flex, because the shell's markup order — header, navigation, main — is the
       reading order and must not change to get a two-column layout. */
    .bsft-shell {
      display: grid;
      grid-template-columns: minmax(12rem, 16rem) 1fr;
      grid-template-rows: auto 1fr;
      grid-template-areas:
        "header header"
        "nav main";
    }

    .bsft-shell-header {
      grid-area: header;
    }

    /* The sidebar stays put while the page scrolls: it rests below the sticky application bar,
       is exactly the rest of the viewport tall and scrolls its own overflow, so the whole table
       of contents is in reach from the last section of a long page. align-self keeps the grid
       from stretching it to the content column's height, which would leave sticky nothing to do;
       overscroll-behavior keeps a scroll that reaches its end from carrying on into the page. */
    .bsft-shell-nav {
      grid-area: nav;
      position: sticky;
      top: var(--bsft-shell-header-height);
      align-self: start;
      height: calc(100vh - var(--bsft-shell-header-height));
      height: calc(100svh - var(--bsft-shell-header-height));
      box-sizing: border-box;
      overflow-y: auto;
      overscroll-behavior: contain;
      /* A table of contents, not a document: its scrollbar is a hint, not a control. */
      scrollbar-width: thin;
    }

    .bsft-shell-main {
      grid-area: main;
      min-width: 0;
    }

    /* There is no drawer up here, so there is no control for one and no layer over the page. */
    .bsft-shell-nav-toggle,
    .bsft-shell-nav-backdrop {
      display: none;
    }

    /* Both panes are on screen up here, so there is nothing to swap to and no control for it. */
    .bsft-split-swap {
      display: none;
    }

    /* --- sheet: wide variant --- */
  }

  /* --- drag and drop ------------------------------------------------------- */

  /* A reorderable list is a list, not a table: the rows carry their own border and the container
     carries none, so a list dropped into a panel does not draw a second frame around it. */
  .bsft-reorder {
    margin: 0;
    padding: 0;
    list-style: none;
    font-family: var(--bsft-font);
    color: var(--bsft-color-text);
  }

  .bsft-reorder-item {
    display: flex;
    align-items: center;
    gap: var(--bsft-space-2);
    padding: var(--bsft-space-2);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius);
    background: var(--bsft-color-surface);
    cursor: grab;
  }

  .bsft-reorder-item + .bsft-reorder-item {
    margin-top: var(--bsft-space-1);
  }

  /* Every row is focusable, so the focus ring is the keyboard path's only affordance and is never
     removed — the visible half of "pick up, move, drop". */
  .bsft-reorder-item:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  /* The held row, whether it was picked up by pointer or by key: one state, because the two
     gestures are one gesture with two inputs. */
  .bsft-reorder-item.is-held {
    border-color: var(--bsft-color-primary);
    cursor: grabbing;
    opacity: 0.7;
  }

  /* The position the held row would take. Only ever set where the target actually accepts it, so
     the marker is a promise the drop keeps rather than a highlight under every pointer. */
  .bsft-reorder-item.is-over {
    border-color: var(--bsft-color-primary);
    box-shadow: inset 0 2px 0 0 var(--bsft-color-primary);
  }

  /* A chooser is one dashed frame: the drop zone and the transfer submit share the card's
     corner, the card's inset and a step between what they hold. */
  .bsft-file-drop {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-2);
    padding: var(--bsft-space-4);
    border: 1px dashed var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    background: var(--bsft-color-surface);
    font-family: var(--bsft-font);
    color: var(--bsft-color-text);
  }

  /* A drag that will land and one that will not are told apart by colour *and* by the refusal the
     surface states after the drop, never by colour alone. */
  .bsft-file-drop.is-over {
    border-style: solid;
    border-color: var(--bsft-color-primary);
    background: var(--bsft-color-info-surface);
  }

  .bsft-file-drop.is-over.is-refusing {
    border-color: var(--bsft-color-danger-accent);
    background: var(--bsft-color-danger-surface);
  }

  .bsft-transfer-submit-statement,
  .bsft-file-drop-statement {
    margin: 0;
    color: var(--bsft-color-muted);
  }

  /* The refusals are a list inside the failure notice (Rule 27), which gives them their colour. */
  .bsft-file-drop-rejections {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  /* The drop zone's progress is the one track and bar of the progress meter section. */

  /* The window-wide drop. The overlay covers the viewport only while a file drag is over the
     window and never takes the pointer, so it is not a drop target of its own and the drag's enter and
     leave events keep landing on the page beneath it. It sits under the toasts, so a refusal or an
     upload notice raised during a drag stays readable. The motion is a fade of the dim and a short
     zoom of the frame; the stylesheet's reduced-motion guard collapses both to their end state. */
  /* The host holds the hidden status region, the overlay and, after a drop, the refusals. It is
     no box of its own: while nothing is shown it would still take a gap slot in the column it is
     mounted in and shift what follows it, and when a refusal list appears, that list is the box. */
  .bsft-page-drop-host {
    display: contents;
  }

  .bsft-page-drop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--bsft-z-toast) - 1);
    display: flex;
    padding: var(--bsft-space-4);
    background: var(--bsft-color-backdrop);
    pointer-events: none;
    font-family: var(--bsft-font);
    animation: bsft-page-drop-dim var(--bsft-motion-entrance) var(--bsft-ease-out) both;
  }

  .bsft-page-drop-frame {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--bsft-space-2);
    border: 3px dashed var(--bsft-color-primary);
    border-radius: var(--bsft-radius-lg);
    background: color-mix(in srgb, var(--bsft-color-surface) 88%, transparent);
    color: var(--bsft-color-text);
    text-align: center;
    animation: bsft-page-drop-zoom var(--bsft-motion-entrance) var(--bsft-ease-out) both;
  }

  .bsft-page-drop-icon {
    inline-size: 3rem;
    block-size: 3rem;
    fill: none;
    stroke: var(--bsft-color-primary);
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    animation: bsft-page-drop-lift var(--bsft-motion-pulse) ease-in-out infinite alternate;
  }

  .bsft-page-drop-title {
    margin: 0;
    font-size: var(--bsft-text-xl);
    font-weight: var(--bsft-weight-semibold);
  }

  .bsft-page-drop-detail {
    margin: 0;
    color: var(--bsft-color-muted);
  }

  /* A drag that will not land, or a drop that is paused, is told apart by the frame's colour and by
     the sentence the frame says — never by colour alone. The frame and the icon are drawn, so they
     take the accent (Rule 16). */
  .bsft-page-drop.is-refusing .bsft-page-drop-frame {
    border-color: var(--bsft-color-danger-accent);
  }

  .bsft-page-drop.is-refusing .bsft-page-drop-icon {
    stroke: var(--bsft-color-danger-accent);
  }

  .bsft-page-drop.is-disabled .bsft-page-drop-frame {
    border-color: var(--bsft-color-muted);
  }

  .bsft-page-drop.is-disabled .bsft-page-drop-icon {
    stroke: var(--bsft-color-muted);
    animation: none;
  }

  @keyframes bsft-page-drop-dim {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  @keyframes bsft-page-drop-zoom {
    from { transform: scale(1.04); }
    to { transform: scale(1); }
  }

  @keyframes bsft-page-drop-lift {
    from { transform: translateY(0); }
    to { transform: translateY(-0.375rem); }
  }

  /* Files are dragged in from outside with a fine pointer only. A device that has none (a phone, a
     tablet without a trackpad) does not draw the overlay, whatever a browser reports about a drag;
     a tablet with a trackpad or a touch laptop with a mouse does. */
  @media not all and (any-pointer: fine) {
    .bsft-page-drop {
      display: none;
    }
  }

  /* Forced colours drop the dim and the tinted frame; the frame's border and the text remain. */
  @media (forced-colors: active) {
    .bsft-page-drop {
      background: Canvas;
    }

    .bsft-page-drop-frame {
      border-color: CanvasText;
    }

    .bsft-page-drop-icon {
      stroke: CanvasText;
    }
  }

  /* --- file preview ----------------------------------------------------------------- */

  /* A figure, because that is what it is: a caption naming the file and one rendering of its
     contents beneath. Every payload below is bounded in height rather than left to grow — a preview
     that pushes the rest of the screen off it has stopped being a preview. */
  .bsft-file-preview {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-1);
    /* A preview fills the width it is given and bounds its own height below: the column decides
       how wide, the payload rules below decide how tall, and neither pushes the screen around. */
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: var(--bsft-space-4);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    background: var(--bsft-color-surface);
  }

  .bsft-file-preview-caption {
    display: flex;
    gap: var(--bsft-space-2);
    align-items: baseline;
    justify-content: space-between;
  }

  .bsft-file-preview-name {
    overflow-wrap: anywhere;
    font-weight: var(--bsft-weight-semibold);
  }

  .bsft-file-preview-size {
    flex: none;
    color: var(--bsft-color-muted);
  }

  /* Contained rather than stretched: an image is shown at whatever size fits, and a portrait scan
     must not become a column of empty page. The figure is a flex column, which would stretch the
     image across it — a thumbnail blown up to the column's width — so the image keeps its own. */
  .bsft-file-preview-image {
    align-self: flex-start;
    max-width: 100%;
    max-height: 32rem;
    object-fit: contain;
    border-radius: var(--bsft-radius);
    background: var(--bsft-color-skeleton);
  }

  .bsft-file-preview-pdf {
    width: 100%;
    height: 32rem;
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius);
  }

  /* pre-wrap rather than pre: a text file's own line breaks are kept, and a line longer than the
     surface wraps instead of scrolling the whole page sideways. */
  .bsft-file-preview-text {
    max-height: 24rem;
    margin: 0;
    overflow: auto;
    padding: var(--bsft-space-2);
    border-radius: var(--bsft-radius);
    background: var(--bsft-color-skeleton);
    font-family: var(--bsft-font-mono);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  /* The table scrolls inside its own box. A CSV with sixty columns is ordinary, and letting it set
     the width of the screen would break every layout it appears in. */
  .bsft-file-preview-csv {
    display: block;
    max-height: 24rem;
    overflow: auto;
    border-collapse: collapse;
    background: var(--bsft-scroll-cue-layers);
  }

  /* A table has one head: the preview's rows take the list's picture — a hairline under each
     row and nothing between the columns, the head set small, semibold, upper-case and muted on
     the canvas — so a CSV read in a preview and a list read on a screen are one kind of table. */
  .bsft-file-preview-csv th,
  .bsft-file-preview-csv td {
    padding: var(--bsft-space-1) var(--bsft-space-2);
    border-bottom: 1px solid var(--bsft-color-border);
    text-align: start;
    white-space: nowrap;
    font-size: var(--bsft-text-sm);
  }

  .bsft-file-preview-csv th {
    position: sticky;
    top: 0;
    background: var(--bsft-color-canvas);
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-xs);
    font-weight: var(--bsft-weight-semibold);
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .bsft-file-preview-csv tbody tr:last-child td {
    border-bottom: 0;
  }

  .bsft-file-preview-fallback {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-1);
  }

  /* --- command palette -------------------------------------------------------------- */

  /* The armed wrapper is layout-neutral on purpose: it contains the whole application, so anything
     it drew — a padding, a border, a stacking context — would be a frame around every screen. It
     is a plain block and not display: contents, because an element without a box cannot take
     focus, and taking focus is the one thing it is there for: it carries the tabindex and the
     focus ring the ordinary rules would otherwise give a focusable element covering the viewport. */
  .bsft-command-palette-root {
    display: block;
  }

  .bsft-command-palette-root:focus,
  .bsft-command-palette-root:focus-visible {
    outline: none;
  }

  .bsft-command-palette {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-2);
    /* The palette fills the dialog panel that holds it, and that panel is given a reading width
       of its own below: wide enough for a whole label and its kind, capped so the panel does not
       become the page on a large screen. */
    width: 100%;
    font-family: var(--bsft-font);
  }

  .bsft-dialog-panel:has(.bsft-command-palette) {
    max-width: 40rem;
  }

  .bsft-command-palette-input {
    width: 100%;
  }

  .bsft-command-palette-list {
    /* Bounded and scrolled rather than paged: the ranking has already put the answer at the top,
       so what is below the fold is the long tail and never the thing being looked for. */
    max-height: 20rem;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius);
    background: var(--bsft-color-surface);
  }

  .bsft-command-palette-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--bsft-space-2);
    min-height: var(--bsft-touch-target);
    padding: var(--bsft-space-2) var(--bsft-space-4);
    cursor: pointer;
    color: var(--bsft-color-text);
  }

  .bsft-command-palette-option-active {
    /* Where the keyboard is — which in this control is also what Enter would run, since a palette
       binds no value of its own — is the one hover tint (Rule 9), as in every other popup. */
    background: var(--bsft-color-hover);
  }

  @media (hover: hover) {
    .bsft-command-palette-option:not(.bsft-command-palette-option-active):not([aria-disabled="true"]):hover {
      background: var(--bsft-color-hover);
    }
  }

  .bsft-command-palette-option-kind {
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
    white-space: nowrap;
  }

  /* --- chat ------------------------------------------------------------------------- */

  /* Mobile first: on a phone the list and the open conversation take turns — the list until a
     conversation is open, then the conversation with its way back. From the tablet width up both
     sit side by side and the way back is hidden. The transcript's height is the surrounding
     layout's to give; the panel fills what it is given. */
  .bsft-chat {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    font-family: var(--bsft-font);
    font-size: var(--bsft-text-base);
    line-height: var(--bsft-leading-body);
    color: var(--bsft-color-text);
  }

  .bsft-chat-main {
    display: none;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
  }

  .bsft-chat-open .bsft-chat-conversations {
    display: none;
  }

  .bsft-chat-open .bsft-chat-main {
    display: flex;
  }

  /* The icon-only controls of the chat: a square of the control height, the glyph centred in
     it, no word to wrap. They are ordinary buttons otherwise — the theme's border, radius and
     focus ring, so a keyboard user sees the same ring here as everywhere, and the send button
     stands level with the draft beside it. */
  .bsft-chat-back,
  .bsft-chat-send,
  .bsft-chat-target-cancel,
  .bsft-chat-message-retry,
  .bsft-chat-message-actions .bsft-popover-trigger {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: var(--bsft-control-height);
    min-width: var(--bsft-control-height);
    height: var(--bsft-control-height);
    padding: 0;
  }

  .bsft-icon {
    display: block;
    flex: none;
  }

  .bsft-chat-conversations {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-2);
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
  }

  /* The list scrolls inside the panel rather than scrolling the page: what grows the list is the
     reader coming within a viewport of the end of a bounded region, and an unbounded one has no
     end to come within reach of. Same shape as the transcript's region one screen over. */
  .bsft-chat-conversations .bsft-scroll-region {
    flex: 1 1 auto;
    min-height: 0;
  }

  .bsft-chat-search {
    display: block;
  }

  .bsft-chat-search-input {
    width: 100%;
  }

  .bsft-chat-load-more {
    width: 100%;
    margin-top: var(--bsft-space-2);
  }

  .bsft-chat-conversation-group-title {
    margin: var(--bsft-space-2) 0 0;
    font-size: var(--bsft-text-sm);
    color: var(--bsft-color-muted);
  }

  .bsft-chat-conversation-list,
  .bsft-chat-messages {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  /* A whole row is one touch target: at least 44px tall on a phone. It is a row of the list,
     not a button in its clothes: no button chrome, the hover tint under the pointer, and the
     chosen one in the one picture of "chosen" (Rule 9), read off aria-current. */
  .bsft-chat-conversation {
    display: flex;
    align-items: center;
    gap: var(--bsft-space-2);
    width: 100%;
    min-height: var(--bsft-touch-target);
    padding: var(--bsft-space-2) var(--bsft-space-3);
    border: 0;
    border-radius: var(--bsft-radius);
    background: transparent;
    color: var(--bsft-color-text);
    font: inherit;
    text-align: start;
    cursor: pointer;
  }

  @media (hover: hover) {
    .bsft-chat-conversation:not([aria-current="true"]):not([disabled]):hover {
      background: var(--bsft-color-hover);
    }
  }

  .bsft-chat-conversation:focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  .bsft-chat-conversation[aria-current="true"] {
    background: var(--bsft-selected-surface);
    box-shadow: inset 3px 0 var(--bsft-selected-accent);
  }

  :root[dir="rtl"] .bsft-chat-conversation[aria-current="true"] {
    box-shadow: inset -3px 0 var(--bsft-selected-accent);
  }

  .bsft-chat-conversation-waiting {
    opacity: 0.7;
  }

  .bsft-chat-conversation-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
  }

  .bsft-chat-conversation-title {
    font-weight: var(--bsft-weight-semibold);
  }

  .bsft-chat-conversation-title,
  .bsft-chat-conversation-preview {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bsft-chat-conversation-preview {
    display: flex;
    gap: var(--bsft-space-1);
    font-size: var(--bsft-text-sm);
    color: var(--bsft-color-muted);
  }

  /* The time of the last message keeps its place at the row's end: it is short, it never shrinks,
     and the preview beside it truncates instead. */
  .bsft-chat-conversation-time {
    flex: 0 0 auto;
    align-self: center;
    margin-inline-start: auto;
    font-size: var(--bsft-text-xs);
    color: var(--bsft-color-muted);
    white-space: nowrap;
  }

  .bsft-chat-conversation-preview-author::after {
    content: ":";
  }

  .bsft-chat-unread {
    flex: 0 0 auto;
    min-width: 1.5rem;
    padding: 0 var(--bsft-space-1);
    border-radius: var(--bsft-radius-pill);
    background: var(--bsft-action-primary);
    color: var(--bsft-color-primary-contrast);
    font-size: var(--bsft-text-xs);
    line-height: 1.5rem;
    text-align: center;
  }

  /* A mention is a badge in the danger status (Rule 16): the status surface as its fill and the
     status colour as its text, never the text colour as a fill. */
  .bsft-chat-unread-mention {
    background: var(--bsft-color-danger-surface);
    color: var(--bsft-color-danger);
  }

  /* The conversation's own bar: the way back, then what the reader is in. It stays at the top of
     the conversation while the transcript scrolls under it, because on a phone — where the host may
     have taken its own bottom navigation away for the conversation — this is the way out. */
  .bsft-chat-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: var(--bsft-space-2);
    padding: var(--bsft-space-2) 0;
    background: var(--bsft-color-surface);
  }

  .bsft-chat-header-text {
    min-width: 0;
  }

  .bsft-chat-title {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--bsft-text-lg);
    font-weight: var(--bsft-weight-semibold);
  }

  .bsft-chat-topic {
    margin: 0;
    color: var(--bsft-color-muted);
  }

  .bsft-chat-main .bsft-scroll-region {
    flex: 1 1 auto;
    min-height: 0;
  }

  .bsft-chat-day {
    margin: var(--bsft-space-2) 0;
    text-align: center;
    font-size: var(--bsft-text-xs);
    color: var(--bsft-color-muted);
  }

  .bsft-chat-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    margin: var(--bsft-space-1) 0;
    padding: var(--bsft-space-3) var(--bsft-space-4);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    overflow-wrap: anywhere;
  }

  /* An own message is tinted, not chosen: the primary surface tells it apart from the other
     side's, and the accent edge stays with the picture of "chosen" (Rule 9). */
  .bsft-chat-message-own {
    margin-inline-start: auto;
    background: var(--bsft-color-primary-surface);
  }

  .bsft-chat-message-highlighted {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
  }

  .bsft-chat-message-tombstone {
    color: var(--bsft-color-muted);
    font-style: italic;
  }

  .bsft-chat-system {
    max-width: none;
    border: none;
    text-align: center;
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
  }

  .bsft-chat-system-text,
  .bsft-chat-message-text {
    margin: 0;
  }

  .bsft-chat-message-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--bsft-space-1);
    font-size: var(--bsft-text-xs);
    color: var(--bsft-color-muted);
  }

  .bsft-chat-message-author {
    font-weight: var(--bsft-weight-semibold);
    color: var(--bsft-color-text);
  }

  /* The initials mark of the message's author. The hue is the component's (one per actor), how
     saturated and how light it becomes is this theme's, so the same mark stays legible in both
     themes without the component knowing either. */
  .bsft-chat-avatar {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: var(--bsft-radius-pill);
    background: light-dark(
      hsl(var(--bsft-chat-avatar-hue, 210) 70% 88%),
      hsl(var(--bsft-chat-avatar-hue, 210) 45% 28%));
    color: light-dark(
      hsl(var(--bsft-chat-avatar-hue, 210) 45% 25%),
      hsl(var(--bsft-chat-avatar-hue, 210) 70% 88%));
    font-size: var(--bsft-text-2xs);
    font-weight: var(--bsft-weight-semibold);
    line-height: 1;
  }

  .bsft-chat-quote {
    display: flex;
    flex-direction: column;
    margin-bottom: var(--bsft-space-1);
    padding: var(--bsft-space-1) var(--bsft-space-2);
    border: none;
    border-inline-start: 3px solid var(--bsft-color-primary);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
  }

  .bsft-chat-quote-unavailable {
    border-inline-start-color: var(--bsft-color-border);
    color: var(--bsft-color-muted);
    font-style: italic;
    cursor: default;
  }

  .bsft-chat-quote-author {
    font-weight: var(--bsft-weight-semibold);
    font-size: var(--bsft-text-xs);
  }

  .bsft-chat-quote-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* The line under the body: the reactions take the room and wrap inside it, the menu keeps its
     place at the end of the first line, so neither many reactions nor none move it. The reaction
     chips and the trigger share one height, which is what puts them on one line. */
  .bsft-chat-message-foot {
    display: flex;
    align-items: flex-start;
    gap: var(--bsft-space-1);
    margin-top: var(--bsft-space-1);
  }

  .bsft-chat-message-foot > .bsft-chat-reactions {
    flex: 1 1 auto;
    min-width: 0;
    margin-top: 0;
  }

  /* The menu belongs to the message, not beside it: a quiet glyph at the end of the message's last
     line rather than a second button-shaped thing inside the bubble. It takes the theme's border
     and ring back as soon as it is hovered or focused, so it is still findable by keyboard. */
  .bsft-chat-message-actions {
    flex: none;
    margin-inline-start: auto;
    margin-inline-end: calc(0px - var(--bsft-space-1));
  }

  /* The menu's panel hangs off the bubble rather than off the trigger: the popover gives up
     its own positioning, so the placement's start or end edge is the bubble's. An own message
     (bottom-end) grows back from the bubble's end, anybody else's (bottom-start) on from its start,
     so the panel stays inside the conversation whatever the bubble's width, and it never grows
     wider than the viewport. */
  .bsft-chat-message {
    position: relative;
  }

  .bsft-chat-message-actions .bsft-popover {
    position: static;
  }

  .bsft-chat-message-actions .bsft-popover-panel {
    min-width: min(12rem, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
  }

  /* Quiet until it is wanted — the secondary button, muted — but the size of every other icon-only
     control of the chat: a square of the control height, which the chat's icon rule above already
     gives it (Rule 23). */
  .bsft-chat-message-actions .bsft-popover-trigger {
    color: var(--bsft-color-muted);
  }

  @media (hover: hover) {
    .bsft-chat-message-actions .bsft-popover-trigger:hover {
      color: var(--bsft-color-text);
    }
  }

  .bsft-chat-message-actions .bsft-popover-trigger:focus-visible,
  .bsft-chat-message-actions .bsft-popover-trigger[aria-expanded="true"] {
    color: var(--bsft-color-text);
  }

  /* A row on its way is dimmed rather than moved: it is already where the confirmed message will
     be, and the only thing that changes when the server answers is that the dimming stops. A
     refused one keeps its full weight — it is not on its way any more — and says so in the danger
     colour beside its retry. */
  .bsft-chat-message-pending {
    opacity: 0.65;
  }

  .bsft-chat-message-failed {
    border-color: var(--bsft-color-danger-accent);
  }

  .bsft-chat-message-state {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--bsft-space-1);
    margin: var(--bsft-space-1) 0 0;
    font-size: var(--bsft-text-xs);
    color: var(--bsft-color-muted);
  }

  .bsft-chat-message-state-failed {
    color: var(--bsft-color-danger);
  }

  .bsft-chat-message-read {
    color: var(--bsft-color-primary);
  }

  /* The reaction bar under a message: chips that wrap rather than scroll sideways, each big enough
     to hit on a phone, the own reaction filled so it reads as pressed and not merely as coloured. */
  .bsft-chat-reactions {
    margin-top: var(--bsft-space-1);
  }

  .bsft-chat-reaction-bar,
  .bsft-chat-reaction-picker,
  .bsft-chat-reactor-keys {
    display: flex;
    flex-wrap: wrap;
    gap: var(--bsft-space-1);
  }

  /* A reaction is a chip: the pills carry .bsft-chip and take its chrome, its hover tint, its
     focus ring and — for the reader's own reaction and the open reactor key, named in the chip's
     chosen rule — its chosen picture (Rule 9, Rule 23); nothing of that is restated here. */

  .bsft-chat-reaction-count {
    font-size: var(--bsft-text-xs);
    font-variant-numeric: tabular-nums;
  }

  .bsft-chat-reaction-who {
    border: none;
    background: transparent;
    color: var(--bsft-color-muted);
    font: inherit;
    font-size: var(--bsft-text-xs);
    text-decoration: underline;
    cursor: pointer;
  }

  .bsft-chat-reaction-picker {
    margin-top: var(--bsft-space-1);
  }

  .bsft-chat-reactors {
    margin-top: var(--bsft-space-1);
    padding-top: var(--bsft-space-1);
    border-top: 1px solid var(--bsft-color-border);
    font-size: var(--bsft-text-sm);
  }

  .bsft-chat-reactors-title {
    margin: 0 0 var(--bsft-space-1);
    color: var(--bsft-color-muted);
  }

  .bsft-chat-reactors-list {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-1);
    margin: var(--bsft-space-1) 0 0;
    padding: 0;
    list-style: none;
  }

  .bsft-chat-reactors-list li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--bsft-space-1);
    min-width: 0;
  }

  /* Who has read a message, under the message: names and read times wrap inside the bubble, so the
     list fits the narrowest phone bubble without scrolling sideways. */
  .bsft-chat-readers {
    margin-top: var(--bsft-space-1);
    padding-top: var(--bsft-space-1);
    border-top: 1px solid var(--bsft-color-border);
    font-size: var(--bsft-text-sm);
  }

  .bsft-chat-readers-title {
    margin: 0;
    color: var(--bsft-color-muted);
  }

  .bsft-chat-readers-list {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-1);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .bsft-chat-readers-list li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--bsft-space-1);
    min-width: 0;
  }

  .bsft-chat-readers-list time {
    color: var(--bsft-color-muted);
  }

  /* The composer owns the bottom edge of the conversation and stays there while the transcript
     scrolls past it. Two things it cannot know itself, and both are read from one custom property
     the host sets: how tall the host's own bottom bar is, and how much of the viewport the
     on-screen keyboard covers where the browser overlays it instead of shrinking the page. A host
     with neither leaves --bsft-chat-composer-offset unset and the composer sits on the bottom.
     The safe area is added here rather than by the host: every phone has one, whatever the host
     puts above it. */
  .bsft-chat-composer {
    position: sticky;
    bottom: var(--bsft-chat-composer-offset, 0px);
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-1);
    padding-top: var(--bsft-space-2);
    padding-bottom: max(var(--bsft-space-2), env(safe-area-inset-bottom));
    background: var(--bsft-color-surface);
  }

  .bsft-chat-composer-row {
    display: flex;
    align-items: flex-end;
    gap: var(--bsft-space-1);
  }

  /* The host's own affordances sit at the start of the row and keep the height of the smallest
     field, so the draft still owns the width it grows into. */
  .bsft-chat-composer-actions {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: var(--bsft-space-2);
  }

  .bsft-chat-target {
    display: flex;
    align-items: center;
    gap: var(--bsft-space-2);
    padding: var(--bsft-space-1) var(--bsft-space-2);
    border-inline-start: 3px solid var(--bsft-color-primary);
    font-size: var(--bsft-text-sm);
  }

  .bsft-chat-target-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bsft-chat-target-text .bsft-chat-actor {
    margin-inline-end: var(--bsft-space-1);
    font-weight: var(--bsft-weight-semibold);
  }

  /* A field, not a bare textarea: the theme's own border, radius and focus ring, a placeholder in
     the muted colour, and one line to start with. It grows with what is written — field-sizing
     where the browser has it, and the one row plus vertical resize everywhere else — up to a
     third of the viewport, and scrolls inside from there rather than pushing the transcript off
     the screen. 16px keeps a phone browser from zooming in on focus. */
  .bsft-chat-draft {
    flex: 1 1 auto;
    max-height: min(9rem, 30dvh);
    font-size: var(--bsft-text-base);
    overflow-y: auto;
    resize: vertical;
    field-sizing: content;
  }

  .bsft-chat-draft:focus-visible {
    border-color: var(--bsft-field-focus-border);
    outline-offset: -1px;
  }

  /* The typing line keeps its height while empty, so a writer starting does not push the transcript;
     the words are flex items with a gap, so the translation keys carry no surrounding spaces. */
  .bsft-chat-typing {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25em;
    min-height: 1.25rem;
    margin: 0;
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
  }

  .bsft-chat-mention {
    color: var(--bsft-color-primary);
    font-weight: var(--bsft-weight-semibold);
  }

  /* The link's visible text is the address itself, so it can be long: it wraps inside the bubble
     rather than widening it. */
  .bsft-chat-link {
    overflow-wrap: anywhere;
  }

  .bsft-chat-link-prompt-question {
    margin: 0 0 var(--bsft-space-1);
  }

  /* The host is what the reader decides on, so it is the loudest line of the prompt, and the whole
     address stands under it unshortened. */
  .bsft-chat-link-prompt-host {
    margin: 0;
    font-weight: var(--bsft-weight-semibold);
    overflow-wrap: anywhere;
  }

  .bsft-chat-link-prompt-address {
    margin: 0;
    font-size: var(--bsft-text-sm);
    color: var(--bsft-color-muted);
    overflow-wrap: anywhere;
  }

  .bsft-chat-link-prompt-notice {
    margin: var(--bsft-space-1) 0 0;
    font-size: var(--bsft-text-sm);
  }

  .bsft-chat-suggestions {
    flex: 1 1 100%;
    max-height: 12rem;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    background: var(--bsft-color-surface);
    box-shadow: var(--bsft-shadow-md);
  }

  .bsft-chat-suggestion {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    min-height: var(--bsft-touch-target);
    padding: var(--bsft-space-1) var(--bsft-space-2);
    border: 0;
    background: transparent;
    color: inherit;
    text-align: start;
  }

  /* A suggestion is an option in a popup: under the pointer, and where the keyboard is, it takes
     the one hover tint (Rule 42, Rule 9), never a colour of its own. */
  @media (hover: hover) {
    .bsft-chat-suggestion:hover:not(:disabled) {
      background: var(--bsft-color-hover);
    }
  }

  .bsft-chat-suggestion:focus-visible {
    background: var(--bsft-color-hover);
  }

  .bsft-chat-suggestion:disabled {
    opacity: var(--bsft-disabled-opacity);
  }

  .bsft-chat-suggestion-note {
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-xs);
  }

  .bsft-chat-badge {
    display: inline-flex;
  }

  @media (min-width: 48rem) {
    .bsft-chat {
      display: grid;
      grid-template-columns: minmax(14rem, 20rem) 1fr;
      gap: var(--bsft-space-2);
    }

    .bsft-chat .bsft-chat-conversations,
    .bsft-chat .bsft-chat-main {
      display: flex;
    }

    /* Both sit side by side here, so the conversation is not a place one has to leave and the host
       keeps its own navigation: the way back has nothing to do and the composer sits on the bottom
       of its own column rather than above somebody else's bar. */
    .bsft-chat-back {
      display: none;
    }

    .bsft-chat-composer {
      bottom: 0;
    }

    .bsft-chat-message {
      max-width: 70%;
    }
  }

  /* --- top layer ----------------------------------------------------------------------- */

  /* --- sheet --------------------------------------------------------------------------- */

  /* --- card and data state ------------------------------------------------------------- */

  /* --- inputs -------------------------------------------------------------------------- */

  /* --- page header --------------------------------------------------------------------- */

  /* --- avatar -------------------------------------------------------------------------- */

  /* --- segmented control --------------------------------------------------------------- */

  /* --- tooltip ------------------------------------------------------------------------- */

  /* --- highlighted text ---------------------------------------------------------------- */

  /* --- mobile navigation --------------------------------------------------------------- */

  /* --- dock ---------------------------------------------------------------------------- */

  /* --- markdown ------------------------------------------------------------------------ */

  /* --- code block ---------------------------------------------------------------------- */

  /* --- streaming text ------------------------------------------------------------------ */

  /* --- bff forms ----------------------------------------------------------------------- */

  /* --- app update ---------------------------------------------------------------------- */

  /* --- print ------------------------------------------------------------------------ */

  /* What a printed page of a BSFT screen is: the record the detail or list layout holds, without
     any of the chrome that only means something to somebody who can click it. Nothing here sets a
     colour — the printer's own rendering of the theme's tokens is closer to right than a guess at
     what paper wants, and a literal here would be the one place in this file that is not a
     token. */
  .bsft-local-settings {
    display: grid;
    gap: var(--bsft-space-4);
    font-family: var(--bsft-font);
    font-size: var(--bsft-text-base);
    line-height: var(--bsft-leading-body);
    color: var(--bsft-color-text);
  }

  .bsft-local-settings-group {
    display: grid;
    gap: var(--bsft-space-4);
    margin: 0;
    min-width: 0;
    padding: var(--bsft-space-4);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    background: var(--bsft-color-surface);
    box-shadow: var(--bsft-shadow-sm);
  }

  .bsft-local-settings-group > legend {
    padding: 0 var(--bsft-space-1);
    font-weight: var(--bsft-weight-semibold);
  }

  /* Label and control share a line, the control at its end, so a column of toggles lines up on
     the right edge; the description and the error take the full width underneath. */
  .bsft-local-settings-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--bsft-space-1) var(--bsft-space-4);
  }

  .bsft-local-settings-row > label {
    font-size: var(--bsft-text-sm);
    font-weight: var(--bsft-weight-medium);
  }

  .bsft-local-settings-row > :is(input, select) {
    width: 12rem;
  }

  .bsft-local-settings-description,
  .bsft-local-settings-row > .bsft-form-field-errors {
    grid-column: 1 / -1;
    margin: 0;
  }

  .bsft-local-settings-description {
    font-size: var(--bsft-text-sm);
  }

  .bsft-local-settings-description,
  .bsft-local-settings-status {
    color: var(--bsft-color-muted);
  }

  .bsft-local-settings-actions {
    display: flex;
    gap: var(--bsft-space-2);
    flex-wrap: wrap;
  }

  /* --- consoles ------------------------------------------------------------------ */

  /* The operational consoles — API keys, webhooks, apps, invitations, members, workflow tasks,
     transfer jobs, notifications, web push, billing, settings, the operator listing and the
     account console — share one shape: a toolbar, a list of rows, a pager, and now and then a
     one-time disclosure. Each part is stated once here and each console only names its classes;
     what departs from the shape follows in the console's own block. The rules on a row's children
     are written in :where(), so a badge or a button inside a row keeps its own colour. */
  .bsft-apikeys,
  .bsft-webhooks,
  .bsft-webhook-deliveries-panel,
  .bsft-apps,
  .bsft-app-detail,
  .bsft-invitations,
  .bsft-org-members,
  .bsft-workflow-inbox,
  .bsft-transfer-jobs,
  .bsft-transfer-submit,
  .bsft-notification-inbox,
  .bsft-webpush,
  .bsft-billing,
  .bsft-billing-plans,
  .bsft-settings,
  .bsft-operator-listing,
  .bsft-idp-account-console {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-4);
    min-width: 0;
    font-family: var(--bsft-font);
    font-size: var(--bsft-text-base);
    line-height: var(--bsft-leading-body);
    color: var(--bsft-color-text);
  }

  /* A heading inside a console is a section heading, not a document title. */
  :where(.bsft-apikeys, .bsft-webhooks, .bsft-webhook-deliveries-panel, .bsft-apps, .bsft-app-detail, .bsft-invitations, .bsft-org-members, .bsft-workflow-inbox, .bsft-transfer-jobs, .bsft-transfer-submit, .bsft-notification-inbox, .bsft-webpush, .bsft-billing, .bsft-billing-plans, .bsft-settings, .bsft-operator-listing, .bsft-idp-account-console) :where(h2, h3) {
    margin: 0;
    font-size: var(--bsft-text-lg);
    font-weight: var(--bsft-weight-semibold);
    line-height: var(--bsft-leading-heading);
  }

  :where(.bsft-apikeys, .bsft-webhooks, .bsft-webhook-deliveries-panel, .bsft-apps, .bsft-app-detail, .bsft-invitations, .bsft-org-members, .bsft-workflow-inbox, .bsft-transfer-jobs, .bsft-transfer-submit, .bsft-notification-inbox, .bsft-webpush, .bsft-billing, .bsft-billing-plans, .bsft-settings, .bsft-operator-listing, .bsft-idp-account-console) > :where(p) {
    margin: 0;
  }

  /* Toolbars and the inline create forms: one wrapping row of controls. */
  .bsft-apikey-create,
  .bsft-apikey-toolbar,
  .bsft-webhook-create,
  .bsft-app-register,
  .bsft-invitation-toolbar,
  .bsft-org-member-add,
  .bsft-workflow-search,
  .bsft-transfer-toolbar,
  .bsft-notification-toolbar,
  .bsft-billing-plan-form,
  .bsft-billing-cancellations,
  .bsft-operator-filters,
  .bsft-idp-offered-factors,
  .bsft-idp-fallback-factors {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--bsft-space-2);
  }

  /* The text control of an inline create form takes the room; the buttons keep their size. A
     captioned field (Rule 8) is the control plus the caption over it, so the row's buttons line
     up with the control's bottom edge, not with the caption's. */
  :where(.bsft-apikey-create, .bsft-webhook-create, .bsft-app-register, .bsft-invitation-toolbar, .bsft-org-member-add, .bsft-workflow-search, .bsft-billing-plan-form) > :where(.bsft-input, .bsft-field) {
    flex: 1 1 14rem;
  }

  /* :is(), not :where(): the toolbar list above centres its items at a class's specificity, and
     a zero-specificity rule after it would lose. */
  :is(.bsft-apikey-create, .bsft-webhook-create, .bsft-app-register, .bsft-invitation-toolbar, .bsft-operator-filters, .bsft-org-member-add, .bsft-billing-plan-form) {
    align-items: flex-end;
  }

  /* A button alone in a console's column is as wide as its label, never as wide as the column
     (Rule 23): a column's cross-axis stretch would otherwise draw it from edge to edge. */
  :where(.bsft-apikeys, .bsft-webhooks, .bsft-webhook-deliveries-panel, .bsft-apps, .bsft-app-detail, .bsft-invitations, .bsft-org-members, .bsft-workflow-inbox, .bsft-transfer-jobs, .bsft-notification-inbox, .bsft-webpush, .bsft-billing, .bsft-billing-plans, .bsft-settings, .bsft-operator-listing, .bsft-operator-detail, .bsft-idp-account-console, .bsft-chat-conversations) > .bsft-button {
    align-self: flex-start;
  }

  .bsft-org-member-user-hint {
    flex-basis: 100%;
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
  }

  .bsft-apikey-list,
  .bsft-webhook-list,
  .bsft-webhook-delivery-list,
  .bsft-app-list,
  .bsft-app-versions,
  .bsft-app-violations,
  .bsft-invitation-list,
  .bsft-org-member-list,
  .bsft-workflow-list,
  .bsft-transfer-list,
  .bsft-notification-list,
  .bsft-webpush-list,
  .bsft-billing-plan-list,
  .bsft-billing-entitlements,
  :is(.bsft-idp-sessions, .bsft-idp-factors, .bsft-idp-linked-identities, .bsft-idp-remembered-devices) > ul {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  /* A row is a card: the name first, its details after it in the muted colour, its actions at the
     end of the line, and a paragraph on a line of its own. Everything in the row stands half a
     step apart, which is the one distance between buttons side by side (Rule 34). */
  .bsft-apikey,
  .bsft-webhook,
  .bsft-webhook-delivery,
  .bsft-app,
  .bsft-app-version,
  .bsft-app-violation,
  .bsft-invitation,
  .bsft-org-member,
  .bsft-workflow-task,
  .bsft-transfer-job,
  .bsft-notification,
  .bsft-webpush-subscription,
  .bsft-billing-plan-row,
  .bsft-billing-entitlement,
  .bsft-idp-session,
  .bsft-idp-factor-row,
  .bsft-idp-link-row,
  .bsft-idp-device-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--bsft-space-1) var(--bsft-space-2);
    padding: var(--bsft-space-3) var(--bsft-space-4);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    background: var(--bsft-color-surface);
  }

  :where(.bsft-apikey, .bsft-webhook, .bsft-webhook-delivery, .bsft-app, .bsft-app-version, .bsft-app-violation, .bsft-invitation, .bsft-org-member, .bsft-workflow-task, .bsft-transfer-job, .bsft-notification, .bsft-webpush-subscription, .bsft-billing-plan-row, .bsft-billing-entitlement, .bsft-idp-session, .bsft-idp-factor-row, .bsft-idp-link-row, .bsft-idp-device-row) > strong {
    font-weight: var(--bsft-weight-semibold);
  }

  /* A row's secondary facts read quieter than its name. The badge is left out inside :where(),
     because a bare :not() would lend the rule its class and outrank every single-class rule that
     gives one fact its own look — a delivery's error, a notification's severity. */
  :where(.bsft-apikey, .bsft-webhook, .bsft-webhook-delivery, .bsft-app, .bsft-app-version, .bsft-app-violation, .bsft-invitation, .bsft-org-member, .bsft-workflow-task, .bsft-transfer-job, .bsft-notification, .bsft-webpush-subscription, .bsft-billing-plan-row, .bsft-billing-entitlement, .bsft-idp-session, .bsft-idp-factor-row, .bsft-idp-link-row, .bsft-idp-device-row) > span:where(:not(.bsft-badge)),
  :where(.bsft-apikey, .bsft-webhook, .bsft-webhook-delivery, .bsft-app, .bsft-app-version, .bsft-app-violation, .bsft-invitation, .bsft-org-member, .bsft-workflow-task, .bsft-transfer-job, .bsft-notification, .bsft-webpush-subscription, .bsft-billing-plan-row, .bsft-billing-entitlement, .bsft-idp-session, .bsft-idp-factor-row, .bsft-idp-link-row, .bsft-idp-device-row) > time {
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
  }

  :where(.bsft-apikey, .bsft-webhook, .bsft-webhook-delivery, .bsft-app, .bsft-app-version, .bsft-app-violation, .bsft-invitation, .bsft-org-member, .bsft-workflow-task, .bsft-transfer-job, .bsft-notification, .bsft-webpush-subscription, .bsft-billing-plan-row, .bsft-billing-entitlement, .bsft-idp-session, .bsft-idp-factor-row, .bsft-idp-link-row, .bsft-idp-device-row) > p {
    flex-basis: 100%;
    margin: 0;
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
  }

  /* A row's actions — its buttons, a rename editor, its downloads — are one group at the end
     of the row (Rule 33), half a step apart inside it (Rule 34): a row with one action ends
     where a row with three does, and a row too narrow for the group wraps the group as a whole
     rather than leaving one button behind on the line above. */
  .bsft-row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--bsft-space-2);
    margin-inline-start: auto;
  }

  /* A captioned field in the group (a key's rename) stands on the buttons' line, not centred
     against its caption and its control together. */
  .bsft-row-actions:has(> .bsft-field) {
    align-items: flex-end;
  }

  /* The row states. The one the reader is in or has chosen takes the one picture of "chosen"
     (Rule 9): the selected tint and the accent bar on the start edge, as a list row does; one
     that is over — a revoked key, a paused endpoint, a finished job, a refused entitlement, a
     plan no longer offered — recedes onto the canvas; one that needs a decision is edged in the
     danger colour. */
  .bsft-app-open,
  .bsft-webpush-subscription-current,
  .bsft-idp-current {
    background: var(--bsft-selected-surface);
    box-shadow: inset 3px 0 var(--bsft-selected-accent);
  }

  :root[dir="rtl"] :is(.bsft-app-open, .bsft-webpush-subscription-current, .bsft-idp-current) {
    box-shadow: inset -3px 0 var(--bsft-selected-accent);
  }

  .bsft-apikey:not(.bsft-apikey-active),
  .bsft-webhook:not(.bsft-webhook-active),
  .bsft-billing-plan-row:not(.bsft-billing-plan-row-active),
  .bsft-billing-entitlement:not(.bsft-billing-entitlement-allowed),
  .bsft-transfer-job-terminal {
    color: var(--bsft-color-muted);
    background: var(--bsft-color-canvas);
  }

  /* A job's outcome is written in its status colour, as a badge writes one: the row's class
     names the state, the word takes the colour. */
  .bsft-transfer-job-completed > .bsft-transfer-job-status {
    color: var(--bsft-color-success);
  }

  .bsft-transfer-job-completed-with-errors > .bsft-transfer-job-status {
    color: var(--bsft-color-warning);
  }

  .bsft-transfer-job-failed > .bsft-transfer-job-status {
    color: var(--bsft-color-danger);
  }

  /* The other consoles' outcome words take the same discipline: the row names its state as a
     class, the word takes the status colour — a revoked key, a paused endpoint, a delivery
     that succeeded, failed or was given up. A neutral state stays in the muted colour. */
  .bsft-apikey:not(.bsft-apikey-active) > .bsft-apikey-status,
  .bsft-webhook-delivery-failed > .bsft-webhook-delivery-status,
  .bsft-webhook-delivery-given-up > .bsft-webhook-delivery-status {
    color: var(--bsft-color-danger);
  }

  .bsft-webhook:not(.bsft-webhook-active) > .bsft-webhook-status {
    color: var(--bsft-color-warning);
  }

  .bsft-webhook-delivery-succeeded > .bsft-webhook-delivery-status {
    color: var(--bsft-color-success);
  }

  .bsft-workflow-task-escalated,
  .bsft-app-violation {
    border-color: var(--bsft-color-danger-accent);
  }

  /* An unread notification is marked twice, by weight and by the bar on its start edge, so it
     never rests on colour alone — and without the selected tint, which is the picture of
     "chosen" (Rule 9) and not of "new". */
  .bsft-notification-unread {
    box-shadow: inset 3px 0 var(--bsft-selected-accent);
  }

  :root[dir="rtl"] .bsft-notification-unread {
    box-shadow: inset -3px 0 var(--bsft-selected-accent);
  }

  .bsft-notification-unread > .bsft-notification-subject {
    font-weight: var(--bsft-weight-bold);
  }

  .bsft-notification-severity {
    font-size: var(--bsft-text-xs);
    font-weight: var(--bsft-weight-semibold);
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .bsft-notification-severity-warning > .bsft-notification-severity {
    color: var(--bsft-color-warning);
  }

  :is(.bsft-notification-severity-error, .bsft-notification-severity-critical, .bsft-notification-severity-danger)
    > .bsft-notification-severity {
    color: var(--bsft-color-danger);
  }

  .bsft-notification-severity-success > .bsft-notification-severity {
    color: var(--bsft-color-success);
  }

  .bsft-webhook-delivery-error {
    color: var(--bsft-color-danger);
  }

  .bsft-invitation-never-expires {
    font-style: italic;
  }

  .bsft-workflow-task-due,
  .bsft-webhook-delivery-code,
  .bsft-transfer-job-progress {
    font-variant-numeric: tabular-nums;
  }

  .bsft-invitation-pager,
  .bsft-workflow-pager,
  .bsft-transfer-pager,
  .bsft-notification-pager,
  .bsft-operator-paging {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--bsft-space-2);
  }

  :where(.bsft-invitation-pager, .bsft-workflow-pager, .bsft-transfer-pager, .bsft-notification-pager, .bsft-operator-paging) > span {
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
  }

  /* When the rows on screen were read, beside the Refresh that reads them again (Rule 39): a
     caption in the pager's voice, one control high and centred in it, so it stands level with
     the button in a toolbar that aligns its items to the control's bottom edge. */
  .bsft-refreshed {
    display: inline-flex;
    align-items: center;
    min-height: var(--bsft-control-height);
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
  }

  /* The one-time disclosure of a secret, and the billing redirect's hand-off: a warning surface
     with the value set apart as something to copy. */
  .bsft-apikey-disclosure,
  .bsft-webhook-disclosure,
  .bsft-invitation-disclosure,
  .bsft-idp-disclosure,
  .bsft-billing-redirect {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--bsft-space-2);
    padding: var(--bsft-space-4);
    border: 1px solid var(--bsft-color-warning);
    border-radius: var(--bsft-radius-lg);
    background: var(--bsft-color-warning-surface);
    color: var(--bsft-color-text);
  }

  :where(.bsft-apikey-disclosure, .bsft-webhook-disclosure, .bsft-invitation-disclosure, .bsft-idp-disclosure, .bsft-billing-redirect) > :is(h3, p) {
    margin: 0;
  }

  .bsft-apikey-disclosure-note,
  .bsft-webhook-disclosure-note,
  .bsft-invitation-disclosure-note {
    color: var(--bsft-color-warning);
  }

  .bsft-idp-disclosure-values {
    display: flex;
    flex-wrap: wrap;
    gap: var(--bsft-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .bsft-apikey-secret,
  .bsft-webhook-secret,
  .bsft-invitation-ticket,
  .bsft-idp-disclosure-values > li,
  .bsft-apikey-previous-secret,
  .bsft-billing-plan-row-key,
  .bsft-app-violation-pointer,
  .bsft-idp-provisioning-uri,
  .bsft-idp-device-consent-origin,
  .bsft-webhook-delivery-code {
    font-family: var(--bsft-font-mono);
    font-size: var(--bsft-text-sm);
    overflow-wrap: anywhere;
  }

  /* A secret is selected whole on the first click; nobody should have to drag across it. */
  .bsft-apikey-secret,
  .bsft-webhook-secret,
  .bsft-invitation-ticket,
  .bsft-idp-disclosure-values > li {
    display: inline-block;
    padding: var(--bsft-space-1) var(--bsft-space-2);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-md);
    background: var(--bsft-color-surface);
    user-select: all;
  }

  /* Name/value pairs — a subscription, an invitation's context, an operator record, an app's releases. */
  .bsft-billing-subscription,
  .bsft-idp-invitation-context,
  .bsft-operator-detail-fields,
  .bsft-app-releases {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: var(--bsft-space-1) var(--bsft-space-4);
    margin: 0;
  }

  :where(.bsft-billing-subscription, .bsft-idp-invitation-context, .bsft-operator-detail-fields, .bsft-app-releases) dt {
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
  }

  :where(.bsft-billing-subscription, .bsft-idp-invitation-context, .bsft-operator-detail-fields, .bsft-app-releases) dd {
    margin: 0;
    overflow-wrap: anywhere;
  }

  /* The bell and the task badge: an ordinary button with the count pinned to its corner. */
  .bsft-notification-bell,
  .bsft-workflow-badge {
    position: relative;
  }

  .bsft-notification-count,
  .bsft-workflow-count {
    position: absolute;
    top: calc(0px - var(--bsft-space-1));
    inset-inline-end: calc(0px - var(--bsft-space-1));
  }

  /* The app manifest is JSON and is edited as such. */
  .bsft-app-manifest {
    min-height: 12rem;
    font-family: var(--bsft-font-mono);
    font-size: var(--bsft-text-sm);
  }

  /* --- transfers ------------------------------------------------------------------- */

  /* The submit surface is the file drop's shape: a dashed frame around the chooser, the progress
     and the outcome, with the drop zone's step between them rather than the console's.
     The native chooser's own button is dressed as the theme's. */
  .bsft-transfer-submit {
    gap: var(--bsft-space-2);
    padding: var(--bsft-space-4);
    border: 1px dashed var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    background: var(--bsft-color-surface);
  }

  .bsft-transfer-submit-input,
  .bsft-file-upload-input {
    font: inherit;
    font-size: var(--bsft-text-sm);
    color: var(--bsft-color-muted);
  }

  .bsft-transfer-submit-input::file-selector-button,
  .bsft-file-upload-input::file-selector-button,
  .bsft-file-drop-input::file-selector-button,
  :where(.bsft-shell) :where(input[type="file"])::file-selector-button {
    margin-inline-end: var(--bsft-space-2);
    padding: var(--bsft-control-padding-block) var(--bsft-button-padding-inline);
    border: 1px solid var(--bsft-control-border);
    border-radius: var(--bsft-radius-button);
    background: var(--bsft-color-surface);
    color: var(--bsft-color-text);
    font: inherit;
    font-size: var(--bsft-text-sm);
    font-weight: var(--bsft-weight-semibold);
    /* The button's own height, not the input's line: a chooser beside a download stands level
       with it. */
    min-height: var(--bsft-control-height);
    line-height: var(--bsft-leading-control);
    box-shadow: var(--bsft-shadow-sm);
    cursor: pointer;
  }

  /* --- operator listing ------------------------------------------------------------- */

  .bsft-operator-filter {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-1);
  }

  /* The same table as the list layout's, in the list's frame: the frame is the scroll
     container (Rule 21), so a table wider than its column scrolls inside it instead of widening
     the page, and the corner cells round its corners as the list's do. It shows the scroll cue
     over its surface, as the list's frame does. */
  .bsft-operator-list {
    min-width: 0;
    overflow-x: auto;
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    background: var(--bsft-scroll-cue-layers), var(--bsft-color-surface);
    box-shadow: var(--bsft-shadow-sm);
  }

  .bsft-operator-table {
    width: 100%;
    border-collapse: collapse;
  }

  .bsft-operator-table th,
  .bsft-operator-table td {
    padding: var(--bsft-space-3) var(--bsft-space-4);
    border-bottom: 1px solid var(--bsft-color-border);
    text-align: start;
  }

  .bsft-operator-table thead tr:first-child > :first-child {
    border-start-start-radius: calc(var(--bsft-radius-lg) - 1px);
  }

  .bsft-operator-table thead tr:first-child > :last-child {
    border-start-end-radius: calc(var(--bsft-radius-lg) - 1px);
  }

  .bsft-operator-table tbody tr:last-child > :first-child {
    border-end-start-radius: calc(var(--bsft-radius-lg) - 1px);
  }

  .bsft-operator-table tbody tr:last-child > :last-child {
    border-end-end-radius: calc(var(--bsft-radius-lg) - 1px);
  }

  .bsft-operator-table th {
    background: var(--bsft-color-canvas);
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-xs);
    font-weight: var(--bsft-weight-semibold);
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .bsft-operator-table td {
    font-size: var(--bsft-text-sm);
    font-variant-numeric: tabular-nums;
  }

  .bsft-operator-table tbody tr:last-child td {
    border-bottom: 0;
  }

  /* The chosen row: the selected tint and the accent bar on its start edge (Rule 9). */
  .bsft-operator-row-selected > td {
    background: var(--bsft-selected-surface);
    color: var(--bsft-color-selection-text);
  }

  .bsft-operator-row-selected > td:first-child {
    box-shadow: inset 3px 0 var(--bsft-selected-accent);
  }

  :root[dir="rtl"] .bsft-operator-row-selected > td:first-child {
    box-shadow: inset -3px 0 var(--bsft-selected-accent);
  }

  @media (hover: hover) {
    .bsft-operator-row:not(.bsft-operator-row-selected):hover > td {
      background: var(--bsft-color-hover);
    }
  }

  .bsft-operator-detail {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-3);
    padding: var(--bsft-space-4);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    background: var(--bsft-color-surface);
    box-shadow: var(--bsft-shadow-sm);
  }

  .bsft-operator-detail-content {
    max-height: 24rem;
    margin: 0;
    padding: var(--bsft-space-3);
    overflow: auto;
    border-radius: var(--bsft-radius-md);
    background: var(--bsft-color-canvas);
    font-family: var(--bsft-font-mono);
    font-size: var(--bsft-text-sm);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  /* --- settings panel ----------------------------------------------------------------- */

  .bsft-setting {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--bsft-space-2);
    padding: var(--bsft-space-4);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    background: var(--bsft-color-surface);
    box-shadow: var(--bsft-shadow-sm);
  }

  .bsft-setting-label {
    font-size: var(--bsft-text-lg);
    font-weight: var(--bsft-weight-semibold);
  }

  .bsft-setting-source {
    margin: 0;
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
  }

  .bsft-setting-own {
    color: var(--bsft-color-success);
  }

  .bsft-setting-value {
    align-self: stretch;
    margin: 0;
    padding: var(--bsft-space-3);
    overflow: auto;
    border-radius: var(--bsft-radius-md);
    background: var(--bsft-color-canvas);
    font-family: var(--bsft-font-mono);
    font-size: var(--bsft-text-sm);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  /* --- step-up landing ---------------------------------------------------------------- */

  /* A page with one question on it: a card the width of a form, the way in first. */
  .bsft-step-up {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--bsft-space-4);
    /* The width of the identity cards: one question on a page is one of them. */
    width: min(100%, 28rem);
    padding: var(--bsft-space-8);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-xl);
    background: var(--bsft-color-surface);
    box-shadow: var(--bsft-shadow-md);
    font-family: var(--bsft-font);
    font-size: var(--bsft-text-base);
    line-height: var(--bsft-leading-body);
    color: var(--bsft-color-text);
  }

  .bsft-step-up-title {
    margin: 0;
    font-size: var(--bsft-text-2xl);
    font-weight: var(--bsft-weight-semibold);
    line-height: var(--bsft-leading-heading);
    letter-spacing: -0.025em;
  }

  .bsft-step-up-explanation,
  .bsft-step-up-retrigger,
  .bsft-step-up-factors-label {
    margin: 0;
  }

  .bsft-step-up-retrigger,
  .bsft-step-up-factors-label {
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
  }

  .bsft-step-up-factors {
    margin: 0;
    padding-inline-start: 1.25em;
  }

  /* The actions are an action bar (Rule 2) and the continue is .bsft-button-primary (Rule 23):
     nothing here draws a button. The bar spans the card's column. */
  .bsft-step-up > .bsft-form-actions {
    align-self: stretch;
  }

  /* --- identity pages ------------------------------------------------------------------ */

  /* Sign-in, registration, reset, redemption, the second factor, enrollment and the two consents
     are each one card the width of a form, centred on whatever page hosts them. The form inside
     is the shared one and is not framed a second time (see the form section). */
  .bsft-idp-login,
  .bsft-idp-registration,
  .bsft-idp-reset,
  .bsft-idp-redemption,
  .bsft-idp-factor,
  .bsft-idp-enrollment,
  .bsft-idp-consent,
  .bsft-idp-device-consent {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-4);
    width: min(100%, 28rem);
    margin-inline: auto;
    padding: var(--bsft-space-8);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-xl);
    background: var(--bsft-color-surface);
    box-shadow: var(--bsft-shadow-md);
    font-family: var(--bsft-font);
    font-size: var(--bsft-text-base);
    line-height: var(--bsft-leading-body);
    color: var(--bsft-color-text);
  }

  :where(.bsft-idp-login, .bsft-idp-registration, .bsft-idp-reset, .bsft-idp-redemption, .bsft-idp-factor, .bsft-idp-enrollment, .bsft-idp-consent, .bsft-idp-device-consent) :where(h1, h2) {
    margin: 0;
    font-size: var(--bsft-text-2xl);
    font-weight: var(--bsft-weight-semibold);
    line-height: var(--bsft-leading-heading);
    letter-spacing: -0.025em;
  }

  :where(.bsft-idp-login, .bsft-idp-registration, .bsft-idp-reset, .bsft-idp-redemption, .bsft-idp-factor, .bsft-idp-enrollment, .bsft-idp-consent, .bsft-idp-device-consent) :where(p) {
    margin: 0;
  }

  :where(.bsft-idp-login, .bsft-idp-registration, .bsft-idp-reset, .bsft-idp-redemption, .bsft-idp-factor, .bsft-idp-enrollment, .bsft-idp-consent, .bsft-idp-device-consent) > :where(form) {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-4);
  }

  .bsft-idp-secondary-link {
    align-self: flex-start;
    font-size: var(--bsft-text-sm);
  }

  .bsft-idp-external-providers {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-2);
    padding-top: var(--bsft-space-4);
    border-top: 1px solid var(--bsft-color-border);
  }

  .bsft-idp-external-provider {
    justify-content: center;
  }

  .bsft-idp-password-policy {
    margin: 0;
    padding-inline-start: 1.25em;
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
  }

  /* The remember-me field is a checkbox beside its label, not a label over a box. */
  .bsft-idp-remember-device {
    flex-direction: row;
    align-items: center;
    gap: var(--bsft-space-2);
  }

  .bsft-idp-enrollment-mandatory {
    color: var(--bsft-color-warning);
    font-weight: var(--bsft-weight-medium);
  }

  .bsft-idp-webauthn {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-2);
  }

  .bsft-idp-masked-email {
    font-weight: var(--bsft-weight-semibold);
  }

  .bsft-idp-redemption-intro {
    color: var(--bsft-color-muted);
  }

  .bsft-idp-device-consent-question {
    font-size: var(--bsft-text-lg);
    font-weight: var(--bsft-weight-medium);
  }

  .bsft-idp-consent-scopes {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-3);
  }

  /* The section's caption is a field's caption (Rule 8's one caption style). */
  .bsft-idp-consent-scopes-title {
    font-size: var(--bsft-text-sm);
    font-weight: var(--bsft-weight-medium);
    line-height: var(--bsft-leading-body);
  }

  /* A list of scopes is a column, not the browser's bulleted list. */
  .bsft-idp-consent-scope-list {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  /* A group stands inside the card and takes the inner corner (Rule 32). */
  .bsft-idp-consent-scope-group {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-1);
    padding: var(--bsft-space-3) var(--bsft-space-4);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius);
    background: var(--bsft-color-canvas);
  }

  .bsft-idp-consent-scope-group-name {
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-xs);
    font-weight: var(--bsft-weight-semibold);
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .bsft-idp-consent-scope-title {
    font-weight: var(--bsft-weight-medium);
  }

  .bsft-idp-consent-scope-summary,
  .bsft-idp-consent-scope-undescribed {
    color: var(--bsft-color-muted);
    font-size: var(--bsft-text-sm);
  }

  .bsft-idp-consent-scope-undescribed {
    font-style: italic;
  }

  .bsft-idp-consent-scope-broad {
    color: var(--bsft-color-warning);
    background: var(--bsft-color-warning-surface);
  }

  .bsft-idp-retry {
    margin-inline-start: var(--bsft-space-2);
  }

  /* The account console's sections are cards of rows, like a console's list, with a card's
     inset (Rule 35). */
  .bsft-idp-sessions,
  .bsft-idp-factors,
  .bsft-idp-linked-identities,
  .bsft-idp-remembered-devices {
    display: flex;
    flex-direction: column;
    gap: var(--bsft-space-3);
    padding: var(--bsft-space-4);
    border: 1px solid var(--bsft-color-border);
    border-radius: var(--bsft-radius-lg);
    background: var(--bsft-color-surface);
    box-shadow: var(--bsft-shadow-sm);
  }

  /* --- theme-wide sizing, focus and disabled state --------------------------------------- */

  /* Three rules hold for every element the theme renders rather than for one component, so they
     are stated once here instead of in each section. Each is written at the lowest specificity
     that works, so any component rule above that says something more specific still wins.

     Border-box sizing for the theme's own elements and the native controls inside them, so a
     control's min-height is its height. Deliberately not every descendant: the shell wraps the
     whole application, and a reset reaching through it would reach the host's own markup. */
  :where([class^="bsft-"], [class*=" bsft-"]),
  :where([class^="bsft-"], [class*=" bsft-"])::before,
  :where([class^="bsft-"], [class*=" bsft-"])::after,
  :where([class^="bsft-"], [class*=" bsft-"]) :where(button, input, select, textarea) {
    box-sizing: border-box;
  }

  :where([class^="bsft-"], [class*=" bsft-"]) :where(button, input, select, textarea) {
    font: inherit;
  }

  /* The focus ring for a theme element no section gives a ring of its own. */
  :where([class^="bsft-"], [class*=" bsft-"]):focus-visible {
    outline: var(--bsft-focus-width) solid var(--bsft-color-focus);
    outline-offset: var(--bsft-focus-offset);
  }

  /* The disabled look for a theme element no section gives one of its own. */
  :where([class^="bsft-"], [class*=" bsft-"]):is(:disabled, [aria-disabled="true"]) {
    opacity: var(--bsft-disabled-opacity);
    cursor: not-allowed;
  }

  /* --- scroll cue ---------------------------------------------------------------------- */

  /* The scroll cue of a container that scrolls sideways: a shadow at an edge its content runs on past
     says that it scrolls, and only there, since a column or a bar cut off at the container's edge
     looks like the end of the content. The two shadows, in the scroll cue's colour and depth, stay at
     the container's edges (scroll) while two covers in --bsft-scroll-cover-color scroll with the
     content (local) and hide the shadow at an end it has reached, so content that fits shows neither;
     no script, so the cue follows every scroll and resize at once, and right-to-left content gets it
     at its own ends. The covers come first, so they paint over the shadows. The layers are declared
     on the container itself rather than once on the root, so a container (or an ancestor) that sets
     --bsft-scroll-cover-color to the colour it sits on is covered in that colour. A container with a
     background of its own lists its colour after these, and an image of its own that must show at
     its ends too (the day bars' baseline) before them, since the covers paint over whatever follows.
     Under forced colours the browser drops the gradients, so no cue is drawn there. This background
     cue lies under the content; the rules after it draw the cue over the content where they can. */
  .bsft-list,
  .bsft-operator-list,
  .bsft-list-window,
  .bsft-day-bars-chart,
  .bsft-chart-table,
  .bsft-bar-table,
  .bsft-graph-canvas,
  .bsft-graph-tables,
  .bsft-file-preview-csv,
  .bsft-shell-header-actions {
    --bsft-scroll-cue-layers:
      linear-gradient(to right, var(--bsft-scroll-cover-color) 50%, transparent) left / calc(var(--bsft-scroll-cue-size) * 2) 100% no-repeat local,
      linear-gradient(to left, var(--bsft-scroll-cover-color) 50%, transparent) right / calc(var(--bsft-scroll-cue-size) * 2) 100% no-repeat local,
      linear-gradient(to right, var(--bsft-scroll-cue-color), transparent) left / var(--bsft-scroll-cue-size) 100% no-repeat scroll,
      linear-gradient(to left, var(--bsft-scroll-cue-color), transparent) right / var(--bsft-scroll-cue-size) 100% no-repeat scroll;
  }

  /* The scroll cue over the content. A background lies under the container's children, so a child
     with a fill of its own (a button, a header cell, the row under the keyboard cursor, a bar) hides
     it exactly where it reaches the edge. Where the browser drives animations by scrolling, the
     shadows are drawn instead by ::before and ::after, which stick to the scrolling box's two edges
     above the content and fade in as soon as content runs on past an edge: the start shadow over the
     first cue's width of scrolling, the end shadow over the last. A box whose content fits has no
     scroll range, so its timeline is inactive and both stay transparent. The shadows belong to the
     box that holds the table (or the drawing) alone: the frame of BsftTable and of the operator
     listing, the window of a windowed list, the bar table, the graph's canvas and its tables, a
     chart's data table, and the table container of the paged list, whose frame around it also holds
     the filter bar and the pager. That box becomes a grid of one cell its table shares with both
     shadows, at least as wide as the box and as wide as the content needs; the day bars, a flex row,
     take the shadows as items that give their room back. The background layers are then dropped. A browser without scroll driven
     animations keeps the background cue. Each shadow starts to show a pixel into the scroll range,
     so the subpixel offset a right-to-left row of fractional widths starts at does not tint an end
     that has been reached. The section stands after the components, since it changes how the boxes
     lay out (the bar table is a flex column above). */
  @keyframes bsft-scroll-cue-start {
    from {
      opacity: 0;
    }

    to {
      opacity: 1;
    }
  }

  @keyframes bsft-scroll-cue-end {
    from {
      opacity: 1;
    }

    to {
      opacity: 0;
    }
  }

  /* The same two under names of their own for right-to-left content. A page that turns its direction
     round (a switch to Arabic) kept painting the shadows the old way round until the next scroll; a
     different name starts the animations afresh with the new direction. */
  @keyframes bsft-scroll-cue-start-rtl {
    from {
      opacity: 0;
    }

    to {
      opacity: 1;
    }
  }

  @keyframes bsft-scroll-cue-end-rtl {
    from {
      opacity: 1;
    }

    to {
      opacity: 0;
    }
  }

  @supports (animation-timeline: scroll()) {
    .bsft-list,
    .bsft-operator-list,
    .bsft-list-window,
    .bsft-bar-table,
    .bsft-graph-canvas,
    .bsft-day-bars-chart,
    .bsft-graph-tables,
    .bsft-chart-table,
    .bsft-shell-header-actions {
      --bsft-scroll-cue-layers: none;
    }

    :is(.bsft-table, .bsft-operator-list, .bsft-list-scroll, .bsft-bar-table, .bsft-graph-canvas) {
      display: grid;
      grid-template-columns: minmax(min-content, 100%);
    }

    :is(.bsft-table, .bsft-operator-list, .bsft-list-scroll, .bsft-bar-table) > table,
    .bsft-graph-canvas > svg,
    :is(.bsft-table, .bsft-operator-list, .bsft-list-scroll, .bsft-bar-table, .bsft-graph-canvas)::before,
    :is(.bsft-table, .bsft-operator-list, .bsft-list-scroll, .bsft-bar-table, .bsft-graph-canvas)::after {
      grid-area: 1 / 1;
    }

    :is(.bsft-table, .bsft-operator-list, .bsft-list-scroll, .bsft-bar-table, .bsft-graph-canvas, .bsft-day-bars-chart, .bsft-graph-tables, .bsft-chart-table)::before {
      content: "";
      position: sticky;
      z-index: 1;
      inset-inline-start: 0;
      justify-self: start;
      inline-size: var(--bsft-scroll-cue-size);
      background: linear-gradient(to right, var(--bsft-scroll-cue-color), transparent);
      pointer-events: none;
      opacity: 0;
      animation: bsft-scroll-cue-start linear both;
      animation-timeline: scroll(nearest inline);
      animation-range: 1px calc(var(--bsft-scroll-cue-size) + 1px);
    }

    :is(.bsft-table, .bsft-operator-list, .bsft-list-scroll, .bsft-bar-table, .bsft-graph-canvas, .bsft-day-bars-chart, .bsft-graph-tables, .bsft-chart-table)::after {
      content: "";
      position: sticky;
      z-index: 1;
      inset-inline-end: 0;
      justify-self: end;
      inline-size: var(--bsft-scroll-cue-size);
      background: linear-gradient(to left, var(--bsft-scroll-cue-color), transparent);
      pointer-events: none;
      opacity: 0;
      animation: bsft-scroll-cue-end linear both;
      animation-timeline: scroll(nearest inline);
      animation-range: calc(100% - var(--bsft-scroll-cue-size) - 1px) calc(100% - 1px);
    }

    :is(.bsft-table, .bsft-operator-list, .bsft-list-scroll, .bsft-bar-table, .bsft-graph-canvas, .bsft-day-bars-chart, .bsft-graph-tables, .bsft-chart-table):dir(rtl)::before {
      background: linear-gradient(to left, var(--bsft-scroll-cue-color), transparent);
      animation-name: bsft-scroll-cue-start-rtl;
    }

    :is(.bsft-table, .bsft-operator-list, .bsft-list-scroll, .bsft-bar-table, .bsft-graph-canvas, .bsft-day-bars-chart, .bsft-graph-tables, .bsft-chart-table):dir(rtl)::after {
      background: linear-gradient(to right, var(--bsft-scroll-cue-color), transparent);
      animation-name: bsft-scroll-cue-end-rtl;
    }

    /* A list's focused region scrolls inside the frame, whose ring is its outline, and an outline lies
       under the shadows, which stick in the scrolled content: they darkened the ring at every edge the
       table runs on past. While the region has the focus, each shadow carries the ring's part inside
       the frame's 1px border along its outer edge, and along the top and the bottom where the region
       starts or ends the frame, so the ring keeps the focus colour over the shadow as the windowed
       list's ring layer does. The shadow fades with the scroll, but the ring under it is the same
       colour, so it shows at any opacity. The shadow keeps its size and its gradient its place, so the
       focus changes nothing over the table. Only where the frame draws the ring (:has). */
    @supports selector(:has(*)) {
      .bsft-list > .bsft-list-scroll:focus-visible::before,
      .bsft-list > .bsft-list-scroll:focus-visible::after {
        box-sizing: border-box;
        border: 0 solid var(--bsft-color-focus);
        background-origin: border-box;
      }

      .bsft-list > .bsft-list-scroll:focus-visible::before {
        border-inline-start-width: calc(var(--bsft-focus-width) - 1px);
      }

      .bsft-list > .bsft-list-scroll:focus-visible::after {
        border-inline-end-width: calc(var(--bsft-focus-width) - 1px);
      }

      .bsft-list > .bsft-list-scroll:first-child:focus-visible::before,
      .bsft-list > .bsft-list-scroll:first-child:focus-visible::after {
        border-block-start-width: calc(var(--bsft-focus-width) - 1px);
      }

      .bsft-list > .bsft-list-scroll:last-child:focus-visible::before,
      .bsft-list > .bsft-list-scroll:last-child:focus-visible::after {
        border-block-end-width: calc(var(--bsft-focus-width) - 1px);
      }
    }

    /* A focused BsftTable is its own frame and scroller and draws its ring as its outline, under its own
       shadows: each carries the ring's part inside the 1px border the same way. The shadows span the
       table's whole height, so they always carry it along the top and the bottom too. */
    .bsft-table:focus-visible::before,
    .bsft-table:focus-visible::after {
      box-sizing: border-box;
      border: 0 solid var(--bsft-color-focus);
      border-block-width: calc(var(--bsft-focus-width) - 1px);
      background-origin: border-box;
    }

    .bsft-table:focus-visible::before {
      border-inline-start-width: calc(var(--bsft-focus-width) - 1px);
    }

    .bsft-table:focus-visible::after {
      border-inline-end-width: calc(var(--bsft-focus-width) - 1px);
    }

    /* A control the keyboard is on inside a container with the cue (a button in a cell, a day bar, a
       header action, a node of the graph) had its ring darkened by a shadow where it sat at an edge
       the content runs on past. The focused control is lifted to the shadows' level, and the end
       shadow, which comes after the content and so painted over it at that level, drops to level 0
       while the focus is inside: it still paints over every other part of the content, the start
       shadow stays where it was, and the control's ring lies over both. A drawing's nodes cannot take
       a level of their own, so the graph's drawing is lifted as a whole while a node has the focus;
       its backdrop is transparent, so the shadow still shows between its shapes, but every node, edge
       and label it draws at an edge then lies over the shadow. Nothing changes for a pointer, which
       shows no focus ring.
       The control is made relative only where nothing else positions it: the selector weighs nothing,
       so any rule of the theme that positions the control wins, as does a host style outside a layer
       or in a layer declared after bsft. A host style in a layer declared before bsft loses (Tailwind
       v4's utilities, for one), so an `absolute inset-0` control there turns relative while it has the
       ring unless the host marks it important. While the control is relative, an absolutely positioned
       descendant of it is placed against the control. A table, a drawing and a dialog or popover
       (native or by role) are never lifted: the windowed list's grid is ringed by its frame, and an
       overlay keeps the place it is given. A control in a windowed list's body is lifted by the rules
       after this one. */
    :where(.bsft-table, .bsft-operator-list, .bsft-list-scroll, .bsft-bar-table, .bsft-graph-canvas, .bsft-day-bars-chart, .bsft-graph-tables, .bsft-chart-table, .bsft-shell-header-actions) :where(:focus-visible:not(table, svg, dialog, [role="dialog"], [role="alertdialog"], [popover], .bsft-list-window tbody *)) {
      position: relative;
      z-index: 1;
    }

    /* A windowed list's header cells stick over its rows, so a row control lifted over the shadows
       alone would paint over the header once its row scrolls under it, and a header control (a sort
       button, the select-all box) cannot be lifted out of its sticky cell at all. While a control in
       the window's header or body has the keyboard focus, the window takes a stacking context of its
       own, a row control is lifted inside it and the header cells one level above it: the ring lies
       over both shadows in the rows and in the header, and the header still covers a row control
       scrolled under it. The header cells then lie over the shadows too, so the cue shows only below
       the header while the focus is on a control in the table. The stacking context keeps the window
       under the shell's header. It is not taken while the window holds a layer that must cover the
       whole page: every overlay and backdrop the theme renders carries .bsft-overlay (a dialog's
       overlay, the backdrop a menu, a popover, a picker or a combobox is dismissed by, the page's
       file drop overlay), and a dialog is told by its role. A native dialog shown modal and an open popover are in the top layer,
       which no stacking context confines, so they need no exception. */
    .bsft-list-window:has(:is(thead, tbody) :focus-visible):not(:has(.bsft-overlay, [role="dialog"], [role="alertdialog"])) {
      isolation: isolate;
    }

    :where(.bsft-list-window:has(:is(thead, tbody) :focus-visible):not(:has(.bsft-overlay, [role="dialog"], [role="alertdialog"])) tbody) :where(:focus-visible:not(table, svg)) {
      position: relative;
      z-index: 1;
    }

    .bsft-list-window:has(:is(thead, tbody) :focus-visible):not(:has(.bsft-overlay, [role="dialog"], [role="alertdialog"])) thead th {
      z-index: 2;
    }

    .bsft-list-window:has(:is(thead, tbody) :focus-visible):not(:has(.bsft-overlay, [role="dialog"], [role="alertdialog"]))::after {
      z-index: 0;
    }

    :where(.bsft-graph-canvas) > svg:has(:focus-visible) {
      z-index: 1;
    }

    :is(.bsft-table, .bsft-operator-list, .bsft-list-scroll:not(.bsft-list-window), .bsft-bar-table, .bsft-graph-canvas, .bsft-day-bars-chart, .bsft-graph-tables, .bsft-chart-table):has(:focus-visible)::after,
    .bsft-shell-header--with-actions .bsft-shell-header-actions:has(:focus-visible)::after {
      z-index: 0;
    }

    /* The day bars are a flex row with a 2px gap: each shadow is an item that hands back its own
       width and the gap after it. */
    .bsft-day-bars-chart::before,
    .bsft-day-bars-chart::after {
      flex: none;
    }

    .bsft-day-bars-chart::before {
      margin-inline-end: calc(-1 * (var(--bsft-scroll-cue-size) + 2px));
    }

    .bsft-day-bars-chart::after {
      margin-inline-start: calc(-1 * (var(--bsft-scroll-cue-size) + 2px));
    }

    /* The graph's column of tables and a chart's data table under its summary hold more than one
       child, so a shadow cannot share a single cell with them. Each becomes a grid of one column as
       wide as its widest table; its first child and both shadows share the first cell, the others
       follow in rows of their own. A shadow there has no height of its own: its gradient is a border
       image reaching down from the top past every row, ink the container clips at its bottom edge
       and that adds nothing to what it scrolls. */
    .bsft-graph-tables,
    .bsft-chart-table {
      display: grid;
      grid-template-columns: minmax(min-content, 100%);
    }

    .bsft-graph-tables > :first-child,
    .bsft-chart-table > summary,
    :is(.bsft-graph-tables, .bsft-chart-table)::before,
    :is(.bsft-graph-tables, .bsft-chart-table)::after {
      grid-area: 1 / 1;
    }

    :is(.bsft-graph-tables, .bsft-chart-table)::before,
    :is(.bsft-graph-tables, .bsft-chart-table)::after {
      align-self: start;
      block-size: 0;
    }

    :is(.bsft-graph-tables, .bsft-chart-table)::before,
    :is(.bsft-graph-tables, .bsft-chart-table):dir(rtl)::after {
      border-image: linear-gradient(to right, var(--bsft-scroll-cue-color), transparent) fill 0 / 0 / 0 0 10000px 0;
    }

    :is(.bsft-graph-tables, .bsft-chart-table)::after,
    :is(.bsft-graph-tables, .bsft-chart-table):dir(rtl)::before {
      border-image: linear-gradient(to left, var(--bsft-scroll-cue-color), transparent) fill 0 / 0 / 0 0 10000px 0;
    }
  }

  /* --- selection under forced colours ------------------------------------------------- */

  /* Forced colours replace every fill with Canvas and every text and border colour with CanvasText,
     and drop box shadows altogether. A selection marked by a fill, a border colour or an inset ring
     then looks exactly like everything around it, while the focus ring, an outline, survives. Each
     selection surface is therefore marked with the system's own selection colours, which forced
     colours keep because they are system colours: the Highlight fill under HighlightText, as the
     platform marks a selected item itself. Text inside inherits HighlightText; a button or a link
     inside does not, since forced colours give it ButtonText or LinkText of its own, so those are
     set to HighlightText too. */
  @media (forced-colors: active) {
    .bsft-theme-option[aria-pressed="true"],
    .bsft-scope-option[aria-pressed="true"],
    .bsft-transfer-kind-toggle[aria-pressed="true"],
    .bsft-menu-item[role="menuitemradio"][aria-checked="true"],
    .bsft-chip[aria-checked="true"],
    .bsft-chip[aria-pressed="true"],
    .bsft-nav-item[aria-current="page"],
    .bsft-choice-selected,
    .bsft-combobox-option-selected,
    .bsft-timepicker-option-selected,
    .bsft-calendar-day-selected,
    .bsft-tree-selected,
    .bsft-graph-row-selected,
    .bsft-list tbody tr[aria-selected="true"] > td,
    .bsft-chat-conversation[aria-current="true"] {
      border-color: Highlight;
      background: Highlight;
      color: HighlightText;
    }

    :is(.bsft-graph-row-selected, .bsft-tree-selected, .bsft-list tbody tr[aria-selected="true"] > td, .bsft-chat-conversation[aria-current="true"]) :is(a, button) {
      color: HighlightText;
    }

    /* A focus ring drawn inside a selected cell or row sits on the Highlight fill, so it takes the
       colour that stands on that fill. */
    .bsft-calendar-day-selected:focus-visible,
    .bsft-tree-selected:focus-visible,
    :is(.bsft-graph-row-selected, .bsft-tree-selected, .bsft-list tbody tr[aria-selected="true"] > td, .bsft-chat-conversation[aria-current="true"]) :focus-visible {
      outline-color: HighlightText;
    }

    /* Where the keyboard is in a listbox that keeps the focus on its input (aria-activedescendant):
       a fill, gone here, so the cursor is an inset ring instead, in CanvasText, or in HighlightText
       on the option that is also selected. */
    .bsft-combobox-option-active,
    .bsft-timepicker-option-active,
    .bsft-command-palette-option-active,
    .bsft-list-window .bsft-list-row-active {
      outline: 2px solid CanvasText;
      outline-offset: -2px;
    }

    .bsft-combobox-option-active.bsft-combobox-option-selected,
    .bsft-timepicker-option-active.bsft-timepicker-option-selected,
    .bsft-list-window .bsft-list-row-active[aria-selected="true"] {
      outline-color: HighlightText;
    }

    /* The current navigation entry is marked by its Highlight fill, so its focus ring, which would be
       a Highlight-coloured outline on that fill, takes HighlightText, inset clear of the fill's edge. */
    .bsft-nav-item[aria-current="page"]:focus-visible {
      outline: var(--bsft-focus-width) solid HighlightText;
      outline-offset: calc(-2 * var(--bsft-focus-width));
    }

    /* Today's inset ring and the range's tinted span are a shadow and a fill, both gone here. An
       inset outline marks today, a dashed one the days between a range's ends; a focus ring, the
       same outline property, replaces either while the cell has focus. */
    .bsft-calendar-day-today {
      outline: 1px solid CanvasText;
      outline-offset: -4px;
    }

    .bsft-calendar-day-today.bsft-calendar-day-selected {
      outline-color: HighlightText;
    }

    .bsft-calendar-day-inrange {
      outline: 1px dashed CanvasText;
      outline-offset: -4px;
    }
  }

  /* Windows high-contrast mode drops backgrounds and shadows, so the active tab, which relies on
     them, gets an outline (the current navigation entry takes the Highlight fill above), and the
     floating panels keep a visible edge. */
  @media (forced-colors: active) {
    .bsft-tab-active {
      outline: 2px solid Highlight;
      outline-offset: -2px;
    }

    .bsft-dialog,
    .bsft-dialog-panel,
    .bsft-popover-panel {
      border-color: CanvasText;
    }
  }

  @media print {
    .bsft-shell-header,
    .bsft-shell-nav,
    .bsft-shell-nav-toggle,
    .bsft-shell-nav-backdrop,
    .bsft-toasts,
    .bsft-list-filterbar,
    .bsft-list-bulk,
    .bsft-list-pager,
    .bsft-file-drop,
    .bsft-page-drop {
      display: none;
    }

    /* The shell stops reserving a viewport's height: on paper that is a blank first sheet. */
    .bsft-shell {
      display: block;
      min-height: 0;
    }

    /* A scroll container prints only what was scrolled into view, so both layouts give up their
       overflow and let the content paginate instead. */
    .bsft-list,
    .bsft-detail,
    .bsft-scroll-region {
      overflow: visible;
    }

    /* A row split across a page break is a row the reader has to reassemble; the header repeats
       on every sheet so the columns stay named. */
    .bsft-list tr {
      break-inside: avoid;
    }

    .bsft-list thead {
      display: table-header-group;
    }

    /* The refreshed theme's canvas, shell padding and elevation are screen affordances: paper
       gets the content edge to edge and no shadows that a printer turns into grey smudges. */
    .bsft-shell {
      background: transparent;
    }

    .bsft-shell-main {
      padding: 0;
    }

    .bsft-dialog,
    .bsft-dialog-panel,
    .bsft-popover-panel,
    .bsft-toast,
    .bsft-dashboard-widget,
    .bsft-metric-tile,
    .bsft-local-settings-group,
    .bsft-form,
    .bsft-list,
    .bsft-operator-table,
    .bsft-operator-detail,
    .bsft-setting,
    .bsft-step-up,
    .bsft-idp-sessions,
    .bsft-idp-factors,
    .bsft-idp-linked-identities,
    .bsft-idp-remembered-devices {
      box-shadow: none;
    }
  }

  /* --- API key and personal-token console ------------------------------------ */
  .bsft-apikeys {
    display: grid;
    gap: var(--bsft-space-4);
    min-width: 0;
  }
  .bsft-apikey-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--bsft-space-2);
  }
  .bsft-apikey-create > .bsft-input {
    flex: 1 1 12rem;
    min-width: 0;
  }
  .bsft-apikey-list {
    display: grid;
    gap: var(--bsft-space-2);
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .bsft-apikey-details {
    display: grid;
    flex: 1 1 14rem;
    min-width: 0;
    gap: var(--bsft-space-1);
    overflow-wrap: anywhere;
  }
}
