/* components.css - shared widget and layout classes (loaded on every page
   from page_configs/default.json). Pairs with widgets.js (WSpark, WModal,
   WRange, WToast, WMenu, WPos), dialogs.js (WDialog) and the game
   lobbies' markup (pages/games_lobby.py). A `:where(body:not(.ui))` rule
   keeps a legacy value for the pages without body.ui - the FF tables
   (DECISIONS 25) - and reaches nothing else.
   Flat chrome throughout: radius tokens, border/background hover, symmetric
   active states, no motion beyond a spinner. */

/* ── Floating cards: spark hover card and tooltip share one chrome ────── */

.w-spark,
.w-tip {
	position: fixed;
	z-index: var(--z-tip);
	padding: var(--sp-2);
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
	pointer-events: none;
}

.w-spark {
	display: none;               /* WSpark shows it as flex */
	flex-direction: column;
	gap: var(--sp-1);
}

.w-tip {
	max-width: 300px;
	font-size: var(--fs-sm);
	line-height: 1.5;
	color: var(--text);
}

.w-tip[hidden] {
	display: none;
}

.w-spark__title {
	margin: 0;
	font-size: var(--fs-xs);
}

.w-spark canvas {
	display: block;
	width: 320px;
	height: 100px;
}

/* ── Page head and section card ──────────────────────────────────────── */

/* The game lobbies' head and panels (pages/games_lobby.py): the head as
   .l-page__head, a panel as .c-panel. */
.page-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--sp-2) var(--sp-4);
}

/* Every page h1 is 28 px: public and admin heads alike. */
.page-head__title {
	margin: 0;
	color: var(--text);
	font-size: var(--fs-2xl);
	font-weight: 600;
	line-height: 1.25;
}

.section-card {
	display: flex;
	flex-direction: column;
	gap: var(--sp-2);
	min-inline-size: 0;
	padding: var(--sp-3) var(--sp-4);
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
}

.section-card__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--sp-2) var(--sp-4);
}

.section-card__head h2 {
	margin: 0;
	font-size: var(--fs-title);
	font-weight: 600;
	line-height: 1.25;
}

/* A head's button can hold one glyph: at least as wide as it is tall. */
.section-card__head .btn { min-inline-size: var(--ctl-h-btn); }

.section-card__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sp-2);
}

/* ── Text primitives ─────────────────────────────────────────────────── */

/* One muted line: "No X." empty states and "Loading..." placeholders. */
.w-empty {
	color: var(--text-muted);
	font-size: var(--fs-sm);
	margin: 0;
}

:where(body:not(.ui)) .w-empty {
	margin: 0.35rem 0; /* lint: ignore[css-spacing] the FF tables (no body.ui) keep this value, DECISIONS 25 */
}

/* A held block (reserve.js) keeps its children packed at the top while it is
   taller than they are, so they do not drift as they fill in. */
[data-reserve-held] {
	align-content: start;
}

/* Small uppercase label above a value or group. */
.eyebrow {
	display: block;
	font-size: var(--fs-xs);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--text-muted);
}

/* ── Rows and lists ──────────────────────────────────────────────────── */

/* Input + button on one line (whitelist add, join-by-code, chat). */
/* Stretch, not centre: the field takes the button's height whatever size
   the button is (a .btn beside a 0.3rem-padded input left a step). */
.inline-form {
	display: flex;
	align-items: stretch;
	gap: var(--sp-2);
}

.inline-form input,
.inline-form select {
	flex: 1;
	min-width: 0;
	font-family: inherit;
	font-size: var(--fs-sm);
	color: var(--text);
	background: var(--surface-3);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	padding: var(--ctl-pad-field);
}

/* ── Modal (WModal + modal_shell) ──────────────────────────────────────
   Overlays take their layer from tokens.css (--z-*). */

.modal-backdrop {
	position: fixed;
	inset: 0;
	z-index: var(--z-modal);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--sp-4);
	background: var(--modal-backdrop);
}

.modal-backdrop[hidden] {
	display: none;
}

body.modal-open {
	overflow: hidden;
}

.modal {
	width: 100%;
	max-width: min(520px, 92vw);
	max-height: 90vh;
	overflow: auto;
	overscroll-behavior: contain;
	box-sizing: border-box;
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	display: flex;
	flex-direction: column;
	gap: var(--sp-3);
	padding: var(--sp-4);
}

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

.modal__head :is(h2, h3) {
	margin: 0;
	font-size: var(--fs-base);
}

.modal__close {
	appearance: none;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--text-muted);
	font: inherit;
	font-size: var(--fs-sm);
	line-height: 1;
	padding: var(--sp-1) var(--sp-2);
	cursor: pointer;
}

body.ui .modal__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-inline-size: var(--ctl-h-btn);
	min-block-size: var(--ctl-h-btn);
}

.modal__close:hover {
	border-color: var(--border);
	background: var(--bg);
	color: var(--text);
}

.modal__body {
	display: grid;
	gap: var(--sp-3);
}

.modal__actions {
	display: flex;
	justify-content: flex-end;
	gap: var(--sp-2);
}

/* ── Dialog (WDialog: dialogs.js alert / confirm / prompt) ─────────────── */

.wdialog__overlay {
	position: fixed;
	inset: 0;
	z-index: var(--z-dialog);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--sp-4);
	background: var(--modal-backdrop);
}

.wdialog__panel {
	display: flex;
	flex-direction: column;
	width: min(420px, 94vw);
	max-height: 85vh;
	overflow: hidden;
	background: var(--surface-2);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	font-size: var(--fs-sm);
}

.wdialog__title {
	font-weight: 600;
	padding: var(--sp-4) var(--sp-4) var(--sp-1);
}

.wdialog__msg {
	padding: var(--sp-2) var(--sp-4) var(--sp-4);
	line-height: 1.4;
	white-space: pre-wrap;
	word-break: break-word;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.wdialog__field {
	display: flex;
	padding: 0 var(--sp-4) var(--sp-4);
}

.wdialog__input {
	flex: 1;
	min-width: 0;
	padding: var(--sp-2);
	border-radius: var(--radius-sm);
	border: 1px solid var(--border-strong);
	background: var(--surface-3);
	color: var(--text-muted);
	font: inherit;
	font-size: var(--fs-sm);
}

.wdialog__input:focus {
	outline: none;
	border-color: var(--text-muted);
	box-shadow: var(--focus-ring);
}

.wdialog__actions {
	display: flex;
	justify-content: flex-end;
	gap: var(--sp-2);
	padding: var(--sp-2) var(--sp-4);
	border-top: 1px solid var(--border);
}

/* On a ui page a dialog is the site's Modal (dialogs.js), above any modal
   it was asked from. */
body.ui .modal-backdrop[data-wdialog-overlay] { z-index: var(--z-dialog); }
/* An overlay's buttons start the line, as a form's do (a form in a modal
   carries its own). */
body.ui .modal__actions { justify-content: flex-start; }

/* One overlay on ui pages: a modal (and so a dialog) hangs from the same
   line near the top, so a message or step that changes the height grows
   the box downwards and never moves its head. */
body.ui .modal-backdrop { align-items: flex-start; padding-block-start: var(--sp-8); }
body.ui .modal {
	inline-size: 100%;
	max-inline-size: 30rem;
	max-block-size: calc(100dvh - var(--sp-8) - var(--sp-4));
	background: var(--bg);
	border-color: var(--border-strong);
}
@media (max-width: 600px) {
	body.ui .modal-backdrop { padding-block-start: var(--sp-4); }
	body.ui .modal { max-block-size: calc(100dvh - 2 * var(--sp-4)); }
}

:where(body:not(.ui)) .wdialog__title {
	padding: 0.9rem 1.1rem 0.3rem; /* lint: ignore[css-spacing] the FF tables (no body.ui) keep this value, DECISIONS 25 */
}

:where(body:not(.ui)) .wdialog__msg {
	padding: 0.5rem 1.1rem 0.9rem; /* lint: ignore[css-spacing] the FF tables (no body.ui) keep this value, DECISIONS 25 */
}

:where(body:not(.ui)) .wdialog__field {
	padding: 0 1.1rem 0.9rem; /* lint: ignore[css-spacing] the FF tables (no body.ui) keep this value, DECISIONS 25 */
}

:where(body:not(.ui)) .wdialog__input {
	padding: 0.5rem 0.6rem; /* lint: ignore[css-spacing] the FF tables (no body.ui) keep this value, DECISIONS 25 */
}

:where(body:not(.ui)) .wdialog__actions {
	padding: 0.6rem 1.1rem; /* lint: ignore[css-spacing] the FF tables (no body.ui) keep this value, DECISIONS 25 */
}

/* ── Toast (WToast) ──────────────────────────────────────────────────── */

.w-toast {
	position: fixed;
	bottom: 1.25rem;
	left: 0;
	right: 0;
	margin: 0 auto;
	width: max-content;
	max-width: min(420px, 90vw);
	z-index: var(--z-toast);
	padding: var(--sp-2) var(--sp-4);
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	font-size: var(--fs-sm);
	color: var(--text);
	overflow-wrap: anywhere;                  /* an unbroken name stays inside the screen */
	pointer-events: none;
}

.w-toast[hidden] {
	display: none;
}

/* A toast holding an action (WToast opts.action: Undo) takes the pointer
   for its button; the button is the accent's text, as a link. */
.w-toast[role="group"] { pointer-events: auto; }
.w-toast .btn--bare { color: var(--accent); }
/* Under the touch layer the button (Undo) is a 44 px target, not a word. */
@media (max-width: 600px), (pointer: coarse) {
	.w-toast .btn--bare { min-block-size: var(--ctl-h-btn); min-inline-size: var(--ctl-h-btn); padding-inline: var(--sp-2); }
}

/* ── Context menu (WMenu) ────────────────────────────────────────────── */

.w-menu__backdrop {
	position: fixed;
	inset: 0;
	z-index: var(--z-menu);
}

.w-menu {
	position: fixed;
	z-index: calc(var(--z-menu) + 1);
	min-width: 11rem;
	padding: var(--sp-1) 0;
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
}

.w-menu[hidden] {
	display: none;
}

.w-menu__item {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
	width: 100%;
	padding: var(--sp-2) var(--sp-4);
	box-sizing: border-box;
	background: none;
	border: none;
	font: inherit;
	font-size: var(--fs-sm);
	color: var(--text);
	text-align: left;
	cursor: pointer;
}

.w-menu__item:hover {
	background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
}

.w-menu__item--danger:hover {
	background: color-mix(in srgb, var(--danger) 8%, var(--surface-2));
	color: var(--danger);
}

/* The delete item's icon is red, not its box. */
.w-menu__item--danger .icon-btn__img {
	filter: invert(1) sepia(1) saturate(6) hue-rotate(315deg);
}

.w-menu__item[disabled] {
	opacity: 0.4;
	cursor: not-allowed;
}

/* The busy ring's turn (a working button, a chart waiting for its data). */
@keyframes w-spin {
	to { transform: rotate(360deg); }
}

/* ── Copy chip (copy_chip / _minecraft_host_chip + copy_tooltip.js) ──── */

.minecraft-host-chip {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-1);
	padding: var(--sp-1) var(--sp-2) var(--sp-1) var(--sp-1);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--bg);
	box-sizing: border-box;
	max-width: 100%;
	min-width: 0;
}

