@font-face {
		font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400; font-display: optional;
		src: url('/ui-assets/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
	}
	@font-face {
		font-family: 'JetBrains Mono'; font-style: normal; font-weight: 700; font-display: optional;
		src: url('/ui-assets/fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2');
	}
	@font-face {
		font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: optional;
		src: url('/ui-assets/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
	}
	@font-face {
		font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: optional;
		src: url('/ui-assets/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
	}

	h1, h2, h3 { text-wrap: balance; }
	.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
	:focus-visible { outline: 2px solid var(--phosphor); outline-offset: 1px; }

	/* Every figure on screen is dynamic; tabular numerals stop columns twitching as they update. */
	.metric-value, .stat-value, .stat-sub, .gauge-figure, .field-value,
	.duty-headroom, .duty-used, .chip-count, .tally, .cp, .sub, .pools, .identity,
	.switcher-level, .move { font-variant-numeric: tabular-nums; }

	/* ---- app frame ------------------------------------------------------------------------------ */

	.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; }
	.app-bare { grid-template-columns: minmax(0, 1fr); }
	.content { display: flex; flex-direction: column; min-width: 0; }

	.sidebar {
		position: sticky; top: 0; align-self: start;
		height: 100dvh; overflow-y: auto;
		display: flex; flex-direction: column;
		border-right: 1px solid var(--hairline);
		background: var(--surface);
		padding: var(--s-4) var(--s-2) var(--s-4);
	}
	.brand {
		display: flex; align-items: center; gap: var(--s-2);
		padding: var(--s-1) var(--s-3) var(--s-5); text-decoration: none;
	}
	.brand:hover .brand-word { color: var(--phosphor); }
	.brand-word { transition: color 140ms ease; }
	.brand-mark { width: 24px; height: 24px; flex: none; filter: drop-shadow(0 0 8px rgba(74, 222, 128, 0.35)); }
	.brand-word {
		font-family: var(--mono); font-weight: 700; font-size: var(--t-xs);
		letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink);
	}

	.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
	/* The drawer is a popover so a phone opens it with no script; on a wide screen it is simply laid out in
	   the sidebar, overriding the popover's hidden, top-layer defaults. */
	.sidebar-drawer[popover] {
		display: flex; flex-direction: column; flex: 1;
		position: static; inset: auto; width: auto; height: auto; margin: 0; padding: 0;
		border: 0; background: none; color: inherit; overflow: visible;
	}
	.nav-toggle { display: none; }

	.nav { display: flex; flex-direction: column; gap: var(--s-5); }

	/* The viewer card sits at the foot of the sidebar; margin-top:auto pins it there however short the nav is. */
	.viewer {
		margin-top: auto; padding: var(--s-3) var(--s-3) 0;
		border-top: 1px solid var(--hairline);
		display: flex; flex-direction: column; gap: var(--s-1);
	}
	.viewer-id { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
	.viewer-avatar {
		flex: none; width: 28px; height: 28px; border-radius: 50%;
		border: 1px solid var(--hairline-bright); object-fit: cover; background: var(--void);
	}
	.viewer-who { display: flex; flex-direction: column; min-width: 0; }
	.viewer-name {
		font-size: var(--t-sm); color: var(--ink);
		overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
	}
	.viewer-mail {
		font-size: var(--t-2xs); color: var(--ink-faint);
		overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
	}
	/* Impersonation is stated, not implied: an operator must never mistake a tenant's view for their own. */
	.viewer-as {
		font-size: var(--t-2xs); letter-spacing: 0.08em; text-transform: uppercase;
		color: var(--phosphor);
	}
	.viewer-out {
		margin-top: var(--s-2); font-size: var(--t-2xs); letter-spacing: 0.14em; text-transform: uppercase;
		color: var(--ink-dim); text-decoration: none; transition: color 140ms ease;
	}
	.viewer-out:hover { color: var(--phosphor); }
	button.viewer-out { background: none; border: 0; padding: 0; font: inherit; font-size: var(--t-2xs); cursor: pointer; text-align: left; }
	.impersonation-bar {
		display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2);
		padding: var(--s-2) var(--s-3); background: var(--void); border-bottom: 1px solid var(--phosphor);
		color: var(--phosphor); font-size: var(--t-sm);
	}
	.impersonation-bar form { margin: 0; }
	.impersonation-leave {
		background: none; border: 1px solid var(--phosphor); color: var(--phosphor); font: inherit;
		font-size: var(--t-2xs); letter-spacing: 0.14em; text-transform: uppercase; padding: 2px var(--s-2); cursor: pointer;
	}
	.nav-group { display: flex; flex-direction: column; }
	.nav-group-label {
		font-size: var(--t-2xs); letter-spacing: 0.18em; text-transform: uppercase;
		color: var(--ink-faint); padding: 0 var(--s-3) var(--s-2);
	}
	.nav-item {
		display: flex; align-items: center; gap: var(--s-3);
		min-height: 36px; padding: 0 var(--s-3);
		text-decoration: none;
		color: var(--ink-dim); font-size: var(--t-sm);
		transition: color 140ms ease, background 140ms ease;
	}
	.nav-item:hover { color: var(--ink); background: var(--surface-raised); }
	.nav-item.is-active { color: var(--ink); background: var(--surface-raised); font-weight: 600; }
	.nav-glyph { font-family: var(--mono); font-size: var(--t-xs); width: var(--s-4); text-align: center; color: var(--ink-faint); }
	.nav-item.is-active .nav-glyph { color: var(--phosphor); }

	/* ---- topbar --------------------------------------------------------------------------------- */

	.topbar {
		display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
		min-height: var(--topbar-h); padding: var(--s-3) var(--s-5);
		border-bottom: 1px solid var(--hairline);
		background: rgba(11, 16, 32, 0.86);
		backdrop-filter: blur(8px);
		position: sticky; top: 0; z-index: 40;
	}
	.wordmark { display: flex; align-items: center; gap: var(--s-2); }
	.topbar-sep { color: var(--ink-faint); }
	.topbar-title { margin: 0; font-size: var(--t-md); font-weight: 600; letter-spacing: -0.01em; }
	.topbar-metrics { margin-left: auto; display: flex; gap: var(--s-6); flex-wrap: wrap; }
	.metric { display: flex; flex-direction: column; }
	.metric-value {
		font-family: var(--mono); font-size: var(--t-md); font-weight: 700; line-height: 1.15;
		color: var(--tone, var(--ink));
	}
	.metric-label { font-size: var(--t-2xs); letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-faint); }

	.acct {
		display: inline-flex; align-items: center; gap: var(--s-2);
		min-height: 36px; padding: 0 var(--s-3);
		border: 1px solid var(--hairline-bright);
		background: var(--void); color: var(--ink);
		font-family: inherit; font-size: var(--t-sm); cursor: pointer;
		transition: border-color 140ms ease, background 140ms ease;
	}
	.acct:hover { border-color: var(--phosphor); background: var(--surface-raised); }
	.acct-name { font-weight: 600; }
	.acct-level { font-family: var(--mono); font-size: var(--t-xs); color: var(--phosphor); }
	.acct-caret { color: var(--ink-faint); font-size: var(--t-2xs); }

	/* ---- account switcher ----------------------------------------------------------------------- */

	/* A [popover] is hidden by a UA rule that AUTHOR styles outrank regardless of specificity, so any
	   display declaration here must be gated on :popover-open or the panel never closes. */
	/* The account's own actions, behind one trigger. Same popover primitive as the switcher. */
	.menu-trigger {
		margin-left: auto;
		font-size: var(--t-md); line-height: 1;
		padding: var(--s-1) var(--s-2);
	}
	.topbar-metrics:not(:empty) + .menu-trigger { margin-left: var(--s-5); }
	/* The screen's primary action sits at the right, the menu trigger beside it. */
	.topbar-action { margin-left: auto; }
	.topbar-metrics:not(:empty) + .topbar-action { margin-left: var(--s-5); }
	.topbar-action + .menu-trigger { margin-left: 0; }
	@media (max-width: 900px) { .topbar-metrics:not(:empty) + .topbar-action { margin-left: 0; } }

	.menu-panel {
		display: none;
		min-width: 13rem;
		margin: 0; padding: var(--s-1); inset: auto;
		position: fixed;
		border: 1px solid var(--hairline-bright);
		background: var(--surface); color: var(--ink);
		box-shadow: 0 24px 60px rgba(2, 6, 23, 0.75);
	}
	.menu-panel:popover-open { display: flex; flex-direction: column; align-items: stretch; }
	.menu-panel .btn {
		justify-content: flex-start; text-align: left;
		border-color: transparent; width: 100%;
	}
	.menu-panel .btn-danger { color: var(--rose); }
	.menu-panel .btn:hover:not(:disabled) { background: var(--surface-raised); }
	.menu-panel .btn:disabled { color: var(--ink-faint); }

	.switcher {
		display: none;
		width: min(420px, calc(100vw - var(--s-8)));
		max-height: min(60vh, 520px);
		margin: 0; padding: 0; inset: auto;
		position: fixed;
		border: 1px solid var(--hairline-bright);
		background: var(--surface); color: var(--ink);
		box-shadow: 0 24px 60px rgba(2, 6, 23, 0.75);
		overflow: hidden;
	}
	.switcher:popover-open { display: flex; flex-direction: column; }
	.switcher::backdrop { background: rgba(2, 6, 23, 0.5); }
	.switcher-head { padding: var(--s-2); border-bottom: 1px solid var(--hairline); }
	.switcher-search {
		width: 100%; min-height: 36px;
		background: var(--void); border: 1px solid var(--hairline-bright);
		color: var(--ink);
		font-family: var(--mono); font-size: var(--t-sm); padding: 0 var(--s-3);
	}
	.switcher-search:focus { border-color: var(--phosphor); outline: none; }
	.switcher-list { list-style: none; margin: 0; padding: var(--s-1); overflow-y: auto; }
	.switcher-item {
		display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
		min-height: 40px; padding: 0 var(--s-3);
		text-decoration: none; color: var(--ink-dim); font-size: var(--t-sm);
	}
	.switcher-item:hover { background: var(--surface-raised); color: var(--ink); }
	.switcher-item.is-active { background: var(--surface-raised); color: var(--ink); font-weight: 600; }
	.switcher-meta { display: flex; align-items: center; gap: var(--s-3); }
	.switcher-level { font-family: var(--mono); font-size: var(--t-xs); color: var(--phosphor); }
	.switcher-seen { font-family: var(--mono); font-size: var(--t-xs); color: var(--ink-faint); }
	.switcher-none { padding: var(--s-4) var(--s-3); color: var(--ink-faint); font-size: var(--t-sm); }

	.well { flex: 1; min-height: 0; min-width: 0; padding: var(--s-5) var(--s-5) var(--s-8); }

	/* ---- Tone ------------------------------------------------------------------------------------ */

	.tone-good { --tone: var(--phosphor); }
	.tone-warn { --tone: var(--amber); }
	.tone-bad  { --tone: var(--rose); }

	/* ---- panel + composition --------------------------------------------------------------------- */

	.panels { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
	/* Deliberate composition, not auto-fit sameness: a narrow reference column against a wide one. */
	.split { display: grid; gap: var(--s-3); grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); align-items: start; }
	.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-3); align-content: start; }

	.panel {
		border: 1px solid var(--hairline);
		background: var(--surface);
		display: flex; flex-direction: column; min-width: 0;
	}
	.panel-head {
		display: flex; align-items: baseline; gap: var(--s-3);
		padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--hairline);
	}
	.panel-title {
		margin: 0; font-size: var(--t-2xs); letter-spacing: 0.14em; text-transform: uppercase;
		color: var(--ink-dim); font-weight: 600;
	}
	.panel-sub { font-size: var(--t-xs); color: var(--ink-faint); margin-left: auto; }
	.panel-body { padding: var(--s-4); }

	/* ---- stat ------------------------------------------------------------------------------------ */

	.stat-row { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
	.stat { display: flex; flex-direction: column; min-width: 0; }
	.stat-value {
		font-family: var(--mono); font-size: var(--t-md); font-weight: 600; line-height: 1.2;
		color: var(--tone, var(--ink));
	}
	.stat-label { font-size: var(--t-2xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
	.stat-sub { font-family: var(--mono); font-size: var(--t-xs); color: var(--ink-faint); }

	/* ---- gauge ----------------------------------------------------------------------------------- */

	.gauge-list { display: flex; flex-direction: column; gap: var(--s-3); }
	.gauge-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-1); }
	.gauge-label { font-size: var(--t-sm); color: var(--ink-dim); }
	.gauge-figure { font-family: var(--mono); font-size: var(--t-sm); color: var(--tone, var(--ink)); }
	.gauge-max { color: var(--ink-faint); margin-left: var(--s-micro); }
	.gauge-track { height: 6px; background: var(--void); border: 1px solid var(--hairline); }
	.gauge-fill { height: 100%; background: var(--tone, var(--phosphor)); transition: width 320ms cubic-bezier(0.23, 1, 0.32, 1); }
	.gauge-note { font-size: var(--t-xs); color: var(--ink-faint); font-style: italic; }

	/* ---- field ----------------------------------------------------------------------------------- */

	.fields { margin: 0; display: flex; flex-direction: column; gap: var(--s-2); }
	.field { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
	.field-label { font-size: var(--t-sm); color: var(--ink-faint); }
	.field-value {
		margin: 0; font-family: var(--mono); font-size: var(--t-sm);
		color: var(--tone, var(--ink)); text-align: right;
	}

	.badge-pill {
		display: inline-flex; align-items: center; padding: var(--s-micro) var(--s-2);
		font-size: var(--t-2xs); letter-spacing: 0.06em;
		border: 1px solid var(--tone, var(--hairline-bright));
		color: var(--tone, var(--ink-dim));
	}

	/* ---- status band + duty meter — the focal element and the signature -------------------------- */

	.status {
		display: grid; gap: var(--s-5); align-items: center;
		grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
		border: 1px solid var(--hairline);
		background:
			linear-gradient(90deg, color-mix(in srgb, var(--tone, var(--phosphor)) 8%, transparent), transparent 45%),
			var(--surface);
		padding: var(--s-4) var(--s-5);
		margin-bottom: var(--s-4);
	}
	.status-verdict { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
	.status-lamp {
		width: var(--s-2); height: var(--s-2); border-radius: 50%;
		background: var(--tone, var(--phosphor));
		box-shadow: 0 0 10px var(--tone, var(--phosphor));
		flex: none;
	}
	.status-word {
		font-size: var(--t-xl); font-weight: 700; letter-spacing: -0.02em;
		color: var(--tone, var(--ink));
	}
	.status-detail { font-size: var(--t-xs); color: var(--ink-faint); flex-basis: 100%; }

	.status-duties { display: grid; gap: var(--s-6); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

	.duty { display: flex; flex-direction: column; min-width: 0; }
	.duty-label { font-size: var(--t-2xs); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); }
	.duty-read { display: flex; align-items: baseline; gap: var(--s-1); }
	.duty-headroom {
		font-family: var(--mono); font-size: var(--t-lg); font-weight: 700;
		line-height: 1.2; letter-spacing: -0.02em; color: var(--tone, var(--ink));
	}
	.duty-unit { font-size: var(--t-2xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
	.duty-bar { display: flex; gap: var(--s-micro); height: var(--s-2); margin: var(--s-1) 0; }
	.duty-seg { flex: 1 1 0; min-width: 0; background: rgba(255, 255, 255, 0.06); }
	.duty-seg.is-lit {
		background: var(--tone, var(--phosphor));
		box-shadow: 0 0 5px color-mix(in srgb, var(--tone, var(--phosphor)) 55%, transparent);
	}
	.duty-used { font-family: var(--mono); font-size: var(--t-2xs); color: var(--ink-faint); }
	.duty-note { font-size: var(--t-xs); color: var(--ink-faint); font-style: italic; padding: var(--s-1) 0 var(--s-4); }

	/* The duty meter at table density: same reading, same Tone, two elements instead of 24. */
	.duty-mini-wrap { display: flex; align-items: center; gap: var(--s-2); justify-content: flex-end; }
	.duty-mini-value {
		font-family: var(--mono); font-variant-numeric: tabular-nums;
		font-size: var(--t-sm); font-weight: 600; color: var(--tone, var(--ink));
		min-width: 44px; text-align: right;
	}
	.duty-mini {
		display: block; width: 68px; height: var(--s-2); flex: none;
		background-image: repeating-linear-gradient(90deg, rgba(255,255,255,0.07) 0 3px, transparent 3px 5px);
	}
	.duty-mini-fill {
		display: block; height: 100%;
		background-image: repeating-linear-gradient(90deg, var(--tone, var(--phosphor)) 0 3px, transparent 3px 5px);
	}

	/* ---- sparkline ------------------------------------------------------------------------------- */

	.series-row { display: grid; gap: var(--s-5); grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
	.series { display: flex; flex-direction: column; min-width: 0; }
	.series-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); }
	.series-label { font-size: var(--t-2xs); letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-faint); }
	.series-delta { font-family: var(--mono); font-size: var(--t-2xs); color: var(--tone, var(--ink-faint)); }
	.series-value {
		font-family: var(--mono); font-variant-numeric: tabular-nums;
		font-size: var(--t-md); font-weight: 600; line-height: 1.2; color: var(--ink);
	}
	.series-sub { font-size: var(--t-2xs); color: var(--ink-faint); }
	.series-note { font-size: var(--t-xs); color: var(--ink-faint); font-style: italic; padding: var(--s-2) 0; }
	.series-chart { width: 100%; height: 34px; margin-top: var(--s-2); display: block; overflow: visible; }
	.series-line {
		fill: none; stroke: var(--tone, var(--phosphor)); stroke-width: 1.5;
		vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round;
	}
	.series-area { fill: color-mix(in srgb, var(--tone, var(--phosphor)) 14%, transparent); stroke: none; }

	/* ---- load histogram --------------------------------------------------------------------------- */
	/* The rolling window as one bar per bucket. Same 24-tick resolution as the duty meter above it, so
	   the two read as one instrument rather than two charts. */
	.histo { display: flex; flex-direction: column; min-width: 0; }
	.histo-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); }
	.histo-label { font-size: var(--t-2xs); letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-faint); }
	.histo-used { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: var(--t-2xs); color: var(--ink-faint); }
	.histo-plot {
		display: flex; align-items: flex-end; gap: 2px;
		height: 64px; margin-top: var(--s-2);
		border-bottom: 1px solid var(--hairline);
	}
	.histo-bar { flex: 1 1 0; display: flex; align-items: flex-end; height: 100%; min-width: 0; }
	.histo-fill {
		display: block; width: 100%;
		background: color-mix(in srgb, var(--tone, var(--phosphor)) 62%, transparent);
	}
	.histo-bar:hover .histo-fill { background: var(--tone, var(--phosphor)); }
	.histo-axis {
		display: flex; justify-content: space-between;
		font-size: var(--t-2xs); color: var(--ink-faint); margin-top: var(--s-1);
	}
	.histo-axis-frees { color: color-mix(in srgb, var(--ink-faint) 70%, transparent); }
	.histo-foot { display: flex; align-items: baseline; gap: var(--s-2); margin-top: var(--s-2); }
	.histo-headroom {
		font-family: var(--mono); font-variant-numeric: tabular-nums;
		font-size: var(--t-md); font-weight: 600; line-height: 1.2; color: var(--tone, var(--ink));
	}
	.histo-foot-label { font-size: var(--t-2xs); color: var(--ink-faint); }
	.histo-note { font-size: var(--t-2xs); color: var(--ink-faint); margin-top: var(--s-2); }

	/* The pulse gates on nothing, so it carries no ceiling, no headroom and no "frees at" axis — just the
	   counts and the shape. Its bars are phosphor throughout: there is no limit here to run out of. */
	.pulse-plot {
		display: flex; align-items: flex-end; gap: 2px;
		height: 44px; margin-top: var(--s-4);
		border-bottom: 1px solid var(--hairline);
	}
	.pulse-bar { flex: 1 1 0; display: flex; align-items: flex-end; height: 100%; min-width: 0; }
	.pulse-fill {
		width: 100%; min-height: 1px;
		background: color-mix(in srgb, var(--phosphor) 55%, transparent);
	}
	.pulse-bar:hover .pulse-fill { background: var(--phosphor); }
	.pulse-axis {
		display: flex; justify-content: space-between; margin-top: var(--s-1);
		font-family: var(--mono); font-size: var(--t-2xs); color: var(--ink-faint);
	}
	.pulse-note { font-size: var(--t-xs); color: var(--ink-faint); font-style: italic; margin-top: var(--s-3); }

	/* A panel that summarises a longer list says where the rest of it is. */
	.panel.tone-bad {
		border-color: color-mix(in oklab, var(--rose) 40%, var(--hairline));
	}
	.panel.tone-bad .panel-title { color: var(--rose); }

	/* A native <dialog>: the platform supplies focus trapping, Escape and the backdrop. */
	/* showModal() puts the dialog in the top layer, renders ::backdrop and makes everything behind it inert
	   — the centring below is the UA's own, restated so a later edit does not remove it by accident. */
	.modal {
		position: fixed; inset: 0; margin: auto;
		width: fit-content; height: fit-content;
		max-width: min(34rem, calc(100vw - var(--s-8)));
		/* Bounded, and the body scrolls rather than the footer sliding off the bottom of the viewport. */
		max-height: calc(100vh - var(--s-8));
		display: none; grid-template-rows: auto 1fr auto;
		padding: 0;
		border: 1px solid var(--hairline-bright);
		background: var(--surface-raised);
		color: var(--ink);
	}
	.modal[open] { display: grid; }
	.modal::backdrop { background: rgb(0 0 0 / 0.62); }
	.modal.tone-bad { border-color: color-mix(in oklab, var(--rose) 46%, var(--hairline-bright)); }

	/* Head, body, foot: the same three bands every modal has, so a question and a form read alike. */
	.modal-head {
		display: flex; align-items: center; gap: var(--s-3);
		padding: var(--s-3) var(--s-4);
		border-bottom: 1px solid var(--hairline);
	}
	.modal-title { margin: 0; flex: 1; font-size: var(--t-md); font-weight: 600; letter-spacing: 0; }
	.modal.tone-bad .modal-title { color: var(--rose); }

	/* Always present, so there is a way out that needs no reading. */
	.modal-dismiss {
		flex: none;
		display: grid; place-items: center;
		width: 26px; height: 26px; padding: 0;
		border: 1px solid transparent; background: transparent;
		color: var(--ink-faint); font-size: 18px; line-height: 1;
		cursor: pointer;
	}
	.modal-dismiss:hover { color: var(--ink); border-color: var(--hairline-bright); }

	.modal-main { display: grid; gap: var(--s-3); padding: var(--s-4); overflow-y: auto; min-height: 0; }
	.modal-body { margin: 0; color: var(--ink-dim); font-size: var(--t-sm); line-height: 1.55; }
	.modal-detail {
		margin: 0;
		padding: var(--s-2) var(--s-3);
		border-left: 2px solid var(--hairline-bright);
		color: var(--ink-faint);
		font-size: var(--t-xs);
		line-height: 1.55;
	}
	.modal-actions {
		display: flex; gap: var(--s-2); justify-content: flex-end; margin: 0;
		padding: var(--s-3) var(--s-4);
		border-top: 1px solid var(--hairline);
		background: var(--surface);
	}

	.admin-actions { display: flex; gap: var(--s-2); align-items: center; }

	.publish-form { display: flex; gap: var(--s-2); align-items: center; }
	.publish-form .onboard-input { min-width: 16rem; }

	.goal-edit { display: grid; gap: var(--s-2); }
	.goal-edit label { display: grid; gap: var(--s-1); }
	textarea.onboard-input { width: 100%; font-family: var(--font-mono, monospace); }
	.form-error { color: var(--rose); margin: 0; }

	.feature-accounts { list-style: none; margin: 0 0 var(--s-4); padding: 0; display: grid; gap: var(--s-1); }
	.feature-account {
		display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
		align-items: center; gap: var(--s-3);
		padding: var(--s-2) var(--s-3);
		border: 1px solid var(--hairline);
		font-size: var(--t-sm);
	}
	.feature-account-name { font-family: var(--mono); }
	.feature-account-state { display: flex; gap: var(--s-2); align-items: baseline; color: var(--ink-dim); }

	/* ---- shundo ---------------------------------------------------------------------------------- */

	.shundo-balance {
		display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-4);
	}
	.shundo-balance > .stat-row, .shundo-balance > .fields { flex: 1 1 28rem; }
	.shundo-topup { margin: 0; flex: none; }
	.shundo-renew { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
	.shundo-renew .panel-note { margin: 0; max-width: 28rem; }
	.shundo-order { display: grid; gap: var(--s-4); max-width: 44rem; }
	.shundo-order.shundo-live { max-width: 64rem; }
	.shundo-history { display: grid; gap: var(--s-4); }
	.shundo-blocked { display: grid; gap: var(--s-3); justify-items: start; }
	.shundo-blocked .panel-note { margin: 0; }
	.shundo-waiting { margin: 0; padding-left: var(--s-4); display: grid; gap: var(--s-1); }

	.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
	.checklist-step {
		display: grid; grid-template-columns: 1.75rem minmax(0, 1fr) auto; align-items: center; gap: var(--s-3);
		padding: var(--s-3);
		border: 1px solid var(--hairline);
	}
	.checklist-mark {
		display: grid; place-items: center; width: 1.75rem; height: 1.75rem; box-sizing: border-box;
		border: 1px solid var(--hairline); border-radius: 50%;
		font-family: var(--mono); font-size: var(--t-sm); color: var(--ink-dim);
	}
	.checklist-step.is-done .checklist-mark { border-color: var(--phosphor); color: var(--phosphor); }
	.checklist-step.is-done .checklist-title { color: var(--ink-dim); }
	.checklist-title { color: var(--ink); font-weight: 600; font-size: var(--t-sm); }
	.checklist-optional {
		margin-left: var(--s-2); font-weight: 400; font-size: var(--t-2xs); letter-spacing: 0.08em;
		text-transform: uppercase; color: var(--ink-faint);
	}
	.checklist-body { margin: var(--s-1) 0 0; font-size: var(--t-sm); color: var(--ink-dim); max-width: 48rem; }

	.guide-toc { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); font-size: var(--t-sm); }
	.guide-toc a { color: var(--phosphor); text-decoration: none; }
	.guide-toc a:hover { text-decoration: underline; }
	.guide :target > .panel { border-color: var(--phosphor); }
	.guide-prose { max-width: 48rem; font-size: var(--t-sm); line-height: 1.6; color: var(--ink-dim); }
	.guide-prose > :first-child { margin-top: 0; }
	.guide-prose p, .guide-prose ul, .guide-prose ol { margin: 0 0 var(--s-3); }
	.guide-prose ul, .guide-prose ol { padding-left: var(--s-5); }
	.guide-prose li + li { margin-top: var(--s-1); }
	.guide-prose strong, .guide-prose em { color: var(--ink); }
	.guide-prose a, .guide-faq a { color: var(--phosphor); }
	.guide .fields, .guide .table-wrap { margin-bottom: var(--s-3); }
	.guide-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-top: var(--s-3); }
	.guide-actions .shundo-topup { margin: 0; }
	.guide-faq { margin: 0; display: grid; gap: var(--s-1); max-width: 48rem; font-size: var(--t-sm); }
	.guide-faq dt { color: var(--ink); font-weight: 600; }
	.guide-faq dd { margin: 0 0 var(--s-3); color: var(--ink-dim); line-height: 1.6; }

	.hunt-form { display: grid; gap: var(--s-5); }
	.hunt-counts { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(14rem, 18rem)); }
	.hunt-modes, .hunt-accounts { margin: 0; padding: 0; border: none; display: grid; gap: var(--s-2); }
	.hunt-modes legend, .hunt-accounts legend { padding: 0; margin-bottom: var(--s-2); }
	.hunt-account-list { display: grid; gap: var(--s-2); }
	.hunt-accounts.is-searchable .hunt-account-list {
		grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
		max-height: 24rem; overflow-y: auto; padding: var(--s-2); border: 1px solid var(--hairline);
	}
	.hunt-account-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
	.hunt-account-tools input[type="search"] { flex: 1 1 14rem; }
	.hunt-account-list [hidden] { display: none; }
	.hunt-paused { color: var(--amber); font-weight: 600; }
	.hunt-mode {
		display: flex; align-items: baseline; gap: var(--s-2);
		padding: var(--s-2) var(--s-3);
		border: 1px solid var(--hairline);
		font-size: var(--t-sm); color: var(--ink-dim); cursor: pointer;
	}
	.hunt-mode strong { color: var(--ink); font-weight: 600; }
	.hunt-mode:has(input:checked) { border-color: var(--phosphor); background: var(--surface-raised); }
	.hunt-mode input { accent-color: var(--phosphor); }
	.hunt-mode.is-locked { cursor: not-allowed; }
	.hunt-mode.is-locked strong { color: var(--ink-faint); }
	.hunt-mode-locked { display: block; margin-top: var(--s-1); font-size: var(--t-2xs); color: var(--ink-faint); }
	.hunt-mode-locked a { color: var(--phosphor); }
	.hunt-rows { border-collapse: collapse; width: 100%; max-width: 60rem; }
	.hunt-rows th {
		text-align: left; padding: 0 var(--s-2) var(--s-1) 0;
		font-size: var(--t-2xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint);
		font-weight: 600;
	}
	.hunt-rows td { padding: 0 var(--s-2) var(--s-2) 0; }
	.hunt-rows .onboard-input { width: 100%; box-sizing: border-box; }
	.hunt-rows .hunt-count { width: 5rem; }
	.hunt-rows select.onboard-input { max-width: 16rem; }
	.hunt-priority, .hunt-wishlist { display: grid; gap: var(--s-2); }
	.hunt-lines-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
	.hunt-total-value { font-family: var(--mono); font-size: var(--t-xl); font-weight: 600; color: var(--ink); }
	.hunt-total-value.tone-bad { color: var(--rose); }
	.check-field { display: flex; align-items: baseline; gap: var(--s-2); font-size: var(--t-sm); color: var(--ink-dim); cursor: pointer; }
	.check-field strong { color: var(--ink); font-weight: 600; }
	.check-field .onboard-note { display: block; }
	.hunt-add-account { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
	.check-field.is-locked { cursor: not-allowed; }
	.check-field.is-locked strong { color: var(--ink-faint); }
	.hunt-changes { display: grid; gap: var(--s-1); }
	.hunt-changes ul { margin: 0; padding-left: var(--s-4); display: grid; gap: var(--s-1); }
	.hunt-charges summary { cursor: pointer; font-size: var(--t-sm); color: var(--ink-dim); }
	.hunt-charges[open] summary { margin-bottom: var(--s-2); }
	/* A hunt's catches: one card per shundo, its location card's art behind it under a scrim. */
	.catch-grid-wrap { display: grid; gap: var(--s-2); }
	.catch-grid {
		list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2);
		grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
	}
	.catch-card {
		display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3);
		border: 1px solid var(--hairline); background: var(--surface-raised);
	}
	.catch-card.has-art {
		background-image: linear-gradient(90deg, rgba(2, 6, 23, 0.9) 35%, rgba(2, 6, 23, 0.5)), var(--card-art);
		background-size: cover; background-position: center; border-color: var(--hairline-bright);
	}
	.catch-sprite { width: 64px; height: 64px; flex: none; object-fit: contain; }
	.catch-body { display: grid; gap: 2px; min-width: 0; font-size: var(--t-sm); color: var(--ink-dim); }
	.catch-name { color: var(--shiny); font-weight: 600; }
	.catch-variant, .catch-meta { font-size: var(--t-xs); overflow-wrap: anywhere; }
	.catch-cp { font-family: var(--mono); color: var(--ink); }
	.catch-body .badge-pill { justify-self: start; }
	@media (max-width: 520px) {
		.catch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
		.catch-card { flex-direction: column; align-items: flex-start; gap: var(--s-1); }
		.catch-sprite { width: 56px; height: 56px; }
	}
	.check-field input { accent-color: var(--phosphor); }
	.hunt-types-form { margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--hairline); }
	/* Each hunt type shows only its own inputs: the target for random and priority, the list or the lines. */
	.hunt-form:has(input[name="mode"][value="wishlist"]:checked) .hunt-target,
	.hunt-form:not(:has(input[name="mode"][value="wishlist"]:checked)) .hunt-total,
	.hunt-form:not(:has(input[name="mode"][value="wishlist"]:checked)) .hunt-wishlist,
	.hunt-form:not(:has(input[name="mode"][value="priority"]:checked)) .hunt-priority { display: none; }

	.plan-cards { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
	.plan-card.is-current { border-color: var(--phosphor); }
	.plan-card .panel-head { align-items: center; min-height: 2.75rem; box-sizing: border-box; }
	.plan-card-body { display: grid; gap: var(--s-2); justify-items: start; }
	.plan-card-body .panel-note { margin: 0; }
	.plan-price { font-family: var(--mono); font-size: var(--t-xl); font-weight: 600; color: var(--ink); }
	.plan-period, .plan-includes, .plan-parallel, .plan-accounts, .plan-hunts { font-size: var(--t-sm); color: var(--ink-dim); }
	.plan-hunts { margin-bottom: var(--s-2); }

	.billing-forms { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
	.billing-form { display: grid; gap: var(--s-3); align-content: start; }
	.billing-form .btn { justify-self: start; }

	.onboard { display: grid; gap: var(--s-3); }
	/* The first-run form stands on the page rather than in a modal, so it needs its own width and its own
	   action beside it. */
	.onboard-inline { display: grid; gap: var(--s-4); max-width: 26rem; }
	.onboard-inline .btn { justify-self: start; }
	.onboard-field { display: grid; gap: var(--s-1); }
	.onboard-label {
		font-size: var(--t-2xs); letter-spacing: 0.08em; text-transform: uppercase;
		color: var(--ink-faint);
	}
	.onboard-input {
		padding: var(--s-2) var(--s-3);
		/* Inset, not raised: an input receives content, and a darker fill says so without a heavy border. */
		background: var(--void);
		border: 1px solid var(--hairline-bright);
		color: var(--ink);
		font-family: var(--mono); font-size: var(--t-sm);
	}
	.onboard-input:focus-visible { border-color: var(--phosphor); }
	/* Progress is quiet; a refusal is not. A failure rendered in metadata grey reads as a caption on the
	   form rather than the reason it did not work. */
	.onboard-note { margin: 0; min-height: 1.2em; color: var(--ink-dim); font-size: var(--t-xs); }
	.onboard-note.tone-bad {
		display: flex; gap: var(--s-2); align-items: flex-start;
		padding: var(--s-2) var(--s-3);
		border: 1px solid color-mix(in oklab, var(--rose) 45%, var(--hairline-bright));
		border-left-width: 3px;
		background: color-mix(in oklab, var(--rose) 8%, var(--surface));
		color: var(--ink);
		font-size: var(--t-sm); line-height: 1.5;
	}
	.onboard-note.tone-bad::before {
		content: "!";
		flex: none;
		display: grid; place-items: center;
		width: 1.15em; height: 1.15em;
		border: 1px solid var(--rose); border-radius: 50%;
		color: var(--rose); font-family: var(--mono); font-size: var(--t-xs); font-weight: 700;
	}

	/* A modal whose action is in flight is inert, including its ways out: dismissing a dialog whose request
	   is still running reads as nothing having happened, while it happens. */
	.modal[data-busy] .modal-dismiss { opacity: 0.38; pointer-events: none; }
	.modal[data-busy] .modal-main { opacity: 0.6; }
	.onboard[data-busy] .onboard-input { opacity: 0.5; }
	.onboard .btn { justify-self: start; }

	.panel-note {
		margin: 0 0 var(--s-3);
		color: var(--ink-faint);
		font-size: var(--t-sm);
		line-height: 1.5;
	}

	.panel-more {
		display: inline-block; margin-top: var(--s-3);
		font-size: var(--t-2xs); letter-spacing: 0.06em;
		color: var(--ink-faint); text-decoration: none;
		border-bottom: 1px solid var(--hairline-bright);
	}
	.panel-more:hover { color: var(--phosphor); border-bottom-color: var(--phosphor); }

	/* ---- component catalogue ------------------------------------------------------------------------ */
/* The gallery renders in the real theme at real sizes; only the framing around each specimen is its own. */
.catalog-specimen .panel-sub { max-width: 60ch; }
.catalog-states {
	display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s-5);
}
.catalog-states > * { min-width: 0; }
.catalog-filler { font-size: var(--t-2xs); color: var(--ink-faint); }

	/* A caption names the table for a screen reader; it is not a second visible heading, so it is placed off
	   screen rather than hidden — display:none would remove it from the accessibility tree entirely. */
	.table-caption {
	position: absolute; width: 1px; height: 1px; overflow: hidden;
	clip-path: inset(50%); white-space: nowrap;
	}

	/* ---- actions --------------------------------------------------------------------------------- */
	/* A button is a chip that COMMITS, so it takes the chip's geometry exactly — same height, same inset
	   surface, same type, same transition. Only the emphasis differs: a primary action wears permanently
	   what an active chip wears while selected. Inventing a second control appearance is what made these
	   read as foreign. */
	.btn {
		display: inline-flex; align-items: center; gap: var(--s-2);
		min-height: 36px; padding: 0 var(--s-4);
		border: 1px solid var(--hairline-bright);
		background: var(--void);
		color: var(--ink-dim);
		font-family: inherit; font-size: var(--t-sm); font-weight: 500;
		cursor: pointer; text-decoration: none; white-space: nowrap;
		transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
	}
	.btn:hover { color: var(--ink); background: var(--surface-raised); }
	.btn-primary { color: var(--ink); border-color: var(--phosphor); }
	.btn-primary:hover { background: var(--surface-raised); }
	.btn-danger { color: var(--ink); border-color: var(--rose); }
	.btn-danger:hover { background: var(--surface-raised); }
	.btn-warning { color: var(--ink); border-color: var(--amber); }
	.btn-warning:hover { background: var(--surface-raised); }
	.btn-quiet { border-color: transparent; }
	.btn-quiet:hover { border-color: var(--hairline-bright); }
	.btn:disabled { opacity: 0.38; cursor: not-allowed; }
	.btn:disabled:hover { color: var(--ink-dim); background: var(--void); }

	/* The action rides the verdict it resolves, pushed to the far end of the band. */
	.status-action { margin-left: auto; padding-left: var(--s-4); }

	/* The notification stack: fixed, top-right, newest first. Pointer events are off on the column so it
	   never blocks the page under it; each toast turns them back on for its own dismiss-on-click. */
	.toasts {
		position: fixed; top: var(--s-4); right: var(--s-4); z-index: 1000;
		display: flex; flex-direction: column; gap: var(--s-2);
		pointer-events: none;
	}
	.toasts .toast { pointer-events: auto; cursor: pointer; }
	/* Entering, repeating and leaving are all the same short move, so a repeat reads as the same object being
	   updated rather than a new one appearing. */
	.toast { animation: toast-in 160ms ease-out; }
	.toast.is-leaving { opacity: 0; transform: translateY(-4px); transition: opacity 200ms ease, transform 200ms ease; }
	.toast.is-repeat { animation: toast-bump 200ms ease-out; }
	.toast-count {
		font-family: var(--mono); font-size: var(--t-xs); color: var(--ink-faint);
	}
	@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }
	@keyframes toast-bump { 50% { border-color: var(--tone, var(--hairline-bright)); } }

	/* An outcome is a surface tint and a brighter word, like every other highlight here. No coloured rail. */
	/* Height comes from the padding, not a min-height: the title and body sit on a shared BASELINE so their
	   two sizes read as one line, and baseline alignment does nothing to centre them inside a taller box —
	   the text would hug the top. 8px + a 13px/1.5 line + 8px lands on the same 36px as a chip. */
	.toast {
		display: inline-flex; align-items: baseline; gap: var(--s-3);
		padding: var(--s-2) var(--s-4);
		background: var(--surface-raised); border: 1px solid var(--hairline);
	}
	.toast-title { font-size: var(--t-sm); font-weight: 600; color: var(--tone, var(--ink)); }
	.toast-body { font-size: var(--t-xs); color: var(--ink-dim); }

