/*
 * Base styles for MagicHat.io.
 *
 * Document defaults (typography, color, sizing) plus the global
 * header, footer, and content shell. Component-specific styles will
 * land in components.css as components are built. The theme toggle
 * lives here because it ships with the layout shell.
 *
 * All colors are token references — see tokens.css.
 */

/* ---- Brand fonts ---------------------------------------------------- */

/* Self-hosted Lato (body) and Raleway (heading). Latin subset only;
 * unicode-range tells the browser not to download these for non-Latin
 * pages. font-display: swap renders fallback first, then swaps when
 * the woff2 arrives — accepted FOUT for instant first paint. */

@font-face {
	font-family: 'Raleway';
	font-style: normal;
	font-weight: 400 700;
	font-display: swap;
	src: url('/static/fonts/raleway-variable.woff2') format('woff2');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: 'Lato';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('/static/fonts/lato-400.woff2') format('woff2');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: 'Lato';
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url('/static/fonts/lato-700.woff2') format('woff2');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

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

html {
	background-color: var(--color-bg);
	color: var(--color-text-primary);
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	/* Block horizontal scroll caused by .page-bg-blob's
	   transform + filter:blur halo leaking past .page-bg's
	   overflow:hidden in Mobile Safari. Both html and body need
	   the rule — applying it only to body is a well-known
	   incomplete fix on iOS.
	   `overflow-x: clip` is the modern equivalent of `hidden`
	   that does NOT create a scroll container, so position:
	   sticky descendants (.impersonation-banner, .training-rail)
	   continue to work. Falls back to `hidden` on browsers that
	   don't support `clip` (pre-Safari 16). */
	overflow-x: hidden;
	overflow-x: clip;
}

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	/* Transparent so the .page-bg layer (z-index: -1, fixed) shows
	 * through. The fallback page background lives on <html> via
	 * --color-bg — pages without a HeroBackdrop still see a solid
	 * surface. */
	background-color: transparent;
	color: var(--color-text-primary);
	overflow-x: hidden;
	overflow-x: clip;
}

a {
	color: var(--color-accent);
	text-decoration: none;
}

a:hover {
	color: var(--color-accent-hover);
	text-decoration: underline;
}

code {
	font-family: var(--font-mono);
	font-size: 0.92em;
	background-color: var(--color-surface-alt);
	padding: 0.1em 0.35em;
	border-radius: var(--radius-sm);
	color: var(--color-text-primary);
}

h1, h2, h3, h4, h5, h6 {
	margin: 0 0 var(--space-3);
	color: var(--color-text-primary);
	font-family: var(--font-heading);
	font-weight: 700;
	line-height: 1.2;
}

p {
	margin: 0 0 var(--space-4);
}

p:last-child {
	margin-bottom: 0;
}

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

.site-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--space-3) var(--space-5);
	border-bottom: 1px solid var(--color-border);
	background-color: var(--color-surface);
}

.brand {
	font-weight: 600;
	font-size: var(--text-lg);
	color: var(--color-text-primary);
	text-decoration: none;
}

.brand:hover {
	text-decoration: none;
	color: var(--color-text-primary);
}

.brand-mark {
	color: var(--color-accent);
}

.brand-logo {
	display: block;
	height: 28px;
	width: auto;
}

/* On desktop, the standard header logo grows to read at the
 * larger viewing distance. Mobile stays compact. The landing
 * (`.brand-logo-lg`) has its own 48px size and isn't affected. */
@media (min-width: 768px) {
	.brand-logo:not(.brand-logo-lg) {
		height: 40px;
	}
}

/* Larger logo size used on landing surfaces. Adds the brand drop-
 * shadow for a subtle lift off the gradient backdrop. */
.brand-logo-lg {
	height: 48px;
	filter: var(--filter-logo-glow);
}

/* Show the matching logo for the active theme; hide the other.
 * Same pattern as the sun/moon theme-toggle icons. */
[data-theme="light"] .brand-logo-dark  { display: none; }
[data-theme="dark"]  .brand-logo-light { display: none; }

.site-nav {
	display: flex;
	align-items: center;
	gap: var(--space-3);
}

/* --- Header account menu (avatar dropdown) ----------------------- */
/* Collapses Profile/Security/Theme/Log out (+ agency switch) behind a
   single avatar affordance so the header is a tidy brand · bell ·
   avatar row. CSS-only open/close via <details>. */
.acct-menu { position: relative; }

.acct-menu-trigger {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	height: 36px;
	padding: 0 var(--space-2) 0 var(--space-3);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	color: var(--color-text-secondary);
	background: transparent;
	cursor: pointer;
	list-style: none;
}
.acct-menu-trigger::-webkit-details-marker { display: none; }
.acct-menu-trigger:hover {
	color: var(--color-text-primary);
	border-color: var(--color-text-muted);
}
.acct-menu[open] .acct-menu-trigger {
	color: var(--color-text-primary);
	border-color: var(--color-accent);
}
.acct-menu-caret { transition: transform 0.15s ease; }
.acct-menu[open] .acct-menu-caret { transform: rotate(180deg); }

.acct-menu-panel {
	position: absolute;
	right: 0;
	top: calc(100% + 6px);
	min-width: 13rem;
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: var(--space-2);
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-lg);
	z-index: 50;
}

.acct-menu-name {
	margin: 0;
	padding: var(--space-1) var(--space-3) var(--space-2);
	font-weight: 600;
	font-size: var(--text-sm);
	color: var(--color-text-primary);
}

.acct-menu-sep {
	height: 1px;
	background: var(--color-border);
	margin: var(--space-1) 0;
}

.acct-menu-item {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	width: 100%;
	padding: var(--space-2) var(--space-3);
	border: none;
	background: none;
	border-radius: var(--radius-sm);
	font: inherit;
	font-size: var(--text-sm);
	color: var(--color-text-primary);
	text-align: left;
	text-decoration: none;
	cursor: pointer;
}
.acct-menu-item:hover { background: var(--color-surface-alt); }
.acct-menu-item-danger { color: var(--color-danger); }

.acct-menu-ctx {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: var(--space-1) var(--space-3) var(--space-2);
	margin: 0;
}
.acct-menu-ctx-label {
	font-size: var(--text-sm);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--color-text-muted);
}
.acct-menu-ctx-select {
	width: 100%;
	padding: var(--space-1) var(--space-2);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	background: var(--color-surface);
	color: var(--color-text-primary);
	font: inherit;
	font-size: var(--text-sm);
}

/* Context switcher in the header. Reads as a status pill
   (Acting as: <agency>) until it's interacted with. */
.ctx-switcher {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	margin: 0;
}

.ctx-switcher-label {
	color: var(--color-text-muted);
	font-size: var(--text-xs);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.ctx-switcher-select {
	background-color: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	color: var(--color-text);
	padding: var(--space-1) var(--space-3);
	font-family: var(--font-body);
	font-size: var(--text-sm);
	cursor: pointer;
}

.ctx-switcher-select:hover {
	border-color: var(--color-text-muted);
}

.ctx-switcher-static {
	color: var(--color-text-muted);
	font-size: var(--text-sm);
	padding: var(--space-1) var(--space-3);
	border: 1px solid transparent;
}

/* ---- Impersonation banner ---- */

/* Sticky strip at the top of every authed page when the actor
   is currently impersonating another user. Bright + amber so
   it's impossible to forget you're acting as someone else. */
.impersonation-banner {
	position: sticky;
	top: 0;
	z-index: 1100;
	background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
	color: #fff;
	padding: var(--space-2) var(--space-5);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.impersonation-banner-inner {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	max-width: var(--max-content-width);
	margin: 0 auto;
	flex-wrap: wrap;
}

.impersonation-banner-eye {
	font-size: var(--text-lg);
}

.impersonation-banner-text {
	flex: 1;
	font-size: var(--text-sm);
	font-weight: 500;
}

.impersonation-banner-stop-form {
	margin: 0;
}

.impersonation-banner-stop-btn {
	background: rgba(255, 255, 255, 0.2);
	border: 1px solid rgba(255, 255, 255, 0.4);
	color: #fff;
	padding: var(--space-1) var(--space-4);
	border-radius: var(--radius-sm);
	font-size: var(--text-sm);
	font-weight: 600;
	cursor: pointer;
	font-family: var(--font-body);
	transition: background 0.15s, border-color 0.15s;
}

.impersonation-banner-stop-btn:hover {
	background: rgba(255, 255, 255, 0.3);
	border-color: rgba(255, 255, 255, 0.7);
}

/* ---- Confirm-action modal ---- */

.confirm-action-dialog {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-7);
	max-width: 28rem;
	background-color: var(--color-surface);
	color: var(--color-text);
}

.confirm-action-dialog::backdrop {
	background-color: rgba(0, 0, 0, 0.45);
}

.confirm-action-title {
	font-family: var(--font-heading);
	font-size: var(--text-lg);
	margin: 0 0 var(--space-3);
}

.confirm-action-message {
	font-size: var(--text-base);
	line-height: 1.5;
	margin: 0 0 var(--space-5);
}

.confirm-action-buttons {
	display: flex;
	gap: var(--space-3);
	justify-content: flex-end;
}

.confirm-action-cancel-form {
	margin: 0;
}

/* ---- Photo-capture widget (admin-join + profile) ---- */

.photo-capture-widget {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--space-3);
	margin: 0 0 var(--space-3);
	text-align: center;
}

/* The HTML `hidden` attribute should win over our explicit
   display: block on the preview/current elements. Without this,
   an empty <img class="photo-preview" hidden> still renders as
   a styled box and leaks its alt text. */
.photo-current[hidden],
.photo-preview[hidden],
.photo-placeholder[hidden] {
	display: none;
}

.photo-current,
.photo-preview {
	display: block;
	width: 9rem;
	height: 9rem;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid var(--color-border);
}

.photo-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 9rem;
	height: 9rem;
	border-radius: 50%;
	background-color: var(--color-surface-alt);
	border: 2px dashed var(--color-border);
	color: var(--color-text-muted);
	font-size: var(--text-xs);
}

/* Landscape framing — used for office staff / agency welcome
   photos (group shots where a circle crop chops people out).
   Overrides the default selfie circle. The 16:9 aspect ratio
   matches typical desktop webcam frames so no top-and-bottom
   black bars sneak in. */
.photo-capture-widget[data-frame="landscape"] .photo-current,
.photo-capture-widget[data-frame="landscape"] .photo-preview,
.photo-capture-widget[data-frame="landscape"] .photo-placeholder {
	width: 22rem;
	max-width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	border-radius: var(--radius-md);
}

/* Inline error message under the photo controls. Lives where
   the hidden `required` attribute used to live before we moved
   the gate into JS — visible, focused, addressable. */
.photo-error {
	margin: var(--space-2) 0 0;
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--color-danger, #b91c1c);
}

.photo-actions {
	display: flex;
	gap: var(--space-2);
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
}

/* The "Choose file" label wraps a native file input that we
   hide by giving it zero footprint. The label is styled like a
   button so it reads as one from the user's perspective. */
.photo-upload-label {
	cursor: pointer;
}

.photo-upload-label .photo-input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

/* On mobile, hide the file-picker fallback so the only path is
   the in-page camera dialog. The dialog feeds the same hidden
   <input type="file"> via DataTransfer, so form submission still
   works — but the user can't bypass the camera with a pre-
   existing gallery photo. Caregivers should land on a freshly-
   shot selfie, which is what the downstream AI cleanup expects.
   The `label.` prefix outranks the later `.btn` rule's
   display:inline-flex so we don't need !important. */
@media (max-width: 640px) {
	label.photo-upload-label { display: none; }
}

/* The camera live-view dialog. Reuses the qr-dialog* container
   styles (border, padding, backdrop) and adds the video sizing. */
.photo-camera-dialog {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-7);
	max-width: 28rem;
	background-color: var(--color-surface);
	color: var(--color-text);
}

.photo-camera-dialog::backdrop {
	background-color: rgba(0, 0, 0, 0.45);
}

.photo-camera-video {
	display: block;
	width: 100%;
	max-width: 24rem;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	background-color: #000;
	border-radius: var(--radius-sm);
	margin: var(--space-3) auto;
}

.photo-camera-actions {
	display: flex;
	gap: var(--space-3);
	justify-content: center;
}

/* ---- Profile photo widgets ---- */

.profile-photo-current {
	display: block;
	width: 8rem;
	height: 8rem;
	border-radius: 50%;
	object-fit: cover;
	margin: 0 0 var(--space-4);
	border: 2px solid var(--color-border);
}

.profile-photo-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 8rem;
	height: 8rem;
	border-radius: 50%;
	background-color: var(--color-surface-alt);
	border: 2px dashed var(--color-border);
	color: var(--color-text-muted);
	font-size: var(--text-xs);
	text-align: center;
	margin: 0 0 var(--space-4);
}

/* ---- QR-invite dialog ---- */

.qr-dialog {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-7);
	max-width: 24rem;
	background-color: var(--color-surface);
	color: var(--color-text);
}

.qr-dialog::backdrop {
	background-color: rgba(0, 0, 0, 0.45);
}

.qr-dialog-close-form {
	margin: 0;
	display: flex;
	justify-content: flex-end;
}

.qr-dialog-close {
	background: transparent;
	border: 0;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	color: var(--color-text-muted);
	padding: 0 var(--space-2);
}

.qr-dialog-title {
	font-family: var(--font-heading);
	font-size: var(--text-lg);
	margin: 0 0 var(--space-2);
}

.qr-dialog-hint {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
	margin: 0 0 var(--space-4);
	line-height: 1.5;
}

.qr-dialog-img {
	display: block;
	margin: 0 auto var(--space-4);
	width: 256px;
	height: 256px;
	max-width: 100%;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
}

.qr-dialog-url {
	margin: 0 0 var(--space-3);
	font-size: var(--text-sm);
	color: var(--color-text-muted);
}

.qr-dialog-url input {
	display: block;
	width: 100%;
	margin-top: var(--space-2);
	padding: var(--space-2);
	font-size: var(--text-xs);
	font-family: var(--font-mono, monospace);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	background-color: var(--color-surface-alt);
	color: var(--color-text);
}

/* ---- Inline upload popover (compliance grid) ---- */

/* <details> styled as a button. Click expands an inline form
   with the file picker + optional expires-at. Avoids needing a
   separate per-row modal. */
.upload-details {
	display: inline-block;
	position: relative;
}

.upload-details > summary {
	cursor: pointer;
	list-style: none;
}
.upload-details > summary::-webkit-details-marker {
	display: none;
}

.upload-popover {
	position: absolute;
	right: 0;
	top: calc(100% + var(--space-2));
	z-index: 10;
	min-width: 18rem;
	background-color: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-4);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	margin: 0;
}

/* ---- Document mandate matrix (admin/document-mandates) ---- */

.mandate-block {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-4);
	margin-bottom: var(--space-3);
	background-color: var(--color-surface);
}

.mandate-block-header {
	margin: 0 0 var(--space-3);
}

.mandate-block-title {
	font-family: var(--font-heading);
	font-size: var(--text-base);
	font-weight: 600;
	margin: 0;
}

.mandate-list {
	list-style: none;
	padding: 0;
	margin: 0 0 var(--space-3);
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
}

.mandate-chip {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	padding: var(--space-1) var(--space-3);
	background-color: var(--color-surface-alt);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-pill, 999px);
	font-size: var(--text-sm);
}

.mandate-chip form {
	display: inline-flex;
	margin: 0;
}

.mandate-chip-remove {
	background: transparent;
	border: 0;
	color: var(--color-text-muted);
	cursor: pointer;
	padding: 0;
	font-size: var(--text-base);
	line-height: 1;
}
.mandate-chip-remove:hover {
	color: var(--color-danger, #b91c1c);
}

/* Locked variant — shown on /agency/documents for mandated
   rows. No remove button; opacity hints "this isn't yours". */
.mandate-chip-locked {
	background-color: var(--color-surface);
	border-style: dashed;
	color: var(--color-text-muted);
}

/* Source badge — small pill inside a mandated chip showing
   "state" or "market". Compact so multiple fit on one chip. */
.mandate-source-badge {
	display: inline-block;
	font-size: var(--text-xs);
	padding: 0 var(--space-2);
	background-color: var(--color-accent-subtle, var(--color-surface-alt));
	color: var(--color-text-secondary, var(--color-text));
	border-radius: var(--radius-pill, 999px);
	margin-left: var(--space-2);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.mandate-add-form {
	display: flex;
	gap: var(--space-2);
	align-items: center;
	margin: 0;
}

.mandate-add-form .settings-input {
	flex: 0 1 auto;
	min-width: 14em;
}

/* ---- Course catalog browse: search + category filter ---- */

.agency-catalog-toolbar {
	display: flex;
	gap: var(--space-2);
	flex-wrap: wrap;
	margin-bottom: var(--space-4);
}

.agency-catalog-search {
	flex: 1 1 18em;
	min-width: 12em;
}

.agency-catalog-cat {
	flex: 0 1 auto;
	min-width: 12em;
}

/* The agency catalog now renders as category shelves of .course-card
   (components/course_shelf.templ); the filter's hide rules for cards and
   shelves live with the shelf styles (.course-card[hidden] /
   .training-shelf[hidden]). */

/* ---- Credentials report (print-friendly audit packet) ---- */

.cred-report {
	max-width: 56rem;
	margin: 0 auto;
}

.cred-report-print-controls {
	display: flex;
	gap: var(--space-3);
	justify-content: space-between;
	margin-bottom: var(--space-5);
}

.cred-cover {
	page-break-after: always;
	break-after: page;
}

.cred-cover-head {
	border-bottom: 2px solid var(--color-border);
	padding-bottom: var(--space-4);
	margin-bottom: var(--space-5);
}

.cred-cover-logo {
	display: block;
	max-height: 3.5rem;
	width: auto;
	max-width: 14rem;
	object-fit: contain;
	margin-bottom: var(--space-3);
}

.cred-cover-title {
	font-family: var(--font-heading);
	font-size: 2rem;
	margin: 0;
}

.cred-cover-meta {
	color: var(--color-text-muted);
	margin: var(--space-2) 0 0;
}

.cred-cover-subject {
	display: flex;
	gap: var(--space-6);
	align-items: center;
	margin-bottom: var(--space-6);
}

.cred-cover-photo {
	width: 8rem;
	height: 8rem;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid var(--color-border);
}

.cred-cover-photo-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--color-text-muted);
	background-color: var(--color-surface-alt);
	border-style: dashed;
	font-size: var(--text-sm);
}

.cred-cover-fields {
	flex: 1;
}

.cred-cover-name {
	font-family: var(--font-heading);
	font-size: var(--text-2xl);
	margin: 0 0 var(--space-3);
}

.cred-cover-dl {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: var(--space-1) var(--space-4);
	margin: 0;
}
.cred-cover-dl dt {
	color: var(--color-text-muted);
	font-size: var(--text-sm);
}
.cred-cover-dl dd {
	margin: 0;
}

.cred-cover-summary {
	margin-bottom: var(--space-6);
}

.cred-cover-section-title {
	font-family: var(--font-heading);
	font-size: var(--text-lg);
	margin: 0 0 var(--space-3);
}

.cred-cover-counts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
	gap: var(--space-3);
}

.cred-count {
	padding: var(--space-3);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	text-align: center;
	background-color: var(--color-surface);
}

.cred-count-value {
	display: block;
	font-family: var(--font-heading);
	font-size: var(--text-2xl);
	font-weight: 700;
}
.cred-count-label {
	display: block;
	font-size: var(--text-xs);
	color: var(--color-text-muted);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.cred-count-ok .cred-count-value     { color: var(--color-success, #15803d); }
.cred-count-warn .cred-count-value   { color: var(--color-warn, #b45309); }
.cred-count-danger .cred-count-value { color: var(--color-danger, #b91c1c); }

.cred-doc {
	page-break-after: always;
	break-after: page;
	padding: var(--space-5) 0;
}

.cred-doc-header {
	border-bottom: 1px solid var(--color-border);
	padding-bottom: var(--space-3);
	margin-bottom: var(--space-4);
}

.cred-doc-title {
	font-family: var(--font-heading);
	font-size: var(--text-xl);
	margin: 0;
}

.cred-doc-meta {
	margin: var(--space-2) 0 0;
	color: var(--color-text-muted);
}

.cred-doc-image {
	display: block;
	max-width: 100%;
	max-height: 80vh;
	margin: 0 auto;
	border: 1px solid var(--color-border);
}

.cred-doc-missing,
.cred-doc-pdf {
	padding: var(--space-6);
	text-align: center;
	color: var(--color-text-muted);
	background-color: var(--color-surface-alt);
	border-radius: var(--radius-md);
}

/* Print overrides — hide the brand chrome and print controls
   so Save-as-PDF produces a clean audit packet. */
@media print {
	.site-header,
	.site-footer,
	.no-print,
	.impersonation-banner {
		display: none !important;
	}
	body {
		background: #fff;
		color: #000;
	}
	.cred-report {
		max-width: none;
		margin: 0;
	}
	.cred-cover-photo {
		border-color: #000;
	}
}

/* ---- Candidate cards (agency dashboard) ---- */

.candidate-card-grid {
	display: grid;
	/* Cap individual card width so a lone card doesn't stretch
	 * across the whole "Needs your attention" panel — on a phone
	 * that read as "this box is too wide for what's in it." Clamp
	 * the min to 100% so very narrow viewports (<20rem) don't
	 * overflow. */
	grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 24rem));
	gap: var(--space-4);
	justify-content: start;
}

.candidate-card {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	padding: var(--space-4);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background-color: var(--color-surface);
}

.candidate-card-header {
	display: flex;
	gap: var(--space-3);
	align-items: center;
	margin: 0;
}

.candidate-card-titles {
	flex: 1;
	min-width: 0;
}

.candidate-card-name {
	font-family: var(--font-heading);
	font-size: var(--text-base);
	margin: 0;
}

.candidate-card-meta {
	font-size: var(--text-xs);
	color: var(--color-text-muted);
	margin: var(--space-1) 0 0;
}

/* Each "piece" stays nowrap so the date doesn't break mid-phrase
 * ("applied May | 18, 2026"); breaks happen at the · separators. */
.candidate-card-meta-piece {
	display: inline-block;
	white-space: nowrap;
}
.candidate-card-meta-sep {
	display: inline-block;
	margin: 0 0.3em;
	color: var(--color-text-muted);
}

/* Activity-feed "When" + "Actor" columns — short labels and
 * full names shouldn't wrap mid-word. Header gets nowrap too so
 * "When" / "Actor" never become "WHE / N" / "ACTO / R" on a
 * narrow viewport. The icon moves inline next to the summary so
 * the table is 3 columns on mobile instead of 4. */
.agency-activity-when,
.agency-activity-actor {
	white-space: nowrap;
}
.agency-activity-icon {
	display: inline-block;
	margin-right: 0.3em;
}

.candidate-card-stats {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--space-2);
}

.candidate-card-stat {
	padding: var(--space-2) var(--space-3);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	background-color: var(--color-surface-alt);
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
}

.candidate-card-stat-label {
	font-size: var(--text-xs);
	color: var(--color-text-muted);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.candidate-card-stat-value {
	font-family: var(--font-heading);
	font-size: var(--text-base);
	font-weight: 600;
}

.candidate-card-stat-ok .candidate-card-stat-value {
	color: var(--color-success, #15803d);
}
.candidate-card-stat-warn .candidate-card-stat-value {
	color: var(--color-warn, #b45309);
}

.candidate-card-footer {
	display: flex;
	gap: var(--space-2);
	flex-wrap: wrap;
	align-items: center;
}

.candidate-card-footer form {
	margin: 0;
}

/* ---- Activity feed (agency dashboard) ---- */

.activity-table .activity-when {
	white-space: nowrap;
	color: var(--color-text-muted);
	font-size: var(--text-sm);
	font-family: var(--font-mono, monospace);
}

.activity-table .activity-icon {
	width: 1.5rem;
	font-size: var(--text-base);
	text-align: center;
}

.activity-table .activity-actor {
	color: var(--color-text-muted);
	font-size: var(--text-sm);
	white-space: nowrap;
}

/* ---- Roster avatars (caregivers + candidates on /agency) ---- */

.roster-avatar {
	display: block;
	width: 2rem;
	height: 2rem;
	border-radius: 50%;
	object-fit: cover;
	border: 1px solid var(--color-border);
}

.roster-avatar-placeholder {
	display: inline-block;
	width: 2rem;
	height: 2rem;
	border-radius: 50%;
	background-color: var(--color-surface-alt);
	border: 1px dashed var(--color-border);
}

/* Section count chip — small numeric badge after section titles
   (Caregivers · 3, Candidates · 1, etc.). */
.admin-section-count {
	display: inline-block;
	font-size: var(--text-xs);
	color: var(--color-text-muted);
	background-color: var(--color-surface-alt);
	padding: 0 var(--space-2);
	border-radius: var(--radius-pill, 999px);
	font-weight: 500;
	vertical-align: middle;
}

/* ---- Pending-invite rows on /admin/agencies/{id} ---- */

/* Each invite is two rows: the summary (phone/rank/etc + actions)
   and a sub-row holding the magic-link copy widget. The sub-row's
   top border is hidden so the pair reads as one logical entry. */
.invite-summary-row td {
	border-bottom: none;
}

.invite-link-row td {
	background-color: var(--color-surface-alt);
	padding-top: var(--space-2);
	padding-bottom: var(--space-3);
}

.invite-link-cell {
	display: flex;
	gap: var(--space-3);
	align-items: center;
	flex-wrap: wrap;
}

.invite-link-label {
	color: var(--color-text-muted);
	font-size: var(--text-xs);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.invite-link-field {
	flex: 1 1 22em;
	min-width: 18em;
	font-family: var(--font-mono, monospace);
	font-size: var(--text-sm);
}

/* ---- Error page (403 / 404 / 500 / etc.) ---- */

.error-page {
	max-width: 32rem;
	margin: var(--space-8) auto;
	padding: var(--space-7);
	text-align: center;
	background-color: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
}

.error-page-code {
	font-family: var(--font-heading);
	font-size: 4rem;
	font-weight: 700;
	color: var(--color-accent);
	line-height: 1;
	margin: 0 0 var(--space-2);
	letter-spacing: -0.02em;
}

.error-page-title {
	font-family: var(--font-heading);
	font-size: var(--text-2xl);
	margin: 0 0 var(--space-4);
	color: var(--color-text-primary);
}

.error-page-message {
	font-size: var(--text-base);
	color: var(--color-text);
	margin: 0 0 var(--space-3);
	line-height: 1.5;
}

.error-page-hint {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
	margin: 0 0 var(--space-5);
	line-height: 1.5;
}

.error-page-actions {
	display: flex;
	gap: var(--space-3);
	justify-content: center;
	flex-wrap: wrap;
	margin-top: var(--space-6);
}

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

.site-footer {
	border-top: 1px solid var(--color-border);
	padding: var(--space-4) var(--space-5);
	color: var(--color-text-muted);
	text-align: center;
	background-color: var(--color-surface);
}
.site-footer-nav {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: var(--space-3);
	font-size: 0.9rem;
	margin-bottom: var(--space-2);
}
.site-footer-nav a {
	color: var(--color-text-muted);
	text-decoration: none;
}
.site-footer-nav a:hover,
.site-footer-nav a:focus-visible {
	color: var(--color-accent);
	text-decoration: underline;
}
.site-footer-sep {
	color: var(--color-border-strong);
}
.site-footer-mark {
	display: block;
	font-size: 0.85rem;
}
.site-footer-address {
	display: block;
	font-style: normal;
	font-size: 0.85rem;
	margin-bottom: var(--space-2);
	color: var(--color-text-muted);
}

/* /contact mailing-address block — keep <address> readable and tight. */
.contact-address {
	font-style: normal;
	line-height: 1.55;
	padding: var(--space-3) var(--space-4);
	border-left: 3px solid var(--color-border-strong);
	background: var(--color-bg-subtle);
	border-radius: var(--radius-md);
	margin: 0 0 var(--space-3) 0;
}
.legal-aside {
	color: var(--color-text-muted);
	font-size: 0.92em;
	margin-top: 0;
}

/* ---- About page (/about) -------------------------------------------
 *
 * Hero band at the top with a portrait photo beside the headline.
 * Alternating image+text rows (.about-row + .about-row-reverse) form
 * the narrative. A full-width tinted highlight band breaks the
 * rhythm for the "Agencies are foundational" line. Mobile collapses
 * each row to a single column with the image on top.
 */
.about-page {
	color: var(--color-text-primary);
}
.about-hero {
	background: linear-gradient(180deg, var(--color-surface-tint), var(--color-surface));
	border-bottom: 1px solid var(--color-border);
	padding: var(--space-7) var(--space-5);
}
.about-hero-inner {
	max-width: 64rem;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--space-5);
}
.about-hero-text {
	max-width: 32rem;
	text-align: center;
}
.about-hero h1 {
	margin: 0 0 var(--space-3) 0;
	font-size: 2.25rem;
	font-weight: 700;
}
.about-lede {
	margin: 0;
	font-size: 1.15rem;
	line-height: 1.55;
	color: var(--color-text-secondary);
}
.about-hero-img {
	max-width: 100%;
	width: 28rem;
	height: auto;
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-md);
}
.about-row {
	max-width: 64rem;
	margin: var(--space-7) auto;
	padding: 0 var(--space-5);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--space-5);
}
.about-row-img {
	max-width: 100%;
	width: 22rem;
	height: auto;
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-sm);
	flex-shrink: 0;
}
.about-row-text {
	max-width: 32rem;
	line-height: 1.7;
}
.about-row-text h2 {
	margin: 0 0 var(--space-3) 0;
	font-size: 1.4rem;
	font-weight: 700;
}
.about-row-text p {
	margin: 0;
	font-size: 1.05rem;
}
.about-highlight {
	background: var(--color-surface-alt);
	border-top: 1px solid var(--color-border);
	border-bottom: 1px solid var(--color-border);
	padding: var(--space-6) var(--space-5);
	text-align: center;
	margin: var(--space-6) 0;
}
.about-highlight h2 {
	margin: 0 0 var(--space-2) 0;
	font-size: 1.5rem;
	font-weight: 700;
}
.about-highlight-tagline {
	margin: 0;
	font-size: 1.1rem;
	color: var(--color-text-secondary);
}
.about-contact {
	max-width: 44rem;
	margin: var(--space-7) auto;
	padding: var(--space-5);
	border-top: 1px solid var(--color-border);
	text-align: center;
	line-height: 1.7;
}
.about-contact h2 {
	margin: 0 0 var(--space-3) 0;
	font-size: 1.4rem;
	font-weight: 700;
}
.about-contact p {
	margin: 0;
	font-size: 1.05rem;
}

/* Two-column layout on wider viewports. Image-text on the left for
 * default rows, swapped on .about-row-reverse. The hero also moves
 * to side-by-side. */
@media (min-width: 48rem) {
	.about-hero-inner {
		flex-direction: row;
		justify-content: space-between;
		gap: var(--space-7);
	}
	.about-hero-text {
		text-align: left;
		flex: 1;
	}
	.about-row {
		flex-direction: row;
		justify-content: space-between;
		gap: var(--space-7);
	}
	.about-row-reverse {
		flex-direction: row-reverse;
	}
}

/* ---- Landing nav (used by ShellBare pages) -------------------------- */

.home-nav {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	/* Tight to the corners — the landing's hero is the visual
	   centerpiece; the brand + auth links shouldn't be inset
	   from the edges by a quarter inch. */
	padding: var(--space-3) var(--space-4);
}

/* The Sign-in / Log out + theme-toggle pair on the landing page
   reads better when they look like a unified action group, not
   "plain link next to a bordered icon button." Give Sign in the
   same chip treatment as the theme toggle so they balance. */
.home-nav-actions .nav-link {
	display: inline-flex;
	align-items: center;
	height: 36px;
	padding: 0 var(--space-3);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	color: var(--color-text-secondary);
	font-family: var(--font-heading);
	font-size: var(--text-sm);
	font-weight: 500;
	transition: color 120ms, border-color 120ms, background-color 120ms;
}
.home-nav-actions .nav-link:hover {
	color: var(--color-accent);
	border-color: var(--color-border-strong);
	background-color: var(--color-surface-alt);
}

@media (max-width: 640px) {
	.home-nav {
		padding: var(--space-2) var(--space-3);
	}
	/* Slightly smaller logo on the landing so it doesn't crowd
	   the action group on a phone-width hero. */
	.home-nav .brand-logo-lg {
		height: 36px;
	}
	/* Tighter spacing on phones — gap:var(--space-3) (12px) plus
	   five action icons plus the brand was 27px over a 360px
	   viewport on signed-in narrow phones (Samsung S23 etc.) and
	   the trailing theme toggle clipped past the right edge. */
	.home-nav-actions {
		gap: var(--space-2);
		flex-wrap: wrap;
		justify-content: flex-end;
	}
}

/* Even narrower phones (Galaxy S8 / S23 / iPhone SE — 360-375px):
   shrink the brand a touch more and tighten icon gaps so a
   signed-in user's full action row (Alerts/Profile/Security/
   Logout/Theme) stays on one line without horizontal scroll. */
@media (max-width: 420px) {
	.home-nav .brand-logo-lg {
		height: 32px;
	}
	.home-nav-actions {
		gap: 4px;
	}
	.home-nav .header-btn {
		min-width: 32px;
		padding: 0 4px;
	}
}

.home-brand {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	transition: transform 250ms ease;
}

.home-brand:hover {
	transform: scale(1.02);
	text-decoration: none;
}

.home-nav-actions {
	display: flex;
	align-items: center;
	gap: var(--space-3);
}

/* ---- Landing hero --------------------------------------------------- */

.hero {
	max-width: 48rem;
	margin: 0 auto;
	padding: var(--space-10) 0 var(--space-8);
}

/* When .hero is a top-level child of a ShellBare body (no .page
 * wrapper), it provides its own horizontal padding and grows to
 * fill the remaining viewport so the content vertically centers. */
body.bare > .hero {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
	width: 100%;
	padding-left: var(--space-5);
	padding-right: var(--space-5);
	position: relative;
	z-index: 1;
}

.eyebrow {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	margin: 0 0 var(--space-4);
	padding: 0;
	font-family: var(--font-heading);
	font-size: var(--text-sm);
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--color-text-secondary);
}

.eyebrow-dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	background-color: var(--color-accent);
	border-radius: 50%;
}

.hero-headline {
	font-size: clamp(2.5rem, 6vw, 4.5rem);
	font-weight: 700;
	line-height: 1.05;
	letter-spacing: -0.02em;
	color: var(--color-text-primary);
	margin: 0 0 var(--space-5);
}

.hero-headline-accent {
	color: var(--color-accent);
}

.hero-subhead {
	font-size: var(--text-xl);
	line-height: 1.5;
	color: var(--color-text-secondary);
	max-width: 40rem;
	margin: 0 0 var(--space-6);
}

.hero-actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-3);
	margin-bottom: var(--space-5);
}