:where(body:not(.ui)) .minecraft-host-chip {
	gap: 0.375rem; /* lint: ignore[css-spacing] the FF tables (no body.ui) keep this value, DECISIONS 25 */
	padding: 0.25rem 0.5rem 0.25rem 0.375rem; /* lint: ignore[css-spacing] the FF tables (no body.ui) keep this value, DECISIONS 25 */
}

.minecraft-host-text {
	font-family: var(--font-mono);
	font-weight: 600;
	/* Clip the text to its box so copy_tooltip.js can detect overflow and
	   shrink the font to fit instead of letting the value spill or truncate. */
	min-width: 0;
	overflow: hidden;
	white-space: nowrap;
}
/* On a ui page the text shrinks no further than 13 px; what still does not
   fit ends in an ellipsis (the button copies the whole value). */
body.ui .minecraft-host-text { text-overflow: ellipsis; }

/* The copy button is a square of the chip height, which the touch layer
   lifts to 44 px (tokens.css). */
.minecraft-host-copy {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	inline-size: var(--ctl-h-chip);
	block-size: var(--ctl-h-chip);
	border-radius: var(--radius-sm);
	border: 1px solid transparent;
	background: transparent;
	cursor: pointer;
	padding: 0;
}

/* The FF tables (no body.ui) keep the 22 px round button. */
:where(body:not(.ui)) .minecraft-host-copy {
	inline-size: 1.375rem;
	block-size: 1.375rem;
	border-radius: 50%;
}

.minecraft-host-copy img {
	width: 14px;
	height: 14px;
	display: block;
	opacity: 0.75;
}

.minecraft-host-tooltip {
	position: absolute;
	right: 0.375rem;
	top: 50%;
	font-size: var(--fs-xs);
	padding: var(--sp-1) var(--sp-2);
	border-radius: var(--radius-sm);
	background: var(--surface-2);
	border: 1px solid var(--border);
	color: var(--text-muted);
	opacity: 0;
	transform: translateY(-50%);
	pointer-events: none;
	z-index: 2;
}

.minecraft-host-chip {
	position: relative;
	overflow: hidden;
}

.minecraft-host-chip.is-copied .minecraft-host-tooltip { opacity: 1; }

/* The FF tables (no body.ui) keep their tooltip's
   padding and its scale-in. */
:where(body:not(.ui)) .minecraft-host-tooltip {
	padding: 0.188rem 0.5rem; /* lint: ignore[css-spacing] the FF tables (no body.ui) keep this value, DECISIONS 25 */
	transform: translateY(-50%) scale(0.95);
	transition: opacity 140ms ease, transform 140ms ease;
}
:where(body:not(.ui)) .minecraft-host-chip.is-copied .minecraft-host-tooltip { transform: translateY(-50%) scale(1); }

.minecraft-host-copy:hover {
	border-color: var(--border);
	background: var(--surface-2);
}

.minecraft-host-chip.is-copied {
	border-color: var(--accent);
	box-shadow: var(--focus-ring);
}

/* == ui primitives and components (FRAMEWORK.md 3.7) ======================
   What src/util/webpage_builder/ui emits. Every rule is a new class, scoped
   to body.ui (ui pages only), or a leaf class legacy markup does not use, so
   legacy and Forgetful Fish pages are unchanged. Sizes come from tokens.css;
   a row sets --row-ctl-h and each control reads it (ruling 15). */

/* -- Reset inside ui pages ------------------------------------------- */
/* The page ground is the darkest surface; the sidebar and what a page raises
   (table heads, hovered rows, callouts) sit one step above it. */
body.ui main { padding: 0; background: var(--bg); }
body.ui :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl, dd, figure, form, fieldset, pre, blockquote, table) { margin: 0; }
body.ui :where(ul, ol) { padding: 0; }
body.ui :where(h1, h2, h3, h4, h5, h6) { line-height: 1.25; }

/* -- Page scroll (a page with the shell) ------------------------------
   Focus moves, anchor jumps and find-in-page stop below the sticky header. */
html:has(> body[data-shell]) { scroll-padding-block-start: calc(var(--header-h) + var(--sp-4)); }

/* -- Focus --------------------------------------------------------------
   One ring for every keyboard focus outside the game pin. A field wears it
   on its border; a control inside a clipped strip wears it inside. */
:focus-visible:not(:where(html.ff-pin *)) {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}
/* The skip link's target is the whole page: it takes focus, not a ring. */
main[tabindex="-1"]:focus { outline: none; }

/* -- Page ------------------------------------------------------------- */
.l-page {
	box-sizing: border-box;
	inline-size: 100%;
	max-inline-size: var(--l-w);
	margin-inline: auto;
	padding: var(--sp-4) var(--page-gutter) var(--sp-6);
	display: flex;
	flex-direction: column;
	gap: var(--sp-4);                         /* Rhythm.HEAD */
	font-size: var(--fs-sm);
	line-height: 1.6;
}
/* Widths: a form or a single card, the reading column, and the pages that
   fill the space beside the sidebar. */
.l-w-narrow { --l-w: calc(var(--w-narrow) + 2 * var(--page-gutter)); }
.l-w-page { --l-w: calc(var(--w-page) + 2 * var(--page-gutter)); }
.l-w-wide, .l-w-admin, .l-w-full { --l-w: none; }
/* An admin page of any width starts at the admin pages' left edge beside
   the sidebar: moving between sidebar items never moves the column. */
.l-page[data-area="admin"]:is(.l-w-narrow, .l-w-page) { margin-inline-start: 0; }

/* Breadcrumbs: on a page that hangs from another one (shell.trail). */
.l-crumbs {
	color: var(--text-muted);
	font-size: var(--fs-sm);
	line-height: 1.25;
}
.l-crumbs > ol {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 0 var(--sp-2);
}
.l-crumbs li {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
	min-block-size: var(--ctl-h-chip);
}
/* The slash trails its item, so a wrapped line never starts with one. */
.l-crumbs li:not(:last-child)::after { content: "/" / ""; color: var(--border-strong); }
.l-crumbs a {
	display: inline-flex;
	align-items: center;
	min-block-size: var(--ctl-h-chip);
	color: var(--text-muted);
}
.l-crumbs a:hover { color: var(--accent-hover); }
.l-crumbs [aria-current="page"] { color: var(--text); }
/* At touch height an item stays one line tall and its link stands 44 px
   around it, over the page's padding and the gap to the head: the trail
   costs the first screen one line. Wrapped lines keep their targets apart.
   A link's text starts its box, so the first one lines up with the h1.
   The current page is left out: the h1 under the trail names it, and alone
   on a wrapped line it read as a subtitle. */
@media (max-width: 600px), (pointer: coarse) {
	.l-crumbs > ol { row-gap: var(--sp-6); }
	.l-crumbs li { min-block-size: 0; block-size: 1lh; }
	.l-crumbs a { flex: none; min-inline-size: var(--ctl-h-chip); justify-content: flex-start; }
	.l-crumbs li[aria-current="page"] { display: none; }
	.l-crumbs li:has(+ li[aria-current="page"])::after { content: none; }
}

/* Outline: the page's sections at the right edge, from 1280 px on a reading
   page and from 1600 px on a page that fills. Below that it is not drawn,
   and a Prose keeps its contents line. outline.js tints the section in view. */