/* ---- data table ------------------------------------------------------------------------------ */

	/* The same table renders full-width on its own screen and in a half-width overview panel. Cells do not wrap
	   -- a sprite, a species and a CP are one line by design -- so a narrow container scrolls it rather than
	   letting it spill past the panel's edge. */
	.table-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
	.table { width: 100%; border-collapse: collapse; }
	.table th {
		text-align: left; font-size: var(--t-2xs); letter-spacing: 0.13em; text-transform: uppercase;
		color: var(--ink-faint); font-weight: 600; padding: 0 var(--s-3) var(--s-2);
		border-bottom: 1px solid var(--hairline); white-space: nowrap;
	}
	.table th.num, .table td.num { text-align: right; }
	.table td {
		padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--hairline);
		font-size: var(--t-sm); color: var(--tone, var(--ink-dim)); white-space: nowrap;
	}
	.table tbody tr:last-child td { border-bottom: none; }
	.table tbody tr:hover td { background: var(--surface-raised); }
	.table td.num .cell-text, .table td.num .cell-sub {
		font-family: var(--mono); font-variant-numeric: tabular-nums;
	}
	/* A commemorative catch wears its own artwork. The scrim is heavier on the left, where the text starts, so
	   the row stays as readable as the plain ones beside it. */
	.table tbody tr.row-art {
		background-image:
			linear-gradient(90deg, rgba(2, 6, 23, 0.94) 30%, rgba(2, 6, 23, 0.55)),
			var(--row-art);
		background-size: cover; background-position: center;
	}
	.table tbody tr.row-art td { background: transparent; border-bottom-color: var(--hairline-bright); }
	.table tbody tr.row-art:hover td { background: rgba(19, 26, 46, 0.5); }

	.cell-mark { margin-left: var(--s-1); font-size: var(--t-xs); line-height: 1; }
	.cell-mark-shiny { color: var(--shiny); }
	.cell-mark-fav { color: var(--rose); }

	/* A sprite in a row is identification, not decoration: a reader recognises a species faster than they read
	   its name. Sized to the row so it never sets the row's height. */
	.cell-sprite {
		width: 28px; height: 28px; object-fit: contain;
		vertical-align: middle; margin-right: var(--s-2); margin-block: -6px;
	}
	.cell-link { color: var(--ink); font-weight: 600; text-decoration: none; }
	.cell-link:hover { color: var(--phosphor); }
	.cell-sub { color: var(--ink-faint); margin-left: var(--s-1); font-size: var(--t-xs); }
	.th-sort {
		display: inline-flex; align-items: baseline; gap: var(--s-1);
		color: inherit; text-decoration: none; cursor: pointer;
	}
	.th-sort:hover { color: var(--ink); }
	.table th.is-sorted { color: var(--ink); }
	.th-arrow { font-family: var(--mono); font-size: var(--t-2xs); }

	.pager {
		display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
		padding-top: var(--s-3); flex-wrap: wrap;
	}
	.pager-summary { font-family: var(--mono); font-size: var(--t-xs); color: var(--ink-faint); }
	.pager-steps { display: flex; gap: var(--s-2); }
	.pager-step {
		display: inline-flex; align-items: center; min-height: 32px; padding: 0 var(--s-3);
		border: 1px solid var(--hairline-bright); background: var(--void);
		color: var(--ink-dim); font-size: var(--t-xs); text-decoration: none;
	}
	.pager-step:hover { color: var(--ink); background: var(--surface-raised); border-color: var(--phosphor); }
	.pager-step.is-off { opacity: 0.35; border-color: var(--hairline); }

	.cell-lamp {
		display: inline-block; width: 6px; height: 6px; border-radius: 50%;
		margin-right: var(--s-2); vertical-align: middle;
		background: var(--tone, var(--ink-faint)); box-shadow: 0 0 6px var(--tone, transparent);
	}

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

	.controls { display: flex; flex-direction: column; gap: var(--s-3); margin-bottom: var(--s-4); }
	.control-row { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
	.control-legend {
		font-size: var(--t-2xs); letter-spacing: 0.14em; text-transform: uppercase;
		color: var(--ink-faint); min-width: 60px;
	}

	input.search {
		min-height: 36px; flex: 1; min-width: 200px;
		background: var(--void);
		border: 1px solid var(--hairline-bright);
		color: var(--ink);
		font-family: var(--mono); font-size: var(--t-sm);
		padding: 0 var(--s-3);
		transition: border-color 160ms ease;
	}
	input.search:hover, input.search:focus { border-color: var(--phosphor); outline: none; }
	input.search::placeholder { color: var(--ink-faint); font-family: var(--sans); }

	.chip {
		display: inline-flex; align-items: center; gap: var(--s-2);
		min-height: 36px; padding: 0 var(--s-3);
		border: 1px solid var(--hairline-bright);
		background: var(--void);
		color: var(--ink-dim);
		font-size: var(--t-sm); font-weight: 500;
		cursor: pointer; text-decoration: none;
		transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
		white-space: nowrap;
	}
	.chip:hover { color: var(--ink); background: var(--surface-raised); }
	.chip[aria-pressed="true"] { color: var(--ink); background: var(--surface-raised); border-color: var(--phosphor); }
	.chip[aria-pressed="true"].chip-transfer { border-color: var(--amber); }
	.chip-count { font-family: var(--mono); font-size: var(--t-xs); color: var(--ink-faint); }
	.chip[aria-pressed="true"] .chip-count { color: inherit; opacity: 0.75; }
	.chip-arrow { font-family: var(--mono); font-size: var(--t-xs); }
	/* A combination with no matches: still reachable, but visibly a dead end rather than a live option. */
	.chip-empty { opacity: 0.38; }
	.chip-empty:hover { opacity: 0.55; }

	/* ---- box grid -------------------------------------------------------------------------------- */

	.tally {
		font-family: var(--mono); font-size: var(--t-xs);
		color: var(--ink-faint); letter-spacing: 0.04em;
	}
	.tally b { color: var(--ink-dim); font-weight: 500; }

	.grid {
		list-style: none; margin: 0; padding: 0;
		display: grid; gap: var(--s-3);
		grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
	}
	@media (min-width: 1440px) { .grid { grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); } }

	.card {
		position: relative;
		display: grid;
		grid-template-rows: var(--row-art) var(--row-stats) var(--row-moves) var(--row-pools);
		border: 1px solid var(--hairline);
		background: var(--surface);
		overflow: hidden;
		transition: border-color 160ms ease, transform 160ms ease;
	}
	.card:hover { border-color: var(--hairline-bright); transform: translateY(-1px); }
	.card[data-membership="candidate"] { border-color: rgba(251, 191, 36, 0.32); }
	.card[data-membership="keep"] { border-color: rgba(74, 222, 128, 0.28); }

	.card-art {
		position: relative; overflow: hidden;
		display: flex; flex-direction: column; align-items: center; justify-content: center;
		padding: var(--badge-band) var(--s-2) var(--s-2);
		border-bottom: 1px solid var(--hairline);
	}
	/* Reserved whether or not this mon has a variant, so the sprite sits at one height on every card. */
	.variant-slot { min-height: var(--s-3); }

	/* The commemorative art is atmosphere, not content — dimmed hard so the sprite stays legible. */
	.card-art::after {
		content: ''; position: absolute; inset: 0;
		background: linear-gradient(180deg, rgba(11, 16, 32, 0.6), rgba(11, 16, 32, 0.88));
	}
	.card-art > * { position: relative; z-index: 1; }
	.card-art > .card-art-bg {
		position: absolute; inset: 0; z-index: 0;
		width: 100%; height: 100%; object-fit: cover;
	}

	/* The game's own lucky sparkle, layered as an aura. It sits ABOVE the commemorative art and its dimming
	   veil — a lucky mon should read as lucky whatever it was caught over — and below the sprite, which shares
	   the z-index of every other child and wins on paint order by coming later in the document. The sparkle is
	   a small scatter, so it is centred at a size that keeps its grain rather than stretched to the corners. */
	.card-art-lucky {
		position: absolute; inset: 0; z-index: 1; pointer-events: none;
		background: url("/ui-assets/icons/lucky.png") center / 112px auto no-repeat;
		opacity: 0.72;
	}

	/* Alignment sits at the foot of the art, clear of the two corner rows above it: it is a fact about the mon
	   rather than a mark competing with the keep badge. Same masked-glyph treatment as the Max flags. */
	.align-mark {
		position: absolute; left: var(--s-2); bottom: var(--s-2); z-index: 2;
		width: 16px; height: 16px;
		-webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
		-webkit-mask-position: center; mask-position: center;
		-webkit-mask-size: contain; mask-size: contain;
	}
	.align-shadow {
		background-color: var(--shadow);
		-webkit-mask-image: url("/ui-assets/icons/shadow.png"); mask-image: url("/ui-assets/icons/shadow.png");
	}
	.align-purified {
		background-color: var(--purified);
		-webkit-mask-image: url("/ui-assets/icons/purified.png"); mask-image: url("/ui-assets/icons/purified.png");
	}

	.sprite { width: 80px; height: 80px; object-fit: contain; flex: none; }
	.species { font-size: var(--t-sm); font-weight: 600; text-align: center; line-height: 1.25; }
	/* A trainer-given name reads as one: italic sets it apart from a species at a glance, and the species
	   itself drops to the line below rather than being lost. It wraps like any other name — a nickname is free
	   text, and truncating it would hide the very thing the trainer wrote. */
	.species.is-nickname { font-style: italic; }
	.variant { font-size: var(--t-2xs); color: var(--ink-faint); text-align: center; }
	.identity { display: flex; align-items: center; gap: var(--s-2); font-family: var(--mono); font-size: var(--t-2xs); color: var(--ink-faint); }

	/* The card's two corners. Left: what the mon IS — its keep decision and its bread category. Right: what it
	   HAS. Both are rows, so a card carrying two marks lays them side by side rather than stacking them. */
	.card-corner, .flags {
		position: absolute; top: var(--s-2); z-index: 2;
		display: flex; align-items: center; gap: var(--s-2);
	}
	.card-corner { left: var(--s-2); }
	/* A card carrying every mark at once (shiny, favourite, background, league standing, size) would otherwise
	   run into the corner opposite. Capped and wrapped, the marks stack into the art instead of colliding. */
	.flags {
		right: var(--s-2); gap: var(--s-1);
		flex-wrap: wrap; justify-content: flex-end; max-width: 55%;
	}

	/* The pill as it reads over the commemorative art: the console's tone vocabulary, made opaque. */
	.card-badge { background: color-mix(in srgb, var(--tone, var(--ink-faint)) 20%, var(--void)); }
	.flag { width: 15px; height: 15px; display: block; }
	.flag-shiny { color: var(--shiny); }
	.flag-fav { color: var(--rose); }
	.flag-bg { color: var(--ink-dim); }
	/* Dynamax and Gigantamax carry the game's own glyphs, masked to the token below so the shape comes from
	   the asset's alpha and the colour from the design system. Larger than the flags beside them: those are
	   attributes, this is a keep CATEGORY, and at 15px it read as decoration. */
	.flag-bread {
		width: 26px; height: 20px;
		background-color: var(--dynamax);
		-webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
		-webkit-mask-position: center; mask-position: center;
		-webkit-mask-size: contain; mask-size: contain;
		filter: drop-shadow(0 0 5px color-mix(in srgb, var(--dynamax) 55%, transparent));
	}
	.flag-dmax {
		-webkit-mask-image: url("/ui-assets/icons/dynamax.png");
		mask-image: url("/ui-assets/icons/dynamax.png");
	}
	.flag-gmax {
		-webkit-mask-image: url("/ui-assets/icons/gigantamax.png");
		mask-image: url("/ui-assets/icons/gigantamax.png");
	}
	.flag-size {
		font-family: var(--mono); font-size: var(--t-2xs); font-weight: 700; letter-spacing: 0.04em;
		color: var(--ink-dim); width: auto; line-height: 15px;
	}

	/* A league standing is quiet until it means something: only the top of a league is marked at all, and the
	   phosphor tone is reserved for the rank that is itself the reason the mon is protected from transfer. */
	.flag-rank {
		font-family: var(--mono); font-size: var(--t-2xs); font-weight: 700; letter-spacing: 0.04em;
		color: var(--ink-dim); width: auto; line-height: 15px;
	}
	.flag-rank.is-keep { color: var(--phosphor); }

	/* Buddy progress is only marked once it reaches the tier the keep policy protects — early hearts say
	   nothing about a mon. Same mono mark as a league standing, and the same phosphor for the tier that is
	   itself the reason the mon is kept. */
	.flag-buddy {
		font-family: var(--mono); font-size: var(--t-2xs); font-weight: 700; letter-spacing: 0.04em;
		color: var(--ink-dim); width: auto; line-height: 15px;
	}
	.flag-buddy.is-keep { color: var(--phosphor); }

	.stats {
		display: flex; flex-direction: column; justify-content: center; gap: var(--s-1);
		padding: 0 var(--s-2); overflow: hidden;
	}
	/* Named apart from the component .stat-row: this is a card's internal baseline row, not a tile grid. */
	.card-stat-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); }
	.cp { font-family: var(--mono); font-size: var(--t-md); font-weight: 700; }
	.cp-label { font-size: var(--t-2xs); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
	.sub { font-family: var(--mono); font-size: var(--t-xs); color: var(--ink-dim); }

	/* IV reads as a meter as well as a number — the fastest thing to scan across a wall of cards. */
	.iv-track { height: 3px; background: var(--hairline); overflow: hidden; }
	.iv-fill { height: 100%; background: linear-gradient(90deg, var(--amber), var(--phosphor)); }

	/* Two Chip rows fit; a rare third move clips rather than growing the card. The full list is on the
	   container's title, so nothing is unreachable. */
	.moves {
		display: flex; flex-wrap: wrap; align-content: center; justify-content: center;
		gap: var(--s-micro); padding: 0 var(--s-2); overflow: hidden;
	}
	.move {
		font-family: var(--mono); font-size: var(--t-2xs); color: var(--ink-dim);
		background: var(--surface-raised); padding: var(--s-micro) var(--s-2);
	}

	/* The game renders a legacy move in a shifting spectrum. A card wall cannot carry animation sixty times
	   over, so the gradient is held still and the chip keeps the same weight as its neighbours — only the
	   letters change, which is enough to find at a glance without competing with the keep badge. */
	/* The chip keeps its own box and the spectrum is clipped to the glyphs of an inner span. Clipping to text
	   and to the box on one element needs a two-layer background-clip, which Firefox renders as a filled block
	   with invisible letters; a single-value clip on a child is understood everywhere. */
	.move-legacy {
		background-image: linear-gradient(90deg, #f87171, #fbbf24, #4ade80, #38bdf8, #a78bfa);
		-webkit-background-clip: text;
		background-clip: text;
		color: transparent;
		font-weight: 700;
	}
	/* Firefox before 49 has neither clip; the letters would vanish into the chip, so they keep a colour there. */
	@supports not ((background-clip: text) or (-webkit-background-clip: text)) {
		.move-legacy { color: var(--shiny); }
	}

	.pools {
		display: flex; align-items: center; justify-content: center; gap: var(--s-3);
		padding: 0 var(--s-2); border-top: 1px solid var(--hairline); overflow: hidden;
		font-family: var(--mono); font-size: var(--t-xs); color: var(--ink-dim);
	}
	.pool { display: inline-flex; align-items: center; gap: var(--s-1); }
	.pool img { width: var(--icon); height: var(--icon); object-fit: contain; }

	/* ---- states --------------------------------------------------------------------------------- */

	.empty {
		border: 1px dashed var(--hairline-bright);
		padding: var(--s-8) var(--s-6); text-align: center; color: var(--ink-dim);
	}
	.empty-title { font-family: var(--mono); font-size: var(--t-sm); color: var(--ink); margin-bottom: var(--s-1); }
	.empty-body { font-size: var(--t-sm); }
	.empty-action { color: var(--phosphor); margin-left: var(--s-1); }

	.sentinel { padding: var(--s-6); display: grid; place-items: center; }
	.spinner {
		width: 18px; height: 18px; border-radius: 50%;
		border: 2px solid var(--hairline-bright); border-top-color: var(--phosphor);
		animation: spin 700ms linear infinite;
	}
	@keyframes spin { to { transform: rotate(360deg); } }

	.htmx-indicator { opacity: 0; transition: opacity 160ms ease; }
	.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

	/* A submitted form's buttons and an htmx button in flight: a spinner beside the label, no second click. */
	.btn.is-busy, .btn.htmx-request { cursor: progress; pointer-events: none; }
	.btn.is-busy::after, .btn.htmx-request::after {
		content: ""; display: inline-block; vertical-align: -2px; margin-left: var(--s-2);
		width: 0.9em; height: 0.9em; border-radius: 50%;
		border: 2px solid currentColor; border-right-color: transparent;
		animation: spin 700ms linear infinite;
	}
	form[aria-busy="true"] { cursor: progress; }

	/* The live panel's poll: a faint note in the corner while a refresh is in flight. */
	.poll { display: flex; justify-content: flex-end; min-height: 1.2em; }
	.poll-status { font-family: var(--mono); font-size: var(--t-xs, 11px); color: var(--ink-faint); }

	/* Filtering and searching are actions repeated constantly, so the result must not perform an
	   entrance. The region being replaced dims for as long as its request is in flight and the new
	   content simply appears — motion felt, not watched, and nothing to sit through per keystroke. */
	#box-grid.htmx-request, #fleet-rows.htmx-request { opacity: 0.45; }
	#box-grid, #fleet-rows { transition: opacity 120ms ease-out; }

	/* ---- responsive ------------------------------------------------------------------------------ */

	@media (max-width: 1080px) { .split { grid-template-columns: minmax(0, 1fr); } }
	/* Below 900px the sidebar is a bar of the brand and a Menu button; the sections and viewer card open as a
	   drawer from the right. Every control is at least 40px tall, a comfortable thumb. */
	@media (max-width: 900px) {
		.app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
		.sidebar {
			position: static; height: auto; padding: var(--s-2) var(--s-3);
			border-right: none; border-bottom: 1px solid var(--hairline);
		}
		.brand { padding: 0 var(--s-2); min-height: 40px; }
		.nav-toggle {
			display: inline-flex; align-items: center; gap: var(--s-2);
			min-height: 40px; padding: 0 var(--s-4);
			border: 1px solid var(--hairline-bright); background: var(--void); color: var(--ink);
			font: inherit; font-size: var(--t-sm); cursor: pointer;
		}
		.sidebar-drawer[popover]:not(:popover-open) { display: none; }
		.sidebar-drawer[popover]:popover-open {
			position: fixed; inset: 0 0 0 auto; width: min(20rem, 85vw); height: 100dvh; margin: 0;
			padding: var(--s-4) var(--s-2); overflow-y: auto;
			background: var(--surface); border-left: 1px solid var(--hairline-bright);
		}
		.sidebar-drawer::backdrop { background: rgba(2, 6, 23, 0.6); }
		.nav-item, .btn, .chip, input.search, .onboard-input, .landing-cta { min-height: 40px; }
		.viewer-out, .guide-toc a, .th-sort { display: inline-flex; align-items: center; min-height: 40px; }
		.check-field { min-height: 40px; padding-block: var(--s-2); }
		.check-field input, .hunt-mode input { width: 20px; height: 20px; flex: none; }
		/* A priority row or wishlist line keeps fields wide enough to read what was typed; the table scrolls. */
		.hunt-rows { min-width: 40rem; }
	}
	@media (max-width: 720px) { .status { grid-template-columns: minmax(0, 1fr); } }

	@media (prefers-reduced-motion: reduce) {
		*, *::before, *::after {
			animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
			transition-duration: 0.01ms !important;
		}
	}

/* ---- account map ------------------------------------------------------------------------------- */
/* The basemap is structure and the trace is content, so the canvas sits on the console's own surface and
   MapLibre's chrome is restyled to the console's rather than left as the library's default white. */
	.map {
		width: 100%; height: 68vh; min-height: 420px;
		background: var(--void); border: 1px solid var(--hairline);
	}
	/* MapLibre fills the container with absolutely-positioned canvas layers, so a message in normal flow lands
	   UNDERNEATH them: an empty window showed a world map instead of saying it was empty. */
	.map { position: relative; }
	.map.is-empty::after {
		content: attr(data-empty);
		position: absolute; inset: 0; z-index: 2;
		display: flex; align-items: center; justify-content: center;
		background: var(--void);
		font-size: var(--t-sm); color: var(--ink-faint); font-style: italic;
	}
	.map canvas { outline: none; }

	.map-legend {
		display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-5);
		padding-top: var(--s-3); font-size: var(--t-2xs); letter-spacing: 0.08em;
		text-transform: uppercase; color: var(--ink-faint);
	}
	.map-key { display: inline-flex; align-items: center; gap: var(--s-2); }
	.map-dot { width: 8px; height: 8px; border-radius: 50%; display: block; }
	/* The legend's catch key stands in for a species sprite, which cannot be drawn generically. */
	.map-dot-catch { background: var(--ink-dim); border-radius: 2px; }
	.map-dot-notable {
		background: color-mix(in srgb, var(--amber) 18%, transparent);
		box-shadow: 0 0 0 1.5px var(--amber);
	}
	.map-stop { width: 10px; height: 18px; object-fit: contain; display: block; }


	/* MapLibre's own chrome, in the console's palette. */
	.maplibregl-ctrl-group {
		background: var(--surface-raised); border: 1px solid var(--hairline); box-shadow: none;
	}
	.maplibregl-ctrl-group button + button { border-top: 1px solid var(--hairline); }
	.maplibregl-ctrl-group button span { filter: invert(1) opacity(0.7); }
	.maplibregl-ctrl-scale {
		background: transparent; border-color: var(--hairline-bright); color: var(--ink-faint);
		font-family: var(--mono); font-size: var(--t-2xs);
	}
	.maplibregl-ctrl-attrib {
		background: color-mix(in srgb, var(--void) 80%, transparent) !important;
		color: var(--ink-faint); font-size: var(--t-2xs);
	}
	.maplibregl-ctrl-attrib a { color: var(--ink-dim); }

	.map-popup .maplibregl-popup-content {
		background: var(--surface-raised); border: 1px solid var(--hairline-bright);
		border-radius: 0; padding: var(--s-3); box-shadow: 0 8px 24px rgba(2, 6, 23, 0.6);
	}
	.map-popup .maplibregl-popup-tip { border-top-color: var(--hairline-bright); border-bottom-color: var(--hairline-bright); }
	.map-pop { display: flex; align-items: center; gap: var(--s-3); }
	.map-pop-sprite { width: 48px; height: 48px; object-fit: contain; flex: none; }
	.map-pop-title { font-size: var(--t-sm); font-weight: 600; color: var(--ink); }
	.map-pop-meta { font-size: var(--t-xs); color: var(--ink-dim); font-family: var(--mono); }
	.map-pop-when { font-size: var(--t-2xs); color: var(--ink-faint); }

	/* The legend IS the layer switch: a key that does nothing next to a control that does the same thing
	   twice over would be two vocabularies for one idea. */
	.map-legend { border: none; margin: 0; padding: var(--s-3) 0 0; }
	.map-key { cursor: pointer; }
	.map-key-static { cursor: default; }
	.map-toggle { accent-color: var(--phosphor); width: 13px; height: 13px; margin: 0; cursor: pointer; }
	.map-dot-stop { background: var(--phosphor); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
	.map-dot-scan {
		background: color-mix(in srgb, #38bdf8 12%, transparent);
		box-shadow: 0 0 0 1px color-mix(in srgb, #38bdf8 55%, transparent);
	}
	.map-dot-line { width: 20px; height: 2px; border-radius: 0; background: var(--phosphor); opacity: 0.55; }

/* ---- time range ------------------------------------------------------------------------------- */
/* One control for every screen that reads history: presets as plain links, and an absolute pair as a GET
   form. Both work with no JS, because the whole next state is in the URL either way. */
	.range { display: flex; flex-direction: column; gap: var(--s-2); }
	.range .control-row { flex-wrap: wrap; }
	.range-form { display: inline-flex; align-items: center; gap: var(--s-2); margin-left: auto; }
	.range-field { display: inline-flex; align-items: center; gap: var(--s-2); }
	.range-label {
		font-size: var(--t-2xs); letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-faint);
	}
	.range-input {
		min-height: 36px; padding: 0 var(--s-2);
		border: 1px solid var(--hairline-bright); background: var(--void); color: var(--ink);
		font-family: var(--mono); font-size: var(--t-xs);
		color-scheme: dark;
	}
	.range-input:hover { border-color: var(--phosphor); }
	.range-apply { min-height: 36px; }
	.range-summary {
		display: flex; align-items: baseline; gap: var(--s-3);
		font-size: var(--t-2xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint);
	}
	.range-note { text-transform: none; letter-spacing: 0; font-style: italic; color: var(--amber); }

/* ── landing ──────────────────────────────────────────────────────────────────────────────────────────────
   The public page. Shares the console's tokens and typeface; none of its chrome, because there is no viewer
   to render one for. */
.landing {
	/* 100vh, not 100dvh: the dynamic unit changes as browser chrome shows and hides, and a centred grid
	   re-centres on every change — which reads as the text flickering while you drag a selection. */
	min-height: 100vh; display: grid; place-items: center;
	background: var(--void); padding: var(--s-6) var(--s-5);
}
.landing-well { width: 100%; max-width: 46rem; }
.landing-brand { padding: 0 0 var(--s-6); gap: var(--s-3); }
.landing-brand .brand-mark { width: 56px; height: 56px; }
.landing-brand .brand-word { font-size: var(--t-sm); }
.landing-title {
	font-size: clamp(2rem, 6vw, 3.25rem); line-height: 1.05; letter-spacing: -0.02em;
	color: var(--ink); margin: 0 0 var(--s-4); font-weight: 600;
}
.landing-lede {
	font-size: var(--t-md); line-height: 1.6; color: var(--ink-dim);
	margin: 0 0 var(--s-6); max-width: 38rem;
}
.landing-cta {
	display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s-5);
	background: var(--phosphor); color: var(--void);
	font-family: var(--mono); font-size: var(--t-xs); font-weight: 700;
	letter-spacing: 0.16em; text-transform: uppercase; text-decoration: none;
	transition: filter 140ms ease;
}
.landing-cta:hover { filter: brightness(1.12); }
.landing-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.landing-cta-quiet {
	background: transparent; color: var(--phosphor);
	box-shadow: inset 0 0 0 1px var(--phosphor);
}
.landing-points {
	list-style: none; margin: var(--s-8) 0 0; padding: var(--s-5) 0 0;
	border-top: 1px solid var(--hairline);
	display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}
.landing-point { display: flex; flex-direction: column; gap: var(--s-1); }
.landing-point-label {
	font-family: var(--mono); font-size: var(--t-2xs); letter-spacing: 0.14em;
	text-transform: uppercase; color: var(--phosphor);
}
.landing-point-body { font-size: var(--t-sm); line-height: 1.5; color: var(--ink-dim); }
/* The phone's sticky sign-in: fixed, so appearing shifts nothing, and slid out of view and hidden from
   assistive tech until landing.js says the hero's button has scrolled away. The landing keeps room for it at
   its foot so it never covers the last line. */
.landing-sticky {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
	padding: var(--s-3) var(--s-5) calc(var(--s-3) + env(safe-area-inset-bottom));
	background: rgba(2, 6, 23, 0.92); border-top: 1px solid var(--hairline);
	backdrop-filter: blur(8px);
	transform: translateY(100%); visibility: hidden;
	transition: transform 180ms ease, visibility 0s linear 180ms;
}
.landing-sticky.is-shown { transform: none; visibility: visible; transition: transform 180ms ease; }
.landing-sticky-cta { display: flex; justify-content: center; width: 100%; }
@media (max-width: 720px) { .landing:has(.landing-sticky) { padding-bottom: calc(var(--s-6) + 72px); } }
@media (min-width: 721px) { .landing-sticky { display: none; } }