.hero-aside {
	font-size: var(--text-base);
	color: var(--color-text-muted);
	margin: 0;
}

.hero-aside a {
	font-weight: 500;
}

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

.btn {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	padding: 0.875rem 1.5rem;
	border-radius: var(--radius-md);
	border: 1px solid transparent;
	font-family: var(--font-heading);
	font-size: var(--text-base);
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 120ms, border-color 120ms, color 120ms, box-shadow 120ms, transform 120ms;
}

.btn:hover {
	text-decoration: none;
}

.btn-primary {
	background: var(--gradient-primary);
	color: var(--color-accent-fg);
	border-color: transparent;
	box-shadow: var(--shadow-accent-sm);
}

.btn-primary:hover {
	color: var(--color-accent-fg);
	box-shadow: var(--shadow-accent-md);
	transform: translateY(-1px);
}

.btn-primary svg {
	transition: transform 120ms;
}

.btn-primary:hover svg {
	transform: translateX(2px);
}

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

.theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	background: transparent;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	color: var(--color-text-secondary);
	cursor: pointer;
	transition: color 120ms, border-color 120ms, background-color 120ms;
}

.theme-toggle:hover {
	color: var(--color-accent);
	border-color: var(--color-border-strong);
	background-color: var(--color-surface-alt);
}

.theme-toggle .icon {
	display: block;
}

/* The toggle previews the *destination* mode — moon when in light
 * (click to go dark), sun when in dark (click to go light). */
[data-theme="light"] .theme-toggle .icon-sun  { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"]  .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"]  .theme-toggle .icon-moon { display: none; }

/* ---- Generic nav link (used inside .home-nav and similar) ---------- */

.nav-link {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	font-family: var(--font-heading);
	font-size: var(--text-sm);
	font-weight: 500;
	color: var(--color-text-secondary);
	text-decoration: none;
	transition: color 120ms;
}

.nav-link:hover {
	color: var(--color-text-primary);
	text-decoration: none;
}

/* ---- Auth pages (sign-in, code entry) ------------------------------ */

.auth-page {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	padding: var(--space-6) var(--space-5) var(--space-8);
	gap: var(--space-5);
	width: 100%;
	position: relative;
	z-index: 1;
}

.auth-card {
	width: 100%;
	max-width: 28rem;
	background-color: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	padding: var(--space-8);
	box-shadow: var(--shadow-lg);
	text-align: center;
}

.auth-icon {
	width: 64px;
	height: 64px;
	margin: 0 auto var(--space-5);
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--gradient-primary);
	border-radius: var(--radius-lg);
	color: var(--color-accent-fg);
	box-shadow: var(--shadow-accent-sm);
}

.auth-title {
	font-family: var(--font-heading);
	font-size: var(--text-2xl);
	font-weight: 700;
	margin: 0 0 var(--space-2);
}

.auth-subtitle {
	color: var(--color-text-secondary);
	margin: 0 0 var(--space-5);
}

.auth-form {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
	text-align: left;
}

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

.auth-field-label {
	font-family: var(--font-heading);
	font-weight: 600;
	font-size: var(--text-sm);
	color: var(--color-text-primary);
}

.auth-phone-wrapper {
	position: relative;
}

.auth-phone-prefix {
	position: absolute;
	left: var(--space-4);
	top: 50%;
	transform: translateY(-50%);
	font-weight: 600;
	color: var(--color-text-muted);
	pointer-events: none;
}

.auth-input {
	width: 100%;
	padding: 0.875rem 1rem 0.875rem 2.75rem;
	font-family: var(--font-body);
	font-size: var(--text-base);
	color: var(--color-text-primary);
	background-color: var(--color-surface-alt);
	border: 2px solid var(--color-border);
	border-radius: var(--radius-md);
	transition: border-color 120ms, box-shadow 120ms;
}

.auth-input:focus {
	outline: none;
	border-color: var(--color-accent);
	box-shadow: var(--ring-accent);
}

.auth-input:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

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

.auth-submit {
	width: 100%;
	justify-content: center;
}

.auth-submit:disabled {
	opacity: 0.55;
	cursor: not-allowed;
	transform: none;
}

/* ---- Dev quick-login box ------------------------------------------- */

.dev-login-box {
	width: 100%;
	max-width: 28rem;
	padding: var(--space-4);
	background-color: var(--color-warning-bg);
	border: 1px solid var(--color-warning-border);
	border-radius: var(--radius-md);
}

.dev-login-title {
	font-family: var(--font-heading);
	font-size: var(--text-sm);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--color-warning-fg);
	margin: 0 0 var(--space-3);
}

.dev-login-list {
	display: grid;
	gap: var(--space-2);
}

.dev-login-btn {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	padding: 0.625rem 0.875rem;
	background-color: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	color: var(--color-text-primary);
	font-family: var(--font-body);
	font-size: var(--text-sm);
	text-align: left;
	cursor: pointer;
	transition: background-color 120ms, border-color 120ms, transform 120ms;
}

.dev-login-btn:hover {
	background-color: var(--color-surface-alt);
	border-color: var(--color-accent);
}

.dev-login-btn:active {
	transform: translateY(1px);
}

.dev-login-btn:disabled,
.dev-login-btn.is-loading {
	opacity: 0.55;
	cursor: progress;
}

.dev-login-btn-name {
	font-weight: 600;
}

.dev-login-btn-phone {
	color: var(--color-text-muted);
	font-size: var(--text-sm);
	font-family: var(--font-mono);
}

.dev-login-error {
	margin: var(--space-3) 0 0;
	color: var(--color-danger);
	font-size: var(--text-sm);
}

.dev-login-error[hidden] {
	display: none;
}

/* ---- Platform admin landing ---------------------------------------- */

.admin-bar {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--space-4);
	padding-bottom: var(--space-5);
	margin-bottom: var(--space-6);
	border-bottom: 1px solid var(--color-border);
}

.admin-bar-titles { flex: 1; }

.admin-title {
	font-family: var(--font-heading);
	font-size: var(--text-2xl);
	font-weight: 700;
	margin: 0;
}

/* ---- Site-header logout (sits next to theme toggle) ----
 *
 * Visual weight matches .theme-toggle so the two read as
 * "header utilities." 36px height aligns the buttons. */

.site-logout {
	margin: 0;
	display: inline-flex;
}

.header-btn {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	height: 36px;
	padding: 0 var(--space-3);
	background: transparent;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	color: var(--color-text-secondary);
	font-family: var(--font-heading);
	font-size: var(--text-sm);
	font-weight: 500;
	line-height: 1;
	cursor: pointer;
	transition: color 120ms, border-color 120ms, background-color 120ms;
}

.header-btn:hover {
	color: var(--color-accent);
	border-color: var(--color-border-strong);
	background-color: var(--color-surface-alt);
}

/* Notification bell in the site header. Same chip-shape as the
   other header buttons; the badge sits in the top-right corner
   of the bell glyph when there are unread alerts. */
.header-bell {
	position: relative;
}
.header-bell-badge {
	position: absolute;
	top: -6px;
	right: -4px;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	border-radius: 8px;
	background: var(--color-danger, #d65151);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 16px;
	text-align: center;
	box-shadow: 0 0 0 2px var(--color-surface, #fff);
	font-family: var(--font-body);
}
.header-bell-has-unread svg {
	color: var(--color-accent, #7a3da0);
}

/* ====================================================================
   Notifications inbox at /notifications. List view, newest first;
   row click → action URL; "Mark read" form per unread row + a
   "Mark all read" bulk action in the header.
   ==================================================================== */

.notifications-wrap {
	max-width: 760px;
	margin: 0 auto;
	padding: var(--space-5) var(--space-4);
}

.notifications-mark-all-form {
	margin: 0;
}

.notifications-empty {
	text-align: center;
	padding: var(--space-7) var(--space-4);
	color: var(--color-text-muted);
}
.notifications-empty-emoji {
	font-size: 2.4rem;
	margin: 0 0 var(--space-3);
}

.notifications-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.notifications-row {
	display: grid;
	grid-template-columns: auto 1fr auto;
	gap: var(--space-3);
	align-items: start;
	padding: var(--space-4);
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	margin-bottom: var(--space-3);
}
.notifications-row-unread {
	border-left: 4px solid var(--color-accent, #7a3da0);
}
.notifications-row-critical {
	border-left-color: var(--color-danger, #d65151);
	background: rgba(214, 81, 81, 0.04);
}

.notifications-row-icon {
	font-size: 1.4rem;
	line-height: 1.2;
	width: 1.8rem;
	text-align: center;
}

.notifications-row-body {
	min-width: 0;
}

.notifications-row-title {
	font-weight: 600;
	color: var(--color-text-primary);
	margin: 0 0 var(--space-1);
	display: flex;
	align-items: center;
	gap: var(--space-2);
	flex-wrap: wrap;
}

.notifications-row-message {
	color: var(--color-text);
	margin: 0 0 var(--space-1);
	line-height: 1.4;
}

.notifications-row-meta {
	color: var(--color-text-muted);
	font-size: var(--text-xs);
	margin: 0;
}

.notifications-row-source {
	font-family: var(--font-mono, monospace);
}

.notifications-row-link {
	color: var(--color-accent, #7a3da0);
	font-weight: 600;
}

.notifications-row-read-form {
	margin: 0;
}

@media (max-width: 640px) {
	.notifications-row {
		grid-template-columns: auto 1fr;
		grid-template-areas:
			"icon body"
			".    cta";
		gap: var(--space-2);
		padding: var(--space-3);
	}
	.notifications-row-icon { grid-area: icon; }
	.notifications-row-body { grid-area: body; }
	.notifications-row-read-form { grid-area: cta; justify-self: end; }
}

.btn-text {
	background: transparent;
	border: 1px solid transparent;
	color: var(--color-text-secondary);
	font-family: var(--font-heading);
	font-size: var(--text-sm);
	font-weight: 500;
	padding: 0.5rem 0.875rem;
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: color 120ms, border-color 120ms, background-color 120ms;
}

.btn-text:hover {
	color: var(--color-text-primary);
	border-color: var(--color-border);
	background-color: var(--color-surface-alt);
}

/* ---- Admin sections + grid ---- */

.admin-section {
	margin-bottom: var(--space-8);
}

.admin-section-header {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	margin-bottom: var(--space-4);
}

.admin-section-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	font-size: 1.25rem;
	line-height: 1;
}

.admin-section-title {
	font-family: var(--font-heading);
	font-size: var(--text-xl);
	font-weight: 700;
	margin: 0;
}

.admin-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
	gap: var(--space-4);
}

/* ---- Admin cards ---- */

.admin-card {
	display: flex;
	flex-direction: column;
	background-color: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-5);
	color: var(--color-text-primary);
	text-decoration: none;
	box-shadow: var(--shadow-sm);
	transition: border-color 120ms, transform 120ms, box-shadow 120ms;
}

/* Only the link variant lifts on hover — placeholder cards have
 * no destination, so the affordance would mislead. */
.admin-card-link:hover {
	border-color: var(--color-accent);
	transform: translateY(-1px);
	box-shadow: var(--shadow-md);
	text-decoration: none;
	color: var(--color-text-primary);
}

.admin-card-head {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	margin-bottom: var(--space-3);
}

.admin-card-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	font-size: 1.125rem;
	line-height: 1;
	flex-shrink: 0;
}

.admin-card-title {
	font-family: var(--font-heading);
	font-size: var(--text-lg);
	font-weight: 700;
	margin: 0;
}

.admin-card-desc {
	color: var(--color-text-secondary);
	font-size: var(--text-sm);
	line-height: 1.5;
	margin: 0 0 var(--space-3);
	flex: 1;
}

.admin-card-status {
	color: var(--color-text-muted);
	font-size: var(--text-sm);
	font-style: italic;
	margin: 0;
}

/* ---- Admin sub-page intro line ---- */

.admin-intro {
	color: var(--color-text-secondary);
	margin: 0 0 var(--space-6);
	font-size: var(--text-base);
}

/* ---- Eyebrow link (for breadcrumbs in admin sub-pages) ---- */

.eyebrow-link {
	color: var(--color-text-secondary);
	text-decoration: none;
}
.eyebrow-link:hover {
	color: var(--color-accent);
	text-decoration: underline;
}

/* ---- Status pill ---- */

.status-pill {
	display: inline-block;
	padding: 0.15rem 0.6rem;
	font-size: var(--text-sm);
	font-weight: 600;
	font-family: var(--font-heading);
	border-radius: 999px;
	letter-spacing: 0.02em;
	/* Keep pill text on a single line — otherwise narrow contexts
	   (a cramped table cell on mobile) wrap the label and the
	   999px radius rounds the result into a blob. The pill may
	   overflow a tight cell horizontally; that's still better
	   than the blob shape. */
	white-space: nowrap;
}

/* Status pills can also appear as <button> submit triggers (the
   agency-onboarding wizard's clickable step rail). Reset the
   user-agent button defaults and restore the pill's typography
   so the button reads visually identical to the span variant. */
button.status-pill {
	border: 0;
	cursor: pointer;
	font-family: var(--font-heading);
	font-size: var(--text-sm);
	font-weight: 600;
	letter-spacing: 0.02em;
	transition: filter 120ms ease, transform 120ms ease;
}
button.status-pill:hover {
	filter: brightness(0.92);
	transform: translateY(-1px);
}
button.status-pill:active {
	transform: translateY(0);
}

.status-pill-active {
	background-color: rgba(47, 204, 113, 0.15);
	color: var(--color-success);
}

.status-pill-inactive {
	background-color: var(--color-surface-alt);
	color: var(--color-text-muted);
}

.status-pill-draft {
	background-color: rgba(255, 191, 64, 0.15);
	color: var(--color-warning-fg);
}

.status-pill-danger {
	background-color: rgba(179, 38, 30, 0.12);
	color: var(--color-danger);
}

/* ---- Logs table cell specifics ---- */

.logs-path {
	max-width: 32rem;
	display: inline-block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	vertical-align: middle;
}

.logs-dur {
	font-variant-numeric: tabular-nums;
	text-align: right;
}

.logs-rid {
	font-size: 0.85em;
	color: var(--color-text-muted);
}

.logs-message {
	max-width: 28rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.logs-meta-json {
	background: var(--color-surface-alt, #f6f6f6);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	padding: var(--space-3);
	font-family: var(--font-mono, monospace);
	font-size: 0.85em;
	line-height: 1.4;
	white-space: pre;
	overflow-x: auto;
	max-height: 32rem;
}

/* Category pills on /admin/logs. Each known category gets a
   tinted background so the eye can scan the column quickly.
   Unknown categories fall back to a neutral grey. */
.pill-category {
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	padding: 2px 8px;
	border-radius: 100px;
	border: 1px solid transparent;
	display: inline-block;
	white-space: nowrap;
}
.pill-category-http_request {
	background: rgba(72, 130, 192, 0.12);
	color: #2c5f87;
	border-color: rgba(72, 130, 192, 0.3);
}
.pill-category-sms_send {
	background: rgba(102, 204, 153, 0.14);
	color: #1b5e20;
	border-color: rgba(102, 204, 153, 0.4);
}
.pill-category-notification_fire {
	background: rgba(122, 61, 160, 0.12);
	color: #5a2a7c;
	border-color: rgba(122, 61, 160, 0.3);
}
.pill-category-audit {
	background: rgba(214, 162, 81, 0.14);
	color: #7a4a14;
	border-color: rgba(214, 162, 81, 0.4);
}
.pill-category-wellsky_run {
	background: rgba(0, 199, 255, 0.14);
	color: #035e7c;
	border-color: rgba(0, 199, 255, 0.3);
}
.pill-category-wellsky_cleanup {
	background: rgba(255, 159, 64, 0.16);
	color: #8a4500;
	border-color: rgba(255, 159, 64, 0.4);
}
[data-theme="dark"] .pill-category-wellsky_cleanup { color: #f0bf85; }
.pill-category-river_job {
	background: rgba(180, 130, 60, 0.12);
	color: #6f4214;
	border-color: rgba(180, 130, 60, 0.3);
}
.pill-category-error {
	background: rgba(214, 81, 81, 0.14);
	color: #8b1f1f;
	border-color: rgba(214, 81, 81, 0.4);
}
.pill-category-default {
	background: var(--color-surface-alt, #ececec);
	color: var(--color-text-muted);
	border-color: var(--color-border);
}

[data-theme="dark"] .pill-category-http_request { color: #8fb9da; }
[data-theme="dark"] .pill-category-sms_send { color: #8edcaa; }
[data-theme="dark"] .pill-category-notification_fire { color: #c597dc; }
[data-theme="dark"] .pill-category-audit { color: #e6c180; }
[data-theme="dark"] .pill-category-wellsky_run { color: #66d8f5; }
[data-theme="dark"] .pill-category-river_job { color: #cfa56e; }
[data-theme="dark"] .pill-category-error { color: #e89696; }

/* ---- Section header right-side action (e.g., "+ New announcement") ---- */

.admin-section-header {
	position: relative;
}

.admin-section-action {
	margin-left: auto;
}

/* ---- Settings row link (clickable title) ---- */

.settings-row-link {
	color: var(--color-text-primary);
	text-decoration: none;
	font-weight: 500;
}
.settings-row-link:hover {
	color: var(--color-accent);
	text-decoration: underline;
}

/* ---- Field hint text ---- */

.settings-field-hint {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
}

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

.announcement-form {
	display: flex;
	flex-direction: column;
	gap: var(--space-5);
	max-width: 56rem;
}

.announcement-body {
	font-family: var(--font-mono);
	font-size: var(--text-sm);
	line-height: 1.55;
	resize: vertical;
	min-height: 16rem;
}

.announcement-form-actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-3);
	align-items: center;
}

.announcement-archive {
	margin-left: auto;
}

/* ---- Announcement preview card ----
 *
 * Modal-style card: gradient header band, body, branded footer.
 * Designed to read as a real product communication — the same
 * markup will render inside the user-facing modal when that
 * surface lands.
 *
 * Visual references the Python's announcement_modal.html: 32.5rem
 * (520px) max width, modal-elevation shadow, slide-in animation,
 * and the 4px gradient highlight strip between header and body.
 */

.announcement-card {
	max-width: 32.5rem; /* 520px — matches the Python modal */
	margin: 0 auto var(--space-6);
	background-color: var(--color-surface);
	border-radius: 1rem;
	box-shadow:
		0 25px 50px -12px rgba(20, 0, 50, 0.20),
		0 8px 20px -4px rgba(20, 0, 50, 0.08);
	overflow: hidden;
	animation: announcementSlideIn 0.4s ease-out;
}

@keyframes announcementSlideIn {
	from {
		opacity: 0;
		transform: scale(0.96) translateY(-12px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.announcement-card { animation: none; }
}

/* ---- Header band (gradient + decorative highlight + bottom strip) ---- */

.announcement-card-header {
	position: relative;
	overflow: hidden;
	padding: var(--space-6) var(--space-7) var(--space-7);
	background: var(--gradient-primary);
	color: #ffffff;
}

/* The 4px highlight strip at the very bottom of the header — same
 * detail Python had, sells the "this is a polished surface" feel
 * without screaming. */
.announcement-card-header::before {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 4px;
	background: linear-gradient(
		90deg,
		rgba(255, 255, 255, 0.45) 0%,
		rgba(255, 255, 255, 0.1) 100%
	);
}

/* Soft radial highlight in the upper-right gives the gradient
 * depth without competing with the headline. */
.announcement-card-header::after {
	content: '';
	position: absolute;
	top: -40%;
	right: -15%;
	width: 70%;
	height: 180%;
	background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.20) 0%, transparent 60%);
	pointer-events: none;
}

.announcement-card-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	margin: 0 0 var(--space-3);
	font-family: var(--font-heading);
	font-size: var(--text-sm);
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.92);
	position: relative; /* above the ::after radial */
	z-index: 1;
}

.announcement-card-eyebrow-dot {
	display: inline-block;
	width: 7px;
	height: 7px;
	background-color: #ffffff;
	border-radius: 50%;
	box-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
}

.announcement-card-title {
	font-family: var(--font-heading);
	font-size: clamp(1.625rem, 3vw, 2rem);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.015em;
	color: #ffffff;
	margin: 0;
	position: relative;
	z-index: 1;
	text-shadow: 0 2px 4px rgba(20, 0, 50, 0.15);
}

/* ---- Body ---- */

.announcement-card-body {
	padding: var(--space-7);
	color: var(--color-text-primary);
	font-size: 1.0625rem;
	line-height: 1.7;
}

/* `.prose` styles already handle paragraph spacing, lists, links,
 * etc. Drop the first child's top margin so body reads tight
 * against the header. */
.announcement-card-body.prose > :first-child { margin-top: 0; }
.announcement-card-body.prose > :last-child  { margin-bottom: 0; }

/* Tighter list styling inside the card — the default .prose
 * margins are tuned for full-page docs, not modal cards. */
.announcement-card-body.prose ul,
.announcement-card-body.prose ol {
	margin-bottom: var(--space-3);
}
.announcement-card-body.prose li { margin-bottom: var(--space-1); }

/* ---- Footer ---- */

.announcement-card-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	padding: var(--space-4) var(--space-7);
	background-color: var(--color-surface-alt);
	border-top: 1px solid var(--color-border);
	font-size: var(--text-sm);
}

.announcement-card-brand {
	font-family: var(--font-heading);
	font-weight: 600;
	color: var(--color-text-secondary);
	letter-spacing: 0.01em;
}

.announcement-card-brand-mark {
	color: var(--color-accent);
}

.announcement-card-meta {
	color: var(--color-text-muted);
	font-family: var(--font-heading);
	font-size: var(--text-sm);
	letter-spacing: 0.02em;
}

/* ---- Placeholder block (for stubbed admin sections) ----
 *
 * A bordered surface that says "this will exist later, here's what
 * lives here when it does." Used on Assistant control today; any
 * future stubbed section can use the same. */

.placeholder-block {
	padding: var(--space-5);
	background-color: var(--color-surface);
	border: 1px dashed var(--color-border-strong);
	border-radius: var(--radius-md);
	color: var(--color-text-secondary);
	font-size: var(--text-base);
	line-height: 1.6;
}

.placeholder-block p { margin: 0 0 var(--space-3); }
.placeholder-block p:last-child { margin-bottom: 0; }

.placeholder-block-status {
	font-family: var(--font-heading);
	font-size: var(--text-sm);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--color-text-muted);
}

/* ---- User detail grid ---- */

.user-detail-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
	gap: var(--space-4);
	background-color: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-5);
	margin-bottom: var(--space-4);
}

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

.user-detail-label {
	font-family: var(--font-heading);
	font-size: var(--text-sm);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--color-text-muted);
}

.user-detail-value {
	font-size: var(--text-base);
	color: var(--color-text-primary);
}

.user-detail-hint {
	color: var(--color-text-muted);
	font-size: var(--text-sm);
}

.user-detail-actions {
	display: flex;
	gap: var(--space-3);
	align-items: center;
	margin-bottom: var(--space-3);
}

.user-detail-actions form { margin: 0; }

/* ---- Stats row (used by user-management; reusable for any
 *      admin page that wants a horizontal counters strip) ---- */

.stats-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
	gap: var(--space-4);
	margin-bottom: var(--space-5);
}

.stat-card {
	background-color: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-4) var(--space-5);
	box-shadow: var(--shadow-sm);
}

.stat-card-value {
	font-family: var(--font-heading);
	font-size: var(--text-3xl);
	font-weight: 700;
	color: var(--color-text-primary);
	line-height: 1;
	margin-bottom: var(--space-2);
}

.stat-card-label {
	font-family: var(--font-heading);
	font-size: var(--text-sm);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--color-text-muted);
}

/* ---- Users filter bar ---- */

.users-filters {
	display: grid;
	grid-template-columns: 2fr 1fr 1fr auto;
	gap: var(--space-3);
	align-items: end;
	background-color: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-4) var(--space-5);
	margin-bottom: var(--space-5);
}

.users-filters-actions {
	display: flex;
	gap: var(--space-2);
	align-items: center;
}

@media (max-width: 768px) {
	.users-filters { grid-template-columns: 1fr; }
}

/* ---- Agency edit form ---- */

.agency-edit-form {
	background-color: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-6);
	max-width: 56rem;
}

.agency-edit-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
	gap: var(--space-4);
	margin-bottom: var(--space-5);
}

.agency-edit-field-wide { grid-column: 1 / -1; }

.agency-edit-address {
	font-family: var(--font-body);
	resize: vertical;
	min-height: 5rem;
}

.agency-edit-actions {
	display: flex;
	gap: var(--space-3);
}

/* `.prose` is reused styling for any rendered-markdown surface —
 * announcement bodies, future help docs, etc. */
.prose p { margin: 0 0 var(--space-4); }
.prose p:last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3 {
	font-family: var(--font-heading);
	margin-top: var(--space-5);
	margin-bottom: var(--space-3);
	color: var(--color-text-primary);
}
.prose h1 { font-size: var(--text-xl); }
.prose h2 { font-size: var(--text-lg); }
.prose h3 { font-size: var(--text-base); font-weight: 700; }
.prose ul, .prose ol {
	margin: 0 0 var(--space-4);
	padding-left: var(--space-5);
}
.prose li { margin-bottom: var(--space-2); }
.prose a {
	color: var(--color-accent);
	text-decoration: underline;
}
.prose a:hover {
	color: var(--color-accent-hover);
}
.prose strong { font-weight: 700; }
.prose em { font-style: italic; }
.prose code {
	background-color: var(--color-surface-alt);
	padding: 0.1em 0.35em;
	border-radius: var(--radius-sm);
	font-size: 0.92em;
}
.prose blockquote {
	margin: 0 0 var(--space-4);
	padding-left: var(--space-4);
	border-left: 3px solid var(--color-border);
	color: var(--color-text-secondary);
}

.announcement-preview-actions {
	max-width: 36rem;
	margin: 0 auto;
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-3);
	align-items: center;
	justify-content: space-between;
}

.announcement-preview-actions form {
	margin: 0;
	display: inline-block;
}

/* ---- Settings tables ---- */

.settings-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: var(--space-5);
	background-color: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	overflow: hidden;
}

.settings-table th,
.settings-table td {
	padding: 0.75rem var(--space-4);
	text-align: left;
	vertical-align: middle;
	border-bottom: 1px solid var(--color-border);
}

.settings-table thead th {
	font-family: var(--font-heading);
	font-weight: 600;
	font-size: var(--text-sm);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--color-text-muted);
	background-color: var(--color-surface-alt);
}

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

.settings-table tbody tr:hover {
	background-color: var(--color-surface-alt);
}

.settings-th-actions {
	width: 1%;
	white-space: nowrap;
	text-align: right;
}

.settings-actions {
	white-space: nowrap;
	text-align: right;
}

/* WellSky "sync in progress" banner. Pulses subtly via a CSS
   animation on the spinner glyph so the eye lands on the
   movement, not the text. Page-level meta refresh handles
   actually updating the data. */
.wellsky-syncing-banner {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	padding: var(--space-3) var(--space-4);
	background: var(--color-accent-soft, rgba(122, 61, 160, 0.1));
	border: 1px solid var(--color-accent, #7a3da0);
	border-radius: var(--radius-md);
	margin: var(--space-4) 0;
	color: var(--color-text);
}
.wellsky-syncing-spin {
	display: inline-block;
	font-size: 1.5rem;
	animation: wellsky-spin 1.2s linear infinite;
	color: var(--color-accent, #7a3da0);
}
@keyframes wellsky-spin {
	from { transform: rotate(0deg); }
	to   { transform: rotate(360deg); }
}

/* WellSky credentials form — vertical stack with breathing room
   between fields and the submit row. Form default rendering puts
   children edge-to-edge; gap was making the Encrypt-credentials
   button sit on top of the password input. */
.wellsky-creds-form {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
	max-width: 32rem;
}

.wellsky-creds-form .settings-actions {
	margin-top: var(--space-2);
	text-align: left;
}

.settings-actions form {
	display: inline-block;
	margin: 0;
}

/* Inline rank-picker form on the admin-team table — keeps the
   <select> + Save button on one line, with the Remove form
   inline next to it.
   The selector is deliberately scoped under .settings-actions
   so it beats the .settings-actions form { display: inline-block }
   rule above (specificity 0,2,0 vs 0,1,1). Without this scoping,
   the rank-form ends up inline-block + the gap rule does nothing,
   and the Save / Remove buttons collapse on top of each other. */
.settings-actions .setrank-row-form {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	margin: 0 var(--space-3) 0 0;
	vertical-align: middle;
}

.setrank-row-select {
	min-width: 11em;
	padding-block: var(--space-1);
}

.settings-empty {
	text-align: center;
	color: var(--color-text-muted);
	font-style: italic;
	padding: var(--space-5) !important;
}

/* ---- Inline create form (markets, service zones) ---- */

.settings-create {
	background-color: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-5);
	margin-bottom: var(--space-5);
}

.settings-create-title {
	font-family: var(--font-heading);
	font-size: var(--text-base);
	font-weight: 600;
	margin: 0 0 var(--space-4);
	color: var(--color-text-primary);
}

.settings-create-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
	gap: var(--space-4);
	margin-bottom: var(--space-4);
}

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