.l-outline {
	display: none;
	position: sticky;
	inset-block-start: var(--header-h);
	align-self: start;
	box-sizing: border-box;
	max-block-size: calc(100dvh - var(--header-h));
	padding-block: var(--sp-4);
	overflow-y: auto;
	overscroll-behavior: contain;
	font-size: var(--fs-sm);
	line-height: 1.5;
}
.l-outline__title {
	padding: var(--sp-1) var(--sp-2);
	color: var(--text-muted);
	font-size: var(--fs-xs);
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}
.l-outline > ul { list-style: none; display: grid; }
.l-outline a {
	display: block;
	padding: var(--sp-1) var(--sp-2);
	border-radius: var(--radius-sm);
	color: var(--text-muted);
	text-decoration: none;
	overflow-wrap: anywhere;
}
.l-outline a:hover { background: var(--surface-3); color: var(--text); }
.l-outline a:focus-visible { outline-offset: -2px; }
.l-outline a[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }
.l-page--outline {
	grid-template-columns: minmax(0, 1fr) var(--outline-w);
	column-gap: var(--sp-7);
}
.l-page--outline > * { grid-column: 1; }
.l-page--outline > .l-outline { grid-column: 2; grid-row: 1 / span 2; }
.l-page--outline > .l-crumbs ~ .l-outline { grid-row: 1 / span 3; }
@media (min-width: 1280px) {
	.l-w-page.l-page--outline {
		--l-w: calc(var(--w-page) + var(--sp-7) + var(--outline-w) + 2 * var(--page-gutter));
		display: grid;
	}
	.l-w-page.l-page--outline > .l-outline { display: block; }
	.l-w-page.l-page--outline:has(> .l-outline[data-outline="prose"]) .prose > nav { display: none; }
}
@media (min-width: 1600px) {
	.l-page--outline:not(.l-w-page) { display: grid; }
	.l-page--outline:not(.l-w-page) > .l-outline { display: block; }
	.l-page--outline:not(.l-w-page):has(> .l-outline[data-outline="prose"]) .prose > nav { display: none; }
}

.l-page__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: var(--sp-2) var(--sp-4);
	min-inline-size: 0;
}
.l-page__title {
	font-size: var(--fs-2xl);                 /* 28 px */
	font-weight: 600;
	line-height: 1.25;
	color: var(--text);                       /* the accent is for links and the primary action */
	text-wrap: balance;
	overflow-wrap: anywhere;                  /* a long unbroken name (a shared file's) wraps, never runs off */
}
.l-page__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: var(--sp-2);
	color: var(--text-muted);
	font-size: var(--fs-sm);
}
.l-page__actions { margin-inline-start: auto; }
/* Phones: the sub-nav's links and symbol field join the head's own lines,
   so the field shares a line with the page actions and takes what they
   leave; the title keeps its own line. */
@media (max-width: 600px) {
	.l-page__head:has(> .l-page__nav) { column-gap: var(--sp-2); }
	.l-page__head:has(> .l-page__nav) > .l-page__title { flex-basis: 100%; }
	/* A status line of any length keeps its own line, so the links under it
	   stay where they are when it fills in. */
	.l-page__head:has(> .l-page__nav) > .l-page__meta { flex-basis: 100%; }
	.l-page__head > .l-page__nav { display: contents; }
	.l-page__head > .l-page__nav > .c-form--inline { flex: 1 1 8rem; align-self: center; }
	.l-page__head:has(> .l-page__nav) > .l-page__actions { align-self: center; }
	.l-page__head > .l-page__nav > .c-form--inline > .fld { flex: 1 1 0; }
}
.l-page__body {
	display: flex;
	flex-direction: column;
	gap: var(--sp-5);                         /* Rhythm.SECTION */
	min-inline-size: 0;
}
/* A box page: a heading and one column of controls, half the reading column
   wide, on the column's own left edge. */
.l-page--box .l-page__surface {
	display: flex;
	flex-direction: column;
	gap: var(--sp-4);
	max-inline-size: calc(var(--w-page) / 2);
}
.l-page--box .l-page__body { gap: var(--sp-3); }
/* Two fields share a line of the column on desk and stack on phones. */
.l-page--box .l-row > .l-field { flex-basis: 10rem; }
@media (max-width: 600px) {
	.l-page--box .l-row:has(> .l-field) { row-gap: var(--sp-3); }
	.l-page--box .l-row > .l-field { flex-basis: 100%; }
}

/* -- Region and panel heads ------------------------------------------ */
.l-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sp-2) var(--sp-4);
	min-block-size: var(--ctl-h-field);       /* one head height with or without actions */
}
.l-head__title {
	display: inline-flex;
	align-items: baseline;
	gap: var(--sp-2);
	font-size: var(--fs-title);
	font-weight: 600;
	text-wrap: balance;
}
.l-head__count {
	color: var(--text-muted);
	font-size: var(--fs-sm);
	font-weight: 400;
	font-variant-numeric: tabular-nums;
}
.l-head__actions { margin-inline-start: auto; }
/* A section's head sits on a hairline; a panel's head has its frame. */
body.ui .l-section > .l-head {
	padding-block-end: var(--sp-1);
	border-block-end: 1px solid var(--border);
}
/* A section a script draws as <details> folds: its head is the summary. */
details.l-section > summary.l-head { column-gap: var(--sp-2); cursor: pointer; user-select: none; list-style: none; }
details.l-section > summary.l-head::-webkit-details-marker { display: none; }
details.l-section > summary.l-head::before { content: "\25BE"; color: var(--text-muted); }
details.l-section:not([open]) > summary.l-head::before { content: "\25B8"; }
/* Phones: a head's actions join its own lines too, so the first shares the
   title's line and the rest wrap under it. */
@media (max-width: 600px) {
	.l-head { column-gap: var(--sp-2); }
	.l-head > .l-head__title { margin-inline-end: auto; }
	.l-head > .l-head__actions { display: contents; }
}

.l-section {
	display: flex;
	flex-direction: column;
	gap: var(--sp-2);                         /* Rhythm.HEADING; Q2 B adds the panel frame here */
	min-inline-size: 0;
}
.l-section__body,
.c-panel__body {
	display: flex;
	flex-direction: column;
	gap: var(--sp-3);                         /* Rhythm.GROUP */
	min-inline-size: 0;
}

/* -- Stack, Row, Toolbar, heads' action rows -------------------------- */
.l-stack { display: flex; flex-direction: column; min-inline-size: 0; }
.l-gap-field { gap: var(--sp-1); }
.l-gap-controls { gap: var(--sp-2); }
.l-gap-group { gap: var(--sp-3); }

.l-row,
.l-toolbar,
.l-toolbar__lead,
.l-toolbar__trail,
.l-page__nav,
.l-page__actions,
.l-head__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sp-2);                         /* Rhythm.CONTROLS */
	min-inline-size: 0;
}
.l-row--nowrap { flex-wrap: nowrap; }
.l-toolbar__trail { margin-inline-start: auto; }
.l-row > .l-field { flex: 1 1 12rem; }      /* two fields side by side on desk, stacked on phones */
/* A link standing on a row, in the page head, in a link list (or in one of
   its grouped entries) or as a KV value is a touch target: the chip height,
   which the touch layer lifts to 44 px (tokens.css); on desk it is the text
   line. */
body.ui :is(.l-row, .l-page__nav, .l-page__actions, .l-head__actions, .c-links, .c-links > span, .c-kv__val, .c-list__main) > :is(.c-link, a.st):not([hidden]) { display: inline-flex; align-items: center; column-gap: var(--sp-1); --st-shape-w: 0.5rem; min-block-size: var(--ctl-h-chip); min-inline-size: var(--ctl-h-chip); }
/* In a row of links a short link's text sits in the middle of its box, so
   the gaps to the separators either side stay even; a KV value or a list
   row's link keeps its text at the start, in line with its siblings. */
body.ui :is(.l-row, .l-page__nav, .l-page__actions, .l-head__actions, .c-links, .c-links > span) > :is(.c-link, a.st):not([hidden]) { justify-content: center; }
/* A state word in the head's meta row that is a link (the dashboard's
   switches) is a touch target on the touch layer only: on desk the meta row
   keeps its text line. */
@media (max-width: 600px), (pointer: coarse) {
	body.ui .l-page__meta > a.st:not([hidden]) { display: inline-flex; align-items: center; min-block-size: var(--ctl-h-chip); min-inline-size: var(--ctl-h-chip); }
}

/* One control height per row (ruling 15). A row only sets --row-ctl-h; each
   control reads it with its own token as the fallback. */
.l-h-chip { --row-ctl-h: var(--ctl-h-chip); }
.l-h-btn { --row-ctl-h: var(--ctl-h-btn); }
.l-h-field { --row-ctl-h: var(--ctl-h-field); }
.l-h-primary { --row-ctl-h: max(var(--ctl-h-btn), var(--ctl-h-primary)); }
.l-h-field-primary { --row-ctl-h: max(var(--ctl-h-field), var(--ctl-h-primary)); }
:is(.l-row, .l-toolbar__lead, .l-toolbar__trail, .l-page__actions, .l-head__actions) > .c-form--inline { display: contents; }
/* A form with a code field stays one item of its row: the squares and their
   button never part at a line's end. */
:is(.l-row, .l-toolbar__lead, .l-toolbar__trail, .l-page__actions, .l-head__actions) > .c-form--inline:has(.c-code) { display: flex; flex: none; max-inline-size: 100%; }

/* -- Grid ------------------------------------------------------------- */
.l-grid {
	display: grid;
	grid-template-columns: var(--l-cols);
	gap: var(--sp-3);
	min-inline-size: 0;
}
.l-grid--regions { gap: var(--sp-5); }
.l-cols-2 { --l-cols: repeat(2, minmax(0, 1fr)); }
/* Two columns only while each has 22rem, the room a four-column table in a
   panel needs, whatever the sidebar leaves; never three (34% a column). */
.l-cols-2-fit { --l-cols: repeat(auto-fit, minmax(min(100%, max(22rem, 34%)), 1fr)); }
/* Two columns of panels: side by side only while each has 34rem, whatever
   the sidebar leaves. */
