/* ============================================================
   MEA Component Library
   Production-ready component styles derived from prototypes.
   Import tokens.css before this file.
   ============================================================ */

/* ── RESET ── */
@layer reset {

	*,
	*::before,
	*::after {
		box-sizing: border-box;
		margin: 0;
		padding: 0;
		-webkit-tap-highlight-color: transparent;
	}
}

/* Everything below is the legacy component surface, assigned to the
   reserved `legacy` cascade layer (declared in frontend/app/00-layers.css)
   so the migrated @layer layout/design/theme rules can win as designed.
   Wrapped 2026-06-09 (design-fidelity pass; see RECONCILIATION-2026-06-09). */
@layer legacy {

	/* ── Screen reader only (WCAG utility) ── */
	.sr-only {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}

	/* ══════════════════════════════════════════════════════════════
   SHARED COMPONENTS (used across citizen, dashboard, officer)
   ══════════════════════════════════════════════════════════════ */

	/* ── Logo wordmark ── */
	.mea-wordmark {
		display: flex;
		align-items: baseline;
		font-family: var(--mea-font-heading);
		font-weight: var(--mea-w-black);
		letter-spacing: var(--mea-ls-tight);
		line-height: 1;
		user-select: none;
	}

	.mea-wordmark .mea-me {
		color: var(--mea-logo-blue);
	}

	.mea-wordmark .mea-a {
		background: var(--mea-logo-grad);
		-webkit-background-clip: text;
		-webkit-text-fill-color: transparent;
		background-clip: text;
	}

	.mea-wordmark--sm {
		font-size: 22px;
	}

	.mea-wordmark--md {
		font-size: 28px;
	}

	.mea-wordmark--lg {
		font-size: 42px;
	}

	/* ── Avatar ── */
	.mea-avatar {
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: var(--mea-radius-circle);
		font-weight: var(--mea-w-bold);
		color: var(--mea-white);
		flex-shrink: 0;
		overflow: hidden;
	}

	.mea-avatar--sm {
		width: 34px;
		height: 34px;
		font-size: 13px;
	}

	.mea-avatar--md {
		width: 40px;
		height: 40px;
		font-size: 16px;
	}

	.mea-avatar--lg {
		width: 72px;
		height: 72px;
		font-size: 28px;
	}

	.mea-avatar img {
		width: 100%;
		height: 100%;
		object-fit: cover;
	}

	/* ── Badge / Pill ── */
	.mea-badge {
		display: inline-flex;
		align-items: center;
		padding: 2px 8px;
		border-radius: 10px;
		font-size: var(--mea-text-xs);
		font-weight: var(--mea-w-bold);
		white-space: nowrap;
	}

	.mea-badge--blue {
		background: var(--mea-baby-blue);
		color: var(--mea-navy);
	}

	.mea-badge--green {
		background: var(--mea-green);
		color: var(--mea-white);
	}

	.mea-badge--amber {
		background: var(--mea-amber);
		color: var(--mea-white);
	}

	.mea-badge--red {
		background: var(--mea-red);
		color: var(--mea-white);
	}

	/* ── Status dot ── */
	.mea-dot {
		width: 8px;
		height: 8px;
		border-radius: var(--mea-radius-circle);
		flex-shrink: 0;
	}

	.mea-dot--active {
		background: var(--mea-green);
	}

	.mea-dot--inactive {
		background: var(--mea-cg-3);
	}

	.mea-dot--alert {
		background: var(--mea-red);
	}

	/* ── Progress bar ── */
	.mea-progress {
		height: 6px;
		border-radius: 4px;
		overflow: hidden;
	}

	.mea-progress--dark {
		background: rgba(255, 255, 255, 0.12);
	}

	.mea-progress--light {
		background: var(--mea-gray-200);
	}

	.mea-progress__fill {
		height: 100%;
		border-radius: 3px;
		background: var(--mea-blue-bright);
		transition: width var(--mea-dur-smooth) var(--mea-ease-default);
	}

	fieldset {
		border: none;
	}

	input[type="radio"] {
		accent-color: var(--t-accent);
	}

	.wizard {

		& > input[type="radio"][name="wizard-step-state"]:not(:checked) + .wizard-step {
			display: none;
		}

		& > .wizard-step {
			& fieldset:invalid~.wizard-nav .next,
			& input:invalid~.wizard-nav .next {
				pointer-events: none;
				opacity: 40%;
			}
		}

	}


	/* ══════════════════════════════════════════════════════════════
   CITIZEN APP (mobile PWA) COMPONENTS
   Max width: 430px. Dark-to-light theming.
   ══════════════════════════════════════════════════════════════ */

	/* Citizen mobile shell (.ctz-*) removed — prototype shells, 0 references; superseded by the layered app/ pages. */


	/* ══════════════════════════════════════════════════════════════
   DASHBOARD (web, desktop-first, 1440px design width)
   ══════════════════════════════════════════════════════════════ */

	/* ── Shell layout ── */
	.dash-shell {
		display: flex;
		height: 100vh;
		overflow: hidden;
	}

	/* ── Sidebar ── */
	.dash-sidebar {
		width: var(--mea-sidebar-w);
		flex-shrink: 0;
		background: var(--mea-surface-sidebar);
		color: var(--mea-white);
		display: flex;
		flex-direction: column;
		overflow: hidden;
		position: relative;
	}

	.dash-sidebar::before {
		content: '';
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		height: 120px;
		background: var(--mea-grad-sidebar);
		pointer-events: none;
	}

	.dash-sidebar__logo {
		display: flex;
		align-items: center;
		gap: 10px;
		padding: 20px 20px 16px;
		border-bottom: 1px solid rgba(130, 203, 245, 0.12);
		position: relative;
	}

	.dash-sidebar__section-label {
		font-size: var(--mea-desk-xs);
		font-weight: var(--mea-w-semibold);
		letter-spacing: var(--mea-ls-caps);
		text-transform: uppercase;
		color: rgba(255, 255, 255, 0.6);
		/* 0.3 failed WCAG (2.68:1 on navy); 0.6 ~= 6.7:1 */
		padding: 20px 20px 6px;
	}

	/* ── Nav item ── */
	.dash-nav-item {
		display: flex;
		align-items: center;
		gap: 10px;
		padding: 9px 20px;
		cursor: pointer;
		font-size: var(--mea-desk-md);
		font-weight: var(--mea-w-medium);
		color: rgba(255, 255, 255, 0.6);
		border-left: 3px solid transparent;
		transition: all var(--mea-dur-normal);
	}

	.dash-nav-item:hover {
		color: var(--mea-white);
		background: rgba(255, 255, 255, 0.05);
	}

	.dash-nav-item.is-active {
		color: var(--mea-white);
		background: rgba(130, 203, 245, 0.12);
		border-left-color: var(--mea-baby-blue);
	}

	/* ── Main area ── */
	.dash-main {
		flex: 1;
		display: flex;
		flex-direction: column;
		overflow: hidden;
		min-width: 0;
	}

	/* ── Top bar ── */
	.dash-topbar {
		height: var(--mea-header-h);
		flex-shrink: 0;
		background: var(--mea-surface-card);
		border-bottom: 1px solid var(--mea-gray-200);
		display: flex;
		align-items: center;
		padding: 0 var(--mea-gutter-desktop);
		gap: var(--mea-space-4);
		box-shadow: 0 1px 0 rgba(130, 203, 245, 0.2);
	}

	.dash-topbar__title {
		font-family: var(--mea-font-heading);
		font-weight: var(--mea-w-bold);
		font-size: var(--mea-desk-xl);
		color: var(--mea-gray-900);
	}

	/* ── Content area ── */
	.dash-content {
		height: calc(100vh - var(--mea-header-h));
		overflow-y: auto;
		padding: var(--mea-gutter-desktop);
	}

	/* ── Responsive: collapse the desktop sidebar shell to the mobile
   bottom-nav layout. These base shell rules (.dash-shell/.dash-sidebar/
   .dash-content) are UNLAYERED, so they beat every @layer rule — the
   equivalent mobile rules in app/shell.css (@layer layout) are powerless
   to override them. The collapse therefore MUST live here, beside the
   base, until the legacy CSS is wrapped in @layer legacy (the reserved
   slot in app/00-layers.css). Without this, the sidebar never collapses
   and the participant/citizen app is unusable on a phone. ── */
	@media (max-width: 768px) {
		.dash-sidebar {
			display: none;
		}

		.dash-topbar {
			padding: 0 var(--mea-space-4);
		}

		.dash-content {
			padding: var(--mea-space-4);
			padding-bottom: 72px;
		}
	}

	/* ── Dashboard button ── */
	.dash-btn {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		padding: 8px 16px;
		border-radius: var(--mea-radius-md);
		font-size: var(--mea-desk-base);
		font-weight: var(--mea-w-semibold);
		cursor: pointer;
		border: none;
		transition: all var(--mea-dur-normal);
		font-family: var(--mea-font-body);
	}

	.dash-btn--primary {
		background: var(--mea-blue);
		color: var(--mea-white);
	}

	.dash-btn--primary:hover {
		background: var(--mea-blue-dark);
	}

	.dash-btn--outline {
		background: var(--mea-white);
		color: var(--mea-gray-700);
		border: 1.5px solid var(--mea-gray-200);
	}

	.dash-btn--outline:hover {
		border-color: var(--mea-blue);
		color: var(--mea-blue);
	}

	.dash-btn--green {
		background: var(--mea-green);
		color: var(--mea-white);
	}

	.dash-btn--green:hover {
		background: var(--mea-green-hover);
	}

	.dash-btn--red {
		background: var(--mea-red);
		color: var(--mea-white);
	}

	.dash-btn--red:hover {
		background: var(--mea-red-hover);
	}

	.dash-btn--sm {
		padding: 5px 12px;
		font-size: 12px;
		border-radius: var(--mea-radius-sm);
	}

	/* ── Stat card ── */
	.dash-stats-row {
		display: grid;
		grid-template-columns: repeat(4, 1fr);
		gap: var(--mea-space-4);
		margin-bottom: var(--mea-space-6);
	}

	.dash-stat-card {
		background: var(--mea-surface-card);
		border-radius: var(--mea-radius-lg);
		padding: var(--mea-space-5);
		border: 1px solid var(--mea-gray-200);
		display: flex;
		flex-direction: column;
		gap: 4px;
		box-shadow: var(--mea-shadow-sm);
		border-top: 2px solid var(--mea-baby-blue);
	}

	.dash-stat-card__value {
		font-family: var(--mea-font-heading);
		font-size: var(--mea-desk-2xl);
		font-weight: var(--mea-w-bold);
		color: var(--mea-gray-900);
	}

	.dash-stat-card__label {
		font-size: var(--mea-desk-sm);
		color: var(--mea-gray-600);
	}

	/* ── Data table ── */
	.dash-table {
		width: 100%;
		border-collapse: collapse;
		background: var(--mea-surface-card);
		border-radius: var(--mea-radius-lg);
		overflow: hidden;
		box-shadow: var(--mea-shadow-sm);
		border: 1px solid var(--mea-gray-200);
	}

	.dash-table th {
		text-align: left;
		padding: 12px 16px;
		font-size: var(--mea-desk-sm);
		font-weight: var(--mea-w-semibold);
		color: var(--mea-gray-500);
		text-transform: uppercase;
		letter-spacing: 0.5px;
		border-bottom: 1px solid var(--mea-gray-200);
		background: var(--mea-gray-50);
	}

	.dash-table td {
		padding: 12px 16px;
		font-size: var(--mea-desk-base);
		border-bottom: 1px solid var(--mea-gray-100);
	}

	.dash-table tr:last-child td {
		border-bottom: none;
	}

	.dash-table tr:hover td {
		background: var(--mea-baby-pale);
	}

	/* ── Icon button (top bar) ── */
	.dash-icon-btn {
		width: 36px;
		height: 36px;
		border-radius: var(--mea-radius-md);
		border: 1.5px solid var(--mea-gray-200);
		background: var(--mea-white);
		display: flex;
		align-items: center;
		justify-content: center;
		cursor: pointer;
		font-size: 17px;
		color: var(--mea-gray-600);
		/* gray-500 was 4.34:1 on white (just under AA); gray-600 ~= 6:1 */
		position: relative;
		transition: all var(--mea-dur-normal);
	}

	.dash-icon-btn__glyph {
		width: 20px;
		height: 20px;
		display: block;
	}

	.dash-icon-btn:hover {
		border-color: var(--mea-blue);
		color: var(--mea-blue);
	}

	/* ── Notification dot (on icon buttons) ── */
	.dash-notif-dot {
		position: absolute;
		top: 6px;
		right: 6px;
		width: 8px;
		height: 8px;
		background: var(--mea-red);
		border-radius: var(--mea-radius-circle);
		border: 1.5px solid var(--mea-white);
	}

	/* ── Status badge (with colored dot prefix) ── */
	.dash-badge {
		display: inline-flex;
		align-items: center;
		gap: 4px;
		padding: 3px 9px;
		border-radius: var(--mea-radius-pill);
		font-size: 11.5px;
		font-weight: var(--mea-w-semibold);
	}

	.dash-badge::before {
		content: '';
		width: 6px;
		height: 6px;
		border-radius: var(--mea-radius-circle);
		flex-shrink: 0;
	}

	.dash-badge--pending {
		background: var(--mea-amber-light);
		color: var(--mea-amber-dark);
	}

	.dash-badge--pending::before {
		background: var(--mea-amber);
	}

	.dash-badge--approved {
		background: var(--mea-green-light);
		color: var(--mea-green-dark);
	}

	.dash-badge--approved::before {
		background: var(--mea-green);
	}

	.dash-badge--denied {
		background: var(--mea-red-light);
		color: var(--mea-red-dark);
	}

	.dash-badge--denied::before {
		background: var(--mea-red);
	}

	.dash-badge--swift {
		background: var(--mea-baby-pale);
		color: var(--mea-blue);
	}

	.dash-badge--swift::before {
		background: var(--mea-baby-blue);
	}

	.dash-badge--review {
		background: var(--mea-teal-light);
		color: var(--mea-teal-dark);
	}

	.dash-badge--review::before {
		background: var(--mea-teal);
	}

	.dash-badge--active {
		background: var(--mea-green-light);
		color: var(--mea-green-dark);
	}

	.dash-badge--active::before {
		background: var(--mea-green);
	}

	.dash-badge--completed {
		background: var(--mea-green-light);
		color: var(--mea-green-dark);
	}

	.dash-badge--completed::before {
		background: var(--mea-green);
	}

	.dash-badge--failed {
		background: var(--mea-red-light);
		color: var(--mea-red-dark);
	}

	.dash-badge--failed::before {
		background: var(--mea-red);
	}

	/* ── Charge tag (color-coded by offense category) ── */
	.dash-charge-tag {
		display: inline-block;
		padding: 3px 9px;
		border-radius: var(--mea-radius-sm);
		font-size: 11.5px;
		font-weight: var(--mea-w-semibold);
		background: var(--mea-gray-100);
		color: var(--mea-gray-700);
	}

	.dash-charge-tag--drug {
		background: var(--mea-violet-light);
		color: var(--mea-violet);
	}

	.dash-charge-tag--theft {
		background: var(--mea-yellow-light);
		color: var(--mea-yellow-dark);
	}

	.dash-charge-tag--property {
		background: var(--mea-orange-light);
		color: var(--mea-orange-dark);
	}

	.dash-charge-tag--conduct {
		background: var(--mea-green-light);
		color: var(--mea-green-hover);
	}

	.dash-charge-tag--dui {
		background: var(--mea-slate-light);
		color: var(--mea-slate);
	}

	.dash-charge-tag--trespass {
		background: var(--mea-amber-light);
		color: var(--mea-amber-dark);
	}

	.dash-charge-tag--assault {
		background: var(--mea-red-light);
		color: var(--mea-red-dark);
	}

	/* ── Priority dot ── */
	.dash-priority-dot {
		width: 8px;
		height: 8px;
		border-radius: var(--mea-radius-circle);
		display: inline-block;
		flex-shrink: 0;
	}

	.dash-priority-dot--high {
		background: var(--mea-red);
	}

	.dash-priority-dot--med {
		background: var(--mea-amber);
	}

	.dash-priority-dot--low {
		background: var(--mea-green);
	}

	/* ── Filter chips ── */
	.dash-filter-row {
		display: flex;
		align-items: center;
		gap: 10px;
		margin-bottom: var(--mea-space-4);
		flex-wrap: wrap;
	}

	.dash-filter-chip {
		padding: 5px 14px;
		border-radius: var(--mea-radius-pill);
		font-size: 12.5px;
		font-weight: var(--mea-w-semibold);
		border: 1.5px solid var(--mea-gray-200);
		background: var(--mea-white);
		color: var(--mea-gray-600);
		cursor: pointer;
		transition: all var(--mea-dur-fast);
	}

	.dash-filter-chip:hover {
		border-color: var(--mea-blue);
		color: var(--mea-blue);
	}

	.dash-filter-chip.is-active {
		background: var(--mea-blue);
		color: var(--mea-white);
		border-color: var(--mea-blue);
	}

	/* ── Search box ── */
	.dash-search-box {
		display: flex;
		align-items: center;
		gap: 8px;
		padding: 7px 12px;
		border: 1.5px solid var(--mea-gray-200);
		border-radius: var(--mea-radius-md);
		background: var(--mea-white);
		margin-left: auto;
	}

	.dash-search-box input {
		border: none;
		outline: none;
		font-family: var(--mea-font-body);
		font-size: var(--mea-desk-base);
		color: var(--mea-gray-900);
		width: 180px;
	}

	.dash-search-box input::placeholder {
		color: var(--mea-gray-400);
	}

	.dash-search-box:focus-within {
		border-color: var(--mea-blue);
		box-shadow: 0 0 0 3px rgba(20, 66, 217, 0.12);
	}

	/* ── Card container ── */
	.dash-card {
		background: var(--mea-surface-card);
		border-radius: var(--mea-radius-lg);
		border: 1px solid var(--mea-gray-200);
		overflow: hidden;
		box-shadow: var(--mea-shadow-sm);
	}

	.dash-card__header {
		padding: var(--mea-space-4) var(--mea-space-5);
		border-bottom: 1px solid var(--mea-gray-200);
		display: flex;
		align-items: center;
		gap: var(--mea-space-3);
	}

	.dash-card__title {
		font-family: var(--mea-font-heading);
		font-weight: var(--mea-w-bold);
		font-size: 15px;
		color: var(--mea-gray-900);
	}

	.dash-card__body {
		padding: var(--mea-space-5);
	}

	.dash-card__body--flush {
		padding: 0;
	}

	/* ── Defendant cell (table row with avatar) ── */
	.dash-def-cell {
		display: flex;
		align-items: center;
		gap: 10px;
	}

	.dash-def-avatar {
		width: 32px;
		height: 32px;
		border-radius: var(--mea-radius-circle);
		background: var(--mea-gray-200);
		display: flex;
		align-items: center;
		justify-content: center;
		font-weight: var(--mea-w-bold);
		font-size: 12px;
		color: var(--mea-gray-700);
		flex-shrink: 0;
	}

	.dash-def-name {
		font-weight: var(--mea-w-semibold);
		color: var(--mea-gray-900);
		font-size: var(--mea-desk-md);
	}

	.dash-def-dob {
		font-size: var(--mea-desk-sm);
		color: var(--mea-gray-500);
	}

	/* ── Case header card (navy detail header) ── */
	.dash-case-header {
		background: var(--mea-navy);
		color: var(--mea-white);
		border-radius: var(--mea-radius-lg);
		padding: var(--mea-space-6) var(--mea-space-7);
		margin-bottom: var(--mea-space-5);
		display: flex;
		align-items: flex-start;
		gap: var(--mea-space-6);
	}

	.dash-case-avatar {
		width: 60px;
		height: 60px;
		border-radius: var(--mea-radius-circle);
		background: rgba(255, 255, 255, 0.15);
		display: flex;
		align-items: center;
		justify-content: center;
		font-weight: var(--mea-w-extrabold);
		font-size: 22px;
		flex-shrink: 0;
	}

	.dash-case-name {
		font-family: var(--mea-font-heading);
		font-weight: var(--mea-w-extrabold);
		font-size: 22px;
	}

	.dash-case-meta {
		font-size: var(--mea-desk-base);
		color: rgba(255, 255, 255, 0.6);
		margin-top: 3px;
	}

	.dash-case-meta span {
		color: rgba(255, 255, 255, 0.9);
		font-weight: var(--mea-w-semibold);
	}

	.dash-case-actions {
		margin-left: auto;
		display: flex;
		gap: 10px;
		align-items: flex-start;
		flex-wrap: wrap;
	}

	/* ── Info grid (3-col case metadata) ── */
	.dash-info-grid {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: var(--mea-space-4);
		margin-bottom: var(--mea-space-5);
	}

	.dash-info-item {
		background: var(--mea-white);
		border: 1px solid var(--mea-gray-200);
		border-radius: 10px;
		padding: 14px 16px;
	}

	.dash-info-item__label {
		font-size: var(--mea-desk-sm);
		font-weight: var(--mea-w-bold);
		text-transform: uppercase;
		letter-spacing: 0.5px;
		color: var(--mea-gray-500);
		margin-bottom: 4px;
	}

	.dash-info-item__value {
		font-size: 15px;
		font-weight: var(--mea-w-bold);
		color: var(--mea-gray-900);
	}

	.dash-info-item__sub {
		font-size: 11.5px;
		color: var(--mea-gray-500);
		margin-top: 2px;
	}

	/* ── Timeline ── */
	.dash-timeline {
		display: flex;
		flex-direction: column;
		gap: 0;
	}

	.dash-timeline-item {
		display: flex;
		gap: var(--mea-space-3);
		padding: 0 0 var(--mea-space-4);
		position: relative;
	}

	.dash-timeline-item:not(:last-child)::before {
		content: '';
		position: absolute;
		left: 11px;
		top: 22px;
		bottom: 0;
		width: 1.5px;
		background: var(--mea-gray-200);
	}

	.dash-timeline-dot {
		width: 24px;
		height: 24px;
		border-radius: var(--mea-radius-circle);
		flex-shrink: 0;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: var(--mea-desk-sm);
		margin-top: 1px;
	}

	.dash-timeline-dot--blue {
		background: var(--mea-blue-light);
		color: var(--mea-blue);
	}

	.dash-timeline-dot--green {
		background: var(--mea-green-light);
		color: var(--mea-green);
	}

	.dash-timeline-dot--amber {
		background: var(--mea-amber-light);
		color: var(--mea-amber);
	}

	.dash-timeline-dot--red {
		background: var(--mea-red-light);
		color: var(--mea-red);
	}

	.dash-timeline-text {
		font-size: var(--mea-desk-base);
		color: var(--mea-gray-700);
	}

	.dash-timeline-time {
		font-size: var(--mea-desk-sm);
		color: var(--mea-gray-400);
	}

	/* ── Grid utilities ── */
	.dash-two-col {
		display: grid;
		grid-template-columns: 1fr 340px;
		gap: var(--mea-space-5);
		margin-bottom: var(--mea-space-6);
	}

	.dash-three-col {
		display: grid;
		grid-template-columns: 1fr 1fr 340px;
		gap: var(--mea-space-5);
	}

	.dash-detail-grid {
		display: grid;
		grid-template-columns: 1fr 300px;
		gap: var(--mea-space-5);
	}

	/* ── Section title (inside cards) ── */
	.dash-section-title {
		font-family: var(--mea-font-heading);
		font-size: var(--mea-desk-lg);
		font-weight: var(--mea-w-bold);
		color: var(--mea-gray-700);
		margin-bottom: var(--mea-space-3);
		padding-bottom: var(--mea-space-2);
		border-bottom: 1px solid var(--mea-gray-200);
	}

	/* ── Modal ── */
	.dash-modal-overlay {
		position: fixed;
		inset: 0;
		background: rgba(10, 22, 40, 0.5);
		z-index: var(--mea-z-modal);
		display: none;
		align-items: center;
		justify-content: center;
	}

	.dash-modal-overlay.is-open {
		display: flex;
	}

	.dash-modal {
		background: var(--mea-white);
		border-radius: var(--mea-radius-2xl);
		width: 480px;
		max-width: 90vw;
		max-height: 90vh;
		box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
		overflow: hidden;
		animation: dash-modal-in 0.2s ease;
		display: flex;
		flex-direction: column;
	}

	.dash-modal--lg {
		width: 680px;
	}

	.dash-modal--xl {
		width: 860px;
	}

	@keyframes dash-modal-in {
		from {
			opacity: 0;
			transform: scale(0.95);
		}

		to {
			opacity: 1;
			transform: scale(1);
		}
	}

	.dash-modal__header {
		padding: 22px 24px;
		border-bottom: 1px solid var(--mea-gray-200);
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.dash-modal__title {
		font-family: var(--mea-font-heading);
		font-weight: var(--mea-w-bold);
		font-size: 16px;
	}

	.dash-modal__close {
		font-size: 20px;
		cursor: pointer;
		color: var(--mea-gray-400);
		background: none;
		border: none;
		line-height: 1;
		padding: 0;
	}

	.dash-modal__close:hover {
		color: var(--mea-gray-900);
	}

	.dash-modal__body {
		padding: var(--mea-space-5) var(--mea-space-6);
		overflow-y: auto;
		flex: 1;
		min-height: 0;
	}

	.dash-modal__footer {
		padding: var(--mea-space-4) var(--mea-space-6);
		border-top: 1px solid var(--mea-gray-200);
		display: flex;
		justify-content: flex-end;
		gap: 10px;
	}

	/* ── Form controls (dashboard) ── */
	.dash-form-group {
		margin-bottom: var(--mea-space-4);
	}

	.dash-form-label {
		font-size: 12px;
		font-weight: var(--mea-w-bold);
		color: var(--mea-gray-700);
		text-transform: uppercase;
		letter-spacing: var(--mea-ls-wide);
		margin-bottom: 6px;
		display: block;
	}

	.dash-form-control {
		width: 100%;
		padding: 9px 12px;
		border-radius: var(--mea-radius-md);
		border: 1.5px solid var(--mea-gray-200);
		font-family: var(--mea-font-body);
		font-size: var(--mea-desk-md);
		color: var(--mea-gray-900);
		background: var(--mea-white);
		outline: none;
		transition: border var(--mea-dur-normal);
	}

	.dash-form-control:focus {
		border-color: var(--mea-blue);
	}

	textarea.dash-form-control {
		resize: vertical;
		min-height: 80px;
	}

	select.dash-form-control {
		cursor: pointer;
	}

	/* ── Notification panel ── */
	.dash-notif-panel {
		position: fixed;
		top: 0;
		right: 0;
		width: 360px;
		height: 100vh;
		background: var(--mea-white);
		border-left: 1px solid var(--mea-gray-200);
		box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
		z-index: var(--mea-z-dropdown);
		transform: translateX(100%);
		transition: transform 0.25s var(--mea-ease-default);
		display: flex;
		flex-direction: column;
	}

	.dash-notif-panel.is-open {
		transform: translateX(0);
	}

	.dash-notif-panel__header {
		padding: var(--mea-space-5);
		border-bottom: 1px solid var(--mea-gray-200);
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.dash-notif-panel__title {
		font-family: var(--mea-font-heading);
		font-weight: var(--mea-w-bold);
		font-size: 15px;
	}

	.dash-notif-item {
		padding: 14px var(--mea-space-5);
		border-bottom: 1px solid var(--mea-gray-100);
		cursor: pointer;
	}

	.dash-notif-item.is-unread {
		background: var(--mea-blue-light);
	}

	.dash-notif-item:hover {
		background: var(--mea-gray-50);
	}

	.dash-notif-item__title {
		font-size: var(--mea-desk-base);
		font-weight: var(--mea-w-semibold);
		color: var(--mea-gray-900);
		margin-bottom: 2px;
	}

	.dash-notif-item__sub {
		font-size: 12px;
		color: var(--mea-gray-500);
	}

	.dash-notif-item__time {
		font-size: var(--mea-desk-sm);
		color: var(--mea-gray-400);
		margin-top: 3px;
	}

	/* ── Progress bar (dashboard variant) ── */
	.dash-progress {
		height: 6px;
		border-radius: 3px;
		background: var(--mea-gray-100);
		overflow: hidden;
	}

	.dash-progress__fill {
		height: 100%;
		border-radius: 3px;
		background: var(--mea-blue);
		transition: width var(--mea-dur-smooth) var(--mea-ease-default);
	}

	/* ── Active case card ── */
	.dash-active-cases-grid {
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		gap: var(--mea-space-4);
	}

	.dash-active-case-card {
		cursor: pointer;
		transition: box-shadow var(--mea-dur-normal), transform 0.1s;
	}

	.dash-active-case-card:hover {
		box-shadow: 0 4px 16px rgba(20, 66, 217, 0.12);
		transform: translateY(-1px);
	}

	.dash-active-case-inner {
		background: var(--mea-white);
		border: 1px solid var(--mea-gray-200);
		border-radius: var(--mea-radius-lg);
		padding: 18px 20px;
	}

	.dash-ac-name {
		font-weight: var(--mea-w-bold);
		font-size: var(--mea-desk-lg);
		color: var(--mea-gray-900);
	}

	.dash-ac-meta {
		font-size: 12px;
		color: var(--mea-gray-500);
		margin-bottom: 10px;
	}

	.dash-ac-task-chip {
		padding: 2px 8px;
		border-radius: 4px;
		font-size: var(--mea-desk-sm);
		font-weight: var(--mea-w-semibold);
		background: var(--mea-gray-50);
		color: var(--mea-gray-500);
	}

	.dash-ac-task-chip--done {
		background: var(--mea-green-light);
		color: var(--mea-green-deep);
	}

	.dash-ac-task-chip--overdue {
		background: var(--mea-red-light);
		color: var(--mea-red-dark);
	}

	/* ── Capacity bar (provider cards) ── */
	.dash-capacity-bar {
		height: 4px;
		background: var(--mea-gray-100);
		border-radius: 2px;
		overflow: hidden;
		margin: 8px 0;
	}

	.dash-capacity-fill,
	.dash-capacity-bar__fill {
		height: 100%;
		border-radius: 2px;
		background: var(--mea-green);
	}

	.dash-capacity-fill--mid,
	.dash-capacity-bar__fill--mid {
		background: var(--mea-amber);
	}

	.dash-capacity-fill--high,
	.dash-capacity-bar__fill--high {
		background: var(--mea-red);
	}

	/* ── Provider grid ── */
	.dash-provider-grid {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: var(--mea-space-4);
	}

	.dash-provider-card {
		background: var(--mea-white);
		border: 1px solid var(--mea-gray-200);
		border-radius: var(--mea-radius-lg);
		padding: var(--mea-space-5);
		transition: all var(--mea-dur-normal);
		cursor: pointer;
	}

	.dash-provider-card:hover {
		box-shadow: var(--mea-shadow-md);
		border-color: var(--mea-blue);
		transform: translateY(-1px);
	}

	.dash-provider-name {
		font-weight: var(--mea-w-bold);
		font-size: var(--mea-desk-lg);
		color: var(--mea-gray-900);
		margin-bottom: 3px;
	}

	.dash-provider-type {
		font-size: 12px;
		color: var(--mea-blue);
		font-weight: var(--mea-w-semibold);
		text-transform: uppercase;
		letter-spacing: var(--mea-ls-wide);
		margin-bottom: 10px;
	}

	/* ── Donut chart ── */
	.dash-donut {
		width: 180px;
		height: 180px;
		position: relative;
	}

	.dash-donut svg {
		transform: rotate(-90deg);
	}

	.dash-donut__center {
		position: absolute;
		inset: 0;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.dash-donut__value {
		font-family: var(--mea-font-heading);
		font-size: 32px;
		font-weight: var(--mea-w-extrabold);
		color: var(--mea-navy);
	}

	.dash-donut__label {
		font-size: var(--mea-desk-sm);
		color: var(--mea-gray-500);
		margin-top: 3px;
		font-weight: var(--mea-w-semibold);
		text-transform: uppercase;
	}

	/* ── Chart bar (horizontal) ── */
	.dash-chart-bar-row {
		display: flex;
		align-items: center;
		gap: 10px;
		margin-bottom: 8px;
	}

	.dash-chart-bar-label {
		font-size: 12px;
		color: var(--mea-gray-500);
		width: 120px;
		flex-shrink: 0;
	}

	.dash-chart-bar-track {
		flex: 1;
		height: 8px;
		background: var(--mea-gray-100);
		border-radius: 4px;
		overflow: hidden;
	}

	.dash-chart-bar-fill {
		height: 100%;
		border-radius: 4px;
		background: var(--mea-blue);
	}

	.dash-chart-bar-val {
		font-size: 12px;
		font-weight: var(--mea-w-bold);
		color: var(--mea-gray-700);
		width: 32px;
		text-align: right;
	}

	/* ── Trend bars (vertical) ── */
	.dash-trend-chart {
		display: flex;
		gap: 10px;
		height: 120px;
		padding-top: 10px;
		align-items: flex-end;
	}

	.dash-trend-bar-wrap {
		flex: 1;
		display: flex;
		flex-direction: column;
		gap: 4px;
		height: 100%;
		justify-content: flex-end;
		align-items: center;
	}

	.dash-trend-bar {
		width: 100%;
		border-radius: 5px 5px 0 0;
		min-height: 4px;
		display: flex;
		align-items: flex-start;
		justify-content: center;
		padding-top: 4px;
	}

	.dash-trend-bar-val {
		font-size: var(--mea-desk-xs);
		font-weight: var(--mea-w-bold);
		color: var(--mea-white);
	}

	.dash-trend-bar-label {
		font-size: var(--mea-desk-xs);
		color: var(--mea-gray-500);
		font-weight: var(--mea-w-semibold);
		text-align: center;
	}

	/* ── Timeline bars (horizontal progress) ── */
	.dash-tl-bar-group {
		margin-bottom: var(--mea-space-4);
	}

	.dash-tl-label-row {
		display: flex;
		justify-content: space-between;
		margin-bottom: 6px;
		align-items: baseline;
	}

	.dash-tl-label {
		font-size: var(--mea-desk-base);
		font-weight: var(--mea-w-semibold);
		color: var(--mea-gray-700);
	}

	.dash-tl-pct {
		font-family: var(--mea-font-heading);
		font-size: var(--mea-text-lg);
		font-weight: var(--mea-w-extrabold);
		color: var(--mea-navy);
	}

	.dash-tl-track {
		height: 32px;
		background: var(--mea-gray-100);
		border-radius: var(--mea-radius-md);
		overflow: hidden;
		position: relative;
	}

	.dash-tl-fill {
		height: 100%;
		border-radius: var(--mea-radius-md);
		display: flex;
		align-items: center;
		padding: 0 14px;
		font-size: 12.5px;
		font-weight: var(--mea-w-bold);
		color: var(--mea-white);
		gap: 8px;
	}

	/* ── Savings hero ── */
	.dash-savings-hero {
		background: linear-gradient(135deg, var(--mea-navy) 0%, var(--mea-blue) 60%, var(--mea-baby-mid) 100%);
		border-radius: var(--mea-radius-xl);
		padding: var(--mea-space-7) var(--mea-space-8);
		color: var(--mea-white);
		margin-bottom: var(--mea-space-5);
		display: flex;
		gap: 40px;
		align-items: center;
	}

	.dash-savings-big {
		font-family: var(--mea-font-heading);
		font-size: 56px;
		font-weight: var(--mea-w-extrabold);
		letter-spacing: -2px;
		line-height: 1;
	}

	.dash-savings-label {
		font-size: var(--mea-desk-base);
		color: rgba(130, 203, 245, 0.8);
		margin-top: 6px;
		font-weight: var(--mea-w-medium);
	}

	/* ── Cost row ── */
	.dash-cost-row {
		display: flex;
		gap: 14px;
		padding: 13px 0;
		border-bottom: 1px solid var(--mea-gray-100);
		align-items: center;
	}

	.dash-cost-row:last-child {
		border-bottom: none;
	}

	.dash-cost-icon {
		font-size: 20px;
		width: 28px;
		text-align: center;
		flex-shrink: 0;
	}

	.dash-cost-label {
		font-size: var(--mea-desk-base);
		color: var(--mea-gray-700);
		flex: 1;
		line-height: 1.4;
	}

	.dash-cost-avoided {
		font-family: var(--mea-font-heading);
		font-size: 17px;
		font-weight: var(--mea-w-extrabold);
		color: var(--mea-green);
	}

	/* ── SWIFT session components ── */
	.dash-swift-header {
		background: linear-gradient(135deg, var(--mea-navy) 0%, var(--mea-blue) 55%, var(--mea-baby-mid) 100%);
		color: var(--mea-white);
		border-radius: var(--mea-radius-lg);
		padding: var(--mea-space-6) var(--mea-space-7);
		margin-bottom: var(--mea-space-5);
		display: flex;
		align-items: center;
		gap: var(--mea-space-5);
	}

	.dash-swift-timer {
		font-family: var(--mea-font-heading);
		font-size: 42px;
		font-weight: var(--mea-w-extrabold);
		letter-spacing: -1px;
	}

	.dash-swift-case-card {
		background: var(--mea-white);
		border: 1px solid var(--mea-gray-200);
		border-radius: 10px;
		padding: var(--mea-space-4) var(--mea-space-5);
		display: flex;
		align-items: center;
		gap: var(--mea-space-4);
		cursor: pointer;
		transition: all var(--mea-dur-normal);
	}

	.dash-swift-case-card:hover {
		border-color: var(--mea-blue);
		box-shadow: 0 2px 12px rgba(20, 66, 217, 0.08);
	}

	.dash-swift-case-card.is-active {
		border-color: var(--mea-blue);
		background: var(--mea-blue-light);
	}

	.dash-swift-num {
		width: 28px;
		height: 28px;
		border-radius: var(--mea-radius-circle);
		background: var(--mea-blue);
		color: var(--mea-white);
		font-weight: var(--mea-w-extrabold);
		font-size: var(--mea-desk-base);
		display: flex;
		align-items: center;
		justify-content: center;
		flex-shrink: 0;
	}

	.dash-swift-num--done {
		background: var(--mea-green);
	}

	.dash-swift-num--pending {
		background: var(--mea-gray-300);
		color: var(--mea-gray-700);
	}

	/* ── SOS program components ── */
	.dash-sos-hero {
		background: linear-gradient(135deg, var(--mea-navy) 0%, var(--mea-navy-deep) 50%, var(--mea-blue) 100%);
		border-radius: var(--mea-radius-xl);
		padding: 0;
		margin-bottom: var(--mea-space-6);
		border: 1px solid rgba(130, 203, 245, 0.2);
		box-shadow: 0 4px 24px rgba(10, 22, 40, 0.15);
		overflow: hidden;
	}

	.dash-sos-badge {
		background: linear-gradient(135deg, var(--mea-blue), var(--mea-baby-blue));
		color: var(--mea-white);
		font-family: var(--mea-font-heading);
		font-size: var(--mea-desk-base);
		font-weight: var(--mea-w-extrabold);
		padding: 4px 12px;
		border-radius: var(--mea-radius-sm);
		letter-spacing: var(--mea-ls-wide);
	}

	/* ── Pulse animation ── */
	@keyframes dash-pulse {

		0%,
		100% {
			opacity: 1;
			transform: scale(1);
		}

		50% {
			opacity: 0.6;
			transform: scale(1.2);
		}
	}

	.dash-pulse {
		animation: dash-pulse 1.4s infinite;
	}

	/* ── Alert boxes ── */
	.dash-alert {
		border-radius: var(--mea-radius-md);
		padding: var(--mea-space-3) 14px;
		font-size: var(--mea-desk-base);
		display: flex;
		gap: 10px;
		align-items: flex-start;
		margin-bottom: var(--mea-space-3);
	}

	.dash-alert--amber {
		background: var(--mea-amber-light);
		color: var(--mea-amber-dark);
		border: 1px solid var(--mea-yellow-border);
	}

	.dash-alert--blue {
		background: var(--mea-blue-light);
		color: var(--mea-blue);
		border: 1px solid var(--mea-blue-border);
	}

	.dash-alert--green {
		background: var(--mea-green-light);
		color: var(--mea-green-dark);
		border: 1px solid var(--mea-green-border);
	}

	.dash-alert--red {
		background: var(--mea-red-light);
		color: var(--mea-red-dark);
		border: 1px solid var(--mea-red-border);
	}

	/* ── Back link ── */
	.dash-back-link {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		font-size: var(--mea-desk-base);
		color: var(--mea-blue);
		font-weight: var(--mea-w-semibold);
		cursor: pointer;
		margin-bottom: var(--mea-space-4);
		text-decoration: none;
	}

	.dash-back-link:hover {
		opacity: 0.8;
	}

	/* ── Stat value size override (match reference 32px) ── */
	.dash-stat-card__value--lg {
		font-size: 32px;
		font-weight: var(--mea-w-extrabold);
	}

	.dash-stat-card__value--blue {
		color: var(--mea-blue);
	}

	.dash-stat-card__value--green {
		color: var(--mea-green-dark);
	}

	.dash-stat-card__value--amber {
		color: var(--mea-amber);
	}

	.dash-stat-card__value--red {
		color: var(--mea-red);
	}

	/* ── Stat delta ── */
	.dash-stat-delta {
		font-size: 12px;
		font-weight: var(--mea-w-semibold);
	}

	.dash-stat-delta--up {
		color: var(--mea-green);
	}

	.dash-stat-delta--down {
		color: var(--mea-red);
	}

	.dash-stat-sub {
		font-size: 12px;
		color: var(--mea-gray-600);
	}

	/* ── Empty state ── */
	.dash-empty-state {
		text-align: center;
		padding: 60px var(--mea-space-5);
		color: var(--mea-gray-400);
	}

	.dash-empty-icon {
		font-size: 36px;
		margin-bottom: 10px;
	}

	.dash-empty-title {
		font-weight: var(--mea-w-semibold);
		font-size: 15px;
		color: var(--mea-gray-600);
	}

	.dash-empty-sub {
		font-size: var(--mea-desk-base);
		margin-top: 4px;
	}

	/* ── Scrollbar (thin) ── */
	.dash-content::-webkit-scrollbar {
		width: 4px;
	}

	.dash-content::-webkit-scrollbar-track {
		background: transparent;
	}

	.dash-content::-webkit-scrollbar-thumb {
		background: var(--mea-gray-300);
		border-radius: 2px;
	}

	/* ── Page header ── */
	.dash-page-header {
		display: flex;
		align-items: flex-start;
		justify-content: space-between;
		gap: var(--mea-space-4);
		margin-bottom: var(--mea-space-5);
	}

	.dash-page-title {
		font-family: var(--mea-font-heading);
		font-weight: var(--mea-w-bold);
		font-size: var(--mea-desk-xl);
		color: var(--mea-gray-900);
	}

	.dash-page-subtitle {
		font-size: var(--mea-desk-lg);
		color: var(--mea-gray-600);
		margin-top: 2px;
	}

	/* ── Nav sub-item (court sub-navigation) ── */
	.dash-nav-sub-item {
		display: flex;
		align-items: center;
		gap: 8px;
		padding: 6px 20px 6px 28px;
		font-size: 12.5px;
		color: rgba(255, 255, 255, 0.6);
		cursor: pointer;
		border-radius: var(--mea-radius-sm);
		margin: 1px 8px;
		transition: background var(--mea-dur-normal), color var(--mea-dur-normal);
	}

	.dash-nav-sub-item:hover {
		background: rgba(255, 255, 255, 0.06);
		color: rgba(255, 255, 255, 0.9);
	}

	.dash-nav-sub-item.is-active {
		background: rgba(130, 203, 245, 0.15);
		color: var(--mea-baby-blue);
		font-weight: var(--mea-w-semibold);
	}

	/* ── Sidebar nav badge ── */
	.dash-nav-badge {
		margin-left: auto;
		background: var(--mea-baby-blue);
		color: var(--mea-navy);
		font-size: var(--mea-desk-sm);
		font-weight: var(--mea-w-bold);
		border-radius: 10px;
		padding: 1px 7px;
	}

	.dash-nav-badge--amber {
		background: var(--mea-amber);
		color: var(--mea-white);
	}

	/* ── Gang Unit / Flagged Row ── */
	.deals-row--flagged {
		border-left: 3px solid var(--mea-red-hover);
		background: rgba(220, 38, 38, 0.04);
	}

	.deals-row--flagged:hover {
		background: rgba(220, 38, 38, 0.08);
	}

	.gang-unit-dot {
		display: inline-block;
		width: 8px;
		height: 8px;
		border-radius: var(--mea-radius-circle);
		background: var(--mea-red-hover);
		margin-left: 6px;
		vertical-align: middle;
		flex-shrink: 0;
	}

	/* ── Gang Unit Alert Card (deal-detail sidebar) ── */
	.gang-unit-alert {
		border: 2px solid var(--mea-red-hover);
		border-radius: var(--mea-radius-lg);
		overflow: hidden;
		background: var(--mea-white);
	}

	.gang-unit-alert__banner {
		background: var(--mea-red-hover);
		color: var(--mea-white);
		padding: var(--mea-space-3) var(--mea-space-4);
		display: flex;
		align-items: center;
		gap: var(--mea-space-2);
		font-weight: var(--mea-w-bold);
		font-size: var(--mea-desk-base);
	}

	.gang-unit-alert__icon {
		font-size: 18px;
	}

	.gang-unit-alert__label {
		flex: 1;
	}

	.gang-unit-alert__body {
		padding: var(--mea-space-4);
	}

	.gang-unit-alert__row {
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-size: var(--mea-desk-base);
		color: var(--mea-gray-700);
	}

	.gang-unit-alert__note {
		margin-top: var(--mea-space-3);
		font-size: var(--mea-desk-sm);
		color: var(--mea-red-hover);
		font-weight: var(--mea-w-semibold);
	}

	/* ── Gang Threat Level Badges ── */
	.gang-threat-badge {
		display: inline-block;
		padding: 2px 10px;
		border-radius: 10px;
		font-size: var(--mea-desk-sm);
		font-weight: var(--mea-w-bold);
		text-transform: uppercase;
		letter-spacing: 0.5px;
	}

	.gang-threat-badge--low {
		background: var(--mea-green-success);
		color: var(--mea-green-success-dark);
	}

	.gang-threat-badge--medium {
		background: var(--mea-amber-light);
		color: var(--mea-amber-dark);
	}

	.gang-threat-badge--high {
		background: var(--mea-red-light);
		color: var(--mea-red-dark);
	}

	/* ── ADA Week Grid (ada-schedule page) ── */
	.ada-week-grid {
		width: 100%;
	}

	.ada-week-grid__header {
		display: grid;
		grid-template-columns: repeat(5, 1fr);
		gap: 1px;
		background: var(--mea-gray-200);
		border-bottom: 2px solid var(--mea-gray-200);
	}

	.ada-week-grid__day-label {
		background: var(--mea-gray-50);
		padding: var(--mea-space-3) var(--mea-space-2);
		text-align: center;
		font-weight: var(--mea-w-bold);
		font-size: var(--mea-desk-sm);
		color: var(--mea-gray-700);
		text-transform: uppercase;
		letter-spacing: 0.5px;
	}

	.ada-week-grid__body {
		display: grid;
		grid-template-columns: repeat(5, 1fr);
		gap: 1px;
		background: var(--mea-gray-200);
		min-height: 120px;
	}

	.ada-week-grid__col {
		background: var(--mea-white);
		padding: var(--mea-space-2);
		display: flex;
		flex-direction: column;
		gap: var(--mea-space-2);
	}

	.ada-week-grid__empty {
		color: var(--mea-gray-300);
		text-align: center;
		padding: var(--mea-space-4) 0;
		font-size: var(--mea-desk-sm);
	}

	.ada-slot {
		background: var(--mea-gray-50);
		border: 1px solid var(--mea-gray-200);
		border-radius: var(--mea-radius-md);
		padding: var(--mea-space-2) var(--mea-space-3);
		cursor: default;
	}

	.ada-slot--primary {
		background: rgba(58, 154, 232, 0.08);
		border-color: var(--mea-blue);
	}

	.ada-slot__name {
		font-weight: var(--mea-w-semibold);
		font-size: var(--mea-desk-base);
		color: var(--mea-gray-900);
	}

	.ada-slot__time {
		font-size: var(--mea-desk-sm);
		color: var(--mea-gray-500);
		margin-top: 2px;
	}

	.ada-slot__badge {
		display: inline-block;
		margin-top: var(--mea-space-1);
		font-size: 10px;
		font-weight: var(--mea-w-bold);
		text-transform: uppercase;
		color: var(--mea-blue);
		letter-spacing: 0.5px;
	}

}

/* end @layer legacy */

@layer layout {
	.work-surface {
		border-radius: var(--t-radius-lg);
	}

	/* On the page background, with no other surface between, it rounds
	   more than a card set inside another, so the page's top layer reads as
	   one level. */
	.surface.lowest .work-surface:not(.surface:not(.lowest) *) {
		border-radius: var(--t-radius-xl);
	}
}

/* A featured surface on the page background, with no other surface
   between, rounds more than a card set inside another, so the page's top
   layer reads as one level. */
@layer layout {
	.surface.lowest .surface.featured:not(.surface:not(.lowest) *) {
		border-radius: var(--t-radius-xl);
	}
}

/* A surface paints from the --c-surface-* set its theme gives it, and its
   children take their colours from the same set. See
   design-system/components/surfaces/README.md. */
@layer design {
	.surface {
		background-color: var(--c-surface-background-color);
		background-image: var(--c-surface-background-image, none);
		color: var(--c-surface-text-color-base);
	}

	/* A surface that is still empty, such as a file drop with no file. Only
	   the style of its edge says so; whether it has an edge, how wide and in
	   what colour, is the component's. */
	.surface.empty {
		border-style: var(--t-border-style-empty);
	}
}

/* A focus column: content to take in as one thing. It measures its own
   width: under 36rem the lines are short, and centring them reads as one
   message; wider, centred lines leave the eye hunting for where each one
   starts, so the column starts at the left. What is read in pairs or in
   order, and every callout, keeps to the start and spans the column, so a
   label stays beside its value and a line starts where the last one did.
   See design-system/README.md#alignment. */
@layer layout {
	.focus-column {
		container: focus-column / inline-size;
	}

	@container focus-column (inline-size < 36rem) {
		.focus-column > * {
			text-align: center;
		}

		.focus-column :is(.facts, .field, fieldset, ul, ol, table, .callout) {
			text-align: start;
		}

		/* Centred text above and below a list that hugs the left edge looks
		   lopsided, so the facts spread across the column: labels at the
		   start, and the value column, as wide as its longest value, against
		   the end. Each value still reads from its own start. */
		.focus-column .facts {
			grid-template-columns: max-content minmax(0, max-content);
			justify-content: space-between;
		}
	}
}

/* A mark: one icon centred in a circle. Its fill and ink come from the
   surface the caller gives it, and its size and the icon's from the page,
   so it sets neither. See design-system/components/README.md. */
@layer layout {
	.mark {
		display: grid;
		place-items: center;
		border-radius: var(--t-radius-pill);
	}
}

/* A dot: a small round marker in the surface's ink of its tone, or the
   muted ink with no tone. See design-system/components/README.md. */
@layer layout {
	.dot {
		display: inline-block;
		inline-size: 0.5rem;
		block-size: 0.5rem;
		flex-shrink: 0;
		border-radius: var(--t-radius-pill);
		vertical-align: middle;
	}
}

@layer design {
	.dot { background-color: var(--c-surface-text-color-muted); }
	.dot[data-tone="info"] { background-color: var(--c-surface-text-color-info); }
	.dot[data-tone="success"] { background-color: var(--c-surface-text-color-success); }
	.dot[data-tone="warning"] { background-color: var(--c-surface-text-color-warning); }
	.dot[data-tone="error"] { background-color: var(--c-surface-text-color-error); }
	.dot[data-tone="accent"] { background-color: var(--c-surface-text-color-interactive); }

}

/* A category badge paints from its theme's --c-category-* pair. It is a
   label colour, not a surface. See design-system/components/README.md. */
@layer design {
	.badge.category {
		background-color: var(--c-category-background-color);
		color: var(--c-category-text-color);
	}
}

/* Button row: one layout the row picks from the space it sits in. The
   behavior is written up in components/buttons/README.md. The row
   measures the nearest container around it, as the outcome heading does.
   It is not a container itself: a row that sizes to its buttons, such as
   one in a pane header, would then measure as zero wide. The narrow
   width below is the one in design-system/README.md (Alignment). */
@layer layout {
	.button-row {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: flex-start;
		gap: var(--t-space-3);
	}

	@container (inline-size < 36rem) {
		.button-row:not(.steps) > * {
			flex-grow: 1;
		}
	}

	/* Steps row: the moves between a task's steps. Back (rel="prev") sits
	   at the start and everything else at the end, at every width, so each
	   move stays in the same place on every step, even when it is alone. */
	.button-row.steps {
		justify-content: flex-end;

		& > [rel="prev"] {
			margin-inline-end: auto;
		}
	}
}

@layer layout {
	button, a.button, label.button, summary.button {
		min-block-size: var(--t-target-min-size);
		min-inline-size: var(--t-target-min-size);
		vertical-align: middle;
		text-align: center;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		gap: var(--t-space-2);

		border-radius: var(--t-radius-pill);

		&.cta {
			min-block-size: calc(var(--t-target-min-size) + var(--t-space-1));
			min-inline-size: calc(var(--t-target-min-size) + var(--t-space-1));
		}

		&:not(.ghost) {
			padding-inline: var(--t-space-4);
		}
	}

	/* A <details> toggle drawn as a button: the browser's disclosure marker
	   would sit beside the label, so it goes. */
	summary.button {
		list-style: none;
		cursor: pointer;

		&::-webkit-details-marker {
			display: none;
		}
	}

	button, a.button, label.button, summary.button {
		border: 0;

		&.outline {
			border-width: var(--t-border-width-interactive);
		}

		&.quiet {
			border-width: var(--t-border-width-interactive);
		}
	}

	button, a.button, label.button, summary.button {
		font-family: var(--t-font-family);
		font-weight: var(--t-font-weight-interactive);
		font-size: var(--t-font-size-interactive);
	}

	/* A button with an icon can put its label in a .words span. In a narrow
	   column only the icon shows: the words leave sight but stay in the
	   accessibility tree, so they are still the button's name. 36rem is the
	   narrow-column line (design-system/README.md#alignment). */
	@container (inline-size < 36rem) {
		:is(button, a.button, label.button, summary.button) > .words {
			position: absolute;
			inline-size: 1px;
			block-size: 1px;
			padding: 0;
			overflow: hidden;
			clip-path: inset(50%);
			white-space: nowrap;
		}
	}
}

@layer design {
	button, a.button, label.button, summary.button {
		/* Every button shows the hand on hover, so a pointer user can tell it
		   is pressable. The busy and disabled rules below take it back. */
		cursor: pointer;

		&.outline {
			background: none;
			border-color: var(--c-surface-border-color-interactive);
			border-style: var(--t-border-style-interactive);
		}

		&.ghost {
			background: none;
		}

		&.outline, &.ghost {
			color: var(--c-surface-text-color-interactive);
		}

		/* A destructive action reads as a warning, not a fill: red text and a
		   red edge, so it stays available without competing for the eye. */
		&.no-go.outline {
			background: none;
			border-style: var(--t-border-style-interactive);
			border-color: var(--c-surface-text-color-error);
			color: var(--c-surface-text-color-error);
		}

		/* A secondary action that keeps the shape of a button: the raised
		   surface fills it, so it reads as a pill on the page background. */
		&.quiet {
			border-style: var(--t-border-style-interactive);
			border-color: var(--t-border);
			color: var(--c-surface-text-color-base);
		}

		&.go, &.no-go {
			color: var(--t-go-text);
		}

		&.go {
			background: var(--t-go-fill);
		}

		&.no-go {
			background: var(--t-no-go-fill);
		}

		/* While its submit is in flight (submit-inflight.js sets aria-busy).
		   aria-disabled, not `disabled`, keeps the button's name and value in
		   the POST, so the server still learns which action was pressed. */
		&[aria-busy="true"] {
			opacity: var(--t-opacity-busy);
			cursor: progress;
		}

		/* A button a script has disabled, such as the voice dialog's Done
		   while its recording is sent. */
		&:disabled {
			opacity: var(--t-opacity-disabled);
			cursor: default;
		}
	}

	a.button {
		text-decoration: none;
	}

	/* A submit that its form's own validation is holding back, such as Add
	   code before a code is typed, reads as disabled on every page, component
	   or older markup: the reader sees it will not go yet. A submit with
	   formnovalidate is never held back (Cancel, Format, Read back), so it
	   keeps its full ink. It keeps the arrow too, so the pointer agrees with
	   the paint. */
	form:invalid button[type="submit"]:not([formnovalidate]) {
		opacity: var(--t-opacity-disabled);
		cursor: default;
	}
}

/* A field is selected by what only the component renders: the group div
   carries role="group", a choice group is a fieldset holding .choice, and
   every control is an input, select or textarea with .surface.input. The
   element is named because an adornment carries the input's surface too, for
   its ink, and is not a control. Older pages still use a bare "field" class
   on their own markup, and these selectors leave it alone. */
@layer layout {
	.field:is([role="group"], fieldset:has(.choice)) {
		display: grid;
		gap: var(--t-space-2);
		min-inline-size: 0;

		/* A label that is a button, such as the camera control a field
		   can hold, keeps the button's type. */
		& label:not(.choice, .button), & legend {
			font-size: var(--t-font-size-sm);
			font-weight: var(--t-font-weight-semibold);
		}
	}

	.field .help {
		margin: 0;
		font-size: var(--t-font-size-sm);
		font-weight: var(--t-font-weight-normal);
	}

	/* A fieldset drops the browser's own frame. */
	fieldset.field:has(.choice) {
		margin: 0;
		padding: 0;
		border: 0;
	}

	/* A control has a visible edge, so it pads itself. */
	.field :is(input, select, textarea).surface.input {
		box-sizing: border-box;
		inline-size: 100%;
		min-block-size: var(--t-target-min-size);
		padding: var(--t-space-2) var(--t-space-3);
		border-width: var(--t-border-width-interactive);
		border-radius: var(--t-radius-md);
		font-family: var(--t-font-family);
		font-size: var(--t-font-size-md);

		/* Focus draws a thicker border; the padding gives up the difference,
		   so the control keeps its size and nothing after it moves. */
		&:focus {
			border-width: var(--t-border-width-focus);
			padding:
				calc(var(--t-space-2) - (var(--t-border-width-focus) - var(--t-border-width-interactive)))
				calc(var(--t-space-3) - (var(--t-border-width-focus) - var(--t-border-width-interactive)));
		}

		&:is(textarea) {
			resize: vertical;
		}
	}
}

@layer design {
	.field :is(input, select, textarea).surface.input {
		border-style: solid;
		border-color: var(--t-border);

		/* Not taking input right now. The theme's locked input surface gives
		   the fill, so this only says the same thing in ink and pointer.
		   `readonly` counts because a script that must keep a value in the
		   payload locks with it instead of `disabled`, which would drop the
		   value from the POST. */
		&:is(:disabled, [readonly]) {
			color: var(--c-surface-text-color-muted);
			cursor: default;
		}

		&::placeholder {
			color: var(--c-surface-text-color-muted);
		}

		&:focus {
			outline: none;
			border-color: var(--t-border-focus);
		}
	}

	.field .help {
		color: var(--c-surface-text-color-muted);
	}
}

/* A control with a fixed mark inside its edge, such as the currency before a
   price. The mark and the control share one grid cell; help, if any, takes
   the row below. The mark carries the input's surface so its ink is the
   input's, read against either of the input's fills. */
@layer layout {
	.adorned {
		/* How much room the mark takes inside the control's edge. A wider
		   mark than one character sets this on its own .adorned. */
		--c-adorned-mark-inline-size: 1ch;

		display: grid;
		gap: var(--t-space-2);

		& .adornment,
		& :is(input, select).surface.input {
			grid-area: 1 / 1;
		}

		& .adornment {
			/* Over the control, which paints its own fill after it. */
			position: relative;
			z-index: 1;
			align-self: center;
			justify-self: start;
			padding-inline-start: var(--t-space-3);
			font-size: var(--t-font-size-md);
			pointer-events: none;
		}

		& :is(input, select).surface.input {
			padding-inline-start: calc(var(--t-space-3) + var(--c-adorned-mark-inline-size) + var(--t-space-2));
		}

		/* The field's focus rule resets every padding edge to give up the
		   thicker border; this one keeps the mark's clearance while doing the
		   same, so a focused value stays where it was and off the mark. */
		& :is(input, select).surface.input:focus {
			padding-inline-start: calc(
				var(--t-space-3) + var(--c-adorned-mark-inline-size) + var(--t-space-2)
				- (var(--t-border-width-focus) - var(--t-border-width-interactive))
			);
		}
	}
}

@layer design {
	.adorned .adornment {
		background: none;
		color: var(--c-surface-text-color-muted);
	}
}

/* Busy indicator (busy-indicator.html): a faint ring with one arc in the
   surface's interactive ink, turning while something is under way. */
@layer layout {
	.busy-indicator {
		display: inline-block;
		flex: none;
		inline-size: 1.25em;
		block-size: 1.25em;
		vertical-align: middle;
		border-width: var(--t-border-width-strong);
		border-style: solid;
		border-radius: var(--t-radius-pill);
	}

	@media (prefers-reduced-motion: no-preference) {
		.busy-indicator {
			animation: busy-indicator-turn 1.6s linear infinite;
		}
	}

	@keyframes busy-indicator-turn {
		to { transform: rotate(360deg); }
	}
}

@layer design {
	/* The arc is the surface's interactive ink, held to 7:1; the track under
	   it is the same ink faded, a guide rather than something to read. */
	.busy-indicator {
		border-color: color-mix(in srgb, var(--c-surface-text-color-interactive) 25%, transparent);
		border-block-start-color: var(--c-surface-text-color-interactive);
	}
}

/* A file input the control after it opens (inputs/file.html). It takes no
   room and is not seen, but stays rendered so a required one can still be
   pointed at; its keyboard focus is drawn on the control. */
@layer layout {
	.file-input {
		position: absolute;
		inline-size: 1px;
		block-size: 1px;
		margin: 0;
		padding: 0;
		border: 0;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.file-input:focus-visible + .button {
		outline-width: var(--t-border-width-focus);
		outline-style: solid;
		outline-offset: var(--t-border-width-focus);
	}
}

@layer design {
	.file-input:focus-visible + .button {
		outline-color: var(--t-border-focus);
	}
}

@layer layout {
	/* A file drop has a visible edge, so it pads itself. How it lays out
	   what it holds is the page's. */
	.file-drop {
		border-width: var(--t-border-width-interactive);
		border-radius: var(--t-radius-md);
		padding: var(--t-space-4);
	}
}

@layer design {
	/* Solid, unless its surface is `empty` (no file yet), which dashes it. A
	   drop is something the user acts on, so its edge is the surface's
	   interactive border. */
	.file-drop {
		border-style: var(--t-border-style-interactive);
		border-color: var(--c-surface-border-color-interactive);
	}
}

@layer layout {
	.badge {
		display: inline-block;
		padding: var(--t-space-1) var(--t-space-2);
		border-radius: var(--t-radius-pill);
		font-size: var(--t-font-size-xs);
		font-weight: var(--t-font-weight-semibold);
		/* A label stays on one line while it fits. A long one, such as an
		   offense's name in a narrow tile, breaks between words, and inside
		   a word only when one word alone is wider than the box. In a
		   narrow table cell the same label can stack onto more lines. That
		   is accepted: every cell stays readable, even when the pill is not
		   tidy. A rule for tidy pills in tables is a follow-up. */
		overflow-wrap: break-word;
	}
}

/* A choice is marked with .choice, which carries no styles. Each kind of
   choice draws itself. A single or multi choice is a label around a radio or a
   checkbox, so the whole row is the touch target. An answer is a ghost submit
   button drawn as a box, with its words at the start and the check mark of a
   chosen answer at the end; the ghost gives it its ink, font and states, and
   it has a visible edge, so it pads itself. */
@layer layout {
	.choice:is(.single, .multi) {
		display: flex;
		align-items: center;
		gap: var(--t-space-3);
		min-block-size: var(--t-target-min-size);
		font-size: var(--t-font-size-md);

		& input {
			flex-shrink: 0;
			inline-size: var(--t-space-5);
			block-size: var(--t-space-5);
			margin: 0;
		}
	}

	.choice.answer {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: var(--t-space-3);
		min-block-size: var(--t-target-min-size);
		padding: var(--t-space-4);
		border-width: var(--t-border-width-interactive);
		border-radius: var(--t-radius-md);
		text-align: start;
		font-size: var(--t-font-size-lg);

		& svg {
			flex-shrink: 0;
			inline-size: var(--t-space-6);
			block-size: var(--t-space-6);
		}

		/* A chosen answer draws a thicker border; its padding gives up the
		   difference, so the answer keeps its size. */
		&[aria-pressed="true"] {
			border-width: var(--t-border-width-focus);
			padding: calc(var(--t-space-4) - (var(--t-border-width-focus) - var(--t-border-width-interactive)));
		}
	}
}

@layer design {
	.choice:is(.single, .multi) {
		cursor: pointer;

		& input {
			accent-color: var(--c-surface-text-color-interactive);
		}

		&:has(input:checked) {
			color: var(--c-surface-text-color-interactive);
		}
	}

	.choice.answer {
		cursor: pointer;
		border-style: solid;
		border-color: var(--c-surface-border-color-interactive);
	}
}

@layer layout {
	/* hgroup: legacy pages put a bare "heading" class on their own headings. */
	hgroup.heading {
		display: grid;
		gap: var(--t-space-2);

		& :is(h1, h2, h3, h4, p) {
			margin: 0;
		}

		& :is(h1, h2, h3, h4) {
			font-family: var(--t-font-family-heading);
			font-size: var(--t-font-size-hero);
			font-weight: var(--t-font-weight-bold);
		}

		& .kicker {
			font-size: var(--t-font-size-sm);
			font-weight: var(--t-font-weight-semibold);
		}

		& .subtitle {
			font-size: var(--t-font-size-sm);
		}
	}

	/* A section heading is one part of a page, so it steps down from the page
	   title's hero scale and weight: an h2 section takes the pane-title scale,
	   and an h3 or h4 takes the sub-heading scale. */
	hgroup.section-heading :is(h2, h3, h4) {
		font-weight: var(--t-font-weight-section-heading);
	}

	hgroup.section-heading :is(h2) {
		font-size: var(--t-font-size-lg);
	}

	hgroup.section-heading :is(h3, h4) {
		font-size: var(--t-font-size-md);
	}

	/* A group label is a small uppercase heading above a list: it carries the
	   outline at its level, not the page title's scale. */
	:is(h1, h2, h3, h4, h5, h6).group-label {
		margin: 0;
		font-size: var(--t-font-size-sm);
		line-height: var(--mea-lh-snug);
		font-weight: var(--t-font-weight-bold);
		text-transform: uppercase;
		letter-spacing: var(--mea-ls-caps);
	}

	/* A hero heading stands beside an accent bar on its leading edge, and its
	   subtitle reads at body size rather than as a caption. */
	hgroup.heading.hero {
		padding-block: var(--t-space-8);
		padding-inline-start: var(--t-space-5);
		border-inline-start-width: calc(var(--t-space-1) / 2);
		border-inline-start-style: solid;

		& .kicker {
			font-size: var(--t-font-size-xs);
			font-weight: var(--t-font-weight-bold);
			text-transform: uppercase;
			letter-spacing: var(--mea-ls-caps);
		}

		& .subtitle {
			font-size: var(--t-font-size-lg);
			line-height: var(--mea-lh-relaxed);
		}
	}

	/* An outcome's heading (outcome.html) leads with its mark on the first line, one line
	   tall, so it centres on that line however long the heading runs. The
	   mark and the words sit inline, so the pair follows the alignment of
	   the column around it: centred in a centred column, at the start
	   otherwise. The words are a block of their own whose lines keep to its
	   start, so a wrapped heading hangs under its first word, not under the
	   mark. */
	hgroup.outcome-heading > :is(h1, h2, h3, h4) {
		& > .mark {
			display: inline-grid;
			vertical-align: top;
			inline-size: 1lh;
			block-size: 1lh;
			margin-inline-end: var(--t-space-3);

			& svg {
				inline-size: 60%;
				block-size: 60%;
			}
		}

		& > .words {
			display: inline-block;
			vertical-align: top;
			max-inline-size: calc(100% - 1lh - var(--t-space-3));
			text-align: start;
		}
	}

	/* In a narrow column a centred heading that wraps would fill the line and
	   read as start-aligned, so the mark stacks above the words instead. Both
	   then follow the column's alignment: centred in a focus column, at the
	   start elsewhere. 36rem is the focus column's narrow line, so the two
	   switch together (design-system/README.md#alignment). */
	@container (inline-size < 36rem) {
		hgroup.outcome-heading > :is(h1, h2, h3, h4) {
			& > .mark {
				margin-inline-end: 0;
				margin-block-end: var(--t-space-3);
			}

			& > .words {
				display: block;
				max-inline-size: none;
				text-align: inherit;
			}
		}
	}
}

@layer design {
	/* A group label and a hero's subtitle sit on the page background rather
	   than on a card, so they take the surface's muted ink. The --t-bg-text-*
	   tokens are rebound to dark inks under a light-skin .app-screen that
	   never paints the light page they assume. */
	:is(h1, h2, h3, h4, h5, h6).group-label {
		color: var(--c-surface-text-color-muted);
	}

	hgroup.heading.hero {
		border-inline-start-color: var(--t-accent);

		& .kicker {
			color: var(--t-accent);
		}

		& .subtitle {
			color: var(--c-surface-text-color-muted);
		}
	}
}

@layer design {
	hgroup.heading {
		& :is(h1, h2, h3, h4) {
			color: var(--c-surface-text-color-base);
		}

		& :is(.kicker, .subtitle) {
			color: var(--c-surface-text-color-muted);
		}
	}
}

/* Page header (page-header.html): one block under another, the way back,
   the title, the note and the page's actions (a button row), spaced by the
   header's gap. The way back keeps its own width. It has no visible edge, so
   it sets no space on its outer edges. */
@layer layout {
	header.page-header {
		display: grid;
		gap: var(--t-space-3);

		& > a {
			justify-self: start;
		}

		& > .note {
			margin: 0;
			font-size: var(--t-font-size-sm);
		}
	}
}

@layer design {
	header.page-header .note {
		color: var(--c-surface-text-color-muted);
	}
}

@layer layout {
	/* A callout has a fill, so it pads itself. */
	.callout {
		display: grid;
		gap: var(--t-space-2);
		padding: var(--t-space-3) var(--t-space-4);
		border-radius: var(--t-radius-md);
		font-size: var(--t-font-size-md);

		& :is(p, ul, h2, h3, h4) {
			margin: 0;
		}

		/* A callout may open with a title of its own. */
		& :is(h2, h3, h4) {
			font-size: var(--t-font-size-md);
			font-weight: var(--t-font-weight-bold);
		}

		& ul {
			padding-inline-start: var(--t-space-5);
		}

		& a {
			font-weight: var(--t-font-weight-semibold);
		}
	}

	/* On a filled surface a fill alone barely sets the callout apart, so it
	   takes an edge. On the plain page and card surfaces (lowest, raised)
	   its fill is enough. */
	.surface:not(.lowest, .raised) .callout {
		border-width: var(--t-border-width-interactive);
	}
}

@layer design {
	.callout a {
		color: var(--c-surface-text-color-interactive);
	}

	/* The edge is the callout's own surface border, the one colour in its
	   set held to 3:1 against its fill. */
	.surface:not(.lowest, .raised) .callout {
		border-style: solid;
		border-color: var(--c-surface-border-color-interactive);
	}
}

/* Facts: a <dl> of label and value pairs. Rows share one label column
   through subgrid, so the values line up; a stacked list tiles its facts
   with each label above its value. */
@layer layout {
	.facts {
		display: grid;
		grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr);
		gap: var(--t-space-2) var(--t-space-3);
		margin: 0;

		& .fact {
			display: grid;
			grid-column: 1 / -1;
			grid-template-columns: subgrid;
			align-items: baseline;
			min-inline-size: 0;
		}

		& :is(dt, dd) {
			margin: 0;
			min-inline-size: 0;
			overflow-wrap: anywhere;
			font-size: var(--t-font-size-sm);
		}

		& dd {
			font-weight: var(--t-font-weight-semibold);
		}
	}

	.facts.stacked {
		grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
		gap: var(--t-space-4);

		/* A fact in a row with a taller one, such as an address that wraps,
		   stretches to its height. Its label and value stay together at the
		   top rather than spreading over that height. */
		& .fact {
			grid-column: auto;
			grid-template-columns: minmax(0, 1fr);
			align-content: start;
			gap: var(--t-space-1);
		}

		& .fact.wide {
			grid-column: 1 / -1;
		}
	}

	/* A tiled fact is a raised card of its own, so it pads itself. Its label
	   is small and in capitals: the value is what the reader scans for, so it
	   keeps body size and bold weight rather than the small detail size. */
	.facts.stacked .fact.tile {
		padding: var(--t-space-4);
		border-radius: var(--t-radius-md);

		& dd {
			font-size: var(--t-font-size-md);
			font-weight: var(--t-font-weight-semibold);
		}
	}
}

@layer design {
	.facts dt {
		color: var(--c-surface-text-color-muted);
	}

	/* A tile's fill can match the card it sits in, so the base's card shadow
	   is what sets each one apart. */
	.facts.stacked .fact.tile {
		box-shadow: var(--mea-shadow-card);
	}

	.facts.stacked .fact.tile dt {
		font-size: var(--t-font-size-xs);
		font-weight: var(--t-font-weight-semibold);
		text-transform: uppercase;
	}

	/* A toned fact's value and a toned row's title take the surface's ink of
	   that name. */
	.fact[data-tone="info"] dd, .row[data-tone="info"] .title {
		color: var(--c-surface-text-color-info);
	}

	.fact[data-tone="success"] dd, .row[data-tone="success"] .title {
		color: var(--c-surface-text-color-success);
	}

	.fact[data-tone="warning"] dd, .row[data-tone="warning"] .title {
		color: var(--c-surface-text-color-warning);
	}

	.fact[data-tone="error"] dd, .row[data-tone="error"] .title {
		color: var(--c-surface-text-color-error);
	}

	/* The accent ink marks something current, such as a task in progress. */
	.fact[data-tone="accent"] dd, .row[data-tone="accent"] .title {
		color: var(--c-surface-text-color-interactive);
	}
}

/* Figures: a value a page leads with and the caption that names it. The
   value is the reading; the caption is its name, kept small and uppercase so
   it never competes with the number. inline() puts them on one line, and
   spread() sets the value and the caption in two columns. */
@layer layout {
	.figures {
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr));
		gap: var(--t-space-6);
		align-items: start;
	}

	.figure {
		display: grid;
		gap: var(--t-space-1);
		min-inline-size: 0;
	}

	.figure .value,
	.figure .caption {
		margin: 0;
	}

	.figure .value {
		font-size: var(--t-font-size-2xl);
		font-weight: var(--t-font-weight-extrabold);
		line-height: var(--t-line-height-tight);
	}

	.figure .caption {
		font-size: var(--t-font-size-xs);
		font-weight: var(--t-font-weight-semibold);
		text-transform: uppercase;
		letter-spacing: var(--mea-ls-wide);
	}

	.figure.inline {
		display: flex;
		align-items: baseline;
		gap: var(--t-space-2);
	}

	.figure.spread {
		display: grid;
		grid-template-columns: auto minmax(0, 1fr);
		align-items: center;
		justify-items: center;
		gap: var(--t-space-6);
	}
}

@layer design {
	.figure .value {
		color: var(--c-surface-text-color-base);
	}

	.figure .caption {
		color: var(--c-surface-text-color-muted);
	}

	.figure[data-tone="info"] .value {
		color: var(--c-surface-text-color-info);
	}

	.figure[data-tone="success"] .value {
		color: var(--c-surface-text-color-success);
	}

	.figure[data-tone="warning"] .value {
		color: var(--c-surface-text-color-warning);
	}

	.figure[data-tone="error"] .value {
		color: var(--c-surface-text-color-error);
	}
}

/* Data table: a scroll region around a <table>. Each cell is divided from
   the next row, so the cells pad themselves; the region has no edge of its
   own. */
@layer layout {
	.data-table {
		overflow-x: auto;

		& table {
			inline-size: 100%;
			border-collapse: collapse;
			font-size: var(--t-font-size-sm);
		}

		& caption {
			padding-block-end: var(--t-space-2);
			text-align: start;
			font-weight: var(--t-font-weight-semibold);
		}

		& :is(th, td) {
			padding: var(--t-space-3) var(--t-space-4);
			text-align: start;
			vertical-align: top;
			border-block-end-width: var(--t-border-width-interactive);
		}

		& thead th {
			vertical-align: bottom;
			white-space: nowrap;
			font-size: var(--t-font-size-xs);
			font-weight: var(--t-font-weight-semibold);
		}

		& tbody tr:last-child :is(th, td) {
			border-block-end-width: 0;
		}

		& thead a {
			display: inline-flex;
			align-items: center;
			gap: var(--t-space-1);
		}

		& thead svg {
			inline-size: 1em;
			block-size: 1em;
		}

		&:focus-visible {
			outline-width: var(--t-border-width-focus);
		}
	}

}

@layer design {
	.data-table {
		& :is(th, td) {
			border-block-end-style: solid;
			border-block-end-color: var(--t-border);
		}

		& thead th {
			color: var(--c-surface-text-color-muted);
		}

		& thead a,
		& tbody a {
			color: var(--c-surface-text-color-interactive);
		}

		&:focus-visible {
			outline-style: solid;
			outline-color: var(--t-border-focus);
		}
	}
}

/* Slats: a list of records, each a few groups of lines side by side. The
   slat's body is a grid; each group spans the same --slat-lines rows of it
   through subgrid, so line N of every group shares one row, and the lines in
   a row sit on one baseline whatever their size. The groups' columns come
   from --slat-columns on the list, so every slat, being the same width, cuts
   the same columns. Each slat has a divider below it and pads itself, like a
   table's cells, so the list sits in a flush pane. In a narrow list, such as
   on a phone, the first group takes the full width and the rest share the
   band under it. */
@layer layout {
	.slats {
		--slat-lines: 4;
		container-type: inline-size;
		display: grid;
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.slat {
		display: grid;
		grid-template-columns: minmax(0, 1fr);
		align-items: first baseline;
		column-gap: var(--t-space-3);
		padding: var(--t-space-4);
		border-block-end-width: var(--t-border-width-interactive);

		&:has(> .lead) {
			grid-template-columns: auto minmax(0, 1fr);
		}

		&:last-child {
			border-block-end-width: 0;
		}

		& > .body {
			display: grid;
			grid-template-columns: var(--slat-columns, none);
			grid-auto-columns: minmax(0, 1fr);
			gap: var(--t-space-1) var(--t-space-5);
			min-inline-size: 0;
		}

		& .group {
			display: grid;
			grid-row: 1 / span var(--slat-lines);
			grid-template-rows: subgrid;
			align-items: baseline;
			margin: 0;
			min-inline-size: 0;

			& > * {
				margin: 0;
				min-inline-size: 0;
			}
		}

		& .title {
			font-size: var(--t-font-size-md);
			font-weight: var(--t-font-weight-semibold);
		}

		@container (inline-size < 36rem) {
			& > .body {
				grid-template-columns: repeat(2, minmax(0, 1fr));
			}

			& .group:nth-child(1 of .group) {
				grid-column: 1 / -1;
			}

			& .group:not(:nth-child(1 of .group)) {
				grid-row: calc(var(--slat-lines) + 1) / span var(--slat-lines);
				padding-block-start: var(--t-space-2);
			}
		}
	}
}

@layer design {
	.slat {
		border-block-end-style: solid;
		border-block-end-color: var(--t-border);

		& .group {
			font-size: var(--t-font-size-sm);
		}

		& .group dt {
			font-size: var(--t-font-size-xs);
			color: var(--c-surface-text-color-muted);
		}

		& .group dd {
			font-weight: var(--t-font-weight-semibold);
		}

		& [data-tone="info"] { color: var(--c-surface-text-color-info); }
		& [data-tone="success"] { color: var(--c-surface-text-color-success); }
		& [data-tone="warning"] { color: var(--c-surface-text-color-warning); }
		& [data-tone="error"] { color: var(--c-surface-text-color-error); }
	}
}

/* Pager: previous, the numbered pages, where the reader is, next. The
   buttons pad themselves; the pager sets only the space between them. The
   page the reader is on is not a control, so it takes the interactive
   surface and carries the same footprint as the outline links beside it. */
@layer layout {
	nav.pager {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: center;
		gap: var(--t-space-4);

		& p {
			margin: 0;
			font-size: var(--t-font-size-sm);
		}

		& .pager-pages {
			display: flex;
			flex-wrap: wrap;
			align-items: center;
			gap: var(--t-space-1);
			margin: 0;
			padding: 0;
			list-style: none;

			& .current {
				display: inline-flex;
				align-items: center;
				justify-content: center;
				min-block-size: var(--t-target-min-size);
				min-inline-size: var(--t-target-min-size);
				padding-inline: var(--t-space-4);
				border-radius: var(--t-radius-pill);
				font-family: var(--t-font-family);
				font-weight: var(--t-font-weight-interactive);
				font-size: var(--t-font-size-interactive);
			}
		}
	}
}

@layer design {
	nav.pager p,
	nav.pager .pager-pages .gap {
		color: var(--c-surface-text-color-muted);
	}
}

/* Search: a text box with a magnifier in it, and its submit beside it, as a
   field and its action sit. The box is the input surface, so it pads itself;
   the input inside it has no fill or edge of its own. The label is for screen
   readers only: the placeholder carries the same words for sighted readers.
   (It isn't called "search": legacy pages put that class on their own
   forms.) */
@layer layout {
	form.search-bar {
		display: flex;
		align-items: center;
		gap: var(--t-space-2);
		min-inline-size: 12rem;

		& .box {
			display: flex;
			flex: 1;
			align-items: center;
			gap: var(--t-space-2);
			min-inline-size: 0;
			min-block-size: var(--t-target-min-size);
			padding: 0 var(--t-space-3);
			border-width: var(--t-border-width-interactive);
			border-radius: var(--t-radius-md);
		}

		& .box:focus-within {
			border-width: var(--t-border-width-focus);
			padding: 0 calc(var(--t-space-3) - (var(--t-border-width-focus) - var(--t-border-width-interactive)));
		}

		& > button { flex-shrink: 0; }

		& > button svg {
			inline-size: 1.25em;
			block-size: 1.25em;
		}

		& .icon {
			display: inline-flex;
			flex-shrink: 0;
		}

		& .icon svg {
			inline-size: 1em;
			block-size: 1em;
		}

		/* Kept in the accessibility tree, out of sight. */
		& label {
			position: absolute;
			inline-size: 1px;
			block-size: 1px;
			padding: 0;
			overflow: hidden;
			clip-path: inset(50%);
			white-space: nowrap;
		}

		& input {
			flex: 1;
			min-inline-size: 0;
			align-self: stretch;
			padding: 0;
			border: 0;
			outline: 0;
			background: none;
			font-family: var(--t-font-family);
			font-size: var(--t-font-size-md);
		}
	}

	/* In a narrow column the box needs the room, so the button shows only its
	   magnifier: the button rule for a .words label does this. */
}

@layer design {
	form.search-bar {
		& .box {
			border-style: solid;
			border-color: var(--t-border);
		}

		& .icon {
			color: var(--c-surface-text-color-muted);
		}

		& input {
			color: var(--c-surface-text-color-base);
		}

		& input::placeholder {
			color: var(--c-surface-text-color-muted);
		}

		& .box:focus-within {
			border-color: var(--t-border-focus);
		}
	}
}

/* Blank slate: what a page shows when it has nothing to list. (Not
   "empty-state": legacy pages put that class on their own markup.) It sets
   no padding or margin; its container supplies the room. */
@layer layout {
	.blank-slate {
		display: grid;
		justify-items: center;
		gap: var(--t-space-3);
		text-align: center;

		& p {
			margin: 0;
		}

		& .icon svg {
			inline-size: calc(var(--t-space-8) + var(--t-space-4));
			block-size: auto;
		}
	}
}

@layer design {
	.blank-slate {
		& .icon,
		& p {
			color: var(--c-surface-text-color-muted);
		}
	}
}

/* Person: a name with its initials in a round badge, for a participant cell
   or row. The grouping is inline so it sits inside a cell or a link without
   breaking the line; the detail column shrinks rather than widening its
   parent. */
@layer layout {
	.person {
		display: inline-flex;
		align-items: center;
		gap: var(--t-space-3);
		min-inline-size: 0;
	}

	.person-initials {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		flex: 0 0 auto;
		inline-size: var(--t-space-8);
		block-size: var(--t-space-8);
		border-radius: var(--t-radius-pill);
		font-size: var(--t-font-size-xs);
		font-weight: var(--t-font-weight-bold);
	}

	.person-detail {
		display: grid;
		gap: var(--t-space-1);
		min-inline-size: 0;
	}

	.person-name,
	.person-sub {
		margin: 0;
	}

	.person-name {
		font-size: var(--t-font-size-sm);
		font-weight: var(--t-font-weight-semibold);
	}

	.person-sub {
		font-size: var(--t-font-size-xs);
	}
}

@layer design {
	.person-name {
		color: var(--c-surface-text-color-base);
	}

	.person-sub {
		color: var(--c-surface-text-color-muted);
	}
}

/* Stat tiles: a <dl> of counts, each tile a raised card. Tiles in a row
   are the same height. Each tile stacks its label, value and note from the
   bottom, so when one label wraps, the figures in the row still line up. A
   tile has a visible edge, so it pads itself; the list sets only the space
   between tiles. A tone colours the value with the surface's ink of that
   name. */
@layer layout {
	dl.stat-tiles {
		display: flex;
		flex-wrap: wrap;
		gap: var(--t-space-3);
		margin: 0;

		& .stat-tile {
			flex: 1 1 10rem;
			display: flex;
			flex-direction: column;
			gap: var(--t-space-1);
			padding: var(--t-space-4);
			border-width: var(--t-border-width-interactive);
			border-radius: var(--t-radius-lg);
			min-inline-size: 0;
			/* A tile centres its label, value and note, so a row of tiles
			   reads as a set of figures. It sets this itself, so the tile
			   looks the same whatever alignment the text around it has. */
			align-items: center;
			text-align: center;
		}

		& :is(dt, dd) {
			margin: 0;
			overflow-wrap: anywhere;
		}

		& dt {
			margin-block-start: auto;
			font-size: var(--t-font-size-sm);
			font-weight: var(--t-font-weight-semibold);
			text-transform: uppercase;
			letter-spacing: var(--mea-ls-caps);
		}


		& .value {
			font-size: var(--t-font-size-2xl);
			font-weight: var(--t-font-weight-extrabold);
			line-height: var(--t-line-height-tight);
		}

		& .note {
			font-size: var(--t-font-size-xs);
		}
	}
}

@layer design {
	dl.stat-tiles {
		& .stat-tile {
			border-style: solid;
			border-color: var(--t-border);
		}

		& :is(dt, .note) {
			color: var(--c-surface-text-color-muted);
		}

		& [data-tone="info"] .value {
			color: var(--c-surface-text-color-info);
		}

		& [data-tone="success"] .value {
			color: var(--c-surface-text-color-success);
		}

		& [data-tone="warning"] .value {
			color: var(--c-surface-text-color-warning);
		}

		& [data-tone="error"] .value {
			color: var(--c-surface-text-color-error);
		}
	}
}

/* Primary content: a page's own parts, grouped as one card under what the
   page breaks out above them. Its fill is a visible edge, so it pads itself.
   It spaces its sections, and each section spaces its heading, content and
   actions. The page sets the space around it. */
@layer layout {
	.primary-content {
		display: grid;
		grid-template-columns: minmax(0, 1fr);
		align-content: start;
		/* Sections stand well apart, so the space between two of them reads
		   larger than any space inside one. */
		gap: var(--t-space-10);
		padding: var(--t-space-5);
		border-radius: var(--t-radius-lg);
		/* What sits inside measures this column, so a button in a section's
		   header can show only its icon when the column is narrow. */
		container-type: inline-size;

		& > section {
			display: grid;
			grid-template-columns: minmax(0, 1fr);
			align-content: start;
			gap: var(--t-space-4);
		}

		/* A section's aside shares the heading's line, at its end. */
		& > section > header {
			display: flex;
			align-items: center;
			justify-content: space-between;
			gap: var(--t-space-2);
		}

		/* Every line in a section starts where its heading starts, so the
		   eye returns to one edge. A divided list keeps its dividers but
		   drops the side padding a row has in a card of its own. A list of
		   cards keeps its padding inside each card's edge. */
		& :is(ul, ol).rows:not(.cards, .tiles) > .row {
			padding-inline: 0;
		}
	}

	/* On the page background, with no other surface between, it rounds
	   more than a card set inside another, so the page's top layer reads as
	   one level. */
	.surface.lowest .primary-content:not(.surface:not(.lowest) *) {
		border-radius: var(--t-radius-xl);
	}
}

/* Pane: a titled card. It has a visible edge, so it pads its header and
   body; the page sets the space between panes. */
@layer layout {
	:is(section, nav, article).pane {
		display: grid;
		align-content: start;
		border-width: var(--t-border-width-interactive);
		border-radius: var(--t-radius-lg);
		overflow: hidden;

		& > header {
			display: flex;
			flex-wrap: wrap;
			align-items: center;
			justify-content: space-between;
			gap: var(--t-space-2);
			padding: var(--t-space-4) var(--t-space-5);
			border-block-end-width: var(--t-border-width-interactive);

			& :is(h1, h2, h3, h4) {
				margin: 0;
				min-inline-size: 0;
				font-family: var(--t-font-family-heading);
				font-size: var(--t-font-size-lg);
				font-weight: var(--t-font-weight-bold);
			}

			/* A lead control sits against the heading, which takes the room
			   between it and the aside. */
			& > .lead {
				display: inline-flex;
			}

			& > .lead + :is(h1, h2, h3, h4) {
				flex: 1 1 0;
			}
		}

		& > .body {
			display: grid;
			gap: var(--t-space-4);
			align-content: start;
			padding: var(--t-space-5);
		}

		& > .body.flush {
			padding: 0;
		}

		/* The footer is the header's mirror: what it holds at the start,
		   its last item (usually the card's action) at the end. */
		& > footer {
			display: flex;
			flex-wrap: wrap;
			align-items: center;
			justify-content: space-between;
			gap: var(--t-space-3);
			padding: var(--t-space-4) var(--t-space-5);
			border-block-start-width: var(--t-border-width-interactive);
		}
	}

	/* On the page background, with no other surface between, it rounds
	   more than a card set inside another, so the page's top layer reads as
	   one level. */
	.surface.lowest :is(section, nav, article).pane:not(.surface:not(.lowest) *) {
		border-radius: var(--t-radius-xl);
	}
}

@layer design {
	:is(section, nav, article).pane {
		border-style: solid;
		border-color: var(--t-border);

		& > header {
			border-block-end-style: solid;
			border-block-end-color: var(--t-border);
		}

		& > footer {
			border-block-start-style: solid;
			border-block-start-color: var(--t-border);
		}
	}
}

/* Rows: a list of things, each row divided from the next. A row has a
   visible edge (its divider), so it pads itself. The main column takes the
   width the aside leaves, so a bar or track in one row lines up with the
   same bar in the next instead of sizing to its own label. */
@layer layout {
	:is(ul, ol).rows {
		display: grid;
		margin: 0;
		padding: 0;
		list-style: none;

		& > .row {
			display: flex;
			align-items: center;
			justify-content: space-between;
			gap: var(--t-space-3);
			padding: var(--t-space-3) var(--t-space-5);
			border-block-end-width: var(--t-border-width-interactive);
		}

		& > .row:last-child {
			border-block-end-width: 0;
		}

		& .main {
			display: grid;
			flex: 1;
			gap: var(--t-space-1);
			min-inline-size: 0;

			& p, & h1, & h2, & h3, & h4, & h5, & h6 {
				margin: 0;
				font-size: var(--t-font-size-sm);
				overflow-wrap: anywhere;
			}

			& :is(p, h1, h2, h3, h4, h5, h6).title {
				font-size: var(--t-font-size-md);
				font-weight: var(--t-font-weight-semibold);
			}

			/* A message row's words read as body text, not as a name. */
			& p.message {
				font-size: var(--t-font-size-md);
			}
		}

		/* A row whose whole main column is the link: the link covers the
		   title and every detail in one name, and the title carries the
		   underline the row's other links do. */
		& a.main {
			text-decoration: none;
		}

		& .aside {
			flex-shrink: 0;
		}

		/* A whole-row link that carries its aside: the link is the row's own
		   flex line, so the badge sits at the row's end inside the one click
		   target and the one name a reader hears. */
		& a.main.main-with-aside {
			display: flex;
			align-items: center;
			justify-content: space-between;
			gap: var(--t-space-3);
		}

		& a.main > .main-text {
			display: grid;
			flex: 1;
			gap: var(--t-space-1);
			min-inline-size: 0;
		}

		/* A marker leads the row: a case number in a circle, an avatar or an
		   icon. It sits at the start of the row's one link, before the text,
		   and stays its own size while the text takes the room left. The row
		   aligns to the top so a tall marker and a stack of details start
		   together, as a card's do. */
		& :is(a.main, .main).main-with-marker {
			display: flex;
			align-items: flex-start;
			gap: var(--t-space-3);
		}

		& :is(a.main, .main) > .marker {
			flex-shrink: 0;
		}

		& :is(a.main, .main).main-with-marker > .main-text {
			flex: 1;
		}

		& a.main > .aside {
			flex-shrink: 0;
		}

		/* aside_at="title": the aside shares the title's line and the details
		   span the whole row beneath, so a long detail is never squeezed into
		   the column the aside leaves. The main column steps aside
		   (display: contents) so its title and details sit in the row's grid. */
		& > .row.aside-title {
			display: grid;
			grid-template-columns: minmax(0, 1fr) auto;
			column-gap: var(--t-space-3);
			row-gap: var(--t-space-1);
			align-items: baseline;

			& > .main {
				display: contents;
			}

			& > .main > .title {
				grid-column: 1;
				grid-row: 1;
			}

			& > .aside {
				grid-column: 2;
				grid-row: 1;
			}

			& > .main > :not(.title) {
				grid-column: 1 / -1;
			}
		}

		/* aside_at="below": the aside takes a line of its own after the
		   details, so the title keeps the row's whole width. */
		& > .row.aside-below {
			flex-direction: column;
			align-items: stretch;
			gap: var(--t-space-2);

			& > .aside {
				align-self: start;
			}
		}

		/* A linked row: the title link's box covers the whole row, so a
		   tap on the details or the aside follows it too. */
		& > .row.linked {
			position: relative;

			& .title a::after {
				content: "";
				position: absolute;
				inset: 0;
			}

			&:has(.title a:focus-visible) {
				outline-width: var(--t-border-width-focus);
				outline-offset: calc(-1 * var(--t-border-width-focus));
			}
		}
	}
}

@layer layout {
	/* Aligned rows: the aside column is one track sized to the widest aside
	   in the list, and every row subgrids it. The main column is therefore the
	   same width in every row, so a bar in one row lines up with the same bar
	   in the next instead of sizing to its own aside. */
	:is(ul, ol).rows.aligned {
		grid-template-columns: minmax(0, 1fr) auto;

		& > .row {
			display: grid;
			grid-column: 1 / -1;
			grid-template-columns: subgrid;
			align-items: center;
		}

		& > .row > :is(.main, a.main) {
			grid-column: 1;
		}

		& > .row > .aside {
			grid-column: 2;
		}

		& > .row:not(:has(.aside)) > :is(.main, a.main) {
			grid-column: 1 / -1;
		}
	}

	/* Inline rows: the title, the one bar or figure from caller(), and the
	   aside read on a single line -- a label, its share, and the figure. The
	   main column has no box of its own, so its title and the caller's bar
	   take their own cells. */
	:is(ul, ol).rows.inline > .row {
		display: grid;
		grid-template-columns: auto minmax(0, 1fr) auto;
		align-items: center;
	}

	:is(ul, ol).rows.inline > .row > :is(.main, a.main) {
		display: contents;
	}

	:is(ul, ol).rows.inline > .row > .main > .title {
		font-size: var(--t-font-size-sm);
	}

	:is(ul, ol).rows.inline > .row > .aside {
		justify-self: end;
	}

	/* An aligned inline list shares three tracks: the widest title, the bar,
	   and the widest aside. */
	:is(ul, ol).rows.aligned.inline {
		grid-template-columns: auto minmax(0, 1fr) auto;
	}

	:is(ul, ol).rows.aligned.inline > .row {
		grid-template-columns: subgrid;
	}

	:is(ul, ol).rows.aligned.inline > .row > .aside {
		grid-column: 3;
	}

	/* Tile rows: each row is its own card on a recessed surface, with the
	   list setting only the gap between cards. A tile has a visible edge all
	   round, so it pads itself. */
	:is(ul, ol).rows.tiles {
		gap: var(--t-space-3);
	}

	:is(ul, ol).rows.tiles > .row {
		padding: var(--t-space-4);
		border-width: var(--t-border-width-interactive);
		border-radius: var(--t-radius-lg);
	}

	:is(ul, ol).rows.tiles > .row:last-child {
		border-block-end-width: var(--t-border-width-interactive);
	}
}

@layer layout {
	/* Card rows: each row is its own card, set apart from the next by space
	   rather than a divider. A card has a visible edge on every side, so it
	   pads itself. Its fill is the surface the list already sits on, so the
	   card's text keeps that surface's ink; a row that is itself a surface,
	   such as the one the reader is on, paints that surface instead. */
	:is(ul, ol).rows.cards {
		gap: var(--t-space-2);

		& > .row,
		& > .row:last-child {
			padding: 0;
			border-width: var(--t-border-width-interactive);
			border-radius: var(--t-radius-lg);
			background-color: var(--c-surface-background-color);
			overflow: hidden;
		}

		/* The row's own content pads itself, not the card: a whole-row link
		   then reaches the card's edge, so a tap anywhere on the card follows
		   it, the same as the rows without cards do. */
		& > .row > :is(a.main, .main) {
			padding: var(--t-space-3) var(--t-space-4);
		}
	}
}

@layer design {
	:is(ul, ol).rows {
		& > .row {
			border-block-end-style: solid;
			border-block-end-color: var(--t-border);
		}

		/* A card row draws its edge all the way round; the space between
		   cards is the list's, so no side is left open. */
		&.cards > .row {
			border-style: solid;
			border-color: var(--t-border);
		}

		& .main :is(p, h1, h2, h3, h4, h5, h6):not(.title, .message) {
			color: var(--c-surface-text-color-muted);
		}

		/* A title that links looks like a link before anyone points at
		   it, the same as a link in a callout. */
		& .title a,
		& a.main .title {
			color: var(--c-surface-text-color-interactive);
		}

		& a.main .title {
			text-decoration: underline;
		}

		/* A plain whole-row link keeps the row's own ink and no underline: the
		   list is a set of rows to read, not a set of links to spot. */
		& a.main.plain .title {
			color: var(--c-surface-text-color-base);
			text-decoration: none;
		}

		/* A note after the title qualifies it, so it reads as secondary ink
		   even when the title is a link. A muted title is one whose own value
		   is degraded or unavailable: its text, and any link in it, take the
		   same muted ink as the row's details. */
		& .title .title-note {
			font-size: var(--t-font-size-xs);
			color: var(--c-surface-text-color-muted);
		}

		& .main .title.muted,
		& .main .title.muted a {
			color: var(--c-surface-text-color-muted);
		}

		/* The row shows the focus ring, so the link doesn't draw its own. */
		& > .row.linked {
			& .title a:focus-visible {
				outline: none;
			}

			&:has(.title a:focus-visible) {
				outline-style: solid;
				outline-color: var(--t-border-focus);
			}
		}

		& > .row:has(a.main:focus-visible) {
			outline-width: var(--t-border-width-focus);
			outline-offset: calc(-1 * var(--t-border-width-focus));
			outline-style: solid;
			outline-color: var(--t-border-focus);
		}

		& a.main:focus-visible {
			outline: none;
		}

		/* A tile row draws its whole edge, not just the divider below it. */
		&.tiles > .row {
			border-style: solid;
			border-color: var(--t-border);
		}
	}
}

/* Progress: every <progress> is drawn the same way, as a button is. The bar
   is an outline with no fill of its own; the part done paints with the
   interactive ink of the surface it sits on, because the done part is a
   pseudo-element and can't take a surface class (surfaces/README.md). A
   labeled progress sets only the gap between its label and its bar. */
@layer layout {
	progress {
		appearance: none;
		display: block;
		inline-size: 100%;
		block-size: var(--t-space-2);
		border-width: var(--t-border-width-interactive);
		border-radius: var(--t-radius-pill);
		overflow: hidden;

		&::-webkit-progress-bar,
		&::-webkit-progress-value {
			border-radius: inherit;
		}
	}

	.labeled-progress {
		display: grid;
		gap: var(--t-space-2);

		& label {
			font-size: var(--t-font-size-sm);
		}
	}
}

@layer design {
	progress {
		border-style: solid;
		border-color: var(--c-surface-border-color-interactive);
		background: none;

		&::-webkit-progress-bar {
			background: none;
		}

		&::-webkit-progress-value {
			background-color: var(--c-surface-text-color-interactive);
		}

		&::-moz-progress-bar {
			background-color: var(--c-surface-text-color-interactive);
		}
	}

	.labeled-progress label {
		color: var(--c-surface-text-color-muted);
	}
}

/* A progress stage: a round marker for where one thing is in a sequence.
   Done fills with the success ink, current with the interactive ink, and
   upcoming is a ring in the muted ink. It is a spacer token wide, so it grows
   with the theme's spacing scale. See design-system/components/README.md. */
@layer layout {
	.progress-stage {
		display: inline-block;
		inline-size: var(--t-space-7);
		block-size: var(--t-space-7);
		flex-shrink: 0;
		border-width: var(--t-border-width-strong);
		border-style: solid;
		border-radius: var(--t-radius-pill);
		vertical-align: middle;
	}
}

@layer design {
	.progress-stage {
		background: none;
		border-color: var(--c-surface-text-color-muted);
	}

	.progress-stage[data-stage="done"] {
		background-color: var(--c-surface-text-color-success);
		border-color: var(--c-surface-text-color-success);
	}

	.progress-stage[data-stage="current"] {
		background-color: var(--c-surface-text-color-interactive);
		border-color: var(--c-surface-text-color-interactive);
	}
}

/* Meter: every <meter> is drawn the same way, as a progress bar is: an
   outline with no fill of its own. The part filled paints with the meaning
   ink of the surface it sits on, picked by where the value falls against the
   caller's low, high and optimum: success when it is where it should be,
   warning when it is borderline, error when it is not. Like a progress bar's,
   the filled part is a pseudo-element and can't take a surface class
   (surfaces/README.md). A labeled meter sets only the gap between its label
   and its bar. */
@layer layout {
	meter {
		appearance: none;
		display: block;
		inline-size: 100%;
		block-size: var(--t-space-2);
		border-width: var(--t-border-width-interactive);
		border-radius: var(--t-radius-pill);
		overflow: hidden;

		/* Chromium ignores a percentage height on the bar and draws it half
		   height, so the bar is given the meter's inner height outright. */
		&::-webkit-meter-bar {
			block-size: calc(var(--t-space-2) - 2 * var(--t-border-width-interactive));
			border: 0;
			border-radius: inherit;
		}

		&::-webkit-meter-optimum-value,
		&::-webkit-meter-suboptimum-value,
		&::-webkit-meter-even-less-good-value {
			border-radius: inherit;
		}
	}

	.labeled-meter {
		display: grid;
		gap: var(--t-space-2);

		& label {
			font-size: var(--t-font-size-sm);
		}
	}
}

@layer design {
	meter {
		border-style: solid;
		border-color: var(--c-surface-border-color-interactive);
		background: none;

		&::-webkit-meter-bar {
			background: none;
		}

		&::-webkit-meter-optimum-value {
			background: var(--c-surface-text-color-success);
		}

		&::-webkit-meter-suboptimum-value {
			background: var(--c-surface-text-color-warning);
		}

		&::-webkit-meter-even-less-good-value {
			background: var(--c-surface-text-color-error);
		}

		&::-moz-meter-bar {
			background: var(--c-surface-text-color-success);
		}

		&:-moz-meter-sub-optimum::-moz-meter-bar {
			background: var(--c-surface-text-color-warning);
		}

		&:-moz-meter-sub-sub-optimum::-moz-meter-bar {
			background: var(--c-surface-text-color-error);
		}
	}

	.labeled-meter label {
		color: var(--c-surface-text-color-muted);
	}
}

/* Chips: a row of filter links. A chip has a visible edge, so it pads
   itself; the row sets only the space between chips. The current chip is an
   interactive surface, so its label and count take that surface's ink. */
@layer layout {
	nav.chip-row {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: var(--t-space-2);
	}

	a.chip {
		display: inline-flex;
		align-items: center;
		gap: var(--t-space-2);
		min-block-size: var(--t-target-min-size);
		padding-inline: var(--t-space-3);
		border-radius: var(--t-radius-pill);
		text-decoration: none;
		white-space: nowrap;
		font-size: var(--t-font-size-sm);
		font-weight: var(--t-font-weight-semibold);

		& .count {
			display: inline-flex;
			justify-content: center;
			min-inline-size: 1.5rem;
			padding-inline: var(--t-space-2);
			border-radius: var(--t-radius-pill);
			font-size: var(--t-font-size-xs);
			font-variant-numeric: tabular-nums;
		}
	}
}


/* Chat: a conversation of message bubbles. The reader's own message sits on
   the right in the interactive surface; everyone else's on the left in the
   recessed surface. See design-system/components/README.md. */
@layer layout {
	.chat {
		display: flex;
		flex-direction: column;
		gap: var(--t-space-3);
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.chat-message {
		display: flex;
		justify-content: flex-start;
	}

	.chat-message.from-me {
		justify-content: flex-end;
	}

	.bubble {
		display: grid;
		gap: var(--t-space-1);
		max-inline-size: min(85%, 32rem);
		padding: var(--t-space-2) var(--t-space-3);
		border-radius: var(--t-radius-lg);

		& :is(p, h1, h2, h3, h4, h5, h6) {
			margin: 0;
		}

		& .sender,
		& .meta {
			font-size: var(--t-font-size-xs);
		}

		& .sender {
			font-weight: var(--t-font-weight-semibold);
		}

		/* When it was sent sits at the trailing edge of the bubble. */
		& .meta {
			justify-self: start;
		}
	}

	.chat-message.from-me .bubble .meta {
		justify-self: end;
	}
}

@layer design {
	.bubble .sender,
	.bubble .meta {
		color: var(--c-surface-text-color-muted);
	}
}

/* Confirm: the step before a destructive action. What will happen, then the
   button row that does it or cancels. It owns only the space between them.
   See design-system/components/README.md. */
@layer layout {
	.confirm-form {
		display: grid;
		gap: var(--t-space-4);

		& :is(p, ul) {
			margin: 0;
		}
	}
}