.settings-field-label {
	font-family: var(--font-heading);
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--color-text-primary);
}

.settings-input {
	width: 100%;
	padding: 0.625rem 0.875rem;
	font-family: var(--font-body);
	font-size: var(--text-base);
	color: var(--color-text-primary);
	background-color: var(--color-surface-alt);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	transition: border-color 120ms, box-shadow 120ms;
}

.settings-input:focus {
	outline: none;
	border-color: var(--color-accent);
	box-shadow: var(--ring-accent);
}

/* Reveal toggle — input + eye-button side-by-side, used on PIN
   fields where fat-fingering a hidden password is a real risk.
   See /static/js/reveal-toggle.js for the click handler. */
.settings-input-reveal {
	display: flex;
	align-items: stretch;
}
.settings-input-reveal .settings-input {
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
	border-right: none;
	min-width: 0;
}
.settings-input-reveal-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 0.875rem;
	background-color: var(--color-surface-alt);
	border: 1px solid var(--color-border);
	border-top-right-radius: var(--radius-sm);
	border-bottom-right-radius: var(--radius-sm);
	color: var(--color-text-secondary);
	cursor: pointer;
	transition: background-color 120ms, color 120ms;
}
.settings-input-reveal-btn:hover {
	color: var(--color-text-primary);
	background-color: var(--color-surface);
}
.settings-input-reveal-btn:focus-visible {
	outline: none;
	box-shadow: var(--ring-accent);
	z-index: 1;
}
.settings-input-reveal-btn[aria-pressed="false"] .reveal-icon-hide { display: none; }
.settings-input-reveal-btn[aria-pressed="true"]  .reveal-icon-show { display: none; }

/* ---- Auth card (verify, recovery, mid-login surfaces) ----
   Stand-alone centered card used by /auth/verify and friends.
   Renders inside ShellBare so there's no app chrome to compete
   with. */
.auth-card-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	min-height: 100vh;
	padding: 2.5rem 1rem 3rem;
	background: var(--color-bg);
}
.auth-card-brand {
	margin-bottom: 1.75rem;
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	text-decoration: none;
}
.auth-card-brand img { height: 40px; width: auto; }
.auth-card {
	width: 100%;
	max-width: 420px;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md, 12px);
	box-shadow: var(--shadow-card, 0 1px 3px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.05));
	padding: 2rem 1.75rem;
}
.auth-card h1, .auth-card h2 {
	margin: 0 0 0.25rem 0;
	font-size: var(--text-lg, 1.25rem);
	color: var(--color-text-primary);
}
.auth-card-subtitle {
	color: var(--color-text-muted);
	margin: 0 0 1.5rem 0;
	font-size: var(--text-sm);
}
.auth-card-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--color-accent-soft, #ede9fe);
	color: var(--color-accent);
	margin-bottom: 0.75rem;
}
.auth-card-icon svg { width: 22px; height: 22px; }
.auth-card-signout {
	background: none;
	border: none;
	padding: 0;
	color: var(--color-text-muted);
	font-size: var(--text-sm);
	text-decoration: underline;
	cursor: pointer;
}
.auth-card-signout:hover { color: var(--color-text-primary); }

/* Lockout panel inside an auth card — replaces the previous
   inline styles. Same warning treatment used on /account/security's
   "recovery code used" banner, scaled for the smaller card width. */