.l-cols-2-wide { --l-cols: repeat(auto-fit, minmax(min(100%, var(--w-narrow)), 1fr)); }
.l-cols-3 { --l-cols: repeat(3, minmax(0, 1fr)); }
.l-cols-tiles { --l-cols: repeat(auto-fill, minmax(14rem, 1fr)); }
@media (max-width: 900px) {
	.l-cols-3 { --l-cols: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
	.l-grid { --l-cols: minmax(0, 1fr); }
	.l-grid > .is-role-numbers { order: 1; }
	.l-grid > .is-role-table { order: 2; }
	.l-grid > .is-role-chart { order: 3; }
}

/* -- Panel, Card ------------------------------------------------------ */
.c-panel {
	display: flex;
	flex-direction: column;
	gap: var(--sp-2);
	padding: var(--sp-3) var(--sp-4);
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	min-inline-size: 0;
}
/* A toned panel is tinted whole, never marked on one edge. */
.c-panel--warn { background: var(--warn-soft); border-color: var(--warn-soft); }
.c-panel--bad { background: var(--danger-soft); border-color: var(--danger-soft); }
.c-card {
	display: flex;
	flex-direction: column;
	gap: var(--sp-2);
	padding: var(--sp-3);
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	color: var(--text);
	text-decoration: none;
	text-wrap-style: pretty;
	min-inline-size: 0;
}
a.c-card:hover { background: var(--surface-2); border-color: var(--border-strong); }
.c-card__title { font-size: var(--fs-base); font-weight: 600; text-wrap: balance; overflow-wrap: anywhere; }
.c-card__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sp-2);
	margin-block-start: auto;                 /* foot to the bottom of an equal-height tile */
}

/* -- Strip ------------------------------------------------------------ */
.c-strip { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2) var(--sp-5); }
.c-strip__item { display: flex; align-items: baseline; gap: var(--sp-1); }
.c-strip__label { color: var(--text-muted); font-size: var(--fs-sm); white-space: nowrap; }
.c-strip__value { font-weight: 500; }   /* a figure is a value leaf, which sets its own digits */
.c-strip--lead .c-strip__value { font-size: var(--fs-title); }
/* D45: a live money value holds 10ch so a wider figure moves nothing; it
   starts at its label, and the room it holds trails it. */
.c-strip__value .v-money { display: inline-block; min-inline-size: 10ch; text-align: start; }

/* -- Table ------------------------------------------------------------ */
.c-table-wrap {
	min-inline-size: 0;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	overflow: clip;                           /* the corners; clip keeps a sticky head working */
}
.c-table-wrap--x { overflow-x: auto; }
/* A table in a panel is as narrow as the panel: it scrolls sideways inside
   its frame, and its head, which would stick inside that scroller, does
   not stick. */
.c-panel .c-table-wrap { overflow-x: auto; }
/* A sideways table stops at its ends (a trackpad swipe past them never goes
   Back) and shades the edge that has more beyond it. */
.c-table-wrap--x, .c-panel .c-table-wrap { overscroll-behavior-x: contain; background: var(--scroll-cue); }
.c-panel--warn .c-table-wrap { --scroll-cue-ground: var(--warn-soft); }
.c-panel--bad .c-table-wrap { --scroll-cue-ground: var(--danger-soft); }
/* A head sticks under the page header; a table in a panel or in another
   table's row detail has no such run and would cover the head above it. */
:is(.c-panel, .c-table__detail) .c-table--sticky thead th { position: static; }
.c-table { border-collapse: collapse; inline-size: 100%; font-size: var(--fs-sm); }
.c-table :is(th, td) {
	box-sizing: border-box;
	block-size: var(--row-h);                 /* 30 px rows (ruling 16), 44 px on touch */
	padding: 0 var(--sp-2);
	border-bottom: 1px solid var(--border);
	text-align: start;
	vertical-align: middle;
	white-space: nowrap;
}
.c-table th { color: var(--text-muted); font-size: var(--fs-xs); font-weight: 600; background: var(--surface-2); }
.c-table tbody tr:hover { background: var(--surface-2); }
/* Rows a script is fetching again (aria-busy on the tbody) dim until the
   answer lands; the dim waits 300 ms (form_submit.js BUSY_DELAY_MS), so a
   quick refetch never dims. */
.c-table tbody[aria-busy="true"] { opacity: 0.55; transition: opacity 120ms 300ms; }
/* The frame closes the table: its last shown row draws no line of its own. */
.c-table-wrap > .c-table > tbody:last-child > tr:nth-last-child(1 of :not(.is-folded, [hidden])) > * { border-bottom: 0; }
.c-table--sticky thead th { position: sticky; inset-block-start: var(--header-h, 0px); z-index: 2; }
/* The stuck head's identity cell stays above the pinned identity cells of
   the rows passing under it (.t-id alone out-ranks the rule above). */
.c-table--sticky thead .t-id { z-index: 3; }
.c-table--sticky tbody :focus { scroll-margin-block-start: var(--row-h); }   /* a focused row clears the stuck head too */
.c-table .t-id { position: sticky; inset-inline-start: 0; z-index: 1; background: var(--bg); }
.c-table :is(thead, tbody tr:hover) .t-id { background: var(--surface-2); }
/* Figures set their digits at one width, so they line up down a numeric
   column: the numeric cells here, and the value leaves and times wherever
   they sit (.v-*, .age). A text cell is prose and sets its hyphens and
   digits at text width. */
.c-table .t-num { text-align: end; font-variant-numeric: tabular-nums; }
.c-table .t-action { text-align: end; inline-size: 1%; }
/* A row's controls on one line (RowActions, WUi.acts). They wrap whole; in a
   table's action cell, which is as narrow as its content, they stay on the line. */
.c-acts { display: inline-flex; flex-wrap: wrap; gap: var(--sp-1); align-items: center; }
.c-acts > * { flex: none; }
.c-table .t-action > .c-acts { flex-wrap: nowrap; }
.c-table .t-wrap { white-space: normal; overflow-wrap: anywhere; min-inline-size: 13ch; }
.c-table .t-wrap * { white-space: normal; }   /* (0,2,0) beats a leaf's nowrap: the D3 class */
.c-table .t-clamp { max-inline-size: 26ch; overflow: hidden; text-overflow: ellipsis; }
/* A bare button (text that opens something) in a cell starts at the cell's
   start, as the cell's text would; in a clamped cell it is one line cut by
   an ellipsis, its title holding the rest. */
.c-table td > .btn--bare { justify-content: flex-start; text-align: start; overflow-wrap: anywhere; }
.c-table .t-clamp > .btn--bare { display: block; max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A selected row (WTable.select) is tinted whole, its pinned cell too. */
.c-table tbody tr[data-selected], .c-table tbody tr[data-selected] .t-id { background: var(--accent-soft); }
.c-table :is([data-row-select], [data-select-all]) { margin: 0; vertical-align: middle; }
/* A row detail inside a sideways table spans the whole scrolled width; what
   it holds keeps to the visible frame and stays in view as the table
   scrolls, so its own tables show their columns. */
.c-table-wrap--x { container: x-scroll / inline-size; }
.c-table-wrap--x > .c-table > tbody > .c-table__detail > td > * { position: sticky; inset-inline-start: var(--sp-2); max-inline-size: calc(100cqi - 2 * var(--sp-2)); }
@media (max-width: 600px) {
	.c-table .t-wrap { min-inline-size: 12ch; }   /* a 320 px phone: the wrapped column gives way first */
}
/* A column that sorts: its label is a button, and a click anywhere in the
   cell sorts (widgets.js). The arrow is silent (its alt text is empty, so
   it joins no name) and every sortable head holds its place, shown only
   while that column sorts, so a sort never widens a column. A numeric head
   draws it before the label, which keeps its digits' right edge. */
.c-table__sort { margin: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.c-table__sort:hover { color: var(--text); }
.c-table th:has(> .c-table__sort) { cursor: pointer; block-size: max(var(--row-h), var(--ctl-h-btn)); }   /* a target: 44 px on touch */
.c-table th:is([aria-sort="ascending"], [aria-sort="descending"], [aria-sort="other"]) { color: var(--accent); }
.c-table th:is([aria-sort="descending"], [aria-sort="other"], :has(> .c-table__sort))::after { content: " \25BC" / ""; font-size: var(--fs-xs); }
.c-table th[aria-sort="ascending"]::after { content: " \25B2" / ""; font-size: var(--fs-xs); }
.c-table th.t-num:is([aria-sort], :has(> .c-table__sort))::after { content: none; }
.c-table th.t-num:is([aria-sort="descending"], [aria-sort="other"], :has(> .c-table__sort))::before { content: "\25BC " / ""; font-size: var(--fs-xs); }
.c-table th.t-num[aria-sort="ascending"]::before { content: "\25B2 " / ""; font-size: var(--fs-xs); }
.c-table th:has(> .c-table__sort):not([aria-sort])::before,
.c-table th:has(> .c-table__sort):not([aria-sort])::after { visibility: hidden; }
.c-table__empty td { color: var(--text-muted); font-size: var(--fs-sm); }
/* A folded row takes no room but still sizes its columns, so a sort that
   brings it into the shown rows, or Show all, changes no column's width. */
.c-table tr.is-folded { visibility: collapse; }
/* WTable.detail's line under a row: the hidden cells as a KV, then what the
   page appends (it opens on a phone row tap, or from a control at any width). */
.c-table .c-table__detail td { block-size: auto; padding-block: var(--sp-2); white-space: normal; }
/* Text takes the status pair: the --mkt-* pair is a fill (heat cells,
   treemap, quintile tints) and is too dark to read on the ground. */
.is-up { color: var(--ok); }
.is-down { color: var(--danger); }
@media (max-width: 600px) {
	.c-table [data-pri="3"] { display: none; }
	.c-table tbody tr[data-detail-row] { cursor: pointer; }
}

/* -- RowList, KV ------------------------------------------------------ */
.c-list { display: flex; flex-direction: column; list-style: none; }
.c-list__item {
	box-sizing: border-box;                   /* 30 px with its border, as table rows */
	display: flex;
	align-items: center;
	gap: var(--sp-2);
	min-block-size: var(--row-h);
	border-bottom: 1px solid var(--border);
}
/* A rule only between rows: the last shown row draws none, so a list in a
   frame never doubles the frame's edge. */
.c-list > .c-list__item:nth-last-child(1 of :not([hidden])) { border-bottom: 0; }
.c-list__main { flex: 1 1 auto; min-inline-size: 0; overflow-wrap: anywhere; }
.c-list__meta { color: var(--text-muted); font-size: var(--fs-sm); }
.c-list__end { display: flex; align-items: center; gap: var(--sp-2); margin-inline-start: auto; }
.c-list__item.is-bad { background: var(--danger-soft); }
/* Phones: a row whose text and meta do not share the line wraps the meta
   and the end under the text, so no word breaks to fit. */
@media (max-width: 600px) {
	.c-list__item { flex-wrap: wrap; column-gap: var(--sp-2); row-gap: 0; }
}
.c-kv {
	display: grid;
	/* The key takes its own width up to 60%; the value keeps at least what
	   its controls need, so a long key wraps before a button is squeezed. */
	grid-template-columns: fit-content(60%) minmax(min-content, 1fr);
	align-items: baseline;                    /* the key reads on its value's line, at any control height */
	gap: var(--sp-1) var(--sp-3);
	font-size: var(--fs-sm);
}
.c-kv--2 { grid-template-columns: repeat(2, fit-content(30%) minmax(min-content, 1fr)); }
.c-kv__key { color: var(--text-muted); overflow-wrap: anywhere; }
.c-kv__val { overflow-wrap: anywhere; }
@media (max-width: 600px) { .c-kv--2 { grid-template-columns: fit-content(60%) minmax(min-content, 1fr); } }
/* 44 px values: the rows keep a gap between their targets. */
@media (max-width: 600px), (pointer: coarse) { .c-kv { row-gap: var(--sp-2); } }

/* -- AsyncBlock, Skeleton, Chart, Bar, Spark -------------------------- */
.c-async { min-inline-size: 0; }
.c-skel { display: flex; flex-direction: column; gap: var(--sp-1); }
.c-skel__row {
	block-size: calc(var(--row-h) - var(--sp-1));
	border-radius: var(--radius-sm);
	background: var(--surface-3);
}
@media (prefers-reduced-motion: no-preference) {
	.c-skel__row { animation: c-skel-pulse 1.4s ease-in-out infinite; }
}
@keyframes c-skel-pulse { 50% { opacity: 0.45; } }
.metric-plot--strip { --plot-ratio: 4 / 1; }   /* .metric-plot (below) reserves 16:9 */
@media (max-width: 600px) { .metric-plot--strip { --plot-ratio: 2 / 1; } }   /* 4:1 of a phone is a 90 px sliver */
.c-bar { display: inline-block; inline-size: 6rem; block-size: 6px; vertical-align: middle; }
.c-bar__track { fill: color-mix(in srgb, var(--text) 10%, transparent); }
.c-bar__fill { fill: var(--accent); }
.c-spark { display: inline-block; inline-size: 80px; block-size: 18px; vertical-align: middle; }
.c-spark canvas { display: block; }
/* Dark on light whatever the theme: a scanner reads nothing else reliably. */
.c-qr { display: block; inline-size: 12.5rem; block-size: 12.5rem; background: var(--text); fill: var(--bg); border-radius: var(--radius-sm); shape-rendering: crispEdges; }
.c-qr[hidden] { display: none; }

/* -- Chart: the plot reserve and the uPlot type ------------------------- */
/* .metric-plot is every WPlot mount (charts_uplot.js) and the ui Chart. It
   holds the drawn chart's box before uPlot draws: the canvas at
   --plot-ratio (chartHeight reads the same variable; 16:9 on desk, the
   taller phone ratio at 600 px and under) plus 56 px for the title and
   legend that flow under it. Once drawn, the box is content-driven. The --plot-* custom properties are the chart's colours
   (WPlot.theme reads them). */
.metric-plot {
	--plot-line: var(--accent);
	--plot-grid: var(--chart-grid);
	--plot-font: var(--text);
	--plot-hover-bg: var(--surface-2);
	--plot-bg: transparent;
	box-sizing: border-box;
	position: relative;
	inline-size: 100%;
	min-inline-size: 0;
	aspect-ratio: var(--plot-ratio, 1.7778);
	margin: 0;
	overflow: hidden;
	color: var(--plot-font);
	background: transparent;
}
.metric-plot:not(.metric-plot--drawn):not(.metric-plot--empty) {
	box-sizing: content-box;
	padding-block-end: 56px;   /* lint: ignore[css-spacing] the title and legend rows under the canvas, a measured reserve */
}
@media (max-width: 600px) {
	.metric-plot { aspect-ratio: var(--plot-ratio, 1.389); }
}
/* Waiting for its data (Chart renders aria-busy; WPlot clears it once it
   draws or says there is none): the busy button's ring in the middle of
   the reserve, over a dimmed chart on a refetch. */
.metric-plot[aria-busy="true"]::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
	margin: auto;
	box-sizing: border-box;
	inline-size: 16px;
	block-size: 16px;
	border: 2px solid var(--text-muted);
	border-inline-end-color: transparent;
	border-radius: 50%;
}
.metric-plot[aria-busy="true"] > .uplot { opacity: 0.55; transition: opacity 120ms 300ms; }
@media (prefers-reduced-motion: no-preference) {
	.metric-plot[aria-busy="true"]::after { animation: w-spin 0.8s linear infinite; }
}
.metric-plot--drawn { aspect-ratio: auto; }
/* A wall of charts a script draws (WPlot.section): two columns, one under
   900 px. An odd last chart spans the row at its neighbours' height. */
.c-plots {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--sp-5) var(--sp-4);             /* a legend stands clear of the next chart's title */
	align-items: start;
}
.c-plots > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.c-plots > .metric-plot:last-child:nth-child(odd) { --plot-ratio: 3.6; }
@media (max-width: 900px) {
	.c-plots { grid-template-columns: minmax(0, 1fr); }
	.c-plots > .metric-plot:last-child:nth-child(odd) { --plot-ratio: initial; }
}
/* Every uPlot chart's title and legend, whatever it mounts in. Set on the
   elements themselves: uPlot's own sheet puts system-ui on .uplot and may
   load later. */
.uplot .u-title,
.uplot .u-legend { font-family: var(--font-sans); color: var(--plot-font, var(--text)); }
.uplot .u-title { font-size: var(--fs-sm); font-weight: 600; }
.uplot .u-legend { font-size: var(--fs-xs); }
.uplot .u-legend .u-value { font-variant-numeric: tabular-nums; }   /* the figures; a series label is text */
.uplot .u-legend .u-series.u-legend-hidden { display: none; }
.metric-plot .u-over { touch-action: pan-y; }   /* the cursor never traps a vertical touch scroll */

/* -- Sideways scroll cue ------------------------------------------------
   A row that scrolls sideways (a tab bar, a long Segmented, a wide table)
   shades the edge that has more beyond it. Two covers in the ground colour
   scroll with the content and two shades stay at the edges: at either end
   of the row its cover hides that edge's shade, and a row that fits shows
   neither. A table's sticky first column covers the left shade. */
.c-tabs__bar, .c-seg, .c-table-wrap {
	--scroll-cue-ground: var(--bg);
	--scroll-cue:
		linear-gradient(to right, var(--scroll-cue-ground) 40%, transparent) left / var(--sp-5) 100% no-repeat local,
		linear-gradient(to left, var(--scroll-cue-ground) 40%, transparent) right / var(--sp-5) 100% no-repeat local,
		linear-gradient(to right, color-mix(in srgb, var(--text-muted) 45%, transparent), transparent) left / var(--sp-3) 100% no-repeat scroll,
		linear-gradient(to left, color-mix(in srgb, var(--text-muted) 45%, transparent), transparent) right / var(--sp-3) 100% no-repeat scroll,
		var(--scroll-cue-ground);
}

/* -- Tabs (today's .w-tab look, without the negative margin) ------------ */
.c-tabs { display: flex; flex-direction: column; gap: var(--sp-4); min-inline-size: 0; }
.c-tabs__bar {
	display: flex;
	flex-wrap: nowrap;                        /* one row, scrolls on phones (ruling 19) */
	align-items: flex-end;
	gap: var(--sp-1);
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
	box-shadow: inset 0 -1px 0 var(--border);
	background: var(--scroll-cue);
}
.c-tabs__tab {
	box-sizing: border-box;                   /* the field height with its border */
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
	block-size: var(--ctl-h-field);
	padding: 0 var(--sp-3);
	border: 1px solid transparent;
	border-radius: var(--radius-md) var(--radius-md) 0 0;
	background: none;
	font: inherit;
	font-weight: 500;
	color: var(--text-muted);
	cursor: pointer;
	user-select: none;
}
.c-tabs__tab:hover { background: var(--surface-3); color: var(--text); }
.c-tabs__tab:focus-visible { outline-offset: -2px; }
/* The tab in view: the whole tab tinted, no line under it. */
.c-tabs__tab.is-active { background: var(--accent-soft); color: var(--accent); }
.c-tabs__pane { display: flex; flex-direction: column; gap: var(--sp-5); min-inline-size: 0; }