.auth-lockout {
	margin: 0 0 1.25rem 0;
	padding: 0.875rem 1rem;
	border-left: 4px solid var(--color-danger, #b91c1c);
	background: var(--color-danger-soft, #fee2e2);
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.auth-lockout-title {
	font-weight: 600;
	margin: 0 0 0.5rem 0;
	color: var(--color-text-primary);
}
.auth-lockout p { margin: 0.25rem 0; }
.auth-recovery-link {
	margin-top: 1.5rem;
	font-size: var(--text-sm);
	color: var(--color-text-muted);
	text-align: center;
}
.auth-recovery-link a { color: var(--color-accent); }

/* Digit-boxes input — N single-character cells in a row,
   used for 6-digit PIN and TOTP entry. See
   /static/js/digit-boxes.js for the keyboard / paste /
   auto-advance behavior. */
.digit-boxes {
	display: flex;
	justify-content: center;
	gap: 0.5rem;
	margin: 0.5rem 0;
}
.digit-box-cell {
	width: 2.75rem;
	height: 3.25rem;
	text-align: center;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 1.5rem;
	color: var(--color-text-primary);
	background-color: var(--color-surface-alt);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	transition: border-color 120ms, box-shadow 120ms;
}
.digit-box-cell:focus {
	outline: none;
	border-color: var(--color-accent);
	box-shadow: var(--ring-accent);
}
@media (max-width: 420px) {
	.digit-box-cell { width: 2.25rem; height: 2.75rem; font-size: 1.25rem; }
	.digit-boxes { gap: 0.35rem; }
}

/* /admin/health — vendor status strip + active alerts +
   recent-failures table. Colocated with the other admin/auth
   surface styles. */
.vendor-status-list {
	list-style: none;
	padding: 0;
	margin: 1rem 0 0 0;
}
.vendor-status-row {
	display: grid;
	grid-template-columns: 70px minmax(180px, 1fr) 110px minmax(220px, 2fr);
	align-items: center;
	gap: 1.25rem;
	padding: 0.75rem 1rem;
	border-top: 1px solid var(--color-border);
	font-size: var(--text-sm);
}
.vendor-status-row:first-child { border-top: none; }
/* In data rows the first column holds the dot (12px); center it
   under the "Status" header text. */
.vendor-status-row > .vendor-status-dot {
	justify-self: center;
}
.vendor-status-header {
	font-size: var(--text-xs);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--color-text-muted);
	background: var(--color-surface-alt);
}
/* In the header row, the first column is the "Status" label —
   center it to line up over the dots below. */
.vendor-status-header > span:first-child {
	text-align: center;
}
.vendor-status-list-with-header { border: 1px solid var(--color-border); border-radius: var(--radius-sm); overflow: hidden; }

/* Toggle switch — iOS-style. Used on /admin/health for the
   "Include HTTP request errors" filter. */
.toggle-switch {
	display: inline-flex;
	align-items: center;
	gap: 0.75rem;
	cursor: pointer;
	user-select: none;
}
.toggle-switch input[type="checkbox"] {
	position: absolute;
	opacity: 0;
	pointer-events: none;
	width: 0; height: 0;
}
.toggle-switch-track {
	flex-shrink: 0;
	display: inline-block;
	position: relative;
	width: 44px;
	height: 24px;
	background: var(--color-border);
	border-radius: 999px;
	transition: background-color 160ms ease;
}
.toggle-switch-knob {
	position: absolute;
	top: 2px;
	left: 2px;
	width: 20px;
	height: 20px;
	background: white;
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(0,0,0,0.2);
	transition: transform 160ms ease;
}
.toggle-switch input:checked ~ .toggle-switch-track {
	background: var(--color-accent);
}
.toggle-switch input:checked ~ .toggle-switch-track .toggle-switch-knob {
	transform: translateX(20px);
}
.toggle-switch input:focus-visible ~ .toggle-switch-track {
	box-shadow: var(--ring-accent);
}
.toggle-switch-label {
	font-size: var(--text-sm);
	color: var(--color-text-primary);
	font-weight: 600;
	display: flex;
	flex-direction: column;
	gap: 0.125rem;
}
.toggle-switch-label-detail {
	font-size: var(--text-xs);
	color: var(--color-text-muted);
	font-weight: 400;
}
.vendor-status-dot {
	width: 12px; height: 12px; border-radius: 50%;
	display: inline-block;
}
.vendor-status-dot-green { background: #15803d; }
.vendor-status-dot-amber { background: #d97706; }
.vendor-status-dot-red   { background: #b91c1c; }
.vendor-status-name { font-weight: 600; color: var(--color-text-primary); }
.vendor-status-tier {
	font-size: var(--text-xs);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--color-surface-alt);
	color: var(--color-text-muted);
}
.vendor-status-tier-critical { color: #b91c1c; background: #fee2e2; }
.vendor-status-tier-high     { color: #d97706; background: #fef3c7; }
.vendor-status-tier-medium   { color: #3b82f6; background: #dbeafe; }
.vendor-status-tier-low      { color: #6b7280; background: #f3f4f6; }
.vendor-status-detail { color: var(--color-text-muted); }
@media (max-width: 700px) {
	.vendor-status-row { grid-template-columns: 14px 1fr auto; }
	.vendor-status-detail { grid-column: 1 / -1; padding-left: 26px; }
}

.active-alerts-list { list-style: none; padding: 0; margin: 1rem 0 0 0; }
.active-alert {
	display: flex;
	gap: 0.875rem;
	align-items: flex-start;
	padding: 0.875rem 1rem;
	border-left: 4px solid transparent;
	background: var(--color-surface-alt);
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
	margin-bottom: 0.5rem;
}
.active-alert-critical { border-left-color: #b91c1c; background: #fee2e2; }
.active-alert-error    { border-left-color: #b91c1c; background: #fef3c7; }
.active-alert-warn     { border-left-color: #d97706; background: #fef3c7; }
.active-alert-badge {
	font-size: var(--text-xs);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 4px 8px;
	border-radius: var(--radius-sm);
	color: white;
}
.active-alert-badge-critical { background: #b91c1c; }
.active-alert-badge-error    { background: #b91c1c; }
.active-alert-badge-warn     { background: #d97706; }
.active-alert-body { flex: 1; }
.active-alert-title  { font-weight: 600; margin: 0 0 0.25rem 0; }
.active-alert-detail { margin: 0 0 0.25rem 0; }
.active-alert-meta   { font-size: var(--text-xs); color: var(--color-text-muted); margin: 0; }

.failure-level {
	font-size: var(--text-xs);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 2px 6px;
	border-radius: var(--radius-sm);
	color: white;
}
.failure-level-warn     { background: #d97706; }
.failure-level-error    { background: #b91c1c; }
.failure-level-critical { background: #7f1d1d; }

/* Toast — slide-in notification at top-right of the page.
   See templates/components/toast.templ + /static/js/toast.js. */
.toast {
	position: fixed;
	top: 1.25rem;
	right: 1.25rem;
	z-index: 9999;
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	min-width: 320px;
	max-width: 420px;
	padding: 0.875rem 1rem;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-left-width: 4px;
	border-radius: var(--radius-sm);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 10px 30px rgba(0, 0, 0, 0.05);
	animation: toast-slide-in 220ms ease-out;
}
.toast-dismissing {
	animation: toast-slide-out 220ms ease-in forwards;
}
@keyframes toast-slide-in {
	from { opacity: 0; transform: translateX(20px); }
	to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-slide-out {
	from { opacity: 1; transform: translateX(0); }
	to   { opacity: 0; transform: translateX(20px); }
}
.toast-success { border-left-color: #15803d; }
.toast-info    { border-left-color: var(--color-accent); }
.toast-warning { border-left-color: #d97706; }
.toast-error   { border-left-color: #b91c1c; }
.toast-icon {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
}
.toast-success .toast-icon { background: #dcfce7; color: #15803d; }
.toast-info    .toast-icon { background: var(--color-accent-soft, #ede9fe); color: var(--color-accent); }
.toast-warning .toast-icon { background: #fef3c7; color: #d97706; }
.toast-error   .toast-icon { background: #fee2e2; color: #b91c1c; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; margin: 0 0 0.125rem 0; color: var(--color-text-primary); }
.toast-text  { margin: 0; font-size: var(--text-sm); color: var(--color-text-muted); word-wrap: break-word; }
.toast-close {
	flex-shrink: 0;
	background: none;
	border: none;
	padding: 4px;
	color: var(--color-text-muted);
	cursor: pointer;
	border-radius: 4px;
	transition: background-color 120ms;
}
.toast-close:hover { background: var(--color-surface-alt); color: var(--color-text-primary); }

/* Staff-photo QR handoff — used on the agency onboarding
   staff-photo step. The QR sits side-by-side with the
   "waiting for upload…" status. */
.staff-photo-handoff {
	display: flex;
	gap: 1.5rem;
	align-items: center;
	margin-top: 1rem;
	padding: 1rem;
	background: var(--color-surface-alt);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
}
.staff-photo-handoff img {
	background: white;
	padding: 0.5rem;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	flex-shrink: 0;
}
.staff-photo-handoff-meta { flex: 1; }
@media (max-width: 540px) {
	.staff-photo-handoff { flex-direction: column; align-items: stretch; }
	.staff-photo-handoff img { align-self: center; }
}

/* Staff-photo preview when a photo's already on file. */
.staff-photo-preview {
	margin-top: 0.75rem;
	max-width: 480px;
}
.staff-photo-preview img {
	width: 100%;
	height: auto;
	border-radius: var(--radius-sm);
	border: 1px solid var(--color-border);
}

/* Payment-method radio cards — used on the agency onboarding
   payment step. Each card is a labeled radio with a title +
   hint, styled as a tappable surface (rather than a tiny
   radio dot next to text). Selected state gets the accent
   border + soft background. */
.payment-method-options {
	display: flex;
	flex-direction: column;
	gap: 0.625rem;
	margin-top: 0.75rem;
}
.payment-method-option {
	display: flex;
	gap: 0.875rem;
	align-items: flex-start;
	padding: 0.875rem 1rem;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	background: var(--color-surface);
	cursor: pointer;
	transition: border-color 120ms, background-color 120ms;
}
.payment-method-option:hover {
	border-color: var(--color-accent);
	background: var(--color-surface-alt);
}
.payment-method-option input[type="radio"] {
	margin-top: 4px;
	flex-shrink: 0;
}
.payment-method-option:has(input[type="radio"]:checked) {
	border-color: var(--color-accent);
	background: var(--color-accent-soft, #ede9fe);
}
.payment-method-body {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}
.payment-method-title {
	font-weight: 600;
	color: var(--color-text-primary);
}
.payment-method-hint {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
}

/* Recovery-codes display — monospace list + plain-text fallback
   textarea. Style co-located with the input/reveal block since
   both are auth/security-page UI. */
.recovery-codes-list {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 1.1rem;
	line-height: 2;
	list-style: none;
	padding: 1rem 1.5rem;
	margin: 1.5rem 0;
	background: var(--color-surface-alt);
	border-radius: var(--radius-sm);
	border: 1px solid var(--color-border);
}
.recovery-codes-textarea {
	width: 100%;
	margin-top: 0.5rem;
	padding: 0.75rem;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 0.95rem;
	background: var(--color-surface-alt);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
}
/* Print stylesheet for the recovery-codes page so a user who
   hits the Print button gets a clean printer-ready layout
   (no nav, no chrome). */
@media print {
	.site-header, .site-footer, .impersonation-banner,
	.user-detail-actions, [data-recovery-codes-flash],
	details summary { display: none !important; }
	.admin-section { border: none; box-shadow: none; padding: 0; }
	.recovery-codes-list { background: white; border: 1px solid #999; }
}

/* ---- Button size + ghost variants ---- */

.btn-sm {
	padding: 0.45rem 0.875rem;
	font-size: var(--text-sm);
}

.btn-ghost {
	background: transparent;
	border-color: var(--color-border);
	color: var(--color-text-secondary);
	box-shadow: none;
}
.btn-ghost:hover {
	background-color: var(--color-surface-alt);
	border-color: var(--color-accent);
	color: var(--color-text-primary);
	box-shadow: none;
	transform: none;
}

/* The danger variant of the ghost button — used for destructive
 * actions (deactivate, eventually delete). Same shape, danger
 * accent on hover. */
.btn-ghost-danger {
	background: transparent;
	border-color: var(--color-border);
	color: var(--color-text-secondary);
	box-shadow: none;
}
.btn-ghost-danger:hover {
	background-color: var(--color-surface-alt);
	border-color: var(--color-danger);
	color: var(--color-danger);
	box-shadow: none;
	transform: none;
}

/* ---- Hero backdrop -------------------------------------------------- */

/*
 * Decorative full-viewport layer behind the home page content.
 * Renders only on pages that include <HeroBackdrop> (currently just
 * Home). Other pages have plain backgrounds.
 *
 * The structure: a fixed wrapper covers the viewport with z-index: -1;
 * inside it, a gradient div, two large blurred "blob" divs that drift
 * with cardFloat keyframes, and (dark-mode only) six rising particles.
 *
 * The header (.site-header) and footer (.site-footer) have their own
 * opaque background-color from --color-surface, so the backdrop only
 * shows in the body content area between them. That's intentional —
 * keeps nav and footer reading as solid surfaces.
 */

.page-bg {
	position: fixed;
	inset: 0;
	z-index: -1;
	overflow: hidden;
	pointer-events: none;
	/* iOS Safari historically lets the filter:blur halo on a
	   transformed child (.page-bg-blob) escape overflow:hidden.
	   contain:paint enforces real containment — painting outside
	   this box is forbidden — which catches the blur escape that
	   was leaking a few pixels of horizontal scroll on phones. */
	contain: paint;
}

.page-bg-gradient {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		165deg,
		var(--hero-bg-1) 0%,
		var(--hero-bg-2) 40%,
		var(--hero-bg-3) 100%
	);
}

.page-bg-blob {
	position: absolute;
	border-radius: 50%;
	filter: blur(80px);
	will-change: transform;
}

.page-bg-blob-1 {
	top: -20%;
	right: -10%;
	width: 70%;
	height: 80%;
	background: var(--hero-blob-1);
	animation: blobFloat 20s ease-in-out infinite;
}

.page-bg-blob-2 {
	bottom: -10%;
	left: -15%;
	width: 60%;
	height: 60%;
	background: var(--hero-blob-2);
	filter: blur(100px);
	animation: blobFloat 25s ease-in-out infinite reverse;
}

@keyframes blobFloat {
	0%, 100% { transform: translate(0, 0) scale(1); }
	33%      { transform: translate(30px, -20px) scale(1.05); }
	66%      { transform: translate(-20px, 20px) scale(0.95); }
}

.page-bg-particles {
	position: absolute;
	inset: 0;
	overflow: hidden;
}

/* Particle = one mote of "magic dust." A small dot with a soft
 * radial glow (box-shadow). Six different motion patterns scattered
 * across the field, no single direction dominates — particles
 * drift diagonally up-right, up-left, down-right, down-left, sway
 * laterally, or twinkle in place. Opacity oscillates along every
 * path so the field shimmers instead of looking like motion.
 *
 * Per-particle nth-child rules set start position, size, which
 * keyframe, duration, and delay. The wide spread of durations
 * (15-40s) + negative offsets removes any visible rhythm.
 *
 * Color comes from --hero-particle: deep purple in light theme,
 * warm gold in dark theme (see tokens.css).
 */
.particle {
	position: absolute;
	width: 3px;
	height: 3px;
	background: var(--hero-particle);
	border-radius: 50%;
	box-shadow:
		0 0 6px var(--hero-particle),
		0 0 14px var(--hero-particle),
		0 0 24px var(--hero-particle);
	opacity: 0;
	pointer-events: none;
	animation-iteration-count: infinite;
	animation-timing-function: ease-in-out;
	will-change: transform, opacity;
}

/* --- Six motion patterns --- */

/* Up-right diagonal drift (starts bottom-left, ends top-right). */
@keyframes particleDriftNE {
	0%   { transform: translate(0,    0)     scale(0.4); opacity: 0; }
	15%  { transform: translate(4vw,  -15vh) scale(0.9); opacity: 0.85; }
	35%  { transform: translate(12vw, -32vh) scale(1.05);opacity: 0.5; }
	55%  { transform: translate(22vw, -55vh) scale(1.1); opacity: 1; }
	75%  { transform: translate(33vw, -80vh) scale(0.9); opacity: 0.55; }
	100% { transform: translate(46vw, -115vh) scale(0.3);opacity: 0; }
}

/* Up-left diagonal drift (starts bottom-right, ends top-left). */
@keyframes particleDriftNW {
	0%   { transform: translate(0,     0)    scale(0.4); opacity: 0; }
	18%  { transform: translate(-5vw,  -18vh) scale(1);   opacity: 0.8; }
	38%  { transform: translate(-13vw, -36vh) scale(1.1); opacity: 0.45; }
	58%  { transform: translate(-22vw, -56vh) scale(0.95);opacity: 0.95; }
	78%  { transform: translate(-32vw, -78vh) scale(0.85);opacity: 0.5; }
	100% { transform: translate(-44vw, -115vh) scale(0.3); opacity: 0; }
}

/* Down-right diagonal drift (starts upper-left, ends lower-right). */
@keyframes particleDriftSE {
	0%   { transform: translate(0,    0)    scale(0.4); opacity: 0; }
	20%  { transform: translate(6vw,  14vh) scale(1);   opacity: 0.75; }
	45%  { transform: translate(15vw, 32vh) scale(1.1); opacity: 0.5; }
	65%  { transform: translate(24vw, 52vh) scale(1);   opacity: 0.95; }
	85%  { transform: translate(34vw, 78vh) scale(0.85);opacity: 0.45; }
	100% { transform: translate(46vw, 115vh) scale(0.3); opacity: 0; }
}

/* Down-left diagonal drift (starts upper-right, ends lower-left). */
@keyframes particleDriftSW {
	0%   { transform: translate(0,     0)    scale(0.4); opacity: 0; }
	22%  { transform: translate(-7vw,  15vh) scale(1);   opacity: 0.8; }
	48%  { transform: translate(-18vw, 36vh) scale(1.1); opacity: 0.5; }
	68%  { transform: translate(-27vw, 56vh) scale(0.95);opacity: 1; }
	88%  { transform: translate(-37vw, 80vh) scale(0.8); opacity: 0.4; }
	100% { transform: translate(-46vw, 115vh) scale(0.3); opacity: 0; }
}

/* Lateral sway with slow vertical drift — feather / falling-leaf
 * pattern. Mostly horizontal motion, a small steady vertical
 * component. */
@keyframes particleSway {
	0%   { transform: translate(0,     0)    scale(0.5); opacity: 0; }
	15%  { transform: translate(22px,  -7vh) scale(1);   opacity: 0.85; }
	30%  { transform: translate(-26px, -16vh) scale(0.9);opacity: 0.5; }
	45%  { transform: translate(28px,  -25vh) scale(1.1);opacity: 1; }
	60%  { transform: translate(-22px, -36vh) scale(0.85);opacity: 0.4; }
	75%  { transform: translate(24px,  -46vh) scale(1);  opacity: 0.9; }
	100% { transform: translate(0,     -60vh) scale(0.4);opacity: 0; }
}

/* In-place twinkle — no translation, just scale + opacity pulses.
 * Reads as a faint star that brightens and dims. */
@keyframes particleTwinkle {
	0%, 100% { transform: scale(0.4); opacity: 0; }
	15%      { transform: scale(1);   opacity: 0.55; }
	30%      { transform: scale(1.7); opacity: 1; }
	42%      { transform: scale(1);   opacity: 0.3; }
	55%      { transform: scale(1.5); opacity: 0.95; }
	70%      { transform: scale(0.9); opacity: 0.45; }
	85%      { transform: scale(1.2); opacity: 0.75; }
}

/* "Sparkle" subset gets a beefier glow + slightly larger base size.
 * Scattered indices so the brightest motes don't band. */
.page-bg-particles .particle:nth-child(3),
.page-bg-particles .particle:nth-child(11),
.page-bg-particles .particle:nth-child(18),
.page-bg-particles .particle:nth-child(24),
.page-bg-particles .particle:nth-child(27) {
	width: 5px;
	height: 5px;
	box-shadow:
		0 0 12px var(--hero-particle),
		0 0 26px var(--hero-particle),
		0 0 44px var(--hero-particle);
}

/* --- 28 per-particle assignments ---
 *
 * Start positions are explicit (top / left / right / bottom set per
 * particle, no shared baseline) so different motion patterns
 * originate from sensible edges of the viewport. Mix of all six
 * keyframes interleaved by index so adjacent particles never share
 * a motion. Durations 15-40s, all delays negative so the field is
 * mid-animation at first paint instead of waiting to ramp up. */

/* Up-right drifters — start near the bottom-left edge */
.page-bg-particles .particle:nth-child(1)  { left:  5%; bottom: -8px; animation: particleDriftNE 26s   -2s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(6)  { left: 12%; bottom: -8px; width: 4px; height: 4px; animation: particleDriftNE 32s  -11s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(12) { left:  3%; bottom: 18%; animation: particleDriftNE 22s  -19s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(17) { left: 22%; bottom: -8px; width: 2px; height: 2px; animation: particleDriftNE 36s   -6s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(23) { left: 15%; bottom:  8%; animation: particleDriftNE 28s  -14s infinite ease-in-out; }

/* Up-left drifters — start near the bottom-right edge */
.page-bg-particles .particle:nth-child(2)  { right:  4%; bottom: -8px; animation: particleDriftNW 30s   -8s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(8)  { right: 10%; bottom: -8px; width: 4px; height: 4px; animation: particleDriftNW 24s  -16s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(13) { right: 18%; bottom: -8px; animation: particleDriftNW 34s   -3s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(19) { right:  2%; bottom: 14%; width: 2px; height: 2px; animation: particleDriftNW 38s -22s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(25) { right: 24%; bottom: -8px; width: 4px; height: 4px; animation: particleDriftNW 26s -10s infinite ease-in-out; }

/* Down-right drifters — start near the top-left edge */
.page-bg-particles .particle:nth-child(3)  { left:  6%; top: -8px; animation: particleDriftSE 36s  -12s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(11) { left: 18%; top: -8px; animation: particleDriftSE 30s   -4s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(20) { left: 28%; top:  5%; width: 4px; height: 4px; animation: particleDriftSE 38s -20s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(26) { left:  2%; top: 12%; animation: particleDriftSE 28s  -7s infinite ease-in-out; }

/* Down-left drifters — start near the top-right edge */
.page-bg-particles .particle:nth-child(7)  { right:  5%; top: -8px; width: 4px; height: 4px; animation: particleDriftSW 32s  -10s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(15) { right: 14%; top: -8px; animation: particleDriftSW 26s   -5s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(21) { right: 24%; top:  6%; animation: particleDriftSW 34s -17s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(27) { right:  8%; top: 10%; animation: particleDriftSW 30s  -9s infinite ease-in-out; }

/* Sway — feather/leaf falling sideways, starts mid-viewport */
.page-bg-particles .particle:nth-child(5)  { left: 32%; bottom: 35%; width: 2px; height: 2px; animation: particleSway 20s  -3s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(10) { left: 64%; bottom: 28%; animation: particleSway 24s -13s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(16) { left: 78%; bottom: 50%; width: 4px; height: 4px; animation: particleSway 18s  -8s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(22) { left: 42%; bottom: 60%; width: 2px; height: 2px; animation: particleSway 22s -15s infinite ease-in-out; }

/* Twinkle — in-place pulse, no drift; scattered around the field
 * for the "stars overhead" feel */
.page-bg-particles .particle:nth-child(4)  { left: 24%; top: 22%; animation: particleTwinkle 15s  -2s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(9)  { left: 55%; top: 15%; width: 2px; height: 2px; animation: particleTwinkle 18s  -7s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(14) { left: 72%; top: 38%; width: 4px; height: 4px; animation: particleTwinkle 12s -10s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(18) { left: 45%; top: 48%; animation: particleTwinkle 16s  -5s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(24) { left: 88%; top: 28%; animation: particleTwinkle 20s -14s infinite ease-in-out; }
.page-bg-particles .particle:nth-child(28) { left: 38%; top: 70%; width: 2px; height: 2px; animation: particleTwinkle 14s  -1s infinite ease-in-out; }

/* Mobile: keep the first 14, drop the rest. Still more than the
 * old 6-particle baseline, but doesn't visually overwhelm a phone
 * viewport. */
@media (max-width: 48rem) {
	.page-bg-particles .particle:nth-child(n+15) {
		display: none;
	}
}

/* Respect prefers-reduced-motion — no blob drift, no particle
 * rising. The gradient stays. */
@media (prefers-reduced-motion: reduce) {
	.page-bg-blob,
	.particle {
		animation: none;
	}
}

/* --- Caregiver action items widget (Phase E) ----------------------
 * Stack of action cards on the caregiver dashboard. Each card
 * is a single pending wizard with a clear CTA. Tone classes
 * (.action-card-danger / -warn / -info) color the deadline
 * text + the left border for at-a-glance triage.
 */
.action-items {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

.action-card {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
	padding: var(--space-4);
	border: 1px solid var(--color-border);
	border-left: 4px solid var(--color-border);
	border-radius: var(--radius-md);
	background: var(--color-surface);
}

.action-card-danger { border-left-color: var(--color-danger); }
.action-card-warn   { border-left-color: var(--color-warning); }
.action-card-info   { border-left-color: var(--color-accent); }

.action-card-body { flex: 1 1 auto; min-width: 0; }

.action-card-title {
	font-size: var(--font-size-base);
	font-weight: 600;
	margin: 0 0 var(--space-1);
}

.action-card-deadline {
	margin: 0;
	font-size: var(--font-size-sm);
	color: var(--color-text-muted);
}

.action-card-tone-danger { color: var(--color-danger); font-weight: 500; }
.action-card-tone-warn   { color: var(--color-warning); font-weight: 500; }

.action-card-cta { flex: 0 0 auto; }

/* ================================================================== */
/* Caregiver hub (/caregiver)                                          */
/* A quiet, glanceable status surface with deliberate hierarchy:       */
/* greeting → one focal "What needs you" card → status-tile grid →     */
/* agencies. Mobile-first; tiles go 2-up on phones, 4-up on tablets+.  */
/* ================================================================== */
.cghub {
	display: flex;
	flex-direction: column;
	gap: var(--space-6);
	padding-block: var(--space-2) var(--space-8);
}

/* --- Greeting ----------------------------------------------------- */
.cghub-eyebrow {
	font-family: var(--font-heading);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--color-accent);
	margin: 0 0 var(--space-1);
}

.cghub-hello {
	font-size: var(--text-2xl);
	line-height: 1.1;
	margin: 0;
}

.cghub-agency {
	margin: var(--space-1) 0 0;
	color: var(--color-text-muted);
	font-size: var(--text-sm);
}

/* --- Focal "What needs you" card ---------------------------------- */
.cghub-focus {
	padding: var(--space-5);
	border-radius: var(--radius-lg);
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	box-shadow: var(--shadow-md);
}

.cghub-focus-head {
	display: flex;
	align-items: center;
	gap: var(--space-3);
}

.cghub-focus-title {
	font-size: var(--text-xl);
	margin: 0;
}

.cghub-focus-count {
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.75rem;
	height: 1.75rem;
	padding: 0 0.5rem;
	border-radius: 999px;
	background: var(--gradient-primary);
	color: var(--color-accent-fg);
	font-family: var(--font-heading);
	font-weight: 700;
	font-size: var(--text-sm);
}

.cghub-focus-hint {
	margin: var(--space-1) 0 var(--space-4);
	color: var(--color-text-muted);
	font-size: var(--text-sm);
}

.cghub-focus-cards {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

/* All-clear variant: calm, reassuring, not loud. */
.cghub-focus-clear {
	display: flex;
	align-items: center;
	gap: var(--space-4);
	box-shadow: var(--shadow-sm);
}

.cghub-clear-icon {
	flex: 0 0 auto;
	width: 2.75rem;
	height: 2.75rem;
	border-radius: 999px;
	display: grid;
	place-items: center;
	background: var(--color-surface-alt);
	color: var(--color-success);
	font-size: var(--text-xl);
	font-weight: 700;
}

.cghub-clear-title {
	margin: 0;
	font-size: var(--text-lg);
}

.cghub-clear-sub {
	margin: var(--space-1) 0 0;
	color: var(--color-text-muted);
	font-size: var(--text-sm);
}

/* --- Status tiles ------------------------------------------------- */
.cghub-tiles {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--space-3);
}

@media (min-width: 40rem) {
	.cghub-tiles {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.cgtile {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
	min-height: 7.5rem;
	padding: var(--space-4);
	border-radius: var(--radius-md);
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	color: var(--color-text-primary);
	text-decoration: none;
	transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.cgtile:hover {
	transform: translateY(-2px);
	box-shadow: var(--shadow-md);
}

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

.cgtile-head {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--color-text-secondary);
}

.cgtile-icon {
	font-size: var(--text-lg);
	line-height: 1;
}

.cgtile-stat {
	display: flex;
	align-items: baseline;
	gap: var(--space-1);
	margin-top: auto;
}

.cgtile-big {
	font-family: var(--font-heading);
	font-weight: 700;
	font-size: var(--text-3xl);
	line-height: 1;
	color: var(--color-text-secondary);
}

.cgtile-unit {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
}

.cgtile-sub {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
}

/* Tone accents — the big value is the landing spot. */
.cgtile-attention {
	border-color: var(--color-accent);
}
.cgtile-attention .cgtile-big {
	color: var(--color-accent);
}
.cgtile-done .cgtile-big {
	color: var(--color-success);
}

/* --- Agencies (quiet footer) -------------------------------------- */
.cghub-agencies-title {
	font-size: var(--text-sm);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--color-text-muted);
	margin: 0 0 var(--space-2);
}

.cghub-agencies-hint {
	margin: var(--space-2) 0 0;
	font-size: var(--text-sm);
	color: var(--color-text-muted);
}

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

.caregiver-agency-item {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	padding: var(--space-3) var(--space-4);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background: var(--color-surface);
}

.caregiver-agency-name {
	font-weight: 600;
	flex: 1 1 auto;
	min-width: 0;
}

.caregiver-agency-rank {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
}

.caregiver-agency-current {
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--color-accent-fg);
	background: var(--color-accent);
	padding: 0 var(--space-2);
	border-radius: var(--radius-sm);
}

/* --- Staggered entrance (respects reduced-motion) ----------------- */
@keyframes cghub-rise {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: none; }
}

.cghub > * {
	animation: cghub-rise 0.4s ease both;
}
.cghub > :nth-child(2) { animation-delay: 0.05s; }
.cghub > :nth-child(3) { animation-delay: 0.10s; }
.cghub > :nth-child(4) { animation-delay: 0.15s; }

@media (prefers-reduced-motion: reduce) {
	.cghub > * { animation: none; }
}

/* --- Caregiver self-upload form ----------------------------------- */
.caregiver-upload-form {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
	max-width: 32rem;
}

/* --- Agency documents picker — chip grid -------------------------
 * Unified list of every active document template. One card per
 * template; required state drives an accent border and a
 * "Required" pill. Toggle in/out with the per-card Require /
 * Remove button.
 */
.doc-chip-grid {
	display: grid;
	/* Clamp the column min to 100% of container so a 320px hard
	 * minimum doesn't overflow the agency-section card's right
	 * padding on a phone viewport. Same fix pattern as
	 * .candidate-card-grid. */
	grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 1fr));
	gap: var(--space-3);
}

.doc-chip {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	padding: var(--space-3) var(--space-4);
	border: 1px solid var(--color-border);
	border-left: 4px solid var(--color-border);
	border-radius: var(--radius-md);
	background: var(--color-surface);
}

.doc-chip-required {
	border-left-color: var(--color-accent);
}

.doc-chip-body { min-width: 0; }

.doc-chip-head {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-1);
}

.doc-chip-name {
	font-size: var(--font-size-base);
	font-weight: 600;
	margin: 0 0 var(--space-1) 0;
	line-height: 1.3;
}

.doc-chip-badge {
	font-size: var(--font-size-xs);
	font-weight: 600;
	padding: 2px var(--space-2);
	border-radius: var(--radius-pill, 999px);
	white-space: nowrap;
	flex-shrink: 0;
}

.doc-chip-badge-required {
	background: var(--color-accent-soft, rgba(122, 61, 160, 0.12));
	color: var(--color-accent, #7a3da0);
}

.doc-chip-badge-optional {
	background: var(--color-surface-muted, #efefef);
	color: var(--color-text-muted);
}

.doc-chip-desc {
	margin: 0;
	font-size: var(--font-size-sm);
	color: var(--color-text-muted);
	line-height: 1.45;
}

.doc-chip-actions {
	display: flex;
	gap: var(--space-2);
	flex-wrap: wrap;
}

/* --- Document template preview (FlowDocument read-only render) --- */
.doc-preview-page {
	max-width: 50rem;
	margin: 0 auto;
	padding: var(--space-4) var(--space-3);
}

.doc-preview-bar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: var(--space-4);
}

.doc-preview {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-6) var(--space-6);
}

.doc-preview-head {
	border-bottom: 2px solid var(--color-accent, #7a3da0);
	margin-bottom: var(--space-4);
	padding-bottom: var(--space-3);
}

.doc-preview-agency {
	font-size: var(--font-size-sm);
	color: var(--color-accent, #7a3da0);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	margin: 0 0 var(--space-1) 0;
}

.doc-preview-title {
	font-size: var(--font-size-xl, 1.5rem);
	font-weight: 700;
	margin: 0;
}

.doc-preview-body {
	font-family: Charter, Georgia, serif;
	line-height: 1.55;
}

.doc-preview-section {
	font-family: 'system-ui', sans-serif;
	font-size: 1.1rem;
	font-weight: 600;
	margin: var(--space-5) 0 var(--space-2) 0;
	color: var(--color-text, #1d1d1f);
}

.doc-preview-subsection {
	font-family: 'system-ui', sans-serif;
	font-size: 0.95rem;
	font-weight: 600;
	margin: var(--space-4) 0 var(--space-2) 0;
	color: var(--color-text-muted);
}

.doc-preview-paragraph {
	margin: 0 0 var(--space-3) 0;
	white-space: pre-line; /* preserve schema's \n bullets */
}

.doc-preview-paragraph-legal {
	font-size: 0.95rem;
}

.doc-preview-divider {
	border: none;
	border-top: 1px solid var(--color-border);
	margin: var(--space-4) 0;
}

.doc-preview-checkbox-group {
	list-style: none;
	padding: 0;
	margin: 0 0 var(--space-3) 0;
}

.doc-preview-checkbox-group li {
	display: flex;
	gap: var(--space-2);
	align-items: baseline;
	margin-bottom: var(--space-2);
}

.doc-preview-checkbox {
	font-size: 1.1em;
	color: var(--color-text-muted);
	flex-shrink: 0;
}

.doc-preview-yes-no {
	margin: var(--space-3) 0;
}

.doc-preview-yes-no-label {
	margin: 0 0 var(--space-1) 0;
}

.doc-preview-field-group {
	margin: var(--space-3) 0;
}

.doc-preview-field-group dt {
	font-weight: 600;
	margin-top: var(--space-2);
}

.doc-preview-field-blank {
	margin: var(--space-1) 0 var(--space-3) 0;
	font-family: ui-monospace, monospace;
	color: var(--color-text-muted);
}

.doc-preview-signature {
	margin: var(--space-5) 0 var(--space-3) 0;
	padding-top: var(--space-3);
	border-top: 1px solid var(--color-border);
}

.doc-preview-signature-label {
	font-weight: 600;
	margin: 0 0 var(--space-2) 0;
}

.doc-preview-signature-line {
	font-family: ui-monospace, monospace;
	color: var(--color-text-muted);
	margin-bottom: var(--space-2);
}

.doc-preview-signature-row {
	display: flex;
	gap: var(--space-4);
	flex-wrap: wrap;
	font-family: ui-monospace, monospace;
	color: var(--color-text-muted);
}

.doc-preview-unknown {
	background: #fbeed9;
	border-left: 3px solid #e6a847;
	padding: var(--space-2) var(--space-3);
	font-size: var(--font-size-sm);
	color: var(--color-text-muted);
	margin: var(--space-2) 0;
}

@media print {
	.no-print { display: none; }
	.doc-preview { border: none; padding: 0; }
}

/* --- Walk-in candidate-facing public flow ------------------------- */
.walkin-page {
	max-width: 32rem;
	margin: 0 auto;
	padding: var(--space-5) var(--space-4);
}

/* /sms-demo only — the static A2P 10DLC reviewer preview banner. */
.walkin-demo-banner {
	margin-bottom: var(--space-5);
	padding: var(--space-3) var(--space-4);
	border: 1px solid var(--color-border);
	border-left: 4px solid var(--color-accent);
	border-radius: var(--radius-md);
	background: var(--color-bg-subtle);
	font-size: var(--font-size-sm);
	color: var(--color-text);
}

.walkin-demo-banner code {
	font-size: 0.95em;
}

.walkin-agency-logo {
	display: block;
	max-width: 12rem;
	max-height: 4rem;
	width: auto;
	height: auto;
	margin: 0 0 var(--space-3) 0;
	object-fit: contain;
}

.walkin-bar {
	margin-bottom: var(--space-5);
}

.walkin-bar .eyebrow {
	margin: 0 0 var(--space-3) 0;
}

.walkin-steps {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	gap: var(--space-2);
	justify-content: space-between;
}

.walkin-step {
	display: flex;
	flex-direction: column;
	align-items: center;
	flex: 1;
	font-size: var(--font-size-xs);
	color: var(--color-text-muted);
	min-width: 0;
}

.walkin-step-num {
	width: 1.8rem;
	height: 1.8rem;
	border-radius: 50%;
	background: var(--color-surface-muted, #efefef);
	color: var(--color-text-muted);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	margin-bottom: var(--space-1);
	border: 2px solid var(--color-border);
}

.walkin-step-active .walkin-step-num {
	background: var(--color-accent, #7a3da0);
	color: white;
	border-color: var(--color-accent, #7a3da0);
}

.walkin-step-active .walkin-step-label {
	color: var(--color-text);
	font-weight: 600;
}

.walkin-step-done .walkin-step-num {
	background: var(--color-accent-soft, rgba(122, 61, 160, 0.18));
	color: var(--color-accent, #7a3da0);
	border-color: var(--color-accent, #7a3da0);
}

.walkin-step-label {
	font-size: var(--font-size-xs);
	line-height: 1.1;
}

.walkin-main {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-5);
}

.walkin-title {
	font-size: 1.5rem;
	font-weight: 700;
	margin: 0 0 var(--space-2) 0;
}

.walkin-lede {
	color: var(--color-text-muted);
	margin: 0 0 var(--space-4) 0;
}

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

.walkin-consent {
	display: flex;
	gap: var(--space-2);
	align-items: flex-start;
	font-size: var(--font-size-sm);
	color: var(--color-text-muted);
	cursor: pointer;
}

.walkin-consent input[type="checkbox"] {
	margin-top: 4px;
	flex-shrink: 0;
}

.walkin-otp-input {
	font-family: ui-monospace, monospace;
	font-size: 1.6rem;
	letter-spacing: 0.4em;
	text-align: center;
}

.walkin-actions {
	display: flex;
	gap: var(--space-3);
	align-items: center;
}

.walkin-error {
	background: #fbeed9;
	border-left: 3px solid #e6a847;
	padding: var(--space-2) var(--space-3);
	border-radius: var(--radius-sm);
	margin-bottom: var(--space-3);
	color: var(--color-text);
}

/* --- Step 3 / Step 4 helpers ------------------------------------- */
.walkin-row {
	display: flex;
	gap: var(--space-3);
}

.walkin-field-state {
	flex: 0 0 6.5rem;
}

.walkin-field-zip {
	flex: 1;
}

.walkin-input-uppercase {
	text-transform: uppercase;
}

.walkin-field-hint {
	color: var(--color-text-muted);
	font-weight: 400;
	font-size: var(--font-size-xs);
	margin-left: var(--space-1);
}

/* --- Walk-in queue card on /agency ------------------------------- */
.walkin-queue {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.walkin-queue-row {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: var(--space-3);
	padding: var(--space-3);
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
}

.walkin-queue-avatar {
	width: 3rem;
	height: 3rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	overflow: hidden;
	background: var(--color-surface-muted, #efefef);
	flex-shrink: 0;
}

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

.walkin-queue-avatar-dot {
	font-size: 1.2rem;
	line-height: 1;
}

.walkin-queue-meta {
	min-width: 0;
}

.walkin-queue-name {
	margin: 0;
	font-weight: 600;
}

.walkin-queue-detail {
	margin: 0;
	font-size: var(--font-size-sm);
	color: var(--color-text-muted);
}

.walkin-queue-arrived {
	margin: 0;
	font-size: var(--font-size-xs);
	color: var(--color-text-muted);
}

.walkin-queue-actions {
	display: flex;
	gap: var(--space-2);
}

/* --- Phase II /walk-in/process/{reg_id} -------------------------- */
.walkin-process-summary-grid {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: var(--space-4);
	align-items: start;
}

.walkin-process-selfie {
	width: 5rem;
	height: 5rem;
}

.walkin-process-selfie-stack {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	align-items: stretch;
}

.walkin-face-badge {
	margin: 0;
	padding: var(--space-1) var(--space-2);
	border-radius: var(--radius-sm);
	font-size: 0.75rem;
	font-weight: 600;
	text-align: center;
}

.walkin-face-badge-ok {
	background: rgba(34, 139, 34, 0.12);
	color: rgb(34, 100, 34);
	border: 1px solid rgba(34, 139, 34, 0.25);
}

.walkin-face-badge-warn {
	background: rgba(230, 168, 71, 0.18);
	color: rgb(140, 90, 20);
	border: 1px solid rgba(230, 168, 71, 0.35);
}

/* --- Candidate-detail walk-in scans section ---------------------- */
.walkin-scans-face {
	margin-bottom: var(--space-3);
	max-width: 16rem;
}

.walkin-scans-grid {
	display: grid;
	/* Smaller column minimum (8rem instead of 10rem) so all five
	 * thumbs reliably sit on a single row at this section's
	 * typical content width; on narrower viewports they wrap to
	 * 2 or 3 per row cleanly. */
	grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
	gap: var(--space-3);
	margin-bottom: var(--space-4);
	/* align-items:stretch is the grid default; explicit here as a
	 * reminder that we want every thumb cell to share a row's
	 * height, then the inner .walkin-scan-thumb fills it via
	 * flex-direction:column with the image pinned bottom. */
	align-items: stretch;
}

.walkin-scan-thumb {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.walkin-scan-label {
	margin: 0;
	font-size: var(--font-size-xs);
	color: var(--color-text-muted);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	/* Reserve two lines of label height across every thumb so a
	 * single-line label ("INSURANCE CARD") doesn't sit higher than
	 * a two-line one ("DRIVER'S LICENSE (FRONT)"). 2.6rem ≈ 2
	 * lines at the current font-size + line-height. */
	min-height: 2.6rem;
	display: flex;
	align-items: flex-end;
	line-height: 1.25;
}

.walkin-scan-thumb-img,
.walkin-scan-thumb-empty {
	width: 100%;
	/* Fixed height (not min-height) so every box in the row is the
	 * same size whether it's holding a populated image or a
	 * "Not captured" placeholder. */
	height: 7.5rem;
	object-fit: cover;
	background: var(--color-surface-alt, #efefef);
	border-radius: var(--radius-sm);
}

.walkin-scan-thumb-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--color-text-muted);
	font-size: var(--font-size-sm);
	border: 1px dashed var(--color-border);
}

.walkin-scans-ocr {
	margin: 0;
	display: grid;
	grid-template-columns: auto 1fr;
	gap: var(--space-1) var(--space-3);
	padding: var(--space-3);
	background: var(--color-surface-muted, #fafafa);
	border-radius: var(--radius-sm);
}

.walkin-scans-ocr dt {
	font-size: var(--font-size-sm);
	color: var(--color-text-muted);
}

.walkin-scans-ocr dd {
	margin: 0;
}

/* --- Agency nav strip -------------------------------------------- */
/* Persistent horizontal nav under the admin-bar on every agency
   page. Underline-accent on the active tab, subtle hover on
   the rest. Wraps to multiple lines on narrow viewports. */
.agency-nav {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-1) var(--space-4);
	border-bottom: 1px solid var(--color-border);
	margin-bottom: var(--space-5);
	padding-bottom: var(--space-2);
}

.agency-nav-item {
	display: inline-block;
	padding: var(--space-2) 0;
	color: var(--color-text-muted);
	font-weight: 500;
	text-decoration: none;
	border-bottom: 2px solid transparent;
	margin-bottom: -2px; /* overlap the section border for a connected look */
	transition: color 80ms ease;
}

.agency-nav-item:hover {
	color: var(--color-text);
}

.agency-nav-item-active {
	color: var(--color-accent, #7a3da0);
	border-bottom-color: var(--color-accent, #7a3da0);
	font-weight: 600;
}

/* Secondary nav strip used inside specific top-level tabs
   (currently scheduling). Smaller and less visually heavy
   than agencyNav — it's a sibling cue, not a top-level
   navigation. */
.agency-subnav {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-1) var(--space-3);
	margin-top: calc(-1 * var(--space-3));
	margin-bottom: var(--space-4);
	font-size: 14px;
}

.agency-subnav-item {
	display: inline-block;
	padding: 4px 10px;
	color: var(--color-text-muted);
	text-decoration: none;
	border-radius: 4px;
	transition: background 80ms ease, color 80ms ease;
}

.agency-subnav-item:hover {
	background: var(--color-surface-tint);
	color: var(--color-text);
}

.agency-subnav-item-active {
	background: rgba(97, 0, 255, 0.08);
	color: var(--color-accent);
	font-weight: 600;
}

/* --- SSN reveal page --------------------------------------------- */
.ssn-reveal-value {
	font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
	font-size: 2rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	padding: var(--space-4) var(--space-5);
	background: var(--color-surface-muted, #fafafa);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	text-align: center;
	margin: 0;
}

.walkin-process-summary-list {
	margin: 0;
	display: grid;
	grid-template-columns: auto 1fr;
	column-gap: var(--space-3);
	row-gap: var(--space-1);
}

.walkin-process-summary-list dt {
	font-size: var(--font-size-sm);
	color: var(--color-text-muted);
}

.walkin-process-summary-list dd {
	margin: 0;
}

.walkin-process-form {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}

.walkin-process-fieldset {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-3) var(--space-4) var(--space-4);
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

.walkin-process-fieldset legend {
	padding: 0 var(--space-2);
	font-weight: 600;
	color: var(--color-text);
}

.walkin-process-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
	gap: var(--space-3);
}

/* --- Phase II doc-capture grid ----------------------------------- */
.walkin-doc-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
	gap: var(--space-3);
}

.walkin-doc-slot {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	padding: var(--space-3);
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
}

.walkin-doc-slot-header {
	display: flex;
	align-items: center;
	gap: var(--space-2);
}

.walkin-doc-slot-label {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
}

.walkin-doc-ocr-badge {
	font-size: 0.65rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	color: var(--color-accent, #7a3da0);
	background: var(--color-accent-soft, rgba(122, 61, 160, 0.12));
	padding: 0.15rem 0.4rem;
	border-radius: var(--radius-sm);
	text-transform: uppercase;
}

.walkin-doc-thumb {
	width: 100%;
	max-height: 10rem;
	object-fit: contain;
	background: var(--color-surface-muted, #efefef);
	border-radius: var(--radius-sm);
}

/* Per-slot OCR status indicator. Lives between the thumbnail
   and the re-capture button on the walk-in process page; gets
   driven by walkin-ocr-poll.js while async OCR runs in
   pkg/jobs.DocumentOCRWorker. */
.walkin-doc-ocr-status {
	display: block;
	font-size: var(--text-xs);
	margin: var(--space-2) 0;
	min-height: 1.25em;
}
.walkin-doc-ocr-status-pending {
	color: var(--color-text-muted);
	font-style: italic;
}
.walkin-doc-ocr-status-done {
	color: var(--color-success, #057a55);
	font-weight: 600;
}
.walkin-doc-ocr-status-refresh {
	color: var(--color-link, #2563eb);
	font-weight: 600;
	text-decoration: underline;
}
.walkin-doc-ocr-status-failed {
	color: var(--color-danger, #b91c1c);
	font-weight: 600;
}

.walkin-doc-form {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

/* --- Walk-in command center: compact "setup tile" ---------------- */
/* Used for low-frequency / one-time-setup actions like the QR
   sheet. Smaller visual weight than a full admin-section so
   daily-use surfaces dominate the page. */
.walkin-setup-tile {
	display: flex;
	gap: var(--space-3);
	align-items: center;
	padding: var(--space-3) var(--space-4);
	background: var(--color-surface-muted, #fafafa);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	margin-top: var(--space-5);
}

/* On phone widths stack the body + button vertically — otherwise
 * the button hogs its natural width and the body gets squeezed
 * narrow enough that the long URL's break-all wraps into a 12-
 * line vertical column. */
@media (max-width: 540px) {
	.walkin-setup-tile {
		flex-direction: column;
		align-items: stretch;
	}
	.walkin-setup-tile .btn {
		align-self: flex-start;
	}
}

.walkin-setup-tile-body {
	flex: 1;
	min-width: 0;
}

.walkin-setup-tile-eyebrow {
	margin: 0 0 var(--space-1) 0;
	font-size: var(--font-size-xs);
	color: var(--color-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.walkin-setup-tile-text {
	margin: 0;
	font-size: var(--font-size-sm);
	color: var(--color-text-muted);
}

.walkin-setup-tile-text code {
	font-size: var(--font-size-xs);
	word-break: break-all;
}

/* --- Command-center QR-sheet action row -------------------------- */
.walkin-qr-actions {
	display: flex;
	gap: var(--space-3);
	align-items: center;
	flex-wrap: wrap;
}

.walkin-qr-url {
	font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
	font-size: var(--font-size-sm);
	color: var(--color-text-muted);
	padding: var(--space-1) var(--space-2);
	background: var(--color-surface-muted, #efefef);
	border-radius: var(--radius-sm);
	word-break: break-all;
}

/* --- Step 5 selfie skip-form spacing ----------------------------- */
.walkin-skip-form {
	margin-top: var(--space-3);
	display: flex;
	justify-content: center;
}

/* --- Printable walk-in QR sheet ---------------------------------- */
/* Standalone /agency/walk-in/qr-sheet page. Two modes:
   - Screen: gray background, centered card, "Print" button visible.
   - Print: full-bleed 8.5×11 sheet, controls hidden. */
.qr-sheet-body {
	margin: 0;
	background: #f0f0f0;
	color: #111;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 2rem;
	min-height: 100vh;
}

.qr-sheet-controls {
	display: flex;
	gap: 0.75rem;
	margin-bottom: 1.5rem;
}

.qr-sheet {
	width: 8.5in;
	min-height: 11in;
	background: #fff;
	padding: 1in;
	box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	text-align: center;
}

.qr-sheet-logo {
	display: block;
	max-height: 1.6in;
	width: auto;
	max-width: 4.5in;
	object-fit: contain;
	margin: 0 0 0.6rem 0;
}

.qr-sheet-agency {
	font-size: 1.25rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.15em;
	color: #666;
	margin: 0 0 1.5rem 0;
}

.qr-sheet-title {
	font-size: 2.25rem;
	font-weight: 800;
	line-height: 1.1;
	margin: 0 0 0.4rem 0;
	color: #111;
}

.qr-sheet-subtitle {
	font-size: 1.1rem;
	color: #555;
	margin: 0 0 1.25rem 0;
}

.qr-sheet-code {
	padding: 1rem;
	background: #fff;
	border: 3px solid #111;
	border-radius: 16px;
	margin-bottom: 1.25rem;
}

.qr-sheet-code-img {
	display: block;
	width: 2.5in;
	height: 2.5in;
}

.qr-sheet-steps {
	max-width: 5in;
	text-align: left;
	font-size: 1rem;
	line-height: 1.5;
	color: #333;
	padding-left: 1.5rem;
	margin: 0 0 0.75rem 0;
}

.qr-sheet-steps li {
	padding-left: 0.25rem;
	margin-bottom: 0.1rem;
}

.qr-sheet-url {
	font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
	font-size: 0.8rem;
	color: #999;
	word-break: break-all;
	margin: 0.25rem 0 0 0;
}

.qr-sheet-frequency {
	max-width: 5.5in;
	font-size: 0.7rem;
	line-height: 1.35;
	color: #777;
	margin: 0.6rem 0 0 0;
}

.qr-sheet-footer {
	margin-top: auto;
	padding-top: 0.75rem;
	font-size: 0.75rem;
	color: #aaa;
}

@page {
	size: letter;
	margin: 0;
}

@media print {
	.qr-sheet-body {
		background: #fff;
		padding: 0;
		min-height: 0;
		display: block;
	}
	.qr-sheet-controls {
		display: none;
	}
	.qr-sheet {
		box-shadow: none;
		width: 8.5in;
		height: 11in;
		min-height: 11in;
		max-height: 11in;
		padding: 0.6in 1in;
		overflow: hidden;
		page-break-inside: avoid;
		page-break-after: avoid;
	}
}

/* --- Walk-in command center billboard ----------------------------- */
.lobby-code-billboard {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-2);
}

.lobby-code-value-large {
	font-size: 4rem;
	letter-spacing: 0.2em;
	padding: var(--space-4) var(--space-5);
	line-height: 1;
}

/* --- Walk-in lobby code widget on /agency ------------------------- */
.lobby-code-display {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
	align-items: flex-start;
}

.lobby-code-value {
	font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
	font-size: 2rem;
	font-weight: 600;
	letter-spacing: 0.15em;
	color: var(--color-accent, #7a3da0);
	background: var(--color-accent-soft, rgba(122, 61, 160, 0.08));
	padding: var(--space-2) var(--space-3);
	border-radius: var(--radius-md);
	border: 1px solid var(--color-accent-soft, rgba(122, 61, 160, 0.18));
}

.lobby-code-meta {
	margin: 0;
	font-size: var(--font-size-sm);
	color: var(--color-text-muted);
}

/* ---- Agency landing redesign --------------------------------------
 *
 * Top of /agency is a four-tile row (Caregivers, Candidates, Team,
 * Walk-in code), each a clickable card with a label + value + sub
 * + CTA. Below the tiles: a "Needs your attention" section (the
 * candidate queue) and recent activity, both inside .agency-section
 * containers that give them a quiet flat-card frame instead of the
 * old emoji-icon section headers.
 *
 * Walk-in code tile is a <button> rather than a link; click pops the
 * lobby-code-lightbox dialog with the code at presentation size so
 * the front desk can read it from across the room.
 */

.agency-tile-row {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: var(--space-4);
	margin: var(--space-5) 0;
}

.agency-tile {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	padding: var(--space-4) var(--space-4);
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	text-decoration: none;
	color: inherit;
	box-shadow: var(--shadow-sm);
	transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
	cursor: pointer;
	text-align: left;
	font: inherit;
}
.agency-tile:hover,
.agency-tile:focus-visible {
	border-color: var(--color-accent);
	transform: translateY(-1px);
	box-shadow: var(--shadow-md);
}
.agency-tile-button {
	/* <button> reset — we styled as a card; kill the default UA chrome */
	-webkit-appearance: none;
	appearance: none;
}
.agency-tile-highlight {
	border-color: var(--color-accent);
	background: var(--color-surface-alt);
}
.agency-tile-label {
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--color-text-muted);
}
.agency-tile-value {
	font-size: 2.5rem;
	font-weight: 700;
	line-height: 1;
	color: var(--color-text-primary);
}
.agency-tile-value-muted {
	color: var(--color-text-muted);
}
.agency-tile-sub {
	font-size: 0.9rem;
	color: var(--color-text-secondary);
}
.agency-tile-cta {
	margin-top: auto;
	padding-top: var(--space-2);
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--color-accent);
}

/* Inside the walk-in tile, the lobby-code-value override shrinks the
 * default chunky styling down to fit the card without overflowing. */
.lobby-code-value-tile {
	font-size: 1.6rem;
	padding: var(--space-1) var(--space-2);
	letter-spacing: 0.12em;
	align-self: flex-start;
}

/* Mobile: collapse 4-column tile row to 2x2. */
@media (max-width: 48rem) {
	.agency-tile-row {
		grid-template-columns: repeat(2, 1fr);
	}
	.agency-tile-value {
		font-size: 2rem;
	}
}

/* ---- Candidate scan-handoff dialog --------------------------------
 *
 * Opened from the "Scan on phone (QR)" button on the candidate
 * detail page. The selfie + name at the top let the admin confirm
 * which candidate they're handing off; the QR + step list at the
 * bottom is the actual handoff.
 */
.scan-handoff-dialog {
	border: none;
	padding: 0;
	border-radius: var(--radius-lg);
	background: var(--color-surface);
	box-shadow: var(--shadow-lg);
	max-width: 92vw;
	width: 26rem;
	position: relative;
}
.scan-handoff-dialog::backdrop {
	background: rgba(20, 28, 38, 0.55);
}
.scan-handoff-close {
	position: absolute;
	top: var(--space-3);
	right: var(--space-3);
	background: transparent;
	border: none;
	color: var(--color-text-muted);
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
	padding: var(--space-1) var(--space-2);
	border-radius: var(--radius-sm);
}
.scan-handoff-close:hover,
.scan-handoff-close:focus-visible {
	background: var(--color-surface-alt);
	color: var(--color-text-primary);
}
.scan-handoff-body {
	padding: var(--space-5);
}
.scan-handoff-header {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	margin-bottom: var(--space-4);
}
.scan-handoff-selfie {
	width: 4rem;
	height: 4rem;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid var(--color-border);
	flex-shrink: 0;
}
.scan-handoff-selfie-placeholder {
	display: inline-block;
	background: var(--color-surface-alt);
}
.scan-handoff-titles {
	min-width: 0;
}
.scan-handoff-eyebrow {
	margin: 0 0 var(--space-1) 0;
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--color-text-muted);
}
.scan-handoff-name {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--color-text-primary);
	overflow-wrap: anywhere;
}
.scan-handoff-qr-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--space-2);
	padding: var(--space-4) 0;
	border-top: 1px solid var(--color-border);
	border-bottom: 1px solid var(--color-border);
	margin-bottom: var(--space-4);
}
.scan-handoff-qr {
	width: 16rem;
	height: 16rem;
	background: var(--color-surface-alt);
	border-radius: var(--radius-md);
}
.scan-handoff-qr:not([src]) {
	/* Hide the broken-image icon while we're still fetching. */
	visibility: hidden;
}
.scan-handoff-status {
	margin: 0;
	font-size: 0.9rem;
	color: var(--color-text-muted);
}
.scan-handoff-steps {
	margin: 0;
	padding-left: var(--space-5);
	font-size: 0.9rem;
	color: var(--color-text-secondary);
	line-height: 1.5;
}
.scan-handoff-steps li {
	margin-bottom: var(--space-2);
}

/* ---- Lobby-code lightbox dialog -----------------------------------
 *
 * Opened from the agency-tile-button. Code at presentation size so
 * the front desk can read it from across an office.
 */
.lobby-code-lightbox {
	border: none;
	padding: 0;
	border-radius: var(--radius-lg);
	background: var(--color-surface);
	box-shadow: var(--shadow-lg);
	max-width: 90vw;
	width: 32rem;
}
.lobby-code-lightbox::backdrop {
	background: rgba(20, 28, 38, 0.55);
}
.lobby-code-lightbox-inner {
	padding: var(--space-6) var(--space-5);
	text-align: center;
}
.lobby-code-lightbox-label {
	margin: 0 0 var(--space-3) 0;
	font-size: 0.85rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--color-text-muted);
}
.lobby-code-lightbox-value {
	font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
	font-size: 6rem;
	font-weight: 700;
	letter-spacing: 0.18em;
	color: var(--color-accent);
	line-height: 1;
	padding: var(--space-3) 0;
}
.lobby-code-lightbox-meta {
	margin-top: var(--space-3);
	font-size: 1rem;
}
.lobby-code-lightbox-close {
	position: absolute;
	top: var(--space-3);
	right: var(--space-3);
	background: transparent;
	border: none;
	color: var(--color-text-muted);
	font-size: 1.8rem;
	line-height: 1;
	cursor: pointer;
	padding: var(--space-1) var(--space-2);
	border-radius: var(--radius-sm);
}
.lobby-code-lightbox-close:hover,
.lobby-code-lightbox-close:focus-visible {
	background: var(--color-surface-alt);
	color: var(--color-text-primary);
}

/* ---- Agency-landing sections (under the tile row) ----------------- */
.agency-section {
	margin: var(--space-6) 0;
	padding: var(--space-5);
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-sm);
}
.agency-section-title {
	margin: 0 0 var(--space-4) 0;
	font-size: 1.1rem;
	font-weight: 700;
}
.agency-section-subtitle {
	margin: var(--space-4) 0 var(--space-2) 0;
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--color-text-secondary);
}
.agency-section-subtitle:first-child {
	margin-top: 0;
}
.agency-section-empty {
	margin: 0;
	color: var(--color-text-muted);
	font-style: italic;
	line-height: 1.5;
}

/* Section urgency variants — used on the Compliance watch page so
 * the eye lands on Past-due first and slides past Completed
 * without effort. Subtle tints + left borders; the section title
 * itself stays the same weight so the difference is ambient
 * rather than shouty. */
.agency-section-danger {
	border-left: 4px solid var(--color-danger, #b3261e);
	background: linear-gradient(90deg,
		rgba(179, 38, 30, 0.04) 0%,
		var(--color-surface) 40%);
}
.agency-section-warn {
	border-left: 4px solid var(--color-warning, #FFBF40);
	background: linear-gradient(90deg,
		rgba(255, 191, 64, 0.06) 0%,
		var(--color-surface) 40%);
}
.agency-section-muted {
	opacity: 0.85;
}
.agency-section-muted .agency-section-title {
	color: var(--color-text-secondary);
	font-size: 1rem;
}

/* Past-due banner — one-line urgency line at the top of the
 * Compliance page when there's actual fire. */
.compliance-banner {
	margin: var(--space-4) 0 0 0;
	padding: var(--space-3) var(--space-4);
	background: rgba(179, 38, 30, 0.06);
	border: 1px solid rgba(179, 38, 30, 0.25);
	border-radius: var(--radius-md);
	color: var(--color-text-primary);
	font-weight: 500;
}
.compliance-banner a {
	color: var(--color-danger, #b3261e);
	font-weight: 600;
	margin-left: var(--space-2);
}

/* "Due" cell — stacks the date on top of the days-pill so the
 * column reads cleanly at a glance. */
.compliance-due {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
	min-width: 9rem;
}
.compliance-due-date {
	font-size: 0.9rem;
	color: var(--color-text-secondary);
}
.compliance-due-in {
	font-size: 0.85rem;
	color: var(--color-text-muted);
}

/* "Nudges" combined cell — count + "last nudge" timing in one
 * line. Mutes the timing component so the count anchors the eye. */
.compliance-nudges {
	white-space: nowrap;
}
.compliance-nudges-when {
	color: var(--color-text-muted);
}

/* --- Compliance-watch row actions --------------------------------- */
.compliance-row-actions {
	display: flex;
	gap: var(--space-2);
	flex-wrap: wrap;
}

.wizard-type {
	font-size: var(--font-size-xs);
	color: var(--color-text-muted);
}

/* ====================================================================
   Training (caregiver-facing) — /training list + /training/{slug}
   slideshow viewer. Mirrors the look of the Python original; uses the
   project's design tokens so it respects light/dark theme.
   ==================================================================== */

/* --- List page ---------------------------------------------------- */
.training-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: var(--space-4);
	margin-top: var(--space-4);
}

.training-card {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-4);
}

.training-card-head {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: var(--space-3);
}

.training-card-name {
	font-size: var(--text-md);
	font-weight: 600;
	margin: 0;
	line-height: 1.3;
	color: var(--color-text-primary);
}

.training-card-category {
	margin: var(--space-1) 0 0;
	font-size: var(--text-xs);
	color: var(--color-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.training-card-meta {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
	gap: var(--space-2) var(--space-4);
	margin: 0;
}

.training-card-meta > div { display: flex; flex-direction: column; gap: 2px; }
.training-card-meta dt {
	font-size: var(--text-xs);
	color: var(--color-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}
.training-card-meta dd {
	margin: 0;
	font-size: var(--text-sm);
	color: var(--color-text-primary);
	font-weight: 500;
}

.training-card-foot { margin-top: auto; }

/* --- Course card (shared component) ------------------------------- */
/* Single card used by the caregiver "My training" list and the agency
   course catalog (and the future explore page). The accent color is
   keyed to the course category via data-category -> --cat-accent; the
   tints below mix that accent with surface/transparent so no raw colors
   appear here (tokens only, per philosophy §6.1). */
.course-card {
	--cat-accent: var(--cat-default);
	display: flex;
	flex-direction: column;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-top: 3px solid var(--cat-accent);
	border-radius: var(--radius-md);
	overflow: hidden;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.course-card:hover {
	box-shadow: var(--shadow-md);
	transform: translateY(-2px);
}

.course-card[data-category="condition-specific-care"]  { --cat-accent: var(--cat-condition); }
.course-card[data-category="professional-skills"]      { --cat-accent: var(--cat-professional); }
.course-card[data-category="infection-control-safety"] { --cat-accent: var(--cat-infection); }
.course-card[data-category="personal-daily-care"]      { --cat-accent: var(--cat-personal); }
.course-card[data-category="rights-compliance"]        { --cat-accent: var(--cat-compliance); }
.course-card[data-category="first-aid-emergencies"]    { --cat-accent: var(--cat-firstaid); }

.course-card-hero {
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	display: block;
	background: var(--color-surface-alt);
}
.course-card-hero--placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(
		135deg,
		color-mix(in srgb, var(--cat-accent) 22%, var(--color-surface)),
		color-mix(in srgb, var(--cat-accent) 7%, var(--color-surface))
	);
}
.course-card-hero-glyph {
	font-size: 2.6rem;
	opacity: 0.85;
}

.course-card-body {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	padding: var(--space-4);
	flex: 1;
}
.course-card-head {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: var(--space-3);
}
.course-card-name {
	font-size: var(--text-lg);
	font-weight: 600;
	margin: 0;
	line-height: 1.3;
	color: var(--color-text-primary);
}
.course-card-category {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	margin: 0;
	font-size: var(--text-xs);
	color: var(--color-text-secondary);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}
.course-card-badge {
	flex: none;
	font-size: var(--text-xs);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 0.18rem var(--space-2);
	border-radius: var(--radius-pill, 999px);
	white-space: nowrap;
	color: var(--cat-accent);
	background: color-mix(in srgb, var(--cat-accent) 14%, transparent);
	border: 1px solid color-mix(in srgb, var(--cat-accent) 35%, transparent);
}
.course-card-meta {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
	gap: var(--space-2) var(--space-4);
	margin: 0;
}
.course-card-meta > div { display: flex; flex-direction: column; gap: 2px; }
.course-card-meta dt {
	font-size: var(--text-xs);
	color: var(--color-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}
.course-card-meta dd {
	margin: 0;
	font-size: var(--text-sm);
	color: var(--color-text-primary);
	font-weight: 500;
}
.course-card-foot {
	margin-top: auto;
	display: flex;
	align-items: center;
	gap: var(--space-3);
	flex-wrap: wrap;
}
.course-card-preview {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
	text-decoration: underline;
}
.course-card-preview:hover { color: var(--color-accent); }
.course-card-add { margin: 0; }

/* Hidden cards/shelves (agency catalog filter sets the `hidden` attr).
   .course-card / .training-shelf are display:flex author rules, which beat
   the UA `[hidden] { display:none }`, so restore hiding explicitly. */
.course-card[hidden] { display: none; }

/* --- Course shelves (category lanes) ------------------------------ */
.training-shelf {
	--cat-accent: var(--cat-default);
	margin-top: var(--space-6);
}
.training-shelf:first-child { margin-top: var(--space-4); }
.training-shelf[hidden] { display: none; }

.training-shelf[data-category="condition-specific-care"]  { --cat-accent: var(--cat-condition); }
.training-shelf[data-category="professional-skills"]      { --cat-accent: var(--cat-professional); }
.training-shelf[data-category="infection-control-safety"] { --cat-accent: var(--cat-infection); }
.training-shelf[data-category="personal-daily-care"]      { --cat-accent: var(--cat-personal); }
.training-shelf[data-category="rights-compliance"]        { --cat-accent: var(--cat-compliance); }
.training-shelf[data-category="first-aid-emergencies"]    { --cat-accent: var(--cat-firstaid); }

.training-shelf-head {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	margin-bottom: var(--space-3);
	padding-bottom: var(--space-2);
	border-bottom: 2px solid var(--cat-accent);
}
.training-shelf-icon { font-size: var(--text-lg); line-height: 1; }
.training-shelf-title {
	margin: 0;
	font-size: var(--text-lg);
	font-weight: 600;
	color: var(--color-text-primary);
}
.training-shelf-count {
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--color-text-secondary);
	background: color-mix(in srgb, var(--cat-accent) 14%, transparent);
	border-radius: var(--radius-pill, 999px);
	padding: 0.1rem var(--space-2);
}
.training-shelf-track {
	display: flex;
	gap: var(--space-4);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-padding-inline: var(--space-1);
	padding-bottom: var(--space-3);
	scrollbar-width: thin;
}
.training-shelf-track:focus-visible {
	outline: none;
	box-shadow: var(--ring-accent);
	border-radius: var(--radius-md);
}
.training-shelf-track > .course-card {
	flex: 0 0 clamp(260px, 70vw, 300px);
	scroll-snap-align: start;
}

/* --- Viewer shell ------------------------------------------------- */
.training-app {
	max-width: 1180px;
	margin: 0 auto;
	padding: var(--space-4);
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}

.training-topbar {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-3);
}

.training-back {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
}

.training-module-title {
	font-size: var(--text-lg);
	margin: 0;
	font-weight: 600;
	color: var(--color-text-primary);
}

.training-progress-text {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
	white-space: nowrap;
}

.training-progress {
	margin-bottom: var(--space-3);
}
.training-progress-bar {
	height: 4px;
	background: var(--color-surface-alt);
	border-radius: 100px;
	overflow: hidden;
}
#training-progress-fill {
	height: 100%;
	background: var(--color-accent);
	transition: width 0.25s ease;
	width: 0;
}

/* --- Intro screen ------------------------------------------------- */
.training-intro {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: var(--space-4);
	min-height: 55vh;
	text-align: center;
	padding: var(--space-6) var(--space-4);
}
.training-intro-eyebrow {
	font-size: var(--text-xs);
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--color-accent);
	font-weight: 700;
	margin: 0;
}
.training-intro-title {
	font-size: var(--text-2xl);
	margin: 0;
	font-weight: 700;
	color: var(--color-text-primary);
}
.training-intro-blurb {
	color: var(--color-text-muted);
	margin: 0;
	max-width: 540px;
	line-height: 1.5;
}

/* --- Player layout: rail + main ----------------------------------- */
.training-player {
	display: grid;
	grid-template-columns: 240px 1fr;
	gap: var(--space-4);
	align-items: start;
}

@media (max-width: 820px) {
	/* Single-column stack: rail goes on top of the slide,
	   neither sticky nor height-capped. Same shape the Python
	   original used. */
	.training-player { grid-template-columns: 1fr; }
	.training-rail {
		position: static;
		max-height: 220px; /* a short window of chapters scrolled inside */
	}

	/* Tighter padding around the page so content uses every
	   pixel of a phone width. */
	.training-app { padding: var(--space-3); gap: var(--space-3); }

	/* Topbar allows wrap and lets the progress text fall to a
	   second line on long module names. */
	.training-topbar {
		flex-wrap: wrap;
		gap: var(--space-1) var(--space-3);
	}
	.training-module-title { font-size: var(--text-md); flex-basis: 100%; }
	.training-progress-text { font-size: var(--text-xs); }

	/* Slide card: drop the min-height floor (phones don't need
	   the desktop's empty space) and shrink padding so a
	   600px-wide image isn't crushed inside a 343px viewport. */
	.training-slide-card {
		padding: var(--space-4);
		min-height: 0;
		gap: var(--space-2);
	}
	.training-slide-headline { font-size: var(--text-lg); }
	.training-slide-image { max-height: 60vh; }
	.training-slide-quote { font-size: var(--text-md); padding: var(--space-3) 0; }

	/* Nav bar: stretch both buttons to fill, equal width.
	   Bigger tap targets, no awkward gap between Previous and
	   Next on a 375px screen. */
	.training-nav-bar {
		display: flex;
		gap: var(--space-2);
		margin-top: var(--space-3);
	}
	.training-nav-bar .btn { flex: 1; padding: var(--space-3); }

	/* Intro screen: don't reserve 55vh on a short screen
	   (would push Begin off the fold on a small phone in
	   landscape). */
	.training-intro {
		min-height: 0;
		padding: var(--space-4) var(--space-2);
		gap: var(--space-3);
	}
	.training-intro-title { font-size: var(--text-xl); }

	/* Quiz card: same padding shrink as slide-card. */
	.training-quiz-card { padding: var(--space-4); }
	.training-quiz-option { padding: var(--space-3); }

	/* Preview banner: wrap and shrink so the back-link doesn't
	   overflow on a phone. */
	.training-preview-banner {
		font-size: var(--text-xs);
		padding: var(--space-2) var(--space-3);
		line-height: 1.4;
	}
	.training-preview-banner a { display: inline-block; margin-left: 0; }
}

.training-rail {
	position: sticky;
	top: var(--space-4);
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-2);
	max-height: calc(100vh - 2rem);
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.training-chapter {
	display: flex;
	gap: var(--space-2);
	align-items: flex-start;
	padding: var(--space-2) var(--space-3);
	border-radius: var(--radius-sm);
	cursor: pointer;
	background: transparent;
	border: 1px solid transparent;
	text-align: left;
	color: inherit;
	font: inherit;
}
.training-chapter:hover { background: var(--color-surface-alt); }
.training-chapter.active {
	background: var(--color-accent-soft, rgba(0, 199, 255, 0.14));
	border-color: var(--color-accent);
}
.training-chapter-num {
	flex-shrink: 0;
	width: 22px;
	font-weight: 700;
	color: var(--color-accent);
	font-size: var(--text-sm);
}
.training-chapter-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.training-chapter-title {
	font-size: var(--text-sm);
	color: var(--color-text-primary);
	font-weight: 600;
	line-height: 1.3;
}
.training-chapter-meta {
	font-size: var(--text-xs);
	color: var(--color-text-muted);
}
.training-chapter-quiz {
	margin-top: var(--space-2);
	padding-top: var(--space-2);
	border-top: 1px solid var(--color-border);
}

/* --- Slide card --------------------------------------------------- */
.training-slide-card {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-5);
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	min-height: 380px;
}

.training-section-tag {
	font-size: var(--text-xs);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--color-accent);
	font-weight: 600;
}

.training-slide-headline {
	font-size: var(--text-xl);
	font-weight: 600;
	color: var(--color-text-primary);
	line-height: 1.3;
	margin: 0;
}

.training-slide-image {
	width: 100%;
	max-height: 380px;
	object-fit: contain;
	border-radius: var(--radius-sm);
	background: var(--color-surface-alt);
}

/* Step-sequence storyboard composites are tall stacked images (cards +
   captions). Show them full-width at natural height — scrollable — instead
   of letterboxing into the hero-image height cap (which shrank them to a
   thumbnail). Higher specificity beats the base rule AND the mobile
   max-height override, so it holds on phones too. */
.training-slide-card img.training-slide-storyboard {
	max-height: none;
	width: 100%;
	height: auto;
	max-width: 680px;     /* comfortable reading size on desktop */
	margin-inline: auto;  /* centered within the wider card */
	display: block;
	background: transparent;
}

/* On phones (primary device) the storyboard uses the full width. */
@media (max-width: 820px) {
	.training-slide-card img.training-slide-storyboard {
		max-width: 100%;
	}
}

.training-slide-bullets { padding-left: 1.25rem; margin: 0; }
.training-slide-bullets li { margin: var(--space-2) 0; line-height: 1.45; }

.training-slide-callout {
	background: var(--color-accent-soft, rgba(0, 199, 255, 0.08));
	border-left: 3px solid var(--color-accent);
	padding: var(--space-3) var(--space-4);
	border-radius: var(--radius-sm);
	font-style: italic;
	color: var(--color-text-primary);
}

.training-slide-quote {
	text-align: center;
	font-size: var(--text-lg);
	line-height: 1.5;
	font-style: italic;
	padding: var(--space-4) var(--space-2);
	margin: 0;
	color: var(--color-text-primary);
}
.training-slide-quote-attr {
	text-align: center;
	margin-top: var(--space-2);
	color: var(--color-text-muted);
	font-size: var(--text-sm);
}

.training-slide-script {
	color: var(--color-text-muted);
	font-size: var(--text-sm);
	line-height: 1.6;
}
.training-slide-script summary {
	cursor: pointer;
	color: var(--color-accent);
	font-weight: 600;
}
.training-slide-script p {
	margin: var(--space-2) 0 0;
	white-space: pre-wrap;
}

.training-voiceover-bar {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	background: var(--color-surface-alt);
	border-radius: var(--radius-sm);
	padding: var(--space-2) var(--space-3);
}
.training-voiceover-bar audio { flex: 1 1 auto; width: auto; min-width: 0; }
.training-vo-speed {
	flex: 0 0 auto;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}
.training-vo-speed.active {
	background: var(--gradient-primary);
	color: var(--color-accent-fg);
	border-color: transparent;
}

/* Slide-level video (e.g. the safe glove-removal demo) — large and
   mobile-friendly, matching the storyboard image sizing. */
.training-video-bar {
	margin-top: var(--space-3);
}
.training-slide-video {
	display: block;
	width: 100%;
	max-width: 680px;
	height: auto;
	margin-inline: auto;
	border-radius: var(--radius-sm);
	background: #000;
}
@media (max-width: 820px) {
	.training-slide-video { max-width: 100%; }
}

/* --- Nav bar ------------------------------------------------------ */
.training-nav-bar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: var(--space-4);
	gap: var(--space-3);
}
.training-nav-center { justify-content: center; }

/* --- Quiz --------------------------------------------------------- */
.training-quiz-view.hidden,
.training-slide-view.hidden,
.hidden { display: none !important; }

.training-quiz-card {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-5);
}

.training-quiz-progress-text {
	color: var(--color-text-muted);
	font-size: var(--text-sm);
	margin: 0 0 var(--space-4);
}

.training-quiz-question {
	margin: 0 0 var(--space-5);
	padding: 0 0 var(--space-4);
	border: none;
	border-bottom: 1px solid var(--color-border);
}
.training-quiz-question:last-of-type {
	border-bottom: none;
	padding-bottom: 0;
	margin-bottom: 0;
}
.training-quiz-prompt {
	padding: 0;
	font-weight: 500;
	color: var(--color-text-primary);
	margin-bottom: var(--space-3);
	line-height: 1.4;
}

.training-quiz-options {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}
.training-quiz-option {
	display: flex;
	gap: var(--space-3);
	align-items: flex-start;
	padding: var(--space-3) var(--space-3);
	background: var(--color-surface-alt);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	cursor: pointer;
	line-height: 1.4;
	color: var(--color-text-primary);
	font: inherit;
	text-align: left;
}
.training-quiz-option:hover { border-color: var(--color-accent); }
.training-quiz-option.selected {
	background: var(--color-accent-soft, rgba(0, 199, 255, 0.1));
	border-color: var(--color-accent);
}
.training-quiz-option-key {
	font-weight: 700;
	color: var(--color-accent);
	flex-shrink: 0;
	min-width: 1.25rem;
}

/* --- Quiz results ------------------------------------------------- */
.training-quiz-results {
	text-align: center;
	padding: var(--space-5) var(--space-3);
}
.training-quiz-results-label {
	color: var(--color-text-muted);
	font-size: var(--text-sm);
	margin: 0;
}
.training-quiz-score-big {
	font-size: 3.5rem;
	font-weight: 700;
	line-height: 1;
	margin: var(--space-2) 0;
}
.training-quiz-score-big.pass { color: var(--color-success, #2e7d32); }
.training-quiz-score-big.fail { color: var(--color-danger, #c62828); }
.training-quiz-result-msg { color: var(--color-text-muted); margin: var(--space-2) 0 0; }

.training-quiz-cooldown {
	background: var(--color-warning-soft, rgba(255,199,0,0.1));
	border: 1px solid var(--color-warning, rgba(255,199,0,0.4));
	color: var(--color-warning-strong, #b15a00);
	padding: var(--space-3) var(--space-4);
	border-radius: var(--radius-sm);
	font-size: var(--text-sm);
	margin: var(--space-3) auto;
	max-width: 480px;
}

.training-quiz-pass-banner {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	background: var(--color-success-soft, rgba(102, 204, 153, 0.12));
	border: 1px solid var(--color-success, rgba(102, 204, 153, 0.45));
	color: var(--color-success-strong, #1b5e20);
	padding: var(--space-4);
	border-radius: var(--radius-md);
	font-size: var(--text-sm);
	line-height: 1.4;
	margin: var(--space-3) auto;
	max-width: 520px;
	text-align: left;
}
.training-quiz-pass-emoji { font-size: 1.6rem; line-height: 1; }
.training-quiz-pass-sub {
	color: var(--color-text-muted);
	font-size: var(--text-xs);
	margin-top: 2px;
}
.training-quiz-missed {
	color: var(--color-text-muted);
	font-size: var(--text-sm);
	margin: var(--space-2) 0;
}
.training-quiz-error {
	color: var(--color-danger, #c62828);
	font-weight: 600;
	margin: 0;
}

/* ====================================================================
   Sortable-table column headers — driven by static/js/sortable-table.js.
   ==================================================================== */
.sortable-th {
	cursor: pointer;
	user-select: none;
	white-space: nowrap;
}
.sortable-th:hover { color: var(--color-accent); }
.sortable-th:focus-visible {
	outline: 2px solid var(--color-accent);
	outline-offset: 2px;
	border-radius: var(--radius-sm);
}

.sortable-indicator {
	display: inline-block;
	width: 0.75em;
	margin-left: var(--space-1);
	color: var(--color-text-muted);
	font-size: 0.8em;
	vertical-align: middle;
}
.sortable-active .sortable-indicator { color: var(--color-accent); }
.sortable-active.sortable-asc .sortable-indicator::before { content: "▲"; }
.sortable-active.sortable-desc .sortable-indicator::before { content: "▼"; }

/* ====================================================================
   Mandate-matrix reveal — markets nested under their parent state.
   ==================================================================== */
.mandate-markets {
	margin-top: var(--space-3);
	padding-top: var(--space-3);
	border-top: 1px dashed var(--color-border);
}
.mandate-markets-summary {
	cursor: pointer;
	user-select: none;
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	font-weight: 600;
	color: var(--color-text-muted);
	font-size: var(--text-sm);
	padding: var(--space-1) 0;
	list-style: none;
}
.mandate-markets-summary::-webkit-details-marker { display: none; }
.mandate-markets-summary:hover { color: var(--color-accent); }
.mandate-markets[open] .mandate-markets-summary { color: var(--color-text-primary); }
.mandate-markets-count {
	display: inline-block;
	background: var(--color-surface-alt);
	border-radius: 100px;
	padding: 0 var(--space-2);
	font-size: var(--text-xs);
	color: var(--color-text-muted);
}
.mandate-block-market {
	margin-top: var(--space-3);
	margin-left: var(--space-4);
	border-left: 2px solid var(--color-border);
	padding-left: var(--space-3);
}

/* ====================================================================
   Compliance watch — Required-not-done caregiver-grouped cards.
   ==================================================================== */
.compliance-care-card {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-3) var(--space-4);
	margin-bottom: var(--space-4);
}

.compliance-care-head {
	display: flex;
	align-items: baseline;
	gap: var(--space-3);
	flex-wrap: wrap;
	margin-bottom: var(--space-2);
	padding-bottom: var(--space-2);
	border-bottom: 1px solid var(--color-border);
}
.compliance-care-name {
	font-size: var(--text-md);
	font-weight: 600;
	color: var(--color-text-primary);
}
.compliance-care-name:hover { color: var(--color-accent); }
.compliance-care-count {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
}
.compliance-care-oldest {
	margin-left: auto;
	font-size: var(--text-sm);
	color: var(--color-text-muted);
}

.compliance-care-table {
	margin: 0;
}
.compliance-care-table thead th {
	font-size: var(--text-xs);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--color-text-muted);
}

/* ====================================================================
   .table-scroll — opt-in scroll wrapper for tables that read better
   wide than collapsed. Wide tables shrunk by the global mobile
   pass below look cramped at 6+ columns; this lets the table keep
   its native width and scroll inside its own box instead. Apply
   by wrapping a table in <div class="table-scroll">…</div>.
   ==================================================================== */
.table-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	/* Make the right-edge fade visible as an affordance so users
	   notice the content extends past what's visible. */
	background:
		linear-gradient(to right, var(--color-surface) 30%, transparent),
		linear-gradient(to right, transparent, var(--color-surface) 70%) right;
	background-repeat: no-repeat;
	background-size: 24px 100%, 24px 100%;
	background-attachment: local, local;
}
/* Inside a .table-scroll the table keeps its natural sizing —
   undo the global mobile shrink so the columns don't crush down
   on top of the scroll. */
.table-scroll .settings-table {
	min-width: 540px;
}
@media (max-width: 640px) {
	.table-scroll .settings-table {
		font-size: var(--text-sm);
	}
	.table-scroll .settings-table th,
	.table-scroll .settings-table td {
		padding: var(--space-2) var(--space-3);
		word-break: normal;
		white-space: nowrap;
	}
}

/* ====================================================================
   Training preview mode — admin watch-only.
   ==================================================================== */
.mandate-chip-preview {
	font-size: var(--text-xs);
	color: var(--color-accent);
	text-decoration: none;
	padding: 2px var(--space-2);
	border: 1px solid var(--color-border);
	border-radius: 100px;
	margin-left: var(--space-1);
}
.mandate-chip-preview:hover {
	background: var(--color-accent);
	color: var(--color-bg);
	border-color: var(--color-accent);
}

.training-preview-banner {
	background: var(--color-warning-soft, rgba(255, 199, 0, 0.14));
	border: 1px solid var(--color-warning, rgba(255, 199, 0, 0.4));
	color: var(--color-text-primary);
	padding: var(--space-2) var(--space-4);
	border-radius: var(--radius-sm);
	font-size: var(--text-sm);
	margin-bottom: var(--space-3);
}
.training-preview-banner strong { font-weight: 600; }
.training-preview-banner a {
	margin-left: var(--space-2);
	color: var(--color-accent);
}

/* ====================================================================
   Generic status pills — used across /training, /onboarding,
   /onboarding/documents and any future caregiver-facing surface.
   ==================================================================== */
.pill {
	display: inline-block;
	font-size: var(--text-xs);
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	padding: 0.18rem var(--space-2);
	border-radius: var(--radius-pill, 999px);
	border: 1px solid transparent;
	white-space: nowrap;
}
.pill-success {
	background: var(--color-success-soft, rgba(102, 204, 153, 0.18));
	color: var(--color-success-strong, #1b5e20);
	border-color: var(--color-success-soft, rgba(102, 204, 153, 0.45));
}
.pill-info {
	background: var(--color-accent-soft, rgba(0, 199, 255, 0.14));
	color: var(--color-accent);
	border-color: var(--color-accent-soft, rgba(0, 199, 255, 0.35));
}
.pill-warning {
	background: var(--color-warning-soft, rgba(255, 199, 0, 0.14));
	color: var(--color-warning-strong, #b15a00);
	border-color: var(--color-warning, rgba(255, 199, 0, 0.4));
}
.pill-muted {
	background: var(--color-surface-alt);
	color: var(--color-text-muted);
	border-color: var(--color-border);
}
.pill-accent {
	background: var(--color-accent);
	color: var(--color-bg);
	border-color: var(--color-accent);
}
.pill-danger {
	background: var(--color-danger-soft, rgba(179, 38, 30, 0.12));
	color: var(--color-danger, #b3261e);
	border-color: var(--color-danger-soft, rgba(179, 38, 30, 0.35));
}

/* ====================================================================
   /onboarding home + /onboarding/documents.
   ==================================================================== */
.onboarding-wrap {
	max-width: 800px;
	margin: 0 auto;
	padding: var(--space-5) var(--space-4);
}

.onboarding-head { margin-bottom: var(--space-5); }

/* Brand band at the top — franchise logo + agency name in a
   bordered banner so the candidate clearly sees who's onboarding
   them. Accent-soft tint distinguishes it from a generic info
   card; an accent left-stripe ties it to the wizard's primary
   color. Wraps cleanly when the agency name is long. */
.onboarding-brand-band {
	display: flex;
	align-items: center;
	gap: var(--space-4);
	padding: var(--space-4) var(--space-4) var(--space-4) var(--space-3);
	background: var(--color-accent-soft, rgba(122, 61, 160, 0.08));
	border: 1px solid var(--color-border);
	border-left: 4px solid var(--color-accent, #7a3da0);
	border-radius: var(--radius-md);
	margin-bottom: var(--space-4);
}
/* Logo in a small white "tile" so a colored mark reads cleanly
   on top of the tinted banner background and a single-color
   logo (e.g. solid black) still has contrast. */
.onboarding-brand-logo {
	display: block;
	height: 3rem;
	width: auto;
	max-width: 7rem;
	object-fit: contain;
	flex-shrink: 0;
	background: #fff;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	padding: 4px 8px;
	box-sizing: content-box;
}
.onboarding-brand-text {
	min-width: 0;
	flex: 1;
}
.onboarding-brand-label {
	font-size: var(--text-xs);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--color-text-muted);
	margin: 0;
	line-height: 1.2;
	font-weight: 600;
}
.onboarding-brand-name {
	font-size: var(--text-lg);
	color: var(--color-text-primary);
	font-weight: 700;
	margin: 4px 0 0;
	line-height: 1.25;
	/* Allow wrap on narrow viewports — long agency names like
	   "Right at Home Murrells Inlet" need it rather than the
	   ellipsis they were getting. */
	overflow-wrap: break-word;
}

@media (max-width: 640px) {
	.onboarding-brand-band {
		padding: var(--space-3) var(--space-3) var(--space-3) var(--space-2);
		gap: var(--space-3);
	}
	.onboarding-brand-logo {
		height: 2.6rem;
		max-width: 5.5rem;
		padding: 3px 5px;
	}
	.onboarding-brand-name {
		font-size: var(--text-md);
	}
}
.onboarding-greeting {
	font-size: var(--text-2xl);
	color: var(--color-text-primary);
	font-weight: 700;
	margin: 0 0 var(--space-2);
}
.onboarding-intro {
	color: var(--color-text-muted);
	margin: 0;
	line-height: 1.55;
}

.onboarding-all-done {
	display: flex;
	gap: var(--space-3);
	align-items: center;
	background: var(--color-success-soft, rgba(102, 204, 153, 0.10));
	border: 1px solid var(--color-success, rgba(102, 204, 153, 0.4));
	color: var(--color-success-strong, #1b5e20);
	padding: var(--space-4);
	border-radius: var(--radius-md);
	margin-bottom: var(--space-4);
}
.onboarding-all-done-emoji { font-size: 1.6rem; }
.onboarding-all-done-sub {
	color: var(--color-text-muted);
	font-size: var(--text-sm);
	margin-top: 2px;
}

/* Wizard hub — franchise mark above the greeting. */
.onboarding-brand-logo {
	display: block;
	max-height: 3rem;
	width: auto;
	max-width: 14rem;
	object-fit: contain;
	margin: 0 0 var(--space-3) 0;
}

/* Progress strip (slim bar + label). Replaces the per-step bars
   from the old dashboard — overall progress is what the wizard
   surfaces; per-step state lives in the TOC. */
.onboarding-progress {
	margin: 0 0 var(--space-4) 0;
}
.onboarding-progress-bar {
	height: 6px;
	background: var(--color-surface-alt);
	border-radius: 100px;
	overflow: hidden;
}
.onboarding-progress-fill {
	height: 100%;
	background: var(--color-accent);
	transition: width 0.25s ease;
}
.onboarding-progress-label {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
	margin: var(--space-2) 0 0 0;
}
.onboarding-progress-label strong {
	color: var(--color-text-primary);
	font-weight: 600;
}

/* The single big "Continue where you left off" CTA panel. On
   wide viewports a 3-column row (icon | body | button); below
   the breakpoint everything stacks and the CTA spans full-width
   so a long title never has to wrap around a side-pinned button. */
.onboarding-continue {
	display: grid;
	grid-template-columns: auto 1fr auto;
	grid-template-areas: "icon body cta";
	gap: var(--space-4);
	align-items: center;
	background: var(--color-surface);
	border: 2px solid var(--color-accent, #7a3da0);
	border-radius: var(--radius-md);
	padding: var(--space-5);
	margin-bottom: var(--space-5);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}
.onboarding-continue-icon {
	font-size: 2.4rem;
	line-height: 1;
	grid-area: icon;
}
.onboarding-continue-body {
	min-width: 0;
	grid-area: body;
}
.onboarding-continue-eyebrow {
	font-size: var(--text-xs);
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--color-text-muted);
	margin: 0 0 var(--space-1);
	white-space: nowrap;
}
.onboarding-continue-title {
	font-size: var(--text-xl);
	font-weight: 700;
	color: var(--color-text-primary);
	margin: 0 0 var(--space-1);
	line-height: 1.25;
}
.onboarding-continue-action {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
	margin: 0;
}
.onboarding-continue-cta {
	grid-area: cta;
	min-width: 8rem;
	justify-content: center;
}

@media (max-width: 640px) {
	.onboarding-continue {
		grid-template-columns: auto 1fr;
		grid-template-areas:
			"icon body"
			"cta  cta";
		gap: var(--space-3);
		padding: var(--space-4);
	}
	.onboarding-continue-icon {
		align-self: start;
		font-size: 2rem;
	}
	.onboarding-continue-cta {
		width: 100%;
		margin-top: var(--space-2);
	}
}

/* "Job alerts" card — optional zone-subscription prompt that
   lives below the required wizard on /onboarding. Same 3-col
   grid as .onboarding-continue, but quieter visual weight (no
   accent border, smaller padding). */
.onboarding-zones-card {
	display: grid;
	grid-template-columns: auto 1fr auto;
	grid-template-areas: "icon body cta";
	gap: var(--space-4);
	align-items: center;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-4);
	margin-bottom: var(--space-5);
}
.onboarding-zones-card-icon {
	font-size: 1.8rem;
	line-height: 1;
	grid-area: icon;
}
.onboarding-zones-card-body {
	min-width: 0;
	grid-area: body;
}
.onboarding-zones-card-eyebrow {
	font-size: var(--text-xs);
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--color-text-muted);
	margin: 0 0 var(--space-1);
}
.onboarding-zones-card-title {
	font-size: var(--text-lg);
	font-weight: 700;
	color: var(--color-text-primary);
	margin: 0 0 var(--space-1);
}
.onboarding-zones-card-desc {
	font-size: var(--text-sm);
	color: var(--color-text-secondary);
	margin: 0;
	line-height: 1.45;
}
.onboarding-zones-card-cta {
	grid-area: cta;
	min-width: 6rem;
	justify-content: center;
}
@media (max-width: 540px) {
	.onboarding-zones-card {
		grid-template-columns: auto 1fr;
		grid-template-areas:
			"icon body"
			"cta  cta";
	}
	.onboarding-zones-card-cta {
		width: 100%;
		margin-top: var(--space-2);
	}
}

/* /onboarding/zones — checkbox list of available zones. */
.onboarding-zones-market {
	margin: 0 0 var(--space-3);
	color: var(--color-text-muted);
	font-size: var(--text-sm);
}
.onboarding-zones-list {
	list-style: none;
	padding: 0;
	margin: 0 0 var(--space-4);
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}
.onboarding-zones-row {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	padding: var(--space-3);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md, 8px);
	cursor: pointer;
	transition: background-color 120ms ease;
}
.onboarding-zones-row:hover {
	background: var(--color-surface-alt);
}
.onboarding-zones-row input[type="checkbox"] {
	width: 1.2rem;
	height: 1.2rem;
}
.onboarding-zones-name {
	font-size: var(--text-base);
	font-weight: 500;
}
.onboarding-zones-actions {
	display: flex;
	align-items: center;
	gap: var(--space-5);
	flex-wrap: wrap;
	margin-top: var(--space-4);
}

/* TOC disclosure — collapsed by default; opens to a list of
   every required step with status pills + click-to-jump. */
.onboarding-toc {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-3) var(--space-4);
}
/* Replace the default `▶` triangle with a styled chevron that
   rotates on open. list-style: none kills the marker on most
   browsers; the ::-webkit-details-marker rule covers Safari. */
.onboarding-toc-summary {
	cursor: pointer;
	font-weight: 600;
	color: var(--color-text-primary);
	padding: var(--space-2) 0 var(--space-2) 1.6rem;
	position: relative;
	list-style: none;
	user-select: none;
}
.onboarding-toc-summary::-webkit-details-marker { display: none; }
.onboarding-toc-summary::before {
	content: "";
	position: absolute;
	left: 0.15rem;
	top: 50%;
	width: 0.55rem;
	height: 0.55rem;
	border-right: 2px solid var(--color-text-muted);
	border-bottom: 2px solid var(--color-text-muted);
	transform: translateY(-65%) rotate(-45deg);
	transition: transform 0.18s ease;
}
.onboarding-toc[open] .onboarding-toc-summary::before {
	transform: translateY(-35%) rotate(45deg);
}
.onboarding-toc-count {
	font-weight: 400;
	color: var(--color-text-muted);
	font-size: var(--text-sm);
}
.onboarding-toc-list {
	list-style: none;
	padding: 0;
	margin: var(--space-2) 0 0 0;
}
.onboarding-toc-row {
	border-top: 1px solid var(--color-border);
}
.onboarding-toc-row:first-child {
	border-top: none;
}
.onboarding-toc-link {
	display: grid;
	grid-template-columns: 1.4rem 1.6rem 1fr auto;
	gap: var(--space-3);
	align-items: center;
	padding: var(--space-3) var(--space-2);
	text-decoration: none;
	color: var(--color-text-primary);
}
.onboarding-toc-link:hover {
	background: var(--color-surface-alt);
}
.onboarding-toc-num {
	font-variant-numeric: tabular-nums;
	color: var(--color-text-muted);
	font-size: var(--text-sm);
	text-align: right;
}
.onboarding-toc-icon { font-size: 1.2rem; line-height: 1; }
.onboarding-toc-body {
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.onboarding-toc-title {
	font-weight: 500;
	color: var(--color-text-primary);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.onboarding-toc-kind {
	font-size: var(--text-xs);
	color: var(--color-text-muted);
}
.onboarding-toc-row-done .onboarding-toc-title { color: var(--color-text-muted); }

.onboarding-step {
	display: grid;
	grid-template-columns: auto 1fr auto;
	gap: var(--space-4);
	align-items: center;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-4) var(--space-5);
	margin-bottom: var(--space-3);
}
.onboarding-step-next {
	border-color: var(--color-accent);
	box-shadow: 0 0 0 1px var(--color-accent-soft, rgba(0,199,255,0.2));
}
.onboarding-step-complete { border-color: var(--color-success, rgba(102,204,153,0.5)); }
.onboarding-step-icon { font-size: 1.6rem; line-height: 1; }
.onboarding-step-body { min-width: 0; }
.onboarding-step-title {
	font-size: var(--text-md);
	font-weight: 600;
	color: var(--color-text-primary);
	margin: var(--space-1) 0 var(--space-1);
}
.onboarding-step-progress {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
	margin: 0 0 var(--space-2);
}
.onboarding-step-progress strong {
	color: var(--color-text-primary);
	font-weight: 600;
}
.onboarding-step-bar {
	height: 4px;
	background: var(--color-surface-alt);
	border-radius: 100px;
	overflow: hidden;
	max-width: 360px;
}
.onboarding-step-bar-fill {
	height: 100%;
	background: var(--color-accent);
	transition: width 0.25s ease;
}
.onboarding-step-bar-fill-done {
	background: var(--color-success, #66cc99);
}

.onboarding-doc-list {
	list-style: none;
	padding: 0;
	margin: 0;
}
.onboarding-doc-row {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	padding: var(--space-3) var(--space-4);
	border-bottom: 1px solid var(--color-border);
}
.onboarding-doc-row:last-child { border-bottom: none; }
.onboarding-doc-body { flex: 1; min-width: 0; }
.onboarding-doc-name {
	margin: 0;
	font-weight: 600;
	color: var(--color-text-primary);
}
.onboarding-doc-meta {
	margin: 2px 0 0;
	color: var(--color-text-muted);
	font-size: var(--text-sm);
}
.onboarding-doc-cta { margin-left: var(--space-2); }

/* ====================================================================
   Document signing wizard — /onboarding/documents/{slug}/sign.
   Focused on legibility for documents you're being asked to read +
   sign legally; smaller line lengths, larger body text.
   ==================================================================== */
.onboarding-sign-wrap { max-width: 720px; }

.signing-doc {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-5);
	margin-bottom: var(--space-4);
	line-height: 1.6;
}
.signing-doc-section {
	font-size: var(--text-lg);
	font-weight: 600;
	margin: var(--space-4) 0 var(--space-2);
	color: var(--color-text-primary);
}
.signing-doc-subhead {
	font-size: var(--text-md);
	font-weight: 600;
	margin: var(--space-3) 0 var(--space-2);
	color: var(--color-text-primary);
}
.signing-doc-paragraph { margin: 0 0 var(--space-3); }
.signing-doc-divider {
	border: none;
	border-top: 1px solid var(--color-border);
	margin: var(--space-4) 0;
}

.signing-doc-field-group {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: var(--space-3);
	margin: var(--space-3) 0;
}
.signing-doc-field { display: flex; flex-direction: column; gap: var(--space-1); }
.signing-doc-field-label {
	font-size: var(--text-xs);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--color-text-muted);
}

.signing-doc-checkboxes,
.signing-doc-yesno,
.signing-doc-choices {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	margin: var(--space-3) 0;
	border: none;
	padding: 0;
}
.signing-doc-yesno legend,
.signing-doc-choices legend {
	margin-bottom: var(--space-2);
	font-weight: 600;
	color: var(--color-text-primary);
}
.signing-doc-checkbox,
.signing-doc-radio {
	display: flex;
	gap: var(--space-2);
	align-items: flex-start;
	padding: var(--space-2);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	cursor: pointer;
}
.signing-doc-checkbox:hover,
.signing-doc-radio:hover { border-color: var(--color-accent); }
.signing-doc-checkbox input,
.signing-doc-radio input { margin-top: 3px; }

.signing-doc-list-block {
	margin: var(--space-3) 0;
	padding: var(--space-3) var(--space-4);
	background: var(--color-surface-alt);
	border-radius: var(--radius-sm);
}
.signing-doc-list-block ul { padding-left: 1.25rem; margin: 0; }

/* --- Signature panel --- */
.signing-block {
	background: var(--color-surface);
	border: 1px solid var(--color-accent);
	box-shadow: 0 0 0 1px var(--color-accent-soft, rgba(0,199,255,0.2));
	border-radius: var(--radius-md);
	padding: var(--space-5);
	margin-bottom: var(--space-4);
}
.signing-block-title {
	margin: 0 0 var(--space-2);
	font-size: var(--text-lg);
	font-weight: 600;
}
.signing-block-consent {
	color: var(--color-text-muted);
	font-size: var(--text-sm);
	margin: 0 0 var(--space-3);
	line-height: 1.5;
}

.signing-pad-tabs {
	display: flex;
	gap: var(--space-2);
	margin-bottom: var(--space-3);
}
.signing-pad-tab {
	background: transparent;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	padding: var(--space-1) var(--space-3);
	font-size: var(--text-sm);
	color: var(--color-text-muted);
	cursor: pointer;
	font: inherit;
}
.signing-pad-tab-active {
	background: var(--color-accent);
	color: var(--color-bg);
	border-color: var(--color-accent);
}

.signing-pad-canvas {
	width: 100%;
	max-width: 100%;
	height: 180px;
	background: #fff;
	border: 1px dashed var(--color-border);
	border-radius: var(--radius-sm);
	touch-action: none;
	cursor: crosshair;
	display: block;
}
.signing-pad-actions {
	display: flex;
	justify-content: flex-end;
	margin-top: var(--space-2);
}

.signing-pad-typed-input {
	width: 100%;
	margin-bottom: var(--space-3);
}
.signing-pad-typed-preview {
	min-height: 90px;
	background: #fff;
	color: #111;
	border: 1px dashed var(--color-border);
	border-radius: var(--radius-sm);
	padding: var(--space-3) var(--space-4);
	font-family: 'Great Vibes', 'Brush Script MT', cursive;
	font-style: italic;
	font-size: 2.4rem;
	display: flex;
	align-items: center;
	justify-content: center;
}

.signing-actions {
	display: flex;
	justify-content: space-between;
	gap: var(--space-3);
	margin-bottom: var(--space-5);
}

/* ====================================================================
   Document-capture wizard (`/caregiver/documents/{tid}/upload`).
   Mobile-first: a candidate clicked an SMS link on their phone, the
   page should look like a flow, not a form. Mirrors the walk-in
   shell visually but tighter — fewer steps, more focused.
   ==================================================================== */

.doc-capture-page {
	max-width: 32rem;
	margin: 0 auto;
	padding: var(--space-5) var(--space-4);
}

.doc-capture-bar {
	margin-bottom: var(--space-5);
}

.doc-capture-bar .eyebrow {
	margin: 0 0 var(--space-3) 0;
}

.doc-capture-steps {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	gap: var(--space-2);
	justify-content: space-between;
}

.doc-capture-step {
	display: flex;
	flex-direction: column;
	align-items: center;
	flex: 1;
	font-size: var(--font-size-xs);
	color: var(--color-text-muted);
	min-width: 0;
}

.doc-capture-step-num {
	width: 1.8rem;
	height: 1.8rem;
	border-radius: 50%;
	background: var(--color-surface-muted, #efefef);
	color: var(--color-text-muted);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	margin-bottom: var(--space-1);
	border: 2px solid var(--color-border);
}

.doc-capture-step-active .doc-capture-step-num {
	background: var(--color-accent, #7a3da0);
	color: white;
	border-color: var(--color-accent, #7a3da0);
}

.doc-capture-step-active .doc-capture-step-label {
	color: var(--color-text);
	font-weight: 600;
}

.doc-capture-step-done .doc-capture-step-num {
	background: var(--color-accent-soft, rgba(122, 61, 160, 0.18));
	color: var(--color-accent, #7a3da0);
	border-color: var(--color-accent, #7a3da0);
}

.doc-capture-step-label {
	font-size: var(--font-size-xs);
	line-height: 1.1;
	text-align: center;
}

.doc-capture {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-5);
}

.doc-capture-title {
	font-size: 1.5rem;
	font-weight: 700;
	margin: 0 0 var(--space-2) 0;
}

.doc-capture-lede {
	color: var(--color-text-muted);
	margin: 0 0 var(--space-4) 0;
	line-height: 1.5;
}

.doc-capture-tips {
	background: var(--color-accent-soft, rgba(122, 61, 160, 0.10));
	border-left: 3px solid var(--color-accent, #7a3da0);
	border-radius: var(--radius-sm);
	padding: var(--space-3) var(--space-4);
	margin: 0 0 var(--space-4) 0;
}

.doc-capture-tips-heading {
	margin: 0 0 var(--space-2) 0;
	font-weight: 600;
	font-size: var(--font-size-sm);
}

.doc-capture-tips-list {
	margin: 0;
	padding-left: 1.1rem;
	font-size: var(--font-size-sm);
	line-height: 1.5;
}

.doc-capture-tips-list li {
	margin-bottom: var(--space-2);
}

.doc-capture-tips-list li:last-child {
	margin-bottom: 0;
}

.doc-capture-actions {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	margin-top: var(--space-4);
}

.doc-capture-actions .btn {
	width: 100%;
	justify-content: center;
}

.doc-capture-footnote {
	margin-top: var(--space-5);
	text-align: center;
	font-size: var(--font-size-sm);
}

.doc-capture-footnote-link {
	color: var(--color-text-muted);
}

.doc-capture-preview-wrap {
	background: var(--color-surface-muted, #f6f6f6);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	min-height: 12rem;
	margin: 0 0 var(--space-4) 0;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--space-3);
}

.doc-capture-preview {
	display: block;
	max-width: 100%;
	max-height: 24rem;
	height: auto;
	width: auto;
}

.doc-capture-pdf-note {
	text-align: center;
	color: var(--color-text);
}

.doc-capture-pdf-icon {
	font-size: 3rem;
	margin: 0 0 var(--space-2) 0;
}

.doc-capture-pdf-hint {
	margin: var(--space-2) 0 0 0;
	color: var(--color-text-muted);
	font-size: var(--font-size-sm);
}

.doc-capture-expires {
	margin: 0 0 var(--space-4) 0;
}

.doc-capture-optional {
	color: var(--color-text-muted);
	font-weight: 400;
	font-size: var(--font-size-sm);
}

/* The capture dialog covers the viewport so the live camera feed
   has full space — like the walk-in scanner. */
.doc-capture-dialog {
	border: none;
	padding: 0;
	margin: 0;
	max-width: 100vw;
	max-height: 100vh;
	width: 100vw;
	height: 100vh;
	background: #000;
	color: #fff;
	display: flex;
	flex-direction: column;
}

.doc-capture-dialog::backdrop {
	background: rgba(0, 0, 0, 0.85);
}

.doc-capture-dialog[open] {
	display: flex;
}

.doc-capture-video {
	flex: 1;
	width: 100%;
	min-height: 0;
	object-fit: contain;
	background: #000;
}

.doc-capture-dialog-actions {
	padding: var(--space-4);
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	background: rgba(0, 0, 0, 0.6);
}

.doc-capture-dialog-actions .btn {
	width: 100%;
	justify-content: center;
}

/* ====================================================================
   Site-wide mobile pass — ≤640px (phones in portrait and most in
   landscape). Targets the common side-scroll + readability issues:
   header layouts that don't wrap, tables that force minimum width,
   padding that eats viewport, and long unbreakable strings (UUIDs,
   slugs) that push content past the right edge.
   ==================================================================== */
@media (max-width: 640px) {
	/* The global overflow-x:clip on html+body (see the top of
	   this file) is the production safety net at every viewport
	   size. Most overflow comes from a single rogue child
	   (a too-wide table, an unbreakable UUID); the rules below
	   target each at its source. */

	/* --- Header / footer / page shell ---------------------------- */

	.site-header {
		padding: var(--space-2) var(--space-3);
		flex-wrap: nowrap;
		gap: var(--space-2);
		align-items: center;
	}
	.site-nav {
		/* Just the bell + the avatar menu now — one tidy row, no wrap.
		   (The agency name moved out of the header; multi-agency
		   switching lives in the avatar dropdown.) */
		gap: var(--space-2);
		flex-wrap: nowrap;
		justify-content: flex-end;
	}
	.brand-logo:not(.brand-logo-lg) { height: 28px; }

	/* On small screens, drop the header buttons to icon-only —
	   labels were pushing the row to wrap and making the whole
	   header look jumbled. Tooltips + aria-labels keep them
	   accessible. */
	.header-btn-label { display: none; }
	.header-btn {
		padding: 0 var(--space-2);
		min-width: 36px;
		justify-content: center;
	}

	/* Context label wraps to 2 lines on long agency names so
	   "Right at Home Murrells Inlet" stays fully visible.
	   `-webkit-line-clamp: 2` truncates with an ellipsis past
	   2 lines so an absurdly long name doesn't blow the header
	   height; in practice every real agency name fits. */
	.ctx-switcher-static {
		max-width: 11rem;
		white-space: normal;
		word-break: break-word;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		line-height: 1.2;
		padding: 2px var(--space-2);
		font-size: var(--text-xs);
	}
	/* The selector form drops to a row of its own underneath the
	   logo+icons strip — full width gives the agency name room to
	   read without truncation. order:999 keeps it last in the
	   wrapped nav; flex-basis:100% forces the row break. The
	   "ACTING AS" label stays hidden — the dropdown's selected
	   option text ("Agency · rank") already conveys what it is,
	   and re-introducing the label clipped against the row edge
	   on narrow viewports. The single-context
	   .ctx-switcher-static keeps its inline 11rem treatment
	   above since it's just a short status label. */
	.ctx-switcher {
		order: 999;
		flex-basis: 100%;
		justify-content: flex-end;
		margin-top: var(--space-3);
	}
	.ctx-switcher-label { display: none; }
	.ctx-switcher-select {
		flex: 1;
		min-width: 0;
		max-width: 100%;
	}

	.page {
		padding: var(--space-4) var(--space-3);
	}
	.site-footer {
		padding: var(--space-3);
		font-size: var(--text-xs);
	}

	/* --- Admin bar (page header strip used on every dashboard) -- */

	.admin-bar {
		flex-wrap: wrap;
		gap: var(--space-3);
		padding-bottom: var(--space-3);
		margin-bottom: var(--space-4);
		align-items: flex-start;
	}
	.admin-title { font-size: var(--text-xl); }

	/* --- Sections --------------------------------------------- */

	.admin-section { margin-bottom: var(--space-5); }
	.admin-section-header {
		flex-wrap: wrap;
		gap: var(--space-2);
	}

	/* --- Tables: shrink + allow breaks. Cells with long names
	   (caregivers, modules) now wrap instead of forcing the
	   table wider than its container. The font shrink keeps a
	   5-col table legible at 375px. */

	.settings-table {
		font-size: var(--text-sm);
	}
	.settings-table th,
	.settings-table td {
		padding: var(--space-2) var(--space-3);
		word-break: break-word;
	}
	/* Action cells (Edit/Deactivate buttons) should still try
	   to keep their buttons inline; bigger tap targets when
	   they do wrap. */
	.settings-table .settings-actions {
		display: flex;
		flex-wrap: wrap;
		gap: var(--space-1);
	}
	.settings-actions form { display: inline-block; }

	/* --- Long machine strings (slugs, UUIDs, keys) — let them
	   wrap so they don't blow out their container. Default
	   word-wrap respects word boundaries, which a UUID has none
	   of; break-word lets it split mid-token. */

	code, pre { word-break: break-word; overflow-wrap: anywhere; }

	/* --- Forms: collapse multi-column grids to single column. */

	.settings-create-grid,
	.agency-edit-grid {
		grid-template-columns: 1fr !important;
	}

	/* --- Lobby code: 2rem font + 0.15em letter-spacing was wide
	   enough to push past a narrow screen. Shrink for mobile. */

	.lobby-code-value {
		font-size: 1.5rem;
		letter-spacing: 0.1em;
		padding: var(--space-2) var(--space-3);
	}

	/* --- Agency nav tabs: tighter gap so 5+ tabs fit. */

	.agency-nav {
		gap: var(--space-1) var(--space-3);
		font-size: var(--text-sm);
	}

	/* --- Doc / caregiver / candidate / chip rows — ensure flex
	   parents allow shrinkable children (the standard
	   min-width: 0 trick so flex items can collapse to fit). */

	.action-card,
	.doc-chip,
	.candidate-card-header,
	.compliance-care-head,
	.onboarding-doc-row,
	.training-card-head {
		flex-wrap: wrap;
		gap: var(--space-2);
	}
	.action-card-body,
	.doc-chip-body,
	.candidate-card-titles,
	.onboarding-doc-body,
	.training-card-titles { min-width: 0; }

	/* --- Confirm dialog: shrink and fit on small screens. */

	.confirm-action-dialog {
		max-width: calc(100vw - var(--space-4));
		padding: var(--space-4);
	}

	/* --- SSN reveal value (huge font-size on desktop). */

	.ssn-reveal-value {
		font-size: 1.5rem;
		padding: var(--space-3);
		letter-spacing: 0.05em;
	}

	/* --- Card-style tables on mobile (opt-in) ---------------- */

	/* Tables tagged with .settings-table-cards collapse their rows
	   into stacked label/value cards at mobile width. The HTML
	   stays a real <table> (preserves semantics + a11y); CSS hides
	   the header row and re-renders each <td>'s data-label
	   attribute next to its value. Each <tr> becomes a bordered
	   card. Opt-in (rather than applying to every .settings-table)
	   so tables that haven't been audited for it keep their
	   existing layout. */

	.settings-table-cards { display: block; }
	.settings-table-cards thead {
		position: absolute;
		width: 1px; height: 1px;
		margin: -1px; padding: 0;
		overflow: hidden;
		clip: rect(0 0 0 0);
		border: 0;
	}
	.settings-table-cards tbody,
	.settings-table-cards tr {
		display: block;
		width: 100%;
	}
	.settings-table-cards tr {
		border: 1px solid var(--color-border);
		border-radius: var(--radius-md);
		padding: var(--space-3);
		margin-bottom: var(--space-3);
		background-color: var(--color-surface);
	}
	.settings-table-cards tr:hover {
		background-color: var(--color-surface);
	}
	.settings-table-cards td {
		display: flex;
		justify-content: space-between;
		align-items: center;
		gap: var(--space-3);
		border: 0;
		padding: var(--space-1) 0;
	}
	.settings-table-cards td::before {
		content: attr(data-label);
		font-weight: 600;
		font-size: var(--text-xs);
		letter-spacing: 0.04em;
		text-transform: uppercase;
		color: var(--color-text-muted);
		flex-shrink: 0;
	}
	/* Cells marked data-label="" (e.g. the actions cell) suppress
	   the label and right-align — the button speaks for itself. */
	.settings-table-cards td[data-label=""]::before { content: none; }
	.settings-table-cards td[data-label=""] { justify-content: flex-end; }

	/* The empty-state row (a single colspan td) keeps a plain
	   centered look, not a card layout. */
	.settings-table-cards tr td.settings-empty {
		justify-content: center;
		text-align: center;
	}
	.settings-table-cards tr td.settings-empty::before { content: none; }

	/* --- Welcome forms list — prettier variant of the cards ----- */

	/* Same cards-mode, dressed up: a left accent stripe, a soft
	   shadow with a lift on hover, hidden DATA-LABEL prefixes
	   (the layout speaks for itself), and the action button
	   stretched full-width below. */
	.welcome-forms-list.settings-table-cards tr {
		border-left: 4px solid var(--color-accent);
		padding: var(--space-4);
		box-shadow:
			0 1px 2px rgba(0, 0, 0, 0.04),
			0 2px 6px rgba(0, 0, 0, 0.05);
		transition: box-shadow 150ms ease, transform 150ms ease;
	}
	.welcome-forms-list.settings-table-cards tr:hover,
	.welcome-forms-list.settings-table-cards tr:focus-within {
		box-shadow:
			0 2px 4px rgba(0, 0, 0, 0.06),
			0 10px 20px rgba(0, 0, 0, 0.06);
		transform: translateY(-1px);
	}
	.welcome-forms-list.settings-table-cards td::before { content: none; }
	.welcome-forms-list.settings-table-cards td[data-label="Document"] {
		display: block;
		font-weight: 600;
		font-size: var(--text-base);
		color: var(--color-text-primary);
		padding-bottom: var(--space-2);
	}
	.welcome-forms-list.settings-table-cards td[data-label="Status"] {
		justify-content: flex-start;
		padding-bottom: var(--space-3);
	}
	.welcome-forms-list.settings-table-cards td.settings-actions {
		justify-content: stretch;
		padding-top: var(--space-2);
		border-top: 1px dashed var(--color-border);
	}
	.welcome-forms-list.settings-table-cards td.settings-actions > a {
		width: 100%;
		justify-content: center;
	}
}

/* Smaller-still safety: at 380px and below (smallest common
   phones, plus some legacy Androids) drop the page padding one
   more step so big-text users don't lose all margin. */
@media (max-width: 380px) {
	.page { padding: var(--space-3) var(--space-2); }
	.admin-title { font-size: var(--text-lg); }
	.settings-table th,
	.settings-table td { padding: var(--space-2); }
}

/* ---- Spacing + layout utilities ----------------------------------
 * Tiny set used to replace the most common inline styles across
 * welcome_wizard.templ + agency_onboard.templ. Names mirror
 * Tailwind's mt-/mb- shape but use the project's --space-N
 * variables, not Tailwind's rem scale. Add more as new
 * high-frequency patterns surface — don't pre-populate.
 */
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }

.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }

.mw-narrow { max-width: 36rem; }

/* ---- Photo-polish modal (camera capture → AI comparison) ----
 * Sits next to the .photo-capture-dialog (the live-view modal).
 * Lifecycle:
 *   .photo-polish-stage-working — spinner while /api/portrait/polish is running
 *   .photo-polish-stage-result  — side-by-side compare + pick / retake
 *   .photo-polish-stage-error   — single-button "use original" + retake
 * Reuses .qr-dialog* visuals for consistency with the camera modal.
 */
.photo-polish-dialog {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	background: var(--color-surface);
	color: var(--color-text-primary);
	padding: var(--space-5);
	max-width: 40rem;
	width: 100%;
	box-shadow:
		0 10px 30px rgba(0, 0, 0, 0.18),
		0 2px 6px rgba(0, 0, 0, 0.08);
}
.photo-polish-dialog::backdrop {
	background: rgba(0, 0, 0, 0.55);
}

.photo-polish-spinner {
	width: 3rem;
	height: 3rem;
	margin: var(--space-5) auto;
	border: 4px solid var(--color-border);
	border-top-color: var(--color-primary);
	border-radius: 50%;
	animation: photo-polish-spin 0.9s linear infinite;
}
@keyframes photo-polish-spin {
	to { transform: rotate(360deg); }
}

.photo-polish-note {
	color: var(--color-text-muted);
	font-size: var(--text-sm);
	text-align: center;
	margin: 0;
}

.photo-polish-compare {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--space-4);
	margin: var(--space-4) 0;
}
.photo-polish-pair {
	margin: 0;
	text-align: center;
}
.photo-polish-pair img {
	display: block;
	width: 100%;
	max-width: 16rem;
	margin: 0 auto var(--space-2);
	border-radius: var(--radius-md);
	border: 2px solid var(--color-border);
	object-fit: cover;
	aspect-ratio: 1 / 1;
}
.photo-polish-pair figcaption {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
	font-weight: 600;
}

.photo-polish-actions {
	display: flex;
	gap: var(--space-2);
	flex-wrap: wrap;
	justify-content: center;
	margin-top: var(--space-3);
}

.photo-polish-error-msg {
	color: var(--color-text-muted);
	font-size: var(--text-sm);
	text-align: center;
	margin: var(--space-3) 0;
	padding: var(--space-3);
	background: var(--color-surface-alt);
	border-radius: var(--radius-md);
}

@media (max-width: 540px) {
	.photo-polish-compare {
		grid-template-columns: 1fr;
	}
	.photo-polish-pair img {
		max-width: 12rem;
	}
}

/* ---- Photo-polish lightbox -------------------------------------
 * Sibling <dialog> to .photo-polish-dialog. Opens when the user
 * taps either thumbnail in the compare grid so they can judge
 * quality at full size. Native <dialog>'s ESC + ::backdrop give
 * us the rest for free.
 */
.photo-polish-zoomable {
	cursor: zoom-in;
	transition: transform 0.15s ease;
}
.photo-polish-zoomable:hover,
.photo-polish-zoomable:focus-visible {
	transform: scale(1.02);
	outline: 2px solid var(--color-primary);
	outline-offset: 2px;
}

.photo-polish-lightbox {
	border: 0;
	background: transparent;
	padding: 0;
	max-width: 100vw;
	max-height: 100vh;
}
.photo-polish-lightbox::backdrop {
	background: rgba(0, 0, 0, 0.92);
}

.photo-polish-lightbox-img {
	display: block;
	max-width: 92vw;
	max-height: 92vh;
	margin: 0 auto;
	border-radius: var(--radius-md);
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
	cursor: zoom-out;
}

.photo-polish-lightbox-close {
	position: fixed;
	top: var(--space-3);
	right: var(--space-3);
	width: 2.5rem;
	height: 2.5rem;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: var(--color-text-primary);
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.photo-polish-lightbox-close:hover,
.photo-polish-lightbox-close:focus-visible {
	background: white;
	outline: 2px solid var(--color-primary);
	outline-offset: 2px;
}

/* ---- Portrait lab (admin test surface) -------------------------- */
.portrait-lab-meta {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
	gap: var(--space-3);
	padding: var(--space-3);
	background: var(--color-surface-alt);
	border-radius: var(--radius-md);
	margin-bottom: var(--space-4);
	font-size: var(--text-sm);
}
.portrait-lab-meta code {
	background: rgba(0, 0, 0, 0.05);
	padding: 0 var(--space-1);
	border-radius: var(--radius-sm);
}
.portrait-lab-compare .portrait-lab-img {
	max-width: 100%;
	width: auto;
	aspect-ratio: auto;
	height: auto;
	max-height: 36rem;
}
.portrait-lab-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 12rem;
	padding: var(--space-4);
	background: var(--color-surface-alt);
	border: 2px dashed var(--color-border);
	border-radius: var(--radius-md);
	color: var(--color-text-muted);
	text-align: center;
}

/* Gallery — N cards stacked, each card a row of figures */
.portrait-lab-gallery {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}
.portrait-lab-card {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-3);
	background: var(--color-surface);
}
.portrait-lab-card-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: var(--space-3);
	margin-bottom: var(--space-3);
	padding-bottom: var(--space-2);
	border-bottom: 1px solid var(--color-border);
}
.portrait-lab-card-title {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	font-size: var(--text-base);
	min-width: 0;
}
.portrait-lab-card-title strong {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 28rem;
}
.portrait-lab-card-kind {
	font-size: var(--text-xs);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	padding: 0.1rem 0.4rem;
	border-radius: var(--radius-sm);
	background: var(--color-surface-alt);
	color: var(--color-text-muted);
	flex-shrink: 0;
}
.portrait-lab-card-images {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-3);
	align-items: flex-start;
	margin-bottom: var(--space-3);
}
.portrait-lab-card-image {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	max-width: 14rem;
}
.portrait-lab-card-image img {
	width: 100%;
	height: auto;
	border-radius: var(--radius-sm);
	border: 1px solid var(--color-border);
	cursor: zoom-in;
}
.portrait-lab-card-image figcaption {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
	text-align: center;
	line-height: 1.4;
}
.portrait-lab-card-footer {
	display: flex;
	gap: var(--space-2);
}
.portrait-lab-error {
	font-size: var(--text-xs);
	color: var(--color-danger, #b91c1c);
	display: inline-block;
	max-width: 14rem;
	white-space: normal;
	word-break: break-word;
}
.portrait-lab-toggle {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	padding: 0.55rem 0.75rem;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background: var(--color-surface);
	font-size: var(--text-sm);
	color: var(--color-text);
}
.portrait-lab-toggle input[type="checkbox"] {
	width: 1.05rem;
	height: 1.05rem;
	margin: 0;
}

/* Busy modal — shown while a form submit is in flight so the
   user knows something is happening during the long WellSky
   fetch / polish round-trips. */
.portrait-lab-busy {
	padding: var(--space-5);
	border-radius: var(--radius-lg);
	border: none;
	text-align: center;
	background: var(--color-surface);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
	min-width: 20rem;
	max-width: 28rem;
}
.portrait-lab-busy::backdrop {
	background: rgba(0, 0, 0, 0.45);
}
.portrait-lab-busy-msg {
	margin: var(--space-3) 0 var(--space-2);
	font-weight: 600;
	color: var(--color-text);
}
.portrait-lab-busy-sub {
	margin: 0;
}

/* Webcam capture modal — live preview + snap button. Width
   matches the lightbox so it sits well on a desktop screen. */
.portrait-lab-webcam {
	padding: var(--space-4);
	border-radius: var(--radius-lg);
	border: none;
	background: var(--color-surface);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	max-width: 90vw;
	width: 44rem;
}
.portrait-lab-webcam::backdrop {
	background: rgba(0, 0, 0, 0.55);
}
.portrait-lab-webcam-stage {
	position: relative;
	background: #000;
	border-radius: var(--radius-md);
	overflow: hidden;
	aspect-ratio: 4 / 3;
}
.portrait-lab-webcam-video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	/* Mirror like a typical "selfie" preview so motion feels
	   natural to the user. The captured frame is un-mirrored
	   (canvas draws the raw track), which is what we want. */
	transform: scaleX(-1);
}
.portrait-lab-webcam-canvas {
	display: none;
}
.portrait-lab-webcam-err {
	margin: var(--space-3) 0 0;
	color: var(--color-danger, #b91c1c);
	font-weight: 600;
}
.portrait-lab-webcam-actions {
	display: flex;
	gap: var(--space-2);
	justify-content: flex-end;
	margin-top: var(--space-3);
}

/* ---- Force-consent gate (/consent) ----
 *
 * Quiet single-card layout, centered. Reuses the legal-page lookup
 * for muted prose. The user lands here only when they have an
 * authed session but no current-version ToS/Privacy consent on
 * file; nothing else on the platform is reachable until they
 * either accept or sign out.
 */
.consent-gate-page {
	min-height: 60vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--space-6) var(--space-4);
}
.consent-gate-card {
	max-width: 36rem;
	width: 100%;
	padding: var(--space-6);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	background: var(--color-surface);
	box-shadow: var(--shadow-sm);
}
.consent-gate-card h1 {
	margin: 0 0 var(--space-4) 0;
	font-size: 1.5rem;
}
.consent-gate-card p {
	margin: 0 0 var(--space-4) 0;
	line-height: 1.6;
}
.consent-gate-err {
	color: var(--color-danger);
	font-weight: 600;
}
.consent-gate-form {
	margin: 0 0 var(--space-3) 0;
}
.consent-gate-check {
	display: flex;
	gap: var(--space-3);
	align-items: flex-start;
	line-height: 1.5;
	margin-bottom: var(--space-4);
}
.consent-gate-check input[type=checkbox] {
	margin-top: 0.3rem;
	transform: scale(1.2);
}
.consent-gate-actions {
	display: flex;
	justify-content: flex-start;
}
.consent-gate-logout {
	margin-top: var(--space-3);
}
.consent-gate-fineprint {
	margin: var(--space-5) 0 0 0;
	color: var(--color-text-muted);
	font-size: 0.85rem;
	line-height: 1.5;
}

/* ---- Legal pages (/privacy, /terms) ----
 *
 * Deliberately quiet styling. Stripe / Twilio reviewers and legal
 * readers want a readable document, not an immersive marketing
 * surface. We borrow the standard Shell chrome and just constrain
 * the prose to a comfortable measure with a clear hierarchy.
 */
.legal-page {
	padding: var(--space-5) var(--space-4) var(--space-6);
}
.legal-content {
	max-width: 48rem;
	margin: 0 auto;
	line-height: 1.65;
	color: var(--color-text-primary);
}
.legal-header {
	margin-bottom: var(--space-5);
	padding-bottom: var(--space-3);
	border-bottom: 1px solid var(--color-border);
}
.legal-header h1 {
	margin: 0 0 var(--space-2) 0;
	font-size: 2rem;
	font-weight: 700;
}
.legal-updated {
	margin: 0;
	color: var(--color-text-muted);
	font-size: 0.9rem;
}
.legal-section {
	margin: var(--space-5) 0;
}
.legal-section h2 {
	margin: 0 0 var(--space-3) 0;
	font-size: 1.35rem;
	font-weight: 700;
	border-bottom: 1px solid var(--color-border);
	padding-bottom: var(--space-2);
}
.legal-section h3 {
	margin: var(--space-4) 0 var(--space-2) 0;
	font-size: 1.1rem;
	font-weight: 600;
}
.legal-section h4 {
	margin: var(--space-3) 0 var(--space-2) 0;
	font-size: 1rem;
	font-weight: 600;
}
.legal-section p,
.legal-content > p {
	margin: 0 0 var(--space-3) 0;
}
.legal-section ul {
	margin: 0 0 var(--space-3) 0;
	padding-left: var(--space-5);
}
.legal-section ul li {
	margin-bottom: var(--space-2);
}
.legal-section a {
	color: var(--color-accent);
	text-decoration: underline;
}
.legal-section-highlight {
	background: var(--color-surface-alt);
	border-left: 3px solid var(--color-accent);
	padding: var(--space-3) var(--space-4);
	border-radius: var(--radius-md);
}
.legal-footer {
	margin-top: var(--space-6);
	padding-top: var(--space-3);
	border-top: 1px solid var(--color-border);
	color: var(--color-text-muted);
	font-size: 0.85rem;
	text-align: center;
}

/* Pricing schedule card on the agency-onboard signing step.
   Deliberately quiet — looks like a plain card. Values are
   editable via inline tap-to-edit; the affordance is a faint
   dotted underline on hover so the sales call doesn't broadcast
   "we adjust these all the time." */
.pricing-schedule {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-4);
	background: var(--color-surface);
}
.pricing-schedule-header { margin-bottom: var(--space-3); }
.pricing-schedule-title {
	font-size: 1rem;
	font-weight: 600;
	margin: 0 0 var(--space-1) 0;
}
.pricing-schedule-hint {
	margin: 0;
	color: var(--color-text-muted);
	font-size: 0.85rem;
}
.pricing-schedule-date {
	margin: 0 0 var(--space-1) 0;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--color-text);
	letter-spacing: 0.02em;
}
.pricing-schedule-grid { display: grid; gap: var(--space-2); margin: 0; }
.pricing-row {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: var(--space-3);
	align-items: center;
}
.pricing-row dt { color: var(--color-text-muted); font-size: 0.9rem; }
.pricing-row dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.pricing-value { font-weight: 600; color: var(--color-text); }
.pricing-value-editable {
	text-decoration: none;
	color: var(--color-text);
	border-bottom: 1px dotted transparent;
	cursor: pointer;
	padding: 1px 2px;
}
.pricing-value-editable:hover { border-bottom-color: var(--color-text-muted); }
.pricing-edit-form { display: inline-flex; gap: var(--space-1); align-items: center; }
.pricing-edit-input {
	width: 6rem;
	padding: 2px 6px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	font-variant-numeric: tabular-nums;
	text-align: right;
}
.btn-xs { font-size: 0.8rem; padding: 2px 8px; }

/* Pricing history (agency detail page). Compact diff list per
   addendum: when + who at the top, value diffs in a small list,
   the founder-supplied reason in italics underneath. */
.pricing-history-title {
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--color-text-muted);
	margin: var(--space-2) 0 var(--space-2) 0;
}
.pricing-history { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.pricing-history-item {
	border-left: 2px solid var(--color-border);
	padding-left: var(--space-3);
}
.pricing-history-meta {
	font-size: 0.85rem;
	color: var(--color-text-muted);
	margin-bottom: var(--space-1);
}
.pricing-history-diffs { list-style: none; margin: 0 0 var(--space-1) 0; padding: 0; font-size: 0.9rem; }
.pricing-history-diffs li { padding: 1px 0; font-variant-numeric: tabular-nums; }
.pricing-history-reason {
	margin: 0;
	font-style: italic;
	color: var(--color-text-muted);
	font-size: 0.85rem;
}

/* Side-by-side "Current vs New" form on the addendum-prepare page. */
.pricing-prepare-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--space-4);
}
@media (max-width: 720px) {
	.pricing-prepare-grid { grid-template-columns: 1fr; }
}
.pricing-prepare-col-title {
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--color-text-muted);
	margin: 0 0 var(--space-2) 0;
}

/* ===========================================================
 * Assistant schedule editor (/admin/assistant/agencies/{id}).
 * Card with a custom toggle switch at the top, then a 2-column
 * grid of numeric fields. Designed to feel polished — the
 * default native checkbox + stacked labels looked sketchy.
 * =========================================================== */
.schedule-form {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg, 12px);
	background: var(--color-surface);
	padding: var(--space-5) var(--space-5);
	max-width: 760px;
}

.schedule-toggle-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
	padding-bottom: var(--space-4);
	margin-bottom: var(--space-5);
	border-bottom: 1px solid var(--color-border);
}
.schedule-toggle-label strong {
	display: block;
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--color-text);
	margin-bottom: 2px;
}
.schedule-toggle-label small {
	display: block;
	font-size: 0.82rem;
	color: var(--color-text-muted);
	line-height: 1.4;
	max-width: 36rem;
}

/* Custom toggle switch. The native input is hidden but kept in
   the form (so it submits); the visible :track + :thumb shift
   when input is :checked. */
.schedule-switch {
	position: relative;
	display: inline-block;
	flex-shrink: 0;
	cursor: pointer;
}
.schedule-switch input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}
.schedule-switch-track {
	display: inline-block;
	width: 44px;
	height: 24px;
	border-radius: 999px;
	background: var(--color-border);
	transition: background 0.18s ease;
	vertical-align: middle;
}
.schedule-switch-thumb {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
	transition: transform 0.18s ease;
}
.schedule-switch input:checked + .schedule-switch-track {
	background: var(--color-accent, #6100FF);
}
.schedule-switch input:checked + .schedule-switch-track .schedule-switch-thumb {
	transform: translateX(20px);
}
.schedule-switch input:focus-visible + .schedule-switch-track {
	outline: 2px solid var(--color-accent);
	outline-offset: 2px;
}

/* 2-column grid of fields. Collapses to single column on narrow
   screens. */
.schedule-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--space-4) var(--space-5);
}
@media (max-width: 640px) {
	.schedule-grid { grid-template-columns: 1fr; }
}
.schedule-field-blackout { grid-column: 1 / -1; }

.schedule-field {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
}
.schedule-field-label {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--color-text-muted);
	letter-spacing: 0.02em;
}
.schedule-input {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md, 8px);
	background: var(--color-surface);
	font-size: 0.95rem;
	font-variant-numeric: tabular-nums;
	color: var(--color-text);
}
.schedule-input:focus {
	outline: none;
	border-color: var(--color-accent);
	box-shadow: 0 0 0 3px var(--color-accent-soft, rgba(97, 0, 255, 0.15));
}
.schedule-input-num { max-width: 6rem; }
.schedule-input-with-suffix {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
}
.schedule-input-suffix {
	font-size: 0.85rem;
	color: var(--color-text-muted);
}
.schedule-blackout-pair {
	display: inline-flex;
	align-items: center;
	gap: var(--space-3);
	flex-wrap: wrap;
}
.schedule-blackout-sep {
	color: var(--color-text-muted);
	font-size: 1rem;
}
.schedule-field-hint {
	font-size: 0.8rem;
	color: var(--color-text-muted);
	line-height: 1.4;
}
.schedule-actions {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	margin-top: var(--space-5);
	padding-top: var(--space-4);
	border-top: 1px solid var(--color-border);
}
.schedule-next-attempt {
	font-size: 0.82rem;
	color: var(--color-text-muted);
}
.schedule-next-attempt strong {
	color: var(--color-text);
	font-weight: 600;
}

/* "Next sync" banner above the schedule form. Variants tint the
   left border + dot color: running (green), imminent (amber),
   scheduled (accent purple), disabled (muted). */
.schedule-next-banner {
	display: flex;
	align-items: flex-start;
	gap: var(--space-3);
	padding: var(--space-3) var(--space-4);
	margin: 0 0 var(--space-4) 0;
	border: 1px solid var(--color-border);
	border-left-width: 4px;
	border-radius: var(--radius-md, 8px);
	background: var(--color-surface);
	max-width: 760px;
}
.schedule-next-banner strong {
	display: block;
	font-size: 0.95rem;
	color: var(--color-text);
	margin-bottom: 2px;
}
.schedule-next-banner small {
	display: block;
	font-size: 0.82rem;
	color: var(--color-text-muted);
	line-height: 1.4;
}
.schedule-next-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--color-text-muted);
	margin-top: 6px;
	flex-shrink: 0;
}
.schedule-next-flight     { border-left-color: #2FCC71; }
.schedule-next-flight     .schedule-next-dot { background: #2FCC71; box-shadow: 0 0 0 4px rgba(47, 204, 113, 0.18); animation: scheduleFlightPulse 1.5s ease-in-out infinite; }
.schedule-next-imminent   { border-left-color: #FFBF40; }
.schedule-next-imminent   .schedule-next-dot { background: #FFBF40; }
.schedule-next-scheduled  { border-left-color: var(--color-accent, #6100FF); }
.schedule-next-scheduled  .schedule-next-dot { background: var(--color-accent, #6100FF); }
.schedule-next-disabled   { border-left-color: var(--color-text-muted); opacity: 0.78; }
.schedule-next-disabled   .schedule-next-dot { background: var(--color-text-muted); }
@keyframes scheduleFlightPulse {
	0%, 100% { box-shadow: 0 0 0 4px rgba(47, 204, 113, 0.18); }
	50%      { box-shadow: 0 0 0 7px rgba(47, 204, 113, 0.10); }
}

/* ===========================================================
 * Pricing defaults form (/admin/pricing-defaults).
 * Sections (Subscription / Referral fee / Term & refund), each
 * with a header + 2-column grid. Inputs sized to content with
 * prefix/suffix labels ($ / %, "/ month", "days worked").
 * =========================================================== */
.pricing-defaults-form {
	max-width: 840px;
	display: flex;
	flex-direction: column;
	gap: var(--space-5);
}
.pricing-defaults-section {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg, 12px);
	background: var(--color-surface);
	padding: var(--space-5);
}
.pricing-defaults-section-header {
	margin-bottom: var(--space-4);
	padding-bottom: var(--space-3);
	border-bottom: 1px solid var(--color-border);
}
.pricing-defaults-section-header h2 {
	margin: 0 0 4px 0;
	font-size: 1.05rem;
	font-weight: 600;
	color: var(--color-text);
}
.pricing-defaults-section-header small {
	display: block;
	font-size: 0.85rem;
	color: var(--color-text-muted);
}
.pricing-defaults-grid {
	display: grid;
	gap: var(--space-4) var(--space-5);
	grid-template-columns: 1fr;
}
.pricing-defaults-grid-2col {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 640px) {
	.pricing-defaults-grid-2col { grid-template-columns: 1fr; }
}
.pricing-defaults-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.pricing-defaults-label {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--color-text-muted);
	letter-spacing: 0.02em;
}
.pricing-defaults-input-row {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
}
.pricing-defaults-input {
	padding: 8px 10px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md, 8px);
	background: var(--color-surface);
	font-size: 0.95rem;
	font-variant-numeric: tabular-nums;
	color: var(--color-text);
}
.pricing-defaults-input:focus {
	outline: none;
	border-color: var(--color-accent);
	box-shadow: 0 0 0 3px var(--color-accent-soft, rgba(97, 0, 255, 0.15));
}
.pricing-defaults-input-num   { width: 6rem; }
.pricing-defaults-input-money { width: 7.5rem; }
.pricing-defaults-input-prefix,
.pricing-defaults-input-suffix {
	font-size: 0.9rem;
	color: var(--color-text-muted);
}
.pricing-defaults-input-prefix { margin-right: -4px; }
.pricing-defaults-hint {
	font-size: 0.8rem;
	color: var(--color-text-muted);
	line-height: 1.4;
}
.pricing-defaults-actions {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	padding: var(--space-4);
	border-top: 1px solid var(--color-border);
}
.pricing-defaults-updated {
	font-size: 0.82rem;
	color: var(--color-text-muted);
}

/* Escalator radio block on the pricing defaults page. Three
   stacked options with a heading + helper line per. The
   fixed-mode percent input sits below the radios. */
.pricing-defaults-escalator { display: flex; flex-direction: column; gap: var(--space-3); }
.pricing-defaults-escalator-radios {
	display: grid;
	gap: var(--space-2);
}
.pricing-defaults-radio {
	display: flex;
	align-items: flex-start;
	gap: var(--space-3);
	padding: var(--space-3);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md, 8px);
	cursor: pointer;
	transition: border-color 0.15s ease;
}
.pricing-defaults-radio:hover { border-color: var(--color-text-muted); }
.pricing-defaults-radio input[type="radio"] {
	margin-top: 4px;
	flex-shrink: 0;
}
.pricing-defaults-radio input[type="radio"]:checked ~ span strong {
	color: var(--color-accent, #6100FF);
}
.pricing-defaults-radio:has(input[type="radio"]:checked) {
	border-color: var(--color-accent, #6100FF);
	background: var(--color-accent-soft, rgba(97, 0, 255, 0.04));
}
.pricing-defaults-radio span strong {
	display: block;
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--color-text);
	margin-bottom: 2px;
}
.pricing-defaults-radio span small {
	display: block;
	font-size: 0.82rem;
	color: var(--color-text-muted);
	line-height: 1.4;
}
.pricing-defaults-escalator-percent {
	padding-left: var(--space-3);
	border-left: 2px solid var(--color-border);
}

/* Compact escalator radios on the addendum prepare form. */
.addendum-escalator-radios {
	display: inline-flex;
	gap: var(--space-2);
	margin-top: 4px;
}
.addendum-escalator-radio {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md, 8px);
	cursor: pointer;
	font-size: 0.85rem;
}
.addendum-escalator-radio:has(input:checked) {
	border-color: var(--color-accent, #6100FF);
	background: var(--color-accent-soft, rgba(97, 0, 255, 0.06));
}
.mt-2 { margin-top: var(--space-2); }

/* ====================================================================
   /agency/caregivers roster — filter input + compliance chip row.
   ==================================================================== */
.caregivers-roster-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-3);
	justify-content: space-between;
	margin-bottom: var(--space-3);
}
.caregivers-roster-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-3);
	flex: 1 1 auto;
	justify-content: flex-end;
}
.caregivers-filter-input {
	flex: 0 1 22rem;
	min-width: 12rem;
	padding: 0.4rem 0.7rem;
	font-size: var(--text-base);
	font-family: inherit;
	color: var(--color-text-primary);
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md, 8px);
}
.caregivers-filter-input:focus {
	outline: none;
	border-color: var(--color-accent);
	box-shadow: 0 0 0 3px var(--color-accent-soft, rgba(97, 0, 255, 0.18));
}
.caregivers-roster-chips {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
}
.caregivers-filter-empty {
	margin: var(--space-3) 0;
	color: var(--color-text-muted);
	font-style: italic;
}
.caregivers-roster-table tbody tr[hidden] { display: none; }

/* /agency/recruit/new — ad creation form + Hattie chat panel.
 * Two columns on desktop: form on the left, Hattie on the right.
 * Stacks (form on top, Hattie below) on narrow viewports. */
.recruit-builder {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--space-4);
}
@media (min-width: 64rem) {
	.recruit-builder {
		grid-template-columns: minmax(0, 1fr) 22rem;
		align-items: start;
	}
}
.recruit-new-form {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}

/* Hattie chat panel. Lives next to the form on desktop, below
 * it on mobile. The log scrolls inside the panel so the page
 * itself stays anchored to the form. */
.hattie-panel {
	display: flex;
	flex-direction: column;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-3);
	gap: var(--space-3);
}
/* On desktop the panel sticks to the viewport top, but sizes
 * to its content rather than gobbling the full viewport — the
 * textarea is generously sized (see rules below) and scrolls
 * inside itself past that. */
@media (min-width: 64rem) {
	.hattie-panel {
		position: sticky;
		top: var(--space-3);
	}
}
.hattie-panel-head {
	display: flex;
	gap: var(--space-3);
	align-items: flex-start;
	padding-bottom: var(--space-3);
	border-bottom: 1px solid var(--color-border);
}
.hattie-panel-head-text { flex: 1 1 auto; min-width: 0; }

/* Speaker (mute/unmute Hattie's voice) toggle in the panel
 * header. Pressed-state ARIA + a CSS swap between the two
 * speaker SVG icons handle the visual state. */
.hattie-speaker-btn {
	flex: 0 0 auto;
	background: transparent;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-1) var(--space-2);
	cursor: pointer;
	color: var(--color-text-secondary);
	display: flex;
	align-items: center;
	justify-content: center;
}
.hattie-speaker-btn:hover {
	background: var(--color-surface-alt);
	color: var(--color-accent);
}
.hattie-speaker-btn .hattie-speaker-off-icon { display: none; }
.hattie-speaker-btn.hattie-speaker-off .hattie-speaker-on { display: none; }
.hattie-speaker-btn.hattie-speaker-off .hattie-speaker-off-icon { display: inline; }
.hattie-speaker-btn.hattie-speaker-off {
	color: var(--color-text-muted);
}
.hattie-panel-icon { font-size: 1.6rem; line-height: 1; }
.hattie-panel-title {
	margin: 0;
	font-size: var(--text-base);
	font-weight: 700;
}
.hattie-panel-sub {
	margin: 0.1rem 0 0;
	font-size: var(--text-xs);
	color: var(--color-text-muted);
	line-height: 1.4;
}
.hattie-panel-log {
	/* Log scrolls inside its own cap. */
	flex: 0 1 auto;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	padding: var(--space-2) 0;
	min-height: 6rem;
	max-height: 14rem;
}
.hattie-bubble {
	padding: var(--space-2) var(--space-3);
	border-radius: var(--radius-md);
	font-size: var(--text-sm);
	line-height: 1.4;
	white-space: pre-wrap;
	max-width: 92%;
}
.hattie-bubble-user {
	background: var(--color-accent-soft, rgba(97, 0, 255, 0.10));
	color: var(--color-text-primary);
	align-self: flex-end;
}
.hattie-bubble-assistant {
	background: var(--color-surface-alt);
	color: var(--color-text-primary);
	align-self: flex-start;
}
.hattie-typing {
	font-style: italic;
	color: var(--color-text-muted);
}
.hattie-panel-input {
	/* Column flow: textarea sits at the top, controls row
	 * below at natural size. Sized to its content (textarea
	 * has its own generous min/max-height + scroll). */
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	padding-top: var(--space-2);
	border-top: 1px solid var(--color-border);
}
/* Bottom row of the input area — mic on the left, Send on
 * the right, both at natural button height. */
.hattie-panel-controls {
	display: flex;
	gap: var(--space-2);
	align-items: center;
	justify-content: space-between;
	flex: 0 0 auto;
}

/* Mic button — visually prominent on mobile (the primary
 * input modality per founder note); equally available on
 * desktop. Round, accent-colored, with a "listening" pulse
 * state. Hidden entirely when the browser doesn't support
 * SpeechRecognition (set inline by hattie-ad-builder.js). */
.hattie-mic-btn {
	flex: 0 0 auto;
	width: 2.6rem;
	height: 2.6rem;
	border-radius: 50%;
	background: var(--color-accent);
	color: var(--color-bg);
	border: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: filter 120ms ease, transform 120ms ease;
}
.hattie-mic-btn:hover {
	filter: brightness(1.1);
}
.hattie-mic-btn:active {
	transform: scale(0.95);
}
.hattie-mic-btn[disabled] {
	opacity: 0.5;
	cursor: wait;
}
@keyframes hattie-mic-pulse-anim {
	0%   { box-shadow: 0 0 0 0 rgba(220, 50, 50, 0.55); }
	100% { box-shadow: 0 0 0 14px rgba(220, 50, 50, 0); }
}
.hattie-mic-btn.hattie-mic-listening {
	background: #dc3232;
	animation: hattie-mic-pulse-anim 1.2s infinite;
}
.hattie-panel-textarea {
	padding: 0.55rem 0.7rem;
	font-size: var(--text-base);
	font-family: inherit;
	color: var(--color-text-primary);
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md, 8px);
	resize: none;
	line-height: 1.45;
	/* Generous default that fits a couple of dictated sentences;
	 * caps so dictation doesn't take over the panel. Past the
	 * cap, the textarea scrolls inside itself. */
	min-height: 8rem;
	max-height: 16rem;
	overflow-y: auto;
}
.hattie-panel-textarea:focus {
	outline: none;
	border-color: var(--color-accent);
	box-shadow: 0 0 0 3px var(--color-accent-soft, rgba(97, 0, 255, 0.18));
}

/* Brief highlight on a field Hattie just filled — gives the
 * admin a visual signal of which fields are coming from the
 * conversation vs. their own typing. */
@keyframes hattie-flash-anim {
	0%   { background: var(--color-accent-soft, rgba(97, 0, 255, 0.30)); }
	100% { background: transparent; }
}
.hattie-flash {
	animation: hattie-flash-anim 1.5s ease-out;
}
.recruit-form-actions {
	display: flex;
	gap: var(--space-3);
	flex-wrap: wrap;
}
/* /agency/recruit/{id} — ad detail. */
.recruit-detail-statusrow {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	flex-wrap: wrap;
	margin-bottom: var(--space-4);
}
.recruit-detail-lifecycle {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
}
.recruit-ad-header { margin-bottom: var(--space-3); }
.recruit-ad-status { margin-bottom: var(--space-3); }
.recruit-ad-meta { }
.recruit-ad-stats {
	display: flex;
	gap: var(--space-2);
	flex-wrap: wrap;
	margin-top: var(--space-4);
	padding-top: var(--space-4);
	border-top: 1px solid var(--color-border);
}
.recruit-interested-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}
.recruit-interested-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	padding: var(--space-3);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background: var(--color-surface);
}
.recruit-interested-body { display: flex; flex-direction: column; gap: 0.1rem; }
.recruit-interested-name {
	font-size: var(--text-base);
	font-weight: 600;
}
.recruit-interested-when {
	font-size: var(--text-xs);
	color: var(--color-text-muted);
}
.recruit-actions {
	display: flex;
	gap: var(--space-3);
	flex-wrap: wrap;
	align-items: center;
}
.recruit-shift-pending {
	color: var(--color-text-muted);
	font-style: italic;
}

/* Revealed-caregiver contact list — name + tappable phone.
 * Replaces the earlier stage-1-clock table per founder direction
 * 2026-05-25 ("don't put billing in front of admins' faces every
 * day"). Billing tracking remains server-side. */
.recruit-contacts-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}
.recruit-contact {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	padding: var(--space-3) var(--space-4);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background: var(--color-surface);
}
.recruit-contact-avatar {
	width: 3rem;
	height: 3rem;
	flex: 0 0 auto;
	border-radius: 50%;
	object-fit: cover;
	border: 1px solid var(--color-border);
	background: var(--color-surface-alt);
}
.recruit-contact-avatar-fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--color-text-muted);
	font-family: var(--font-heading);
	font-size: 1.2rem;
	font-weight: 700;
	text-transform: uppercase;
}
.recruit-contact-body {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	min-width: 0;
	flex: 1 1 auto;
}
.recruit-contact-name {
	font-size: var(--text-base);
	font-weight: 600;
	color: var(--color-text-primary);
}
.recruit-contact-meta {
	font-size: var(--text-xs);
	color: var(--color-text-muted);
}
.recruit-contact-phone {
	text-decoration: none;
}
.recruit-contact-phone code {
	font-size: var(--text-base);
	color: var(--color-accent);
}
.recruit-contact-phone:hover code {
	text-decoration: underline;
}

/* /admin/system-settings — market filter above the zones table.
 * Inline row: label + select; auto-submits on change. */
.settings-zone-filter {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	margin-bottom: var(--space-3);
	flex-wrap: wrap;
}
.settings-zone-filter-label {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
}
.settings-zone-filter .settings-input {
	flex: 0 1 22rem;
	min-width: 12rem;
}

/* Preview-before-post dialog on /agency/recruit/new. Shows
 * the ad in a phone-shaped frame using the same fact-card
 * CSS as the actual caregiver-facing landing — so what the
 * admin sees IS what the caregiver will see. */
.recruit-preview-dialog {
	padding: 0;
	border: 0;
	border-radius: var(--radius-lg);
	background: var(--color-surface);
	max-width: 28rem;
	width: 92vw;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.recruit-preview-dialog::backdrop {
	background: rgba(0, 0, 0, 0.45);
}
.recruit-preview-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	padding: var(--space-3) var(--space-4);
	border-bottom: 1px solid var(--color-border);
}
.recruit-preview-title {
	margin: 0;
	font-size: var(--text-base);
	font-weight: 700;
}
.recruit-preview-close {
	width: 2rem;
	height: 2rem;
	border-radius: 999px;
	background: transparent;
	border: 0;
	font-size: 1.4rem;
	line-height: 1;
	cursor: pointer;
	color: var(--color-text-muted);
}
.recruit-preview-close:hover {
	background: var(--color-surface-alt);
	color: var(--color-text-primary);
}
/* The phone-frame container — a soft inset to suggest a
 * device viewport without going full skeuomorphic. Scrolls
 * inside the dialog if the ad body is taller than the
 * frame height. */
.recruit-preview-frame {
	background: var(--color-surface-alt);
	padding: var(--space-3);
	max-height: 70vh;
	overflow-y: auto;
}
.recruit-preview-frame .ad-landing-wrap {
	max-width: none;
	margin: 0;
	padding: var(--space-3);
	background: var(--color-surface);
	border-radius: var(--radius-md);
}
.recruit-preview-actions {
	display: flex;
	gap: var(--space-3);
	padding: var(--space-3) var(--space-4);
	border-top: 1px solid var(--color-border);
	flex-wrap: wrap;
}

.recruit-form-error {
	margin: 0 0 var(--space-3);
	padding: var(--space-3);
	border-radius: var(--radius-md, 8px);
	background: var(--color-danger-soft, rgba(179, 38, 30, 0.10));
	color: var(--color-danger, #b3261e);
	border: 1px solid var(--color-danger-soft, rgba(179, 38, 30, 0.35));
}

/* Public /ad/{token} landing — what the caregiver sees from
 * the SMS tap. Brand band on top, facts dl in the middle, big
 * CTA on the bottom. Single-column at any width since the
 * page is the caregiver's reading-on-phone target. */
.ad-landing-wrap {
	max-width: 36rem;
	margin: 0 auto;
	padding: var(--space-5) var(--space-4);
}
.ad-landing-brand {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	margin-bottom: var(--space-5);
	padding: var(--space-3) var(--space-4);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background: var(--color-accent-soft, rgba(97, 0, 255, 0.06));
}
.ad-landing-logo {
	height: 3rem;
	width: auto;
}
.ad-landing-brand-label {
	margin: 0;
	font-size: var(--text-xs);
	color: var(--color-text-muted);
	letter-spacing: 0.08em;
	text-transform: uppercase;
}
.ad-landing-brand-name {
	margin: 0;
	font-size: var(--text-lg);
	font-weight: 700;
}
.ad-landing-body {
	margin-bottom: var(--space-5);
}
/* Caregiver-facing fact cards — the WHERE / WHEN / PAY trio
 * that should land in the first second of looking at the ad.
 * Stacked full-width by default (mobile-first); could side-by-
 * side at wider viewports but for the caregiver-target the
 * stacked read is clearer. */
.ad-fact-cards {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	margin: 0 0 var(--space-4);
}
.ad-fact-card {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	padding: var(--space-3) var(--space-4);
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-left: 4px solid var(--color-accent);
	border-radius: var(--radius-md);
}
.ad-fact-icon {
	font-size: 1.8rem;
	line-height: 1;
}
.ad-fact-body { min-width: 0; flex: 1 1 auto; }
.ad-fact-label {
	margin: 0;
	font-size: var(--text-xs);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--color-text-muted);
}
.ad-fact-value {
	margin: 0.1rem 0 0;
	font-size: var(--text-lg);
	font-weight: 700;
	line-height: 1.25;
}
.ad-fact-sub {
	margin: 0.15rem 0 0;
	font-size: var(--text-sm);
	color: var(--color-text-secondary);
}

/* Job title is no longer the headline — demoted to a soft
 * subtitle below the fact cards. The role description and
 * agency identity already say what the job is. */
.ad-landing-title-soft {
	font-size: var(--text-base);
	font-weight: 600;
	color: var(--color-text-muted);
	margin: var(--space-4) 0 var(--space-2);
}
.ad-landing-section {
	margin-top: var(--space-4);
}
.ad-landing-section-title {
	font-size: var(--text-base);
	font-weight: 700;
	margin: 0 0 var(--space-2);
}
.ad-landing-section-body {
	margin: 0;
	line-height: 1.5;
	white-space: pre-wrap;
}
.ad-landing-cta {
	margin-top: var(--space-5);
	padding-top: var(--space-5);
	border-top: 1px solid var(--color-border);
}
.ad-landing-form {
	margin: 0 0 var(--space-3);
}
.ad-landing-form .btn { width: 100%; }
.ad-landing-cta-hint {
	margin: 0 0 var(--space-3);
	font-size: var(--text-sm);
	color: var(--color-text-muted);
	line-height: 1.5;
}
.ad-landing-cta-skip {
	margin: 0;
	font-size: var(--text-sm);
	color: var(--color-text-muted);
}
.ad-landing-already {
	margin: 0 0 var(--space-3);
	padding: var(--space-3);
	border-radius: var(--radius-md);
	background: var(--color-success-soft, rgba(102, 204, 153, 0.18));
	color: var(--color-success-strong, #1b5e20);
}
.ad-landing-profile {
	margin-top: var(--space-5);
	padding-top: var(--space-4);
	border-top: 1px dashed var(--color-border);
	text-align: center;
}
.ad-landing-profile-link {
	display: inline-block;
	font-size: var(--text-base);
	font-weight: 600;
	color: var(--color-accent);
	text-decoration: none;
	padding: var(--space-2) var(--space-3);
}
.ad-landing-profile-link:hover {
	text-decoration: underline;
}
.ad-landing-profile-hint {
	margin: var(--space-2) 0 0;
	font-size: var(--text-xs);
	color: var(--color-text-muted);
}
.ad-landing-thanks {
	text-align: center;
	padding: var(--space-5) 0;
}
.ad-landing-thanks-emoji { font-size: 3rem; display: block; }
.ad-landing-thanks-title {
	font-size: var(--text-2xl);
	font-weight: 700;
	margin: var(--space-3) 0 var(--space-2);
}
.ad-landing-thanks-body {
	margin: 0 0 var(--space-2);
	line-height: 1.5;
}

/* /caregiver/job-alerts inbox. */
.caregiver-alerts-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}
.caregiver-alert {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background: var(--color-surface);
}
.caregiver-alert-link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	padding: var(--space-3) var(--space-4);
	text-decoration: none;
	color: inherit;
}
.caregiver-alert-link:hover {
	background: var(--color-surface-alt);
	border-radius: var(--radius-md);
}
.caregiver-alert-body { min-width: 0; flex: 1 1 auto; }
.caregiver-alert-title {
	font-size: var(--text-base);
	font-weight: 700;
	margin: 0 0 var(--space-1);
}
.caregiver-alert-meta {
	margin: 0 0 var(--space-1);
	font-size: var(--text-sm);
	color: var(--color-text-muted);
}
.caregiver-alert-agency { font-weight: 600; color: var(--color-text-primary); }
.caregiver-alert-sep { margin: 0 0.3em; }
.caregiver-alert-when {
	margin: 0;
	font-size: var(--text-xs);
	color: var(--color-text-muted);
}

/* Roster cell defaults: text cells stay on one line so Name / Phone
 * don't break mid-word on a narrow viewport. The status column is
 * already nowrap via the .pill rule. */
.caregivers-roster-table td,
.caregivers-roster-table th {
	white-space: nowrap;
}
/* On phone widths hide the two least-essential columns (avatar
 * placeholder + Joined date) so Name / Phone / Status fit without
 * crushing or overflowing the panel. Both facts live on the per-
 * caregiver detail page, one tap away. */
@media (max-width: 540px) {
	.caregivers-roster-avatar,
	.caregivers-roster-joined {
		display: none;
	}
}

/* Override the generic .table-scroll min-width (540px) because the
 * caregivers table is only 3 nowrap columns on mobile (Name /
 * Phone / Status). 420px is enough for those to sit flush; tighter
 * viewports still scroll, just less of one. */
.caregivers-roster-scroll .settings-table {
	min-width: 420px;
}


/* ---- External training credit dialog -----------------------------
 *
 * Opened from the "Add external training credit" button on the
 * agency caregiver-detail page. Form-shaped: scrolls the body if
 * the field list gets longer than the viewport.
 */
.credit-dialog {
	border: none;
	padding: 0;
	border-radius: var(--radius-lg);
	background: var(--color-surface);
	box-shadow: var(--shadow-lg);
	max-width: 92vw;
	width: 32rem;
	max-height: 90vh;
}
.credit-dialog::backdrop {
	background: rgba(20, 28, 38, 0.55);
}
.credit-dialog-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--space-4) var(--space-5);
	border-bottom: 1px solid var(--color-border);
}
.credit-dialog-header h3 {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 600;
	color: var(--color-text-primary);
}
.credit-dialog-close {
	background: transparent;
	border: none;
	color: var(--color-text-muted);
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	padding: var(--space-1) var(--space-2);
	border-radius: var(--radius-sm);
}
.credit-dialog-close:hover,
.credit-dialog-close:focus-visible {
	background: var(--color-surface-alt);
	color: var(--color-text-primary);
}
.credit-dialog-body {
	padding: var(--space-5);
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}
.credit-dialog-footer {
	display: flex;
	justify-content: flex-end;
	gap: var(--space-3);
	padding: var(--space-4) var(--space-5);
	border-top: 1px solid var(--color-border);
}

/* ---- Drug test attestation: signing canvas + cert page ----- */

/* Reusable signing canvas — used in the drug-test-attest modal.
 * Matches the styling pattern of the document-signing wizard's
 * canvas without dragging in its full pad layout. */
.signing-canvas {
	width: 100%;
	height: 9rem;
	background: #ffffff;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	touch-action: none;
	display: block;
}

/* Cert page — formal layout, print-friendly. Distinct visual
 * weight from any platform module-completion cert (per the
 * design decision). */
.cert-attestation {
	max-width: 44rem;
	margin: var(--space-6) auto;
	padding: var(--space-6) var(--space-7);
	background: var(--color-surface);
	border: 2px solid var(--color-text-primary);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-md);
}
.cert-attestation-header {
	text-align: center;
	border-bottom: 1px solid var(--color-border);
	padding-bottom: var(--space-4);
	margin-bottom: var(--space-5);
}
.cert-attestation-eyebrow {
	margin: 0 0 var(--space-1) 0;
	font-size: 0.85rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--color-text-muted);
}
.cert-attestation-title {
	margin: 0 0 var(--space-2) 0;
	font-size: 1.7rem;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var(--color-text-primary);
}
.cert-attestation-subtitle {
	margin: 0;
	font-size: 0.95rem;
	color: var(--color-text-secondary);
}
.cert-attestation-fields {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--space-3) var(--space-5);
	margin: var(--space-5) 0;
}
.cert-attestation-fields > div {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
}
.cert-attestation-fields dt {
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--color-text-muted);
}
.cert-attestation-fields dd {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 600;
	color: var(--color-text-primary);
}
.cert-attestation-statement {
	margin: var(--space-5) 0;
	padding: var(--space-4);
	background: var(--color-surface-alt);
	border-radius: var(--radius-sm);
	font-size: 0.95rem;
	line-height: 1.55;
	color: var(--color-text-primary);
}
.cert-attestation-signature-block {
	margin: var(--space-5) 0 var(--space-3);
	padding-top: var(--space-4);
	border-top: 1px solid var(--color-border);
}
.cert-attestation-sig-label {
	margin: 0 0 var(--space-2) 0;
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--color-text-muted);
}
.cert-attestation-signature-img {
	max-height: 5rem;
	display: block;
	margin-bottom: var(--space-2);
}
.cert-attestation-signer {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 600;
}
.cert-attestation-signed-at {
	margin: 0;
	font-size: 0.85rem;
	color: var(--color-text-muted);
}
.cert-attestation-footer {
	display: flex;
	justify-content: space-between;
	margin-top: var(--space-5);
	padding-top: var(--space-4);
	border-top: 1px solid var(--color-border);
}
@media print {
	.cert-attestation-footer { display: none; }
	.cert-attestation { box-shadow: none; border-width: 1px; }
}

/* ---- Inline-edit pair (admin training-modules list) ---------- */

.quick-edit-form {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	flex-wrap: wrap;
}
.quick-edit-pair {
	display: inline-flex;
	align-items: center;
	gap: var(--space-1);
	margin: 0;
}
.quick-edit-label {
	font-size: 0.78rem;
	color: var(--color-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}
.quick-edit-input {
	width: 4.5rem;
	padding: 0.25rem 0.4rem;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	background: var(--color-surface);
	color: var(--color-text-primary);
	font-size: 0.92rem;
}
.quick-edit-input:focus {
	outline: 2px solid var(--color-accent);
	outline-offset: 1px;
}

/* Satisfier list — comma-joined module names shown below a
 * requirement on the satisfaction grid so admin can see at a
 * glance which platform modules clear the row. */
.satisfier-list {
	display: inline-block;
	margin-top: var(--space-1);
	font-size: 0.78rem;
	color: var(--color-text-secondary);
	line-height: 1.35;
}

/* Upload-popover action row — Save/Cancel pair. */
.upload-popover-actions {
	display: flex;
	gap: var(--space-2);
	justify-content: flex-end;
	margin-top: var(--space-2);
}

/* ---- Requirement-satisfaction cards -----------------------------
 *
 * One card per state regulatory requirement on the caregiver
 * detail page. Replaces a wide table row that was carrying 6+
 * fields per requirement.
 */
.requirement-cards {
	display: grid;
	gap: var(--space-3);
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
	margin-top: var(--space-3);
}
.requirement-card {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-4);
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}
.requirement-card-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--space-3);
}
.requirement-card-title-block {
	min-width: 0;
	flex: 1;
}
.requirement-card-title {
	margin: 0 0 var(--space-1) 0;
	font-size: 1rem;
	font-weight: 600;
	color: var(--color-text-primary);
	line-height: 1.3;
}
.requirement-card-citation {
	margin: 0;
	font-size: 0.78rem;
	color: var(--color-text-muted);
}
.requirement-card-citation code {
	font-size: 0.78rem;
}
.requirement-card-meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
}
.requirement-card-pill {
	display: inline-flex;
	align-items: center;
	padding: 0.2rem 0.55rem;
	background: var(--color-surface-alt);
	color: var(--color-text-secondary);
	border-radius: 999px;
	font-size: 0.78rem;
	font-weight: 500;
}
.requirement-card-pill-state {
	background: var(--color-accent-soft, var(--color-surface-alt));
	color: var(--color-accent, var(--color-text-secondary));
	font-weight: 600;
}
.requirement-card-pill-hours {
	font-variant-numeric: tabular-nums;
}
.requirement-card-satisfiers {
	margin: 0;
	font-size: 0.88rem;
	color: var(--color-text-secondary);
	line-height: 1.45;
}
.requirement-card-satisfiers-label {
	display: inline-block;
	margin-right: var(--space-2);
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--color-text-muted);
}
.requirement-card-unmapped {
	margin: 0;
	font-size: 0.85rem;
	color: var(--color-text-muted);
	font-style: italic;
}
.requirement-card-unmapped a {
	color: var(--color-accent, var(--color-text-secondary));
	text-decoration: underline;
}

/* Subtitle + tooltip refinements for the satisfaction section. */
.requirement-section-subtitle {
	margin: 0 0 var(--space-2) 0;
	font-size: 1.05rem;
	color: var(--color-text-primary);
	display: flex;
	align-items: center;
	gap: var(--space-2);
}
.requirement-section-subtitle strong {
	font-weight: 600;
}
.requirement-section-subtitle-sep {
	color: var(--color-text-muted);
}
.requirement-section-subtitle-state {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--color-text-muted);
	letter-spacing: 0.06em;
	padding: 0.15rem 0.45rem;
	background: var(--color-surface-alt);
	border-radius: 999px;
}

.requirement-card-citation a {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	text-decoration: none;
	color: var(--color-accent, var(--color-text-secondary));
	border-bottom: 1px dotted currentColor;
}
.requirement-card-citation a:hover,
.requirement-card-citation a:focus-visible {
	border-bottom-style: solid;
}
.requirement-card-citation-icon {
	font-size: 0.72rem;
	opacity: 0.7;
}

.requirement-card-pill-funding {
	cursor: help;
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
}
.requirement-card-pill-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.05rem;
	height: 1.05rem;
	border-radius: 50%;
	background: var(--color-text-muted);
	color: var(--color-surface);
	font-size: 0.7rem;
	font-weight: 700;
	line-height: 1;
}

/* ---- Hover/focus tooltip (no JS) ------------------------------
 *
 * Pure-CSS tooltip pattern. Add `tooltip-host` to any element
 * with a `.tooltip-bubble` child — the bubble shows on
 * hover/focus instantly (no native title-attribute delay).
 * The host should also carry an aria-label or visually-hidden
 * text describing the same thing for screen readers.
 */
.tooltip-host {
	position: relative;
}
.tooltip-bubble {
	position: absolute;
	bottom: calc(100% + 0.4rem);
	left: 50%;
	transform: translateX(-50%);
	min-width: 12rem;
	max-width: 18rem;
	padding: 0.5rem 0.7rem;
	background: var(--color-text-primary);
	color: var(--color-surface);
	border-radius: var(--radius-sm);
	font-size: 0.78rem;
	font-weight: 400;
	line-height: 1.4;
	text-align: left;
	box-shadow: var(--shadow-md);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.12s ease-out;
	z-index: 100;
	white-space: normal;
}
.tooltip-bubble::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 5px solid transparent;
	border-top-color: var(--color-text-primary);
}
.tooltip-host:hover .tooltip-bubble,
.tooltip-host:focus .tooltip-bubble,
.tooltip-host:focus-within .tooltip-bubble {
	opacity: 1;
	visibility: visible;
}

/* =========================================================
   Scheduling — per-client weekly calendar
   ========================================================= */

.schedule-headbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.schedule-weeknav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.schedule-week-label {
    margin-left: 8px;
    font-weight: 500;
    color: var(--color-text-secondary);
}
.schedule-refresh {
    display: flex;
    align-items: center;
    gap: 12px;
}
.schedule-refresh-form {
    display: inline-block;
    margin: 0;
}
.schedule-fresh {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
}
.schedule-fresh-fresh   { background: rgba(47, 204, 113, 0.12); color: #228855; }
.schedule-fresh-stale   { background: rgba(255, 191, 64, 0.18); color: #b07000; }
.schedule-fresh-syncing { background: rgba(97, 0, 255, 0.10); color: #6100ff; }

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
}
.schedule-daycol {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    min-height: 240px;
}
.schedule-daycol-today {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 1px var(--color-accent);
}
.schedule-dayhead {
    padding: 6px 8px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-2, var(--color-surface));
}
.schedule-dayhead-label {
    font-weight: 600;
    font-size: 0.9rem;
}
.schedule-tiles {
    list-style: none;
    margin: 0;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}
.schedule-tile {
    padding: 6px 8px;
    border-radius: 4px;
    border-left: 3px solid var(--color-border-strong);
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.85rem;
    position: relative; /* anchor for the hover popover */
}

/* When the user hovers a tile, hoist it (and its popover) above
   every adjacent tile's stacking position. Without this, the
   transform on .schedule-tile-clickable:hover creates a new
   stacking context that "traps" the popover's z-index relative
   to its parent, and later sibling tiles paint over it in
   document order. */
.schedule-tile:hover,
.schedule-tile:focus,
.schedule-tile:focus-within {
    z-index: 100;
}

/* Hover popover. Shows the full info for a tile without the
   day-column width constraint. CSS-only — the same tile that
   click-opens the edit modal grows on hover to reveal
   everything we have without refetching from WellSky. */
.schedule-tile-popover {
    display: none;
    position: absolute;
    top: -2px;
    left: -2px;
    z-index: 50;
    width: 360px;
    max-width: 360px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
    padding: 14px 16px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
    color: var(--color-text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: normal;
    /* The popover sits OVER the tile; pointer-events: none lets
       click-through to the tile (which opens the edit modal) still
       work even when the cursor is on the popover. */
    pointer-events: none;
}
.schedule-tile:hover .schedule-tile-popover,
.schedule-tile:focus .schedule-tile-popover,
.schedule-tile:focus-within .schedule-tile-popover {
    display: block;
}

/* Rightmost two day-columns (Fri + Sat) anchor the popover to
   the tile's right edge instead of the left so it doesn't run
   off the page. */
.schedule-daycol:nth-child(n+6) .schedule-tile-popover {
    left: auto;
    right: -2px;
}

.schedule-tile-popover-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}
.schedule-tile-popover-time {
    font-weight: 700;
    font-size: 1rem;
}
.schedule-tile-popover-duration {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}
.schedule-tile-popover-fields {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 6px 12px;
    margin: 0;
}
.schedule-tile-popover-fields dt {
    color: var(--color-text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    align-self: baseline;
    padding-top: 2px;
}
.schedule-tile-popover-fields dd {
    margin: 0;
    color: var(--color-text-primary);
    word-break: break-word;
    font-size: 0.9rem;
}

/* Mobile: no hover affordance available, and the day-column
   already collapses to full-width — hide the popover. The
   click-to-edit flow already surfaces all the same data. */
@media (max-width: 768px) {
    .schedule-tile-popover { display: none !important; }
}
.schedule-tile-scheduled    { border-left-color: #6100ff; }
.schedule-tile-carelogged   { border-left-color: #2fcc71; }
.schedule-tile-in-progress  { border-left-color: #ffbf40; }
.schedule-tile-cancelled    {
    border-left-color: #b3261e;
    opacity: 0.55;
    text-decoration: line-through;
}
.schedule-tile-tentative    { border-left-color: #888; font-style: italic; }
.schedule-tile-time { font-weight: 600; }
.schedule-tile-caregiver { color: var(--color-text-primary); }
.schedule-tile-rate {
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    /* Names like "Allen_Week_half_couple_..." can run long. Clip
       with a clean ellipsis instead of letting the text spill
       mid-character past the column edge. */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
/* Status pill inside a schedule tile: the day columns are narrow,
   so override the global status-pill metrics to a compact form
   that doesn't fill the cell edge-to-edge. */
.schedule-tile .status-pill {
    align-self: flex-start;
    padding: 1px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-body, inherit);
    letter-spacing: 0;
    line-height: 1.4;
    margin-top: 2px;
}
.schedule-dayfoot {
    padding: 6px;
    border-top: 1px dashed var(--color-border);
    text-align: center;
}
.schedule-addbtn { width: 100%; }

@media (max-width: 800px) {
    .schedule-grid {
        grid-template-columns: 1fr;
    }
}

/* Add-shift modal */
.agency-modal {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0;
    background: var(--color-surface);
    color: var(--color-text-primary);
    max-width: 640px;
    width: 92vw;
    box-shadow: var(--shadow-lg);
}
.agency-modal::backdrop {
    background: rgba(0, 0, 0, 0.45);
}
.agency-modal-body {
    padding: 16px;
}
.agency-modal-footer {
    padding: 8px 16px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-2, var(--color-surface));
    display: flex;
    justify-content: flex-end;
}
.agency-modal-header {
    margin-bottom: 12px;
}
.agency-modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}
.agency-modal-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.agency-modal-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    flex: 1 1 140px;
}
.agency-modal-label select,
.agency-modal-label input {
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-bg);
    color: var(--color-text-primary);
    font-size: 0.95rem;
}
/* Grouped sections inside the add/edit shift modal. The
   "Caregiver & pay" pairing makes the dependency between
   caregiver and pay-rate explicit; "Client billing" stays
   visually separate. */
.agency-modal-section {
    margin: 0 0 14px;
    padding: 10px 14px 6px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
}
.agency-modal-section legend {
    padding: 0 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.agency-modal-help {
    margin: 4px 0 2px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-style: italic;
}

.agency-modal-overrides {
    margin-top: 8px;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
}
.agency-modal-overrides legend {
    padding: 0 4px;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}
.agency-modal-overrides label {
    display: inline-flex;
    gap: 4px;
    margin-right: 12px;
    font-size: 0.85rem;
}
.agency-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}
.agency-modal-loading {
    text-align: center;
    color: var(--color-text-secondary);
    padding: 24px;
}

/* Spinner + friendlier loader for the add-shift modal. Replaces
   the bare "Loading modal…" line that confused agency admins. */
.agency-modal-loading-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 24px;
    text-align: center;
}
.agency-modal-loading-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-primary);
}
.agency-modal-loading-sub {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    max-width: 360px;
    line-height: 1.5;
}
.agency-modal-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: agencyModalSpin 0.8s linear infinite;
}
@keyframes agencyModalSpin { to { transform: rotate(360deg); } }

/* HTMX-driven swap on the pay-rate dropdown briefly leaves the
   <select> in a "Loading pay rates…" placeholder state. The
   in-flight class HTMX adds is a subtle visual cue, not a
   blocker. */
.agency-modal-form select.htmx-request {
    opacity: 0.6;
}
.agency-form-error {
    color: #b3261e;
    background: rgba(179, 38, 30, 0.08);
    padding: 8px 12px;
    border-radius: 4px;
    margin: 8px 0;
}

/* Shift-write status region (poller target) */
.shift-write-status-region {
    margin-top: 12px;
}
.shift-write-pending,
.shift-write-success,
.shift-write-error {
    padding: 10px 14px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}
.shift-write-pending  {
    background: rgba(97, 0, 255, 0.08);
    color: #4d00cc;
}
.shift-write-success  {
    background: rgba(47, 204, 113, 0.10);
    color: #2fcc71;
}
.shift-write-error    {
    background: rgba(179, 38, 30, 0.10);
    color: #b3261e;
}
.shift-write-details {
    margin-left: 12px;
}
.shift-write-details pre {
    background: rgba(0, 0, 0, 0.04);
    padding: 8px;
    border-radius: 4px;
    overflow-x: auto;
    max-width: 480px;
    font-size: 0.8rem;
}

/* Session 6 — clickable shift tiles + modal spacer */
.schedule-tile-clickable {
    cursor: pointer;
    transition: transform 0.08s ease-out, box-shadow 0.08s ease-out;
}
.schedule-tile-clickable:hover,
.schedule-tile-clickable:focus {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    outline: none;
}
.schedule-tile-clickable:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}
.agency-modal-spacer { flex: 1; }

/* ----------------------------------------------------------------
   Generic .primary-button / .secondary-button / .link-button.
   Used across the corrections-inbox and the scheduling index; will
   subsume the older .btn / .btn-primary convention over time.
   ---------------------------------------------------------------- */
.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--color-accent);
    color: var(--color-accent-fg);
    border: 1px solid var(--color-accent);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.primary-button:hover {
    background: var(--color-accent-hover);
    color: var(--color-accent-fg);
    text-decoration: none;
}
.primary-button:active { transform: translateY(1px); }
.primary-button:disabled {
    background: var(--color-border-strong);
    border-color: var(--color-border-strong);
    cursor: not-allowed;
    opacity: 0.8;
}

.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--color-surface);
    color: var(--color-accent);
    border: 1px solid var(--color-accent);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease;
}
.secondary-button:hover {
    background: var(--color-surface-tint);
    color: var(--color-accent-hover);
    text-decoration: none;
}

/* .link-button — text-only with accent color, no border/background. */
.link-button {
    background: none;
    border: none;
    color: var(--color-accent);
    cursor: pointer;
    padding: 0;
    font: inherit;
    font-weight: 500;
}
.link-button:hover { color: var(--color-accent-hover); text-decoration: underline; }

/* Scheduling index page (clients list + prototype banner) */
.scheduling-proto-banner {
    background: rgba(255, 191, 64, 0.12);
    border: 1px solid #ffbf40;
    color: #875a00;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.scheduling-proto-banner strong { font-weight: 700; }
.scheduling-index-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
}
.scheduling-index-row {
    border-bottom: 1px solid var(--color-border);
}
.scheduling-index-row:last-child { border-bottom: none; }
.scheduling-index-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    color: var(--color-text-primary);
    text-decoration: none;
    transition: background 0.08s ease-out;
}
.scheduling-index-link:hover,
.scheduling-index-link:focus {
    background: rgba(97, 0, 255, 0.06);
    outline: none;
}
.scheduling-index-name { font-weight: 500; }
.scheduling-index-arrow { color: var(--color-text-secondary); }
.scheduling-index-missing {
    margin-top: 12px;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

/* Tools section (the "Preview corrections" CTA card on /agency/scheduling). */
.scheduling-tools {
    background: linear-gradient(135deg, rgba(97, 0, 255, 0.04) 0%, rgba(0, 199, 255, 0.04) 100%);
    border: 1px solid rgba(97, 0, 255, 0.15);
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 20px;
}
.scheduling-tools .agency-section-title {
    margin-top: 0;
}
.scheduling-tools form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}
.scheduling-tool-hint {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    margin: 0;
    max-width: 720px;
    line-height: 1.55;
}

/* Make the index list a touch more substantial so it carries its weight
   on the page next to the prominent Tools card. */
.scheduling-index-link {
    font-size: 0.95rem;
}
.scheduling-index-link:hover .scheduling-index-arrow,
.scheduling-index-link:focus .scheduling-index-arrow {
    color: var(--color-accent);
    transform: translateX(2px);
}
.scheduling-index-arrow {
    transition: color 0.12s ease, transform 0.12s ease;
}

@media (max-width: 640px) {
    .scheduling-tools { padding: 14px 16px; }
    .scheduling-tools form .primary-button { width: 100%; min-height: 44px; }
}

/* Schedule day footer — "past" placeholder for past days */
.schedule-dayfoot-note {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    font-style: italic;
    opacity: 0.6;
    cursor: help;
}