/* -- Controls (ui pages only) ------------------------------------------ */
/* The button: bordered on the page colour. One solid primary per view.
   A destructive entry is outlined red and only the confirming step is
   solid red. forms.css keeps the look the game pages draw; every variant
   is restated here because body.ui .btn outranks its bare class. */
body.ui .btn {
	box-sizing: border-box;
	white-space: nowrap;                      /* a label never breaks inside its button */
	block-size: var(--row-ctl-h, var(--ctl-h-btn));
	padding: 0 var(--sp-3);
	border-color: var(--border-strong);
	border-radius: var(--radius-md);
	background: var(--bg);
	color: var(--text);
	font-size: var(--ctl-fs);
	font-weight: 500;
	letter-spacing: 0;
	text-decoration: none;
	transition: none;
}
body.ui .btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
body.ui .btn:active { background: var(--border); transform: none; }
body.ui .btn--ghost { background: transparent; }
body.ui .btn--ghost:hover { background: var(--surface-3); }
body.ui .btn--accent { color: var(--accent); }
body.ui .btn--primary {
	block-size: var(--row-ctl-h, var(--ctl-h-primary));
	background: var(--accent);
	border-color: var(--accent);
	color: var(--on-accent);
}
body.ui .btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
body.ui .btn--primary:active { background: var(--accent); border-color: var(--accent); }
body.ui .btn--danger { background: var(--danger); border-color: var(--danger); color: var(--on-accent); }
body.ui .btn--danger:hover { background: color-mix(in srgb, var(--bg) 12%, var(--danger)); border-color: var(--danger); }
/* A per-row destructive action: red text, no box; the solid red is the
   confirming step alone (WDialog's danger buttons). */
body.ui .btn--danger-quiet { background: transparent; border-color: transparent; color: var(--danger); }
body.ui .btn--danger-quiet:hover { background: var(--danger-soft); border-color: transparent; }
/* A .btn used as a toggle: the whole control tinted. */
body.ui .btn.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
body.ui .btn--bare {
	block-size: auto;
	padding: 0;
	white-space: normal;                      /* text that opens something: it wraps as text does */
	border-color: transparent;
	border-radius: var(--radius-sm);
	background: none;
	color: inherit;
	font-weight: inherit;
}
body.ui .btn--bare:hover { background: none; border-color: transparent; text-decoration: underline; }
/* Off: a dashed border and a flat fill, so the state does not rest on
   colour. A link drawn as a button is off by aria-disabled. */
body.ui .btn:is([disabled], [aria-disabled="true"]) {
	background: var(--surface-2);
	border-color: var(--border);
	border-style: dashed;
	color: var(--text-muted);
	opacity: 1;
	cursor: not-allowed;
}
body.ui .btn--bare:is([disabled], [aria-disabled="true"]) { background: none; border-color: transparent; text-decoration: none; }
/* Working: form_submit.js sets data-busy at once (the progress cursor) and
   aria-busy once the request has run BUSY_DELAY_MS; then the label gives its
   place to a ring, so the button keeps its width. */
body.ui .btn[data-busy="true"] { cursor: progress; }
body.ui .btn[aria-busy="true"] { position: relative; color: transparent; cursor: progress; }
body.ui .btn[aria-busy="true"]::after {
	content: "";
	position: absolute;
	inset: 0;
	margin: auto;
	box-sizing: border-box;
	inline-size: 1em;
	block-size: 1em;
	border: 2px solid var(--text-muted);
	border-inline-end-color: transparent;
	border-radius: 50%;
}
@media (prefers-reduced-motion: no-preference) {
	body.ui .btn[aria-busy="true"]::after { animation: w-spin 0.8s linear infinite; }
}
body.ui .fld {
	box-sizing: border-box;
	block-size: var(--row-ctl-h, var(--ctl-h-field));
	min-inline-size: var(--ctl-h-field);      /* shrinks in a row, never under its own height (an empty select) */
	padding: 0 var(--sp-2);
	font: inherit;
	font-size: var(--ctl-fs-field);
	color: var(--text);
	background: var(--bg);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-md);
}
body.ui ::placeholder { color: var(--text-muted); opacity: 1; }   /* 7:1, still fainter than typed text */
body.ui .fld:hover { border-color: var(--text-muted); }
body.ui .fld:focus-visible { outline-offset: 0; border-color: var(--accent); }
body.ui .fld:user-invalid,
body.ui .fld[aria-invalid="true"] { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
body.ui .fld:disabled {
	background: var(--surface-2);
	border-color: var(--border);
	border-style: dashed;
	color: var(--text-muted);
	cursor: not-allowed;
}

/* Code field (CodeField; WDialog's code prompt): a code of a known length,
   one square a character. The squares are drawn under one input whose
   letters are spaced a square apart, so the typed text, the caret, a paste
   and the phone's code autofill are the input's own. The input runs one
   square past the last, clipped, so the caret after a full code does not
   scroll the text; clipped by clip, not hidden, so the caret out there
   cannot scroll the squares either. ui.js marks the square being typed
   ([data-on]). */
body.ui .c-code {
	--code-w: min(var(--ctl-h-field), 2rem);
	position: relative;
	display: inline-flex;
	flex: none;
	gap: var(--sp-1);
	inline-size: fit-content;
	block-size: var(--row-ctl-h, var(--ctl-h-field));
	overflow: clip;
	vertical-align: middle;
}
body.ui .c-code__cell {
	box-sizing: border-box;
	flex: none;
	inline-size: var(--code-w);
	background: var(--bg);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-md);
}
body.ui .c-code > input.c-code__input {
	position: absolute;
	inset: 0 auto 0 0;
	z-index: 1;
	inline-size: calc(100% + var(--code-w) + var(--sp-1));
	min-inline-size: 0;
	max-inline-size: none;
	block-size: 100%;
	padding: 0;
	text-indent: calc((var(--code-w) - 1ch) / 2);
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	outline: none;
	font-family: var(--font-mono);
	font-size: var(--fs-base);
	letter-spacing: calc(var(--code-w) + var(--sp-1) - 1ch);
}
body.ui .c-code[data-code="alnum"] > input.c-code__input { text-transform: uppercase; }
body.ui .c-code:hover .c-code__cell { border-color: var(--text-muted); }
/* Focus: the square being typed; every square where no script marks one. */
body.ui .c-code:focus-within .c-code__cell[data-on],
body.ui .c-code:focus-within:not(:has([data-on])) .c-code__cell {
	border-color: var(--accent);
	box-shadow: inset 0 0 0 1px var(--accent);
}
body.ui .c-code:has(> :user-invalid) .c-code__cell,
body.ui .c-code:has(> [aria-invalid="true"]) .c-code__cell {
	border-color: var(--danger);
	box-shadow: inset 0 0 0 1px var(--danger);
}
body.ui .c-code:has(> :disabled) .c-code__cell {
	background: var(--surface-2);
	border-color: var(--border);
	border-style: dashed;
}
/* A file field is its picker button and the chosen file's name: no field
   box around the browser's own button, which takes a button's height. */
body.ui input[type="file"].fld:not(.c-drop__input) { block-size: auto; padding: 0; border: 0; background: none; color: var(--text-muted); }
body.ui input[type="file"].fld::file-selector-button {
	box-sizing: border-box;
	block-size: var(--row-ctl-h, var(--ctl-h-btn));
	padding: 0 var(--sp-3);
	border-radius: var(--radius-md);
	background: var(--bg);
	color: var(--text);
	font-weight: 500;
}
body.ui input[type="file"].fld::file-selector-button:hover { border-color: var(--text-muted); background: var(--surface-3); }
body.ui textarea.fld { block-size: auto; min-block-size: calc(4 * var(--row-h)); padding: var(--sp-2); resize: vertical; }
.l-field { display: flex; flex-direction: column; gap: var(--sp-1); min-inline-size: 0; }
.l-field--inline { flex-direction: row; align-items: center; }
.l-field__label { font-size: var(--fs-sm); font-weight: 500; }
.l-field__hint { color: var(--text-muted); font-size: var(--fs-sm); text-wrap-style: pretty; }
.chk-row {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
	min-block-size: var(--row-ctl-h, var(--ctl-h-btn));   /* the label is the touch target */
}
.chk { inline-size: 16px; block-size: 16px; accent-color: var(--accent); }
.chk-row:has(> .chk[aria-label]) { min-inline-size: var(--row-ctl-h, var(--ctl-h-btn)); }   /* a box alone: the target stays square */
body.ui .chk-row > .chk { margin: 0; }      /* the UA margin otherwise (gate G08); the row spaces the box */
/* password_toggle.js wraps the field in .pw-wrap and adds a bare button
   inside its right edge; the field keeps its full width in the wrapper.
   Scoped to ui pages. The toggle rule follows body.ui .btn--bare, which
   it overrides. */
body.ui .pw-wrap { position: relative; display: block; }
body.ui .pw-wrap > .fld { display: block; inline-size: 100%; }
/* As tall as the field, so it is the field's touch height. Its clear
   border is as wide as the field's invalid ring (the border and the 1 px
   inside it) and its ground is clipped inside it, so a refused field's ring
   runs unbroken behind it (A113). */
body.ui .pw-toggle {
	position: absolute;
	inset: 0 0 0 auto;
	padding: 0 var(--sp-3);
	border: 2px solid transparent;
	border-radius: 0 var(--radius-md) var(--radius-md) 0;
	background: var(--bg);
	background-clip: padding-box;
	color: var(--text-muted);
	font-weight: 600;
}
body.ui .pw-toggle:hover { background: var(--bg); color: var(--text); text-decoration: none; }
body.ui .pw-toggle:focus-visible { outline-offset: -2px; }
.chip {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	gap: var(--sp-1);
	block-size: var(--row-ctl-h, var(--ctl-h-chip));
	padding: 0 var(--sp-2);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-md);
	background: var(--bg);
	color: var(--text);
	font: inherit;
	font-size: var(--fs-sm);
	text-decoration: none;
	cursor: pointer;
}
.chip:not(:disabled):hover { background: var(--surface-3); }
button.chip { user-select: none; }   /* a quick second click selects no label; a link chip stays selectable */
body.ui .chip { min-inline-size: var(--ctl-h-chip); justify-content: center; }   /* a short label ("US") is still a 44 px target on touch */
/* A toggle chip carries a box that fills when it is on, so on and off do
   not rest on the tint. */
.chip[aria-pressed]::before {
	content: "";
	flex: none;
	box-sizing: border-box;
	inline-size: 0.625rem;
	block-size: 0.625rem;
	border: 1px solid var(--border-strong);
	border-radius: 2px;
}
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"]::before { background: var(--accent); border-color: var(--accent); }
.chip[aria-pressed="true"]:not(:disabled):hover { background: color-mix(in srgb, var(--accent) 22%, var(--bg)); }   /* on stays tinted under the pointer */
body.ui .chip:disabled { border-style: dashed; border-color: var(--border); color: var(--text-muted); cursor: not-allowed; }
.c-seg {
	box-sizing: border-box;
	display: inline-flex;
	block-size: var(--row-ctl-h, var(--ctl-h-btn));
	outline: 1px solid var(--border-strong);    /* inside the box: the buttons keep the full height */
	outline-offset: -1px;
	border-radius: var(--radius-md);
	background: var(--scroll-cue);
	overflow: clip;
	overscroll-behavior-x: contain;           /* the screener's set picker scrolls on phones */
}
.c-seg__btn {
	block-size: 100%;
	min-inline-size: var(--ctl-h-chip);
	padding: 0 var(--sp-2);
	border: 0;
	background: none;
	font: inherit;
	font-size: var(--ctl-fs);
	font-weight: 500;                         /* one weight on and off: a choice never moves its neighbours */
	color: var(--text);
	cursor: pointer;
	user-select: none;
}
.c-seg__btn + .c-seg__btn { border-inline-start: 1px solid var(--border); }
.c-seg__btn:not(:disabled, .is-active):hover { background: var(--surface-3); }
.c-seg__btn:focus-visible { outline-offset: -2px; }
.c-seg__btn.is-active { background: var(--accent-soft); color: var(--accent); }
.c-seg__btn:disabled { color: var(--text-muted); cursor: not-allowed; }
.l-field > .c-seg { align-self: flex-start; }
.c-form { display: flex; flex-direction: column; gap: var(--sp-3); min-inline-size: 0; }
/* A form's submit keeps its own width; the column would stretch it. */
body.ui .c-form:not(.c-form--inline) > .btn { align-self: flex-start; }
.c-form--inline { flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
/* On a phone the field takes the row beside its submit, so the button never
   drops below it. */
@media (max-width: 600px) { .c-form--inline > .fld { flex: 1 1 8rem; min-inline-size: 0; } }
/* DropZone: the label is the visible control and the file input holds no
   box, so the zone wears the focus ring. */
.c-drop { border: 1px dashed var(--border-strong); border-radius: var(--radius-md); background: var(--surface-2);
	padding: var(--sp-5) var(--sp-4); text-align: center; cursor: pointer; }
.c-drop.is-over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface-2)); }
.c-drop:has(.c-drop__input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.c-drop__main { font-size: var(--fs-sm); }
.c-drop__pick { color: var(--accent); text-decoration: underline; cursor: pointer; }
.c-drop__note { padding-block-start: var(--sp-1); color: var(--text-muted); font-size: var(--fs-sm); }
body.ui .c-drop > .c-drop__input { position: absolute; inline-size: 1px; min-inline-size: 0; block-size: 0; min-block-size: 0; padding: 0;
	border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.c-drop--slim:not([hidden]) { box-sizing: border-box; display: flex; align-items: center; justify-content: center;
	min-block-size: var(--ctl-h-primary); padding: var(--sp-1) var(--sp-4); }
.c-drop--slim > .c-drop__note { display: none; }
/* No pointer, no drag and drop. */
@media (hover: none) { .c-drop__alt { display: none; } }
.c-msg { padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-md);
	background: var(--surface-2); line-height: 1.4; }
/* An empty line stays on the page for assistive technology (it is a live
   region) and takes no room, in or out of a gap. */
.c-msg:empty { position: absolute; padding: 0; border: 0; }
/* A form on the page keeps its answer line's room from the first paint, so
   a refusal or a saved line moves nothing under it. A dialog grows down
   from its top and keeps the line out of the way until it speaks. */
.c-form:not(.c-form--inline, .modal .c-form) > .c-msg:empty {
	position: static;
	min-block-size: calc(1.4em + 2 * var(--sp-2) + 2px);
	background: none;
}
.c-msg[data-state="success"] { border-color: color-mix(in srgb, var(--ok) 50%, transparent); color: var(--ok); }
.c-msg[data-state="error"] { border-color: color-mix(in srgb, var(--danger) 50%, transparent); color: var(--danger); }
.c-msg[data-state="success"] { background: var(--ok-soft); border-color: var(--ok-soft); }
.c-msg[data-state="error"] { background: var(--danger-soft); border-color: var(--danger-soft); }

/* -- Links off the site: the new-tab mark (ui.Link, Prose, the sidebar) - */
/* One size and one space after the text everywhere it appears; a row of
   links' own column gap is that space there. */
.ext-icon {
	inline-size: 11px;
	block-size: 11px;
	padding-inline-start: var(--sp-1);       /* inside its box: the drawn mark keeps its 11 px */
	flex: none;
	color: var(--text-muted);
}
body.ui :is(.l-row, .l-page__nav, .l-page__actions, .l-head__actions, .c-links, .c-links > span, .c-kv__val, .c-list__main) > .c-link > .ext-icon { padding-inline-start: 0; }
/* Words for a screen reader alone ("(new tab)"). */
.sr-only {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* -- Banner (ui.Banner over the header; /admin/settings banner.*) ----- */
/* One still line per message on the accent's soft ground, in the page's
   gutters, with Dismiss at the end of the first line. No motion. */

.c-banner:not([hidden]) { display: flex; }
.c-banner {
	align-items: flex-start;
	gap: var(--sp-3);
	padding: var(--sp-1) var(--page-gutter);
	background: var(--accent-soft);
	border-block-end: 1px solid var(--border);
	color: var(--text);
	font-family: var(--font-sans);
	font-size: var(--fs-sm);
	line-height: 1.5;
}
.c-banner__list {
	flex: 1 1 auto;
	min-inline-size: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	align-self: center;
	overflow-wrap: anywhere;
}
.c-banner > .btn { flex: none; }

/* -- Text leaves ------------------------------------------------------ */
.age { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* A state is a word, a tone and a shape: circle, triangle, cross and ring.
   The shape is drawn from the tone class, so a state a script writes
   (st st--good) carries it too. It is an inline box on the baseline, 8 px
   of shape and 4 px before the word, so the state stays one line of text
   (a flex box would break the word from its detail in innerText). Where a
   row makes the state a flex box, the row's gap stands in for the 4 px. */
.st { font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; }
.st:is(.st--good, .st--warn, .st--bad, .st--muted)::before {
	content: "";
	display: inline-block;
	flex: none;
	inline-size: var(--st-shape-w, 0.75rem);
	block-size: 0.5rem;
	background: currentColor;
}
.st.st--good::before { clip-path: circle(0.25rem at 0.25rem 50%); }
.st.st--warn::before { clip-path: polygon(0.25rem 0, 0.5rem 100%, 0 100%); }
.st.st--bad::before { clip-path: polygon(0.1rem 0, 0.25rem 0.15rem, 0.4rem 0, 0.5rem 0.1rem, 0.35rem 0.25rem, 0.5rem 0.4rem, 0.4rem 0.5rem, 0.25rem 0.35rem, 0.1rem 0.5rem, 0 0.4rem, 0.15rem 0.25rem, 0 0.1rem); }
.st.st--muted::before { background: radial-gradient(circle at 0.25rem 50%, transparent calc(0.25rem - 2.25px), currentColor calc(0.25rem - 1.75px) calc(0.25rem - 0.25px), transparent 0.25rem); }
.st--good { color: var(--ok); }
.st--warn { color: var(--warn); }
.st--bad { color: var(--danger); }
.st--muted { color: var(--text-muted); }
.st__detail { color: var(--text-muted); font-weight: 400; }

/* -- Forced colours -----------------------------------------------------
   The system palette replaces tints and backgrounds, so the selected item
   takes the system selection colours, and the shapes drawn as clipped
   backgrounds (state shapes, the sidebar triangle and guide, a pressed
   chip's box) keep their own colour. */
@media (forced-colors: active) {
	body.ui :is(.c-tabs__tab.is-active, .c-seg__btn.is-active, .l-outline a[aria-current="true"], .btn.is-active) {
		forced-color-adjust: none;
		background: SelectedItem;
		color: SelectedItemText;
	}
	.st::before, .nav-group > summary::before { forced-color-adjust: none; }
	.chip[aria-pressed="true"]::before { forced-color-adjust: none; background: CanvasText; }
	body .nav-group[open] > summary::after,
	body .nav-group > .nav-sub::before,
	body .nav-group > .nav-list::before { forced-color-adjust: none; background: GrayText; }   /* body: outranks chrome.css, which loads later */
}
.c-note, .c-empty { color: var(--text-muted); font-size: var(--fs-sm); text-wrap-style: pretty; }
/* A toned Note: the whole line on its tone's soft tint, in text colour. */
.c-note:is(.c-note--good, .c-note--warn, .c-note--bad) {
	padding: var(--sp-2) var(--sp-3);
	border-radius: var(--radius-md);
	color: var(--text);
}
.c-note--good { background: var(--ok-soft); }
.c-note--warn { background: var(--warn-soft); }
.c-note--bad { background: var(--danger-soft); }
/* A script's failed read (WUi.failure): the bad note is the row's control
   height, as its Retry is. */
[data-load-failed] > .c-note { display: flex; align-items: center; block-size: var(--row-ctl-h); padding-block: 0; }

/* Text as a program wrote it (Output, WUi.out): monospace, wrapped at the
   edge, in a bounded scroller. */
.c-out {
	max-block-size: 320px;
	overflow: auto;
	overscroll-behavior: contain;
	padding: var(--sp-2);
	font-family: var(--font-mono);
	font-size: var(--fs-xs);
	line-height: 1.45;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
}

/* One a script fills holds its height from the first paint. */
.c-out--fixed { block-size: 160px; }

/* A terminal surface: 80 columns as tmux prints them and 24 rows, never
   wrapped (a wrap breaks box drawing); a narrower screen scrolls it sideways. */
.c-out--terminal {
	box-sizing: content-box;
	inline-size: 80ch;
	max-inline-size: calc(100% - 2 * var(--sp-2) - 2px);
	max-block-size: calc(24 * 1.25em);
	line-height: 1.25;
	white-space: pre;
	overflow-wrap: normal;
}
.c-pager { display: flex; align-items: center; gap: var(--sp-2); }
/* A folded table's pager sits inside its frame, off the border. */
.c-table-wrap > .c-pager { padding: var(--sp-1) var(--sp-2); }
.c-pager__count { color: var(--text-muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
/* The " | " between plain links is drawn centred in the gap before each
   link, not by the separator span: a line that wraps then never ends on a
   separator, and the one opening a line falls outside the list's box and is
   clipped (the clip margin keeps focus rings). The gap is 16 px: the bar
   with about 6 px either side. The bar is regular weight and muted whatever
   its link's weight (the current sub-nav item is bold). */
.c-links { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.c-links:has(> .c-links__sep) {
	column-gap: var(--sp-4);
	overflow: clip;
	overflow-clip-margin: var(--sp-1);
}
.c-links > .c-links__sep { display: none; }
.c-links > .c-links__sep + * { position: relative; }
.c-links > .c-links__sep + *::before {
	content: "|" / "";
	position: absolute;
	right: 100%;
	inline-size: var(--sp-4);
	text-align: center;
	color: var(--text-muted);
	font-weight: 400;
	pointer-events: none;
}
.c-subnav__current { color: var(--text); font-weight: 600; }
/* The current page stands as tall as its sibling links, so a wrapped line
   of the sub-nav keeps one height. */
body.ui .c-links > .c-subnav__current { display: inline-flex; align-items: center; min-block-size: var(--ctl-h-chip); }
.c-edit__input { inline-size: 10ch; }
.prose { max-inline-size: 68ch; font-size: var(--fs-base); line-height: 1.6; text-wrap-style: pretty; }
/* The only flow margins: Markdown has no primitives. body.ui raises them over
   the ui reset's :where() margin: 0. */
body.ui .prose > * + * { margin-block-start: var(--sp-3); }
body.ui .prose > h2 { margin-block-start: var(--sp-5); }
body.ui .prose :is(ul, ol) { padding-inline-start: var(--sp-5); }
body.ui .prose li + li { padding-block-start: var(--sp-2); }   /* padding: the flow margins are the two above */
.prose :is(h2, h3, h4) { text-wrap: balance; }
/* A link inside a sentence is underlined: its colour alone sits too close to
   the text's. The contents line is a link list and stays plain. */
.prose :is(p, li, blockquote, td) a:not(.btn) { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
.prose a:hover { color: var(--accent-hover); }
.prose code { padding-inline: var(--sp-1); border-radius: var(--radius-sm); background: var(--code-bg); font-size: var(--fs-sm); }
.prose pre { padding: var(--sp-3); border-radius: var(--radius-md); background: var(--code-bg); overflow-x: auto; overscroll-behavior-x: contain; }
.prose pre code { padding: 0; background: none; }
/* Screenshots are dark captures on the dark panel: a hairline marks their edge. */
.prose img { max-inline-size: 100%; block-size: auto; outline: 1px solid var(--border); outline-offset: -1px; }
/* An image that links its full size: the link's box is the image's, not a line of text. */
.prose a:has(> img) { display: inline-block; max-inline-size: 100%; }
.prose h2 { font-size: var(--fs-xl); }
.prose h3 { font-size: var(--fs-title); }
.prose :is(h4, h5, h6) { font-size: var(--fs-base); }
/* A list item's link is a touch target of its own: on touch it is padded
   to 44 px. The padding of an inline box takes no room in its line, so the
   item keeps the paragraph's line height. */
@media (max-width: 600px), (pointer: coarse) {
	.prose li > a { padding-block: var(--sp-4); }   /* 16 px over and under a 16 px line: a 44 px box and more */
}

/* -- Leaf classes 3.7 does not style (ui/components.py) ---------------- */
.c-text, .c-link { overflow-wrap: anywhere; }
/* Text(clamp=True): three lines at most; a script lifts it by dropping the class. */
.c-text--clamp {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	overflow: hidden;
}
.v-money, .v-pct, .v-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip__count { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.c-links__sep { color: var(--text-muted); font-weight: 400; }
.v-date { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Age(label=): the muted word and its age stay on one line. */
.c-age { white-space: nowrap; }
/* Bar(label=True): the bar and its percentage, one unit on one line. */
.c-share { display: inline-flex; align-items: center; gap: var(--sp-2); white-space: nowrap; }
/* SubHead: a group's name inside a section or panel, the interface size. */
.c-subhead { font-size: var(--fs-sm); font-weight: 600; text-wrap: balance; }
/* FieldGroup: a fieldset of controls under one legend, the field label's
   look. Floated, the legend is a flex item like the controls (not the
   fieldset's border legend): on its own line above them, or beside them
   (INLINE) and on its own line again at 600 px and under. */
.c-group {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sp-1) var(--sp-2);
	min-inline-size: 0;
	padding: 0;
	border: 0;
}
.c-group > legend { float: left; flex-basis: 100%; padding: 0; }
.c-group--inline { row-gap: var(--sp-2); }
.c-group--inline > legend { flex-basis: auto; }
@media (max-width: 600px) {
	.c-group--inline > legend { flex-basis: 100%; }
}
/* Frame: a titled iframe whose box is held from the first paint. WIDE is
   the column's width at 16:9, framed (a remote screen). PAGE takes the
   viewport below the header less a head row and a panel, so a document
   sits whole on the first screen, on white paper ground; at 600 px and
   under it is one A4 page of its own width, the rest scrolling inside. */
.c-frame { display: block; }
.c-frame > iframe {
	display: block;
	box-sizing: border-box;
	inline-size: 100%;
	aspect-ratio: 16 / 9;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--bg);
}
.c-frame--page {
	block-size: max(20rem, calc(100dvh - var(--header-h) - 12rem));
	overflow: auto;
}
@media (max-width: 600px) {
	.c-frame--page { block-size: auto; aspect-ratio: 210 / 297; }
}
.c-frame--page > iframe {
	block-size: 100%;
	aspect-ratio: auto;
	border: 0;
	border-radius: 0;
	background: #fff;
}
.c-edit { display: inline-flex; align-items: center; }
/* The value is its own edit button: the text line on desk, a 44 px target
   under the touch layer (ruling 15). */
@media (max-width: 600px), (pointer: coarse) {
	body.ui .c-edit > .btn { min-block-size: var(--ctl-h-chip); }
}

/* -- Chrome touch layer (chrome.css) ------------------------------------
   Every header, sidebar and footer control is a 44 px target. chrome.css
   loads after this file, so each selector starts at its chrome root: it
   then outranks the chrome.css rule it overrides. */
@media (max-width: 600px), (pointer: coarse) {
	.site-header .menu-button {
		min-inline-size: 44px;
		min-block-size: 44px;
		justify-content: center;
	}

	.site-header .skip-link {
		display: inline-flex;
		align-items: center;
		min-block-size: 44px;
	}

	/* Flex items already, so the line is the box: a 44 px line keeps the
	   ellipsis a flex container would lose, and leaves display alone (the
	   shortcut stays hidden beside a sidebar). */
	.site-header .brand,
	.site-header .site-header__end a {
		line-height: 44px;
	}
	.site-header .site-header__end a {
		min-inline-size: 44px;
		text-align: center;
	}

	.sidebar .nav-link,
	.sidebar .nav-group > summary {
		min-block-size: 44px;
	}

	/* The footer row wraps between links, not before a stray "|" separator. */
	footer.site-footer {
		font-size: var(--fs-xs);
		padding-top: var(--sp-2);
		padding-bottom: var(--sp-2);
	}

	.site-footer .site-footer__links {
		gap: 0 var(--sp-4);
	}

	.site-footer .site-footer__links li + li::before {
		content: none;
	}

	.site-footer .site-footer__links a {
		display: inline-flex;
		align-items: center;
		min-height: 44px;
	}
}

/* Last: author display rules must not defeat [hidden] (panes, colsets, folds). */
.l-page [hidden] { display: none; }
