:root {
	--bg: #f3f6f2;
	--bg-muted: #edf3ee;
	--surface: #ffffff;
	--surface-muted: #f7faf7;
	--surface-subtle: #eef5ee;
	--border: #d7e2d8;
	--border-strong: #bfcebf;
	--text: #172033;
	--text-muted: #62708a;
	--heading: #0f172a;
	--brand: #217a00;
	--brand-strong: #195d00;
	--brand-soft: #eef8e8;
	--success-soft: #eefbf3;
	--success-border: #c7edd5;
	--danger: #b42318;
	--danger-soft: #fdecea;
	--danger-border: #f2c6c2;
	--label: #3b475c;
	--warn: #8a4b00;
	--warn-soft: #fff4e5;
	--warn-border: #f1d3a6;
	--info: #1d4f91;
	--info-soft: #eef4fc;
	--info-border: #c9dbf2;
	--text-xs: 12px;
	--text-sm: 13px;
	--text-md: 14px;
	--text-lg: 16px;
	--text-xl: 20px;
	--text-2xl: 28px;
	--space-1: 4px;
	--space-2: 8px;
	--space-3: 12px;
	--space-4: 16px;
	--space-5: 24px;
	--space-6: 32px;
	--shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
	--shadow-md: 0 12px 24px rgba(15, 23, 42, 0.06);
	--radius-xl: 18px;
	--radius-lg: 14px;
	--radius-md: 10px;
	--radius-sm: 8px;
	--transition: 160ms ease;
	--chart-1: var(--brand);
	--chart-2: #0b2f5c;
	--chart-3: #b06f00; /* 4.10:1 on white */
	--chart-4: #4a90d9; /* 3.34:1 on white */
	--chart-other: #8b929c;
}

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

html {
	min-height: 100%;
	background: var(--bg);
}

body {
	margin: 0;
	min-height: 100vh;
	background:
		linear-gradient(180deg, #f9fcf8 0%, var(--bg) 132px, var(--bg) 100%);
	color: var(--text);
	font: 14px/1.5 "Inter", "Segoe UI Variable", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

a,
a:link,
a:visited {
	color: var(--brand);
	text-decoration: none;
	transition: color var(--transition), background-color var(--transition), border-color var(--transition), box-shadow var(--transition);
}

a:hover {
	color: var(--brand-strong);
}

img {
	max-width: 100%;
}

hr {
	border: 0;
	height: 1px;
	margin: 18px 0;
	background: var(--border);
}

.centertext {
	text-align: center;
}

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* App shell (www/body.php): top bar, section links, client header. */

.topbar {
	background: var(--surface);
	border-top: 3px solid var(--brand);
	border-bottom: 1px solid var(--border);
}

.topbar__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 20px;
	padding: 4px 18px;
}

a.topbar__brand,
a.topbar__brand:link,
a.topbar__brand:visited {
	display: inline-flex;
	gap: 6px;
	min-height: 44px;
	align-items: center;
	color: var(--heading);
	font-size: 17px;
	font-weight: 700;
	letter-spacing: -0.01em;
}

.topbar__site {
	color: var(--text-muted);
	font-weight: 500;
}

.topbar__toggle {
	display: none;
}

.topbar__nav {
	display: flex;
	flex: 1 1 auto;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 16px;
	min-width: 0;
}

#menu_tabs {
	flex: 0 1 auto;
	min-width: 0;
}

ul#tabnav {
	display: flex;
	flex-wrap: wrap;
	gap: 2px;
	margin: 0;
	padding: 0;
	list-style: none;
}

ul#tabnav li {
	margin: 0;
	padding: 0;
}

#menu_tabs a:link,
#menu_tabs a:visited {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 0 10px;
	border-radius: var(--radius-sm);
	color: #3b475c;
	font-size: 14px;
	font-weight: 600;
}

#menu_tabs a:hover,
#menu_tabs a:focus-visible {
	background: var(--surface-subtle);
	color: var(--heading);
}

#menu_tabs a.sel:link,
#menu_tabs a.sel:visited {
	background: var(--brand-soft);
	color: var(--brand-strong);
}

.topbar__search {
	position: relative;
	display: flex;
	/* Grows into the bar's spare room, up to enough for the whole
	   placeholder ("name, ID, CN- case note or DOB"); starts at 200px so
	   it never pushes the bar onto a second line sooner than before. */
	flex: 1 1 200px;
	min-width: 170px;
	max-width: 440px;
	margin: 0 0 0 auto;
}

.topbar__account {
	flex: none;
}

/* :not([size]) outranks the general input[type=search]:not([size]) rule,
   whose 420px cap would leave the box narrower than the form and the
   search button hanging off its right edge. */
.topbar__search input[type=search],
.topbar__search input[type=search]:not([size]) {
	width: 100%;
	height: 40px;
	padding: 0 44px 0 12px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface-muted);
	font: inherit;
	font-size: 14px;
	color: var(--text);
}

.topbar__search input[type=search]:focus {
	outline: 2px solid var(--brand);
	outline-offset: 1px;
	background: var(--surface);
}

.topbar__search button {
	position: absolute;
	top: 0;
	right: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 40px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--text-muted);
	box-shadow: none;
	cursor: pointer;
}

.topbar__search button:hover {
	color: var(--brand-strong);
	background: transparent;
}

/* Small drop-down menus (account, Print): <details class="shell-menu">. */
.shell-menu {
	position: relative;
}

.shell-menu > summary {
	list-style: none;
	cursor: pointer;
}

.shell-menu > summary::-webkit-details-marker {
	display: none;
}

.shell-menu > summary::after {
	content: "";
	display: inline-block;
	width: 6px;
	height: 6px;
	margin-left: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-2px) rotate(45deg);
}

.topbar__account > summary {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 0 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	color: var(--heading);
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
}

.shell-menu__list {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	z-index: 20;
	display: grid;
	min-width: 190px;
	padding: 6px;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--surface);
	box-shadow: var(--shadow-md);
}

.shell-menu__list a:link,
.shell-menu__list a:visited {
	display: flex;
	align-items: center;
	min-height: 40px;
	padding: 0 10px;
	border-radius: var(--radius-sm);
	color: var(--text);
	font-size: 14px;
}

.shell-menu__list a:hover {
	background: var(--surface-subtle);
	color: var(--heading);
}

/* Links for the current section, under the top bar. */
.section-links {
	background: var(--surface);
	border-bottom: 1px solid var(--border);
}

.section-links__inner {
	display: flex;
	gap: 0 24px;
	padding: 0 18px;
	overflow-x: auto;
}

.section-links a:link,
.section-links a:visited,
.client-bar__tabs a:link,
.client-bar__tabs a:visited {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 2px;
	border-bottom: 2px solid transparent;
	color: #3b475c;
	font-size: 14px;
	font-weight: 500;
	white-space: nowrap;
}

.client-bar__tabs a:link,
.client-bar__tabs a:visited {
	font-weight: 600;
}

.section-links a:hover,
.client-bar__tabs a:hover {
	color: var(--heading);
}

/* A link kept apart at the right end of the row (Admin > Usage). */
.section-links a.section-links__end {
	margin-left: auto;
}

.section-links a.is-active,
.client-bar__tabs a.is-active {
	border-bottom-color: var(--brand);
	color: var(--brand-strong);
	font-weight: 600;
}

/* The open client. */
.client-bar {
	background: var(--surface);
	border-bottom: 1px solid var(--border);
}

.client-bar__inner {
	display: grid;
	gap: 8px;
	padding: 14px 18px 0;
}

.client-bar__top {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 12px 16px;
}

.client-bar__who {
	display: grid;
	gap: 6px;
	min-width: 0;
}

.client-bar__back {
	width: fit-content;
	font-size: 13px;
}

.client-bar__name {
	margin: 0;
	font-size: 24px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.01em;
}

.client-bar__name a:link,
.client-bar__name a:visited {
	color: var(--heading);
}

.client-bar__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.chip {
	display: inline-flex;
	align-items: center;
	padding: 2px 10px;
	border-radius: 999px;
	background: #f1f4f8;
	color: #3b475c;
	font-size: 13px;
}

.chip--warn {
	background: #fff4e5;
	color: #8a4b00;
}

.client-bar__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.client-bar__tabs {
	display: flex;
	gap: 0 24px;
	overflow-x: auto;
}

.section-links a.section-links__back:link,
.section-links a.section-links__back:visited {
	margin-left: auto;
	color: var(--brand);
	font-weight: 600;
}

/* Rows that scroll sideways on phones: no scrollbar under the tabs. */
.client-bar__tabs,
.section-links__inner {
	scrollbar-width: none;
}

.client-bar__tabs::-webkit-scrollbar,
.section-links__inner::-webkit-scrollbar {
	display: none;
}

.shell-button,
a.shell-button:link,
a.shell-button:visited {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 0 16px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--heading);
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
}

a.shell-button--primary:link,
a.shell-button--primary:visited {
	border-color: var(--brand);
	background: var(--brand);
	color: #fff;
}

a.shell-button--primary:hover,
a.shell-button--primary.is-active {
	border-color: var(--brand-strong);
	background: var(--brand-strong);
	color: #fff;
}

/* New Case Action pinned to the bottom of the screen on phones. */
.client-cta {
	display: none;
}

#page {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 14px;
	padding: 14px 18px 20px;
	align-items: start;
}

#page.has-side {
	grid-template-columns: minmax(0, 1fr) 236px;
}

#main,
#menu .m_c {
	border: 1px solid var(--border);
	border-radius: var(--radius-xl);
	background: var(--surface);
	box-shadow: var(--shadow-sm);
}

#main {
	min-width: 0;
	padding: 16px;
}

.section {
	padding: 0;
}

#menu {
	min-width: 0;
}

#menu .m_c {
	padding: 12px 8px;
}

.menu_panel_title {
	margin: 0 8px 6px;
	color: var(--text-muted);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

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

a:link.dubsubmenuitem,
a:visited.dubsubmenuitem {
	display: block;
	padding: 5px 8px;
	border-radius: var(--radius-sm);
	color: #3b475c;
	font-size: 13px;
}

a:hover.dubsubmenuitem {
	background: var(--surface-subtle);
	color: var(--brand-strong);
}

div.page_header {
	margin: 0 0 14px;
	padding: 12px 14px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface-muted);
}

div.page_header h1 {
	margin: 0;
	color: var(--heading);
	font-family: inherit;
	font-size: clamp(1.15rem, 2vw, 1.55rem);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.02em;
}

div.page_header h1 a {
	white-space: normal;
}

div.page_header h1 span {
	display: inline-block;
	margin-left: 8px;
	color: var(--text-muted);
	font-size: 0.95rem;
	font-weight: 500;
}

div.sheet div.page_header h1 {
	font-size: 2rem;
}

div.page_header p {
	margin: 8px 0 0;
	color: var(--text-muted);
}

h1,
h2,
h3,
h4 {
	margin-top: 0;
	color: var(--heading);
	font-family: inherit;
	letter-spacing: -0.02em;
}

p {
	margin-top: 0;
}

table {
	width: 100%;
	border-collapse: collapse;
	border-spacing: 0;
	background: transparent;
}

th,
td {
	padding: 4px 12px;
	vertical-align: top;
}

th {
	color: var(--heading);
	font-size: 13px;
	font-weight: 700;
	text-align: left;
}

td {
	color: var(--text);
}

tr + tr td,
tr + tr th {
	border-top: 1px solid #e9eef6;
}

.listbox,
.listLeft,
.listCent {
	padding: 10px 12px;
	border-bottom: 1px solid #e9eef6;
	background: transparent;
}

.listbox,
.listCent {
	text-align: center;
}

.listLeft {
	text-align: left;
}

.listhead {
	padding: 10px 12px;
	background: #edf5ea;
	color: var(--brand-strong);
	text-align: center;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	border-bottom: 1px solid var(--border);
}

.logsheetcell {
	width: 310px;
	margin: 0;
	padding-top: 8px;
	padding-right: 12px;
	padding-left: 8px;
	border-right: 1px solid var(--border);
	border-bottom: 1px solid var(--border);
}

.key {
	color: var(--heading);
	font-weight: 700;
	white-space: nowrap;
}

input,
select,
textarea,
button {
	font: inherit;
}

input[type=text],
input[type=password],
input[type=email],
input[type=number],
input[type=search],
select,
textarea {
	width: auto;
	max-width: 100%;
	padding: 8px 10px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--text);
	box-shadow: none;
	transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}

input[type=text]:not([size]),
input[type=password]:not([size]),
input[type=email]:not([size]),
input[type=number]:not([size]),
input[type=search]:not([size]),
select {
	width: min(100%, 420px);
}

input[type=text]:focus,
input[type=password]:focus,
input[type=email]:focus,
input[type=number]:focus,
input[type=search]:focus,
select:focus,
textarea:focus {
	outline: none;
	border-color: #8bb47e;
	box-shadow: 0 0 0 3px rgba(33, 122, 0, 0.12);
	background: #fff;
}

input[type=checkbox],
input[type=radio] {
	accent-color: var(--brand);
}

textarea {
	width: 100%;
	min-height: 120px;
	resize: vertical;
}

.buttons,
button.buttons,
input.buttons {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 36px;
	padding: 0 14px;
	border: 1px solid var(--brand);
	border-radius: var(--radius-sm);
	background: var(--brand);
	color: #fff;
	cursor: pointer;
	font-weight: 600;
	box-shadow: none;
}

.buttons:hover,
button.buttons:hover,
input.buttons:hover {
	border-color: var(--brand-strong);
	background: var(--brand-strong);
	color: #fff;
}

.buttons-secondary {
	border-color: var(--border-strong);
	background: var(--surface);
	color: var(--text);
}

.buttons-secondary:hover {
	border-color: var(--border-strong);
	background: var(--surface-subtle);
	color: var(--heading);
}

/* Buttons side by side (Search + Clear All, Save + Save as...): keep a gap
   between them, and keep a pair in a table cell on one line instead of
   stacking when the cell is narrow. */
.buttons + .buttons,
.buttons + .buttons-secondary,
.buttons-secondary + .buttons,
.buttons-secondary + .buttons-secondary {
	margin-left: 8px;
}

td:has(> .buttons + .buttons) {
	white-space: nowrap;
}

/* These rows already space their buttons with gap. */
.aform-pagenav > .buttons + .buttons,
.aform-actions > .buttons + .buttons,
.login_actions > .buttons + .buttons {
	margin-left: 0;
	margin-top: 0;
}

#topBar {
	display: none;
}

#search_box {
	max-width: 640px;
	margin: 0 auto;
	padding: 16px 18px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface-muted);
	color: var(--text-muted);
}

#search_box h3 {
	margin: 0 0 12px;
	color: var(--heading);
	font-size: 18px;
	text-align: center;
}

#search_box label {
	display: block;
	margin: 0 0 6px;
	color: var(--heading);
	font-weight: 700;
}

#search_box input[type=text] {
	width: 100%;
}

#search_box > form > div + div {
	margin-top: 10px;
}

.login_shell {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 18px 8px 8px;
}

.login_card {
	width: min(100%, 420px);
	padding: 22px;
	border: 1px solid var(--border);
	border-radius: var(--radius-xl);
	background: var(--surface);
	box-shadow: var(--shadow-md);
}

.login_card-compact {
	text-align: center;
}

/* Failed sign-in (www/login.php), with the note about reset passwords. */
.login_error {
	margin: 0 0 16px;
	padding: 10px 12px;
	border: 1px solid var(--danger);
	border-left-width: 4px;
	border-radius: var(--radius-md, 8px);
	color: var(--text, inherit);
}

.login_card .login_error p {
	margin: 0 0 6px;
}

.login_card .login_error p:last-child {
	margin: 0;
}

.login_error strong {
	color: var(--danger);
}

.login_eyebrow {
	display: inline-block;
	padding: 4px 8px;
	border-radius: 999px;
	background: var(--brand-soft);
	color: var(--brand-strong);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.login_card h1 {
	margin: 12px 0 6px;
	font-size: 28px;
	font-weight: 700;
	line-height: 1.1;
}

.login_card p {
	margin: 0 0 16px;
	color: var(--text-muted);
}

.login_form {
	display: grid;
	gap: 12px;
}

.form_row label {
	display: block;
	margin-bottom: 6px;
	color: var(--heading);
	font-size: 13px;
	font-weight: 700;
}

.login_actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	padding-top: 2px;
}

#client-ai-answer-wrap {
	border-radius: var(--radius-lg);
	border-color: var(--border) !important;
	background: var(--surface-muted) !important;
	box-shadow: none;
}

#client-ai-error {
	font-weight: 600;
	color: var(--danger);
}

@media (max-width: 1120px) {
	#page.has-side {
		grid-template-columns: 1fr;
	}

	#menu {
		order: -1;
	}
}

@media (max-width: 860px) {
	.topbar__inner {
		padding: 0 8px 0 16px;
	}

	.topbar__toggle {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		min-height: 44px;
		margin: 4px 0 4px auto;
		padding: 0 12px;
		border: 1px solid var(--border);
		border-radius: var(--radius-sm);
		background: var(--surface);
		color: var(--heading);
		font: inherit;
		font-size: 14px;
		font-weight: 600;
		box-shadow: none;
		cursor: pointer;
	}

	.topbar.is-open .topbar__toggle {
		border-color: var(--brand);
		background: var(--brand-soft);
		color: var(--brand-strong);
	}

	/* Folded away until Menu is pressed; without JavaScript it stays open. */
	.topbar.has-js .topbar__nav {
		display: none;
	}

	.topbar.has-js.is-open .topbar__nav {
		display: flex;
	}

	.topbar__nav {
		flex: 1 1 100%;
		flex-direction: column;
		align-items: stretch;
		gap: 10px;
		padding: 4px 8px 14px 0;
	}

	.topbar__search {
		order: -1;
		flex: 1 1 auto;
		max-width: none;
		margin: 0;
	}

	ul#tabnav {
		flex-direction: column;
	}

	#menu_tabs a:link,
	#menu_tabs a:visited {
		display: flex;
		min-height: 44px;
	}

	.topbar__account > summary {
		border: 0;
		padding: 0 12px;
		color: var(--text-muted);
	}

	.shell-menu__list {
		left: 0;
		right: auto;
	}

	.section-links__inner,
	.client-bar__inner {
		padding-left: 16px;
		padding-right: 16px;
	}

	#page {
		padding: 10px 12px 18px;
	}

	#main {
		padding: 14px;
	}
}

@media (max-width: 640px) {
	body {
		font-size: 14px;
	}

	.client-bar__name {
		font-size: 22px;
	}

	body:has(.client-cta) .client-bar__actions .shell-button--primary {
		display: none;
	}

	.client-cta {
		position: fixed;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: 30;
		display: block;
		padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
		border-top: 1px solid var(--border);
		background: var(--surface);
	}

	.client-cta .shell-button {
		display: flex;
		width: 100%;
		min-height: 48px;
	}

	body:has(.client-cta) {
		padding-bottom: 76px;
	}

	.buttons,
	button.buttons,
	input.buttons {
		width: 100%;
	}

	.login_card {
		padding: 22px 18px;
	}

	.login_actions {
		flex-direction: column;
	}

	/* .buttons are full width here, so pairs stack with space between. */
	.buttons + .buttons {
		margin-left: 0;
		margin-top: 8px;
	}

	td:has(> .buttons + .buttons) {
		white-space: normal;
	}

	th,
	td {
		padding: 10px 8px;
	}
}

textarea.editor + .ck-editor .ck-editor__editable_inline {
	min-height: 26rem;
}

.report_notice {
	margin: 0 0 16px;
	padding: 12px 16px;
	border: 1px solid var(--border-strong);
	border-radius: 8px;
	background: var(--brand-soft);
	color: var(--text);
	line-height: 1.5;
}

.fund-picker-multi {
	margin-top: 6px;
}

/* AI Reports (www/aireports.php) and Ask the Data (www/aiagent.php) share
   the side list + main column layout and the chip, input and result styles. */
.ai-report-layout {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 20px;
}

.ai-report-side {
	flex: 1 1 240px;
	max-width: 290px;
	padding: 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface);
}

.ai-report-side h3 {
	margin: 14px 4px 4px;
	color: var(--text-muted);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

/* The saved list (www/ai_library_side.php, www/ai-library.js): the same on
   AI Reports, Ask the Data and Reports > Saved. */
.ai-lib [hidden] {
	display: none !important;
}

.ai-lib-new-links {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.ai-lib-new-links .buttons {
	min-height: 32px;
	padding: 0 12px;
	font-size: 13px;
}

.ai-lib-new-links .buttons + .buttons,
.ai-lib-new-links .buttons + .buttons-secondary,
.ai-lib-new-links .buttons-secondary + .buttons {
	margin-left: 0;
}

input.ai-lib-search[type=search] {
	display: block;
	width: 100%;
	margin: 10px 0 0;
	padding: 6px 10px;
	font-size: 13px;
}

.ai-lib .ai-lib-error {
	margin: 8px 0 0;
	padding: 8px 10px;
	font-size: 13px;
}

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

.ai-lib-item {
	position: relative;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 3px 4px 3px 2px;
	border-radius: var(--radius-sm);
	color: var(--text);
	font-size: 13px;
	line-height: 1.35;
}

.ai-lib-item:hover {
	background: var(--surface-subtle);
}

.ai-lib-item.is-current {
	background: var(--brand-soft);
}

.ai-lib-item.is-current .ai-lib-name {
	font-weight: 600;
}

.ai-lib-star,
.ai-lib-menu-btn {
	flex: none;
	width: 22px;
	height: 22px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--border-strong);
	cursor: pointer;
	font-size: 15px;
	line-height: 22px;
	text-align: center;
}

.ai-lib-star[aria-pressed="true"] {
	color: var(--chart-3);
}

.ai-lib-star:hover,
.ai-lib-menu-btn:hover,
.ai-lib-menu-btn[aria-expanded="true"] {
	background: var(--border);
	color: var(--heading);
}

.ai-lib-star:focus-visible,
.ai-lib-menu-btn:focus-visible,
.ai-lib-name:focus-visible,
.ai-lib-menu button:focus-visible {
	outline: 2px solid var(--brand);
	outline-offset: 1px;
}

.ai-lib-menu-btn {
	color: var(--text-muted);
	font-weight: 700;
}

.ai-lib-kind {
	flex: none;
	padding: 0 4px;
	border: 1px solid var(--border);
	border-radius: 4px;
	color: var(--text-muted);
	font-size: 10px;
	line-height: 16px;
}

.ai-lib-kind-report {
	border-color: var(--success-border);
	background: var(--brand-soft);
	color: var(--brand-strong);
}

.ai-lib-kind-conversation {
	border-color: #cfdcef;
	background: #eef3fb;
	color: var(--chart-2);
}

a.ai-lib-name,
a.ai-lib-name:link,
a.ai-lib-name:visited {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	color: var(--text);
	text-decoration: none;
	text-overflow: ellipsis;
	white-space: nowrap;
}

a.ai-lib-name:hover {
	color: var(--brand-strong);
	text-decoration: underline;
}

.ai-lib-new {
	flex: none;
	padding: 0 5px;
	border-radius: 999px;
	background: var(--brand);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 16px;
}

.ai-lib-meta {
	flex: none;
	max-width: 76px;
	overflow: hidden;
	color: var(--text-muted);
	font-size: 11px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ai-lib-menu {
	position: absolute;
	top: 100%;
	right: 0;
	z-index: 20;
	display: flex;
	flex-direction: column;
	min-width: 150px;
	padding: 4px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface);
	box-shadow: var(--shadow-md);
}

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

.ai-lib-menu button {
	padding: 6px 10px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--text);
	cursor: pointer;
	font-size: 13px;
	text-align: left;
}

.ai-lib-menu button:hover,
.ai-lib-menu button:focus {
	background: var(--surface-subtle);
}

.ai-lib-menu button[data-action="delete"] {
	color: var(--danger);
}

/* A table row's menu (Reports > Saved) opens from its cell. */
td > .ai-lib-menu {
	top: auto;
	right: auto;
	margin-top: 2px;
}

td:has(> .ai-lib-menu) {
	position: relative;
}

.ai-lib-none,
.ai-lib-status {
	margin: 10px 4px 0;
	padding: 3px 4px;
	color: var(--text-muted);
	font-size: 13px;
}

a.ai-lib-all,
a.ai-lib-all:link,
a.ai-lib-all:visited {
	display: block;
	margin: 12px 4px 0;
	color: var(--brand-strong);
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
}

a.ai-lib-all:hover {
	text-decoration: underline;
}

.ai-lib-dialog {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1000;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 12vh 16px 16px;
	background: rgba(15, 23, 42, 0.35);
}

.ai-lib-dialog-box {
	width: min(100%, 420px);
	max-height: 76vh;
	overflow: auto;
	padding: 18px 20px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface);
	box-shadow: var(--shadow-md);
}

.ai-lib-dialog-box:focus {
	outline: none;
}

.ai-lib-dialog-box h2 {
	margin: 0 0 4px;
	color: var(--heading);
	font-size: 18px;
}

.ai-lib-dialog-item {
	margin: 0 0 10px;
	overflow-wrap: anywhere;
	color: var(--text-muted);
}

.ai-lib-dialog-label {
	display: block;
	margin: 14px 0 4px;
	font-weight: 600;
}

.ai-lib-dialog-box select {
	width: 100%;
}

.ai-lib-share-list {
	margin: 8px 0 0;
	padding: 0;
	list-style: none;
}

.ai-lib-share-list li {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 6px 0;
	border-bottom: 1px solid var(--surface-subtle);
}

.ai-lib-share-list li.ai-lib-none {
	margin: 0;
	padding: 6px 0;
	border-bottom: 0;
}

.ai-lib-share-remove {
	padding: 2px 8px;
	border: 1px solid var(--border-strong);
	border-radius: 6px;
	background: var(--surface);
	color: var(--danger);
	cursor: pointer;
	font-size: 12px;
}

.ai-lib-share-remove:hover {
	background: #fdecea;
}

.ai-lib-dialog-actions {
	display: flex;
	gap: 8px;
	margin-top: 16px;
}

.ai-lib-dialog-actions .buttons + .buttons-secondary {
	margin-left: 0;
}

.ai-report-main {
	flex: 999 1 560px;
	min-width: 0;
}

.ai-report-main > h2 {
	margin: 0 0 8px;
	color: var(--heading);
	font-size: 20px;
}

.ai-report-chip,
.ai-report-example {
	display: inline-block;
	margin: 0 6px 6px 0;
	padding: 4px 12px;
	border: 1px solid var(--border-strong);
	border-radius: 999px;
	background: var(--surface);
	color: #3b475c;
	font-size: 13px;
	cursor: pointer;
}

.ai-report-chip:hover,
.ai-report-example:hover {
	border-color: var(--brand);
	color: var(--brand-strong);
}

.ai-report-chip.active {
	border-color: var(--brand);
	background: var(--brand-soft);
	color: var(--brand-strong);
	font-weight: 600;
}

.ai-report-examples {
	margin: 10px 0 12px;
}

.ai-report-examples-label {
	margin-bottom: 6px;
	color: var(--text-muted);
	font-size: 12px;
}

.ai-report-interp {
	margin-bottom: 8px;
	color: var(--text-muted);
}

.ai-report-summary {
	margin-bottom: 10px;
	color: var(--heading);
	font-weight: 700;
}

.ai-report-results {
	margin-bottom: 16px;
}

.ai-report-pager,
.ai-report-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 10px 0;
}

.ai-report-pager .buttons + .buttons,
.ai-report-actions .buttons + .buttons {
	margin: 0;
}

.ai-report-sql-edit {
	margin-bottom: 16px;
}

.ai-report-ask {
	display: grid;
	gap: 8px;
	justify-items: start;
	margin-top: 12px;
}

.ai-input {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--text);
	font: inherit;
	font-size: 14px;
	resize: vertical;
}

.code-input,
.code-block,
.agent-sql {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12px;
}

.code-block,
.agent-sql {
	margin: 6px 0;
	padding: 10px 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface-muted);
	color: var(--text);
	overflow-x: auto;
	white-space: pre-wrap;
}

/* Query results drawn by the scripts: a .data-table without row links. */
.result-table {
	min-width: 0;
	font-size: 13px;
}

.result-table thead th,
.result-table td {
	padding: 8px 12px;
}

.result-table td:first-child {
	white-space: normal;
}

.result-table td.empty-cell {
	color: var(--text-muted);
	text-align: center;
}

.table-scroll > .result-table {
	border: 1px solid var(--border);
}

.notice-error {
	margin: 10px 0;
	padding: 10px 12px;
	border: 1px solid #f2c6c2;
	border-radius: var(--radius-sm);
	background: #fdecea;
	color: var(--danger);
}

.notice {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 10px 0;
	padding: 10px 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface-muted);
}

/* Participant search: why a row matched (a household member, a case note). */
.search-match {
	margin-top: 4px;
	font-size: 0.9em;
	color: var(--text-muted);
}

/* Ask the Data conversation. */
.agent-intro {
	max-width: 780px;
	color: var(--text-muted);
}

.agent-starters {
	margin: 10px 0 16px;
}

.agent-msg {
	max-width: 900px;
	margin: 12px 0;
	padding: 10px 14px;
	border-radius: var(--radius-md);
}

.agent-msg p {
	margin: 4px 0;
}

.agent-msg ul {
	margin: 4px 0 4px 20px;
	padding: 0;
}

.agent-user {
	border: 1px solid #cfe5c8;
	background: var(--brand-soft);
}

.agent-assistant {
	border: 1px solid var(--border);
	background: var(--surface);
}

.agent-tool {
	margin: 4px 0 4px 12px;
	color: var(--text-muted);
	font-size: 12px;
}

#agent-thread .agent-tool a,
#agent-thread .agent-tool a:visited {
	color: var(--text-muted);
	text-decoration: none;
}

#agent-thread .agent-tool a:hover {
	color: var(--heading);
}

.agent-tool-status {
	color: var(--text-muted);
}

.agent-bad {
	color: var(--danger);
}

.agent-result {
	margin: 12px 0;
	padding: 10px 14px;
	border: 1px solid var(--border);
	border-left: 3px solid var(--brand);
	border-radius: var(--radius-sm);
	background: var(--surface);
}

.agent-result h3 {
	margin: 0 0 6px;
}

.agent-summary {
	margin: 4px 0;
	color: var(--heading);
	font-weight: 700;
}

.agent-work {
	margin: 8px 0 8px 12px;
	color: var(--text-muted);
	font-size: 13px;
}

#agent-thread a.agent-work-head,
#agent-thread a.agent-work-head:visited {
	color: var(--text-muted);
	text-decoration: none;
	white-space: nowrap;
}

#agent-thread a.agent-work-head:hover {
	color: var(--heading);
}

.agent-spark {
	display: inline-block;
	width: 1em;
	color: var(--text-muted);
	text-align: center;
}

.agent-working .agent-spark {
	color: var(--brand);
	font-weight: 700;
}

.agent-work-meta,
.agent-caret,
.agent-work-detail {
	color: var(--text-muted);
	font-size: 12px;
}

.agent-caret {
	font-size: 11px;
}

.agent-work-detail {
	margin: 2px 0 0 1.4em;
}

.agent-work-body {
	margin: 6px 0 0 0.45em;
	padding-left: 12px;
	border-left: 2px solid var(--border);
}

.agent-work-body .agent-tool {
	margin: 4px 0;
}

.agent-step {
	margin: 4px 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--text-muted);
	font-size: 12px;
}

.agent-save-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 4px 0 14px;
}

.agent-save-status {
	color: var(--text-muted);
	font-size: 12px;
}

/* A reopened conversation: "Showing what this found on <date>" with Update
   to today, the "Updated <date>" divider, and a table's rows then or today. */
.agent-asof {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	max-width: 900px;
	margin: 0 0 12px;
	padding: 6px 10px;
	border: 1px solid #f0d9a6;
	border-radius: var(--radius-sm);
	background: #fff8e6;
	color: #5c4100;
	font-size: 13px;
}

.agent-asof .buttons {
	margin-left: auto;
}

.agent-update-divider {
	display: flex;
	align-items: center;
	gap: 8px;
	max-width: 900px;
	margin: 18px 0 8px;
	color: var(--brand-strong);
	font-size: 12px;
	font-weight: 600;
}

.agent-update-divider::before,
.agent-update-divider::after {
	content: "";
	flex: 1;
	border-top: 1px dashed var(--border-strong);
}

.agent-then-note {
	margin: 2px 0 6px;
	color: var(--text-muted);
	font-size: 12px;
}

.agent-today-label {
	display: inline-block;
	margin: 0 0 2px;
	padding: 1px 8px;
	border-radius: 999px;
	background: var(--brand-soft);
	color: var(--brand-strong);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

@media (max-width: 640px) {
	.ai-report-side {
		max-width: none;
	}
}

/* Household details banner on the Case Notes page
   (functions/client_update_check.inc.php, www/client-update.js). */
.client-update {
	margin: 0 0 16px;
	border: 1px solid #f3d9b1;
	border-radius: var(--radius-md);
	background: #fffaf2;
	box-shadow: var(--shadow-sm);
}

.client-update--done {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 14px;
	border-color: var(--success-border);
	background: var(--success-soft);
}

.client-update__bar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 14px;
}

.client-update__icon {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 999px;
	background: #f5a524;
	color: #fff;
	font-weight: 700;
	font-size: 14px;
	line-height: 1;
}

.client-update--done .client-update__icon {
	background: var(--brand);
}

.client-update__summary {
	flex: 1 1 auto;
	min-width: 0;
	color: var(--heading);
}

.client-update__detail {
	color: #7a5a1f;
}

.client-update__toggle {
	flex: 0 0 auto;
}

/* button.buttons outranks .buttons-secondary, so restate it here. */
.client-update button.buttons-secondary {
	border-color: var(--border-strong);
	background: var(--surface);
	color: var(--text);
}

.client-update button.buttons-secondary:hover {
	background: var(--surface-subtle);
	color: var(--heading);
}

.client-update__form {
	padding: 4px 14px 14px;
	border-top: 1px solid #f3d9b1;
}

.client-update__form[hidden] {
	display: none;
}

.client-update__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 12px 16px;
	margin: 12px 0;
}

.client-update__field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 8px 10px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface);
}

.client-update__field.is-missing {
	border-color: #f0b35a;
	box-shadow: inset 3px 0 0 #f5a524;
}

.client-update__label {
	color: var(--text-muted);
	font-size: 12px;
	font-weight: 600;
}

.client-update__value {
	color: var(--heading);
	font-weight: 600;
}

.client-update__link {
	font-size: 12px;
}

.client-update__field select {
	width: 100%;
}

.client-update__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.client-update__actions .buttons + .buttons {
	margin-left: 0;
}

.client-update__error {
	color: var(--danger);
}

@media (max-width: 640px) {
	.client-update__bar {
		flex-wrap: wrap;
	}
}

/* Shared page pieces: labeled fields, filter bars, table cards, side
   panels, the danger zone. First used on the Case notes page. */

.muted {
	color: var(--text-muted);
}

.field {
	display: grid;
	gap: 6px;
	min-width: 0;
	color: #3b475c;
	font-size: 13px;
	font-weight: 600;
}

.field input,
.field select,
.field textarea {
	width: 100%;
	min-height: 40px;
	padding: 8px 10px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--text);
	font: inherit;
	font-weight: 400;
	font-size: 14px;
}

.filter-bar {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 12px;
	align-items: end;
	margin: 0 0 16px;
	padding: 14px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface-muted);
}

.filter-bar__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.filter-bar__actions .buttons + .buttons {
	margin: 0;
}

.buttons,
a.buttons:link,
a.buttons:visited {
	text-decoration: none;
}

a.buttons:link,
a.buttons:visited {
	color: #fff;
}

a.buttons-secondary:link,
a.buttons-secondary:visited {
	color: var(--text);
}

.buttons-danger,
input.buttons-danger {
	border-color: var(--danger);
	background: var(--surface);
	color: var(--danger);
}

.buttons-danger:hover,
input.buttons-danger:hover {
	border-color: var(--danger);
	background: var(--danger);
	color: #fff;
}

.table-card {
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface);
	overflow: hidden;
}

.table-card__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 16px;
	padding: 12px 16px;
}

.table-card__title {
	margin: 0;
	color: var(--heading);
	font-size: 16px;
}

.table-scroll {
	overflow-x: auto;
}

.data-table {
	width: 100%;
	min-width: 520px;
	border-collapse: collapse;
}

.data-table td:first-child {
	white-space: nowrap;
}

.data-table thead th {
	padding: 10px 16px;
	border-top: 1px solid var(--border);
	border-bottom: 1px solid var(--border);
	background: var(--surface-muted);
	color: var(--text-muted);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-align: left;
	text-transform: uppercase;
	white-space: nowrap;
}

.data-table td {
	padding: 12px 16px;
	border-top: 0;
	border-bottom: 1px solid #edf1ed;
	vertical-align: middle;
}

.data-table tbody tr:last-child td {
	border-bottom: 0;
}

/* The whole row opens the link in its first cell. */
.data-table tbody tr {
	position: relative;
}

.data-table tbody tr:hover {
	background: var(--surface-muted);
}

.data-table a.row-link::after {
	content: "";
	position: absolute;
	inset: 0;
}

.data-table a.row-link:link,
.data-table a.row-link:visited {
	color: var(--heading);
	font-weight: 600;
}

.data-table a.row-link:focus-visible {
	outline: 2px solid var(--brand);
	outline-offset: 2px;
}

.empty-state {
	margin: 0;
	padding: 24px 16px;
	border-top: 1px solid var(--border);
	color: var(--text-muted);
	text-align: center;
}

.case-notes-layout {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 20px;
}

.case-notes-main {
	flex: 999 1 560px;
	min-width: 0;
}

.case-notes-side {
	display: grid;
	flex: 1 1 300px;
	gap: 16px;
	min-width: 0;
}

.panel {
	display: grid;
	gap: 10px;
	padding: 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface);
}

.panel__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.panel__title {
	margin: 0;
	color: var(--heading);
	font-size: 16px;
}

.panel__note {
	margin: 0;
	color: var(--text-muted);
	font-size: 13px;
}

.panel__input {
	width: 100%;
	min-height: 96px;
	resize: vertical;
}

.panel__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.panel__error {
	color: var(--danger);
	font-weight: 600;
}

.panel__result {
	padding: 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--surface-muted);
	overflow-wrap: anywhere;
}

.panel__result-head {
	margin-bottom: 8px;
}

.panel__citations {
	margin-top: 10px;
}

.panel__citations ul {
	margin: 6px 0 0;
	padding-left: 18px;
}

.badge-beta {
	flex: none;
	padding: 2px 8px;
	border-radius: 999px;
	background: #e8f1ff;
	color: #1d4f91;
	font-size: 11px;
	font-weight: 700;
}

/* Ask AI tab on the client page (www/client_ai.php, www/client-ai.js). */
.client-ai__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
	gap: 16px;
	align-items: start;
	margin-bottom: 16px;
}

/* General advice covers ten areas: once it is shown, each panel takes the full width. */
.client-ai__grid:has(#client-ai-advice-wrap:not([hidden])) {
	grid-template-columns: minmax(0, 1fr);
}

.client-ai__panel select {
	width: 100%;
	max-width: 100%;
}

.client-ai__result {
	padding: 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--surface-muted);
	overflow-wrap: anywhere;
}

.client-ai__answer-head {
	margin-bottom: 8px;
}

.client-ai__answer {
	white-space: pre-wrap;
}

.client-ai__overview {
	margin: 0 0 12px;
}

.client-ai__domains {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
	gap: 12px;
}

.client-ai__domain {
	padding: 10px 12px;
	border: 1px solid var(--border);
	border-left-width: 4px;
	border-radius: var(--radius-md);
	background: var(--surface);
}

.client-ai__domain--need {
	border-left-color: var(--danger);
}

.client-ai__domain--watch {
	border-left-color: #c58a00;
}

.client-ai__domain--stable {
	border-left-color: var(--brand-strong);
}

.client-ai__domain p {
	margin: 6px 0;
}

.client-ai__domain-title {
	margin: 0;
	font-size: 15px;
	color: var(--heading);
}

.client-ai__recs {
	display: grid;
	gap: 10px;
	margin: 8px 0 0;
	padding: 0;
	list-style: none;
}

.client-ai__rec-head {
	font-weight: 600;
}

.client-ai__rec-foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-top: 4px;
}

.client-ai__timeline {
	margin-top: 16px;
	padding-top: 12px;
	border-top: 1px solid var(--border);
}

.client-ai__timeline-when {
	margin: 10px 0 2px;
	font-size: 1em;
}

.client-ai__timeline ul {
	margin: 0;
	padding-left: 20px;
}

.client-ai__history {
	gap: 12px;
}

.client-ai__entry {
	padding: 10px 0;
	border-top: 1px solid var(--border);
}

.client-ai__entry-head {
	font-size: 13px;
}

.client-ai__entry-q {
	cursor: pointer;
	font-weight: 600;
	margin: 4px 0;
}

.client-ai__entry details > :not(summary) {
	margin-top: 8px;
}

.danger-zone {
	margin-top: 24px;
	padding: 14px 16px;
	border: 1px solid #f2c6c2;
	border-radius: var(--radius-lg);
	background: var(--surface);
}

.danger-zone > summary {
	color: var(--danger);
	font-weight: 600;
	cursor: pointer;
}

.danger-zone p {
	margin: 10px 0;
	color: var(--text-muted);
}

.danger-zone form {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}

.danger-zone__check {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

/* Quick Glance: summary tiles, income and benefits tables. */

.stat-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 14px;
	margin: 0 0 18px;
}

.stat {
	display: grid;
	gap: 4px;
	align-content: start;
	padding: 16px 18px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface);
}

.stat p {
	margin: 0;
}

.stat__label {
	color: var(--text-muted);
	font-size: 13px;
	font-weight: 600;
}

.stat__value {
	color: var(--heading);
	font-size: 26px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.01em;
	font-variant-numeric: tabular-nums;
}

.stat__unit {
	color: var(--text-muted);
	font-size: 15px;
	font-weight: 500;
}

.stat__sub {
	color: var(--text-muted);
	font-size: 13px;
}

.glance .table-card {
	margin-bottom: 18px;
}

.data-table .num {
	text-align: right;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.data-table tbody th,
.data-table tfoot th {
	padding: 12px 16px;
	border-bottom: 1px solid #edf1ed;
	color: var(--text);
	font-size: 14px;
	font-weight: 500;
	text-align: left;
}

.data-table tfoot th,
.data-table tfoot td {
	border-top: 1px solid var(--border);
	border-bottom: 0;
	background: var(--surface-muted);
	color: var(--heading);
	font-weight: 700;
}

.glance-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	color: #3b475c;
	font-size: 14px;
}

.glance-hideable:has(.glance-hide:checked) tr.is-zero {
	display: none;
}

.glance-hideable:has(.glance-hide:not(:checked)) .glance-hidden-list {
	display: none;
}

.glance-hidden-list {
	margin: 0;
	padding: 10px 16px;
	border-top: 1px solid var(--border);
	font-size: 13px;
}

.chip--ok {
	background: var(--success-soft);
	color: var(--brand-strong);
}

/* Add a client: step 1 duplicate check and step 2 summary
   (functions/client_dupcheck.inc.php, www/newclient-check.js). */
.newclient-check__title {
	margin: 0 0 8px;
	color: var(--heading);
	font-size: 22px;
}

.newclient-steps {
	display: flex;
	margin: 0 0 16px;
	padding: 0;
	list-style: none;
	border: 1px solid var(--border-strong);
	border-radius: 999px;
	overflow: hidden;
	max-width: 520px;
}

.newclient-steps li {
	flex: 1;
	padding: 6px 12px;
	text-align: center;
	color: var(--text-muted);
}

.newclient-steps li + li {
	border-left: 1px solid var(--border-strong);
}

.newclient-steps .is-current {
	background: var(--brand);
	color: #fff;
	font-weight: 600;
}

.newclient-steps .is-done {
	background: var(--brand-soft);
	color: var(--brand-strong);
}

.newclient-check__layout {
	display: grid;
	grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
	gap: 24px;
	align-items: start;
}

@media (max-width: 800px) {
	.newclient-check__layout {
		grid-template-columns: minmax(0, 1fr);
	}
}

.newclient-check__fields {
	display: grid;
	gap: 12px;
}

.newclient-check__row {
	display: flex;
	align-items: center;
	gap: 10px;
}

.newclient-check__row input[type="text"],
.newclient-check__row input[type="date"] {
	flex: 1;
}

.field .newclient-check__unk {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-weight: 400;
	white-space: nowrap;
}

.field .newclient-check__unk input {
	width: auto;
	min-height: 0;
}

.newclient-check__actions {
	display: flex;
	align-items: center;
	gap: 12px;
}

.newclient-check__actions .buttons:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.newclient-check__panel.is-loading {
	opacity: 0.6;
}

.dupcheck__title {
	margin: 0 0 8px;
	color: var(--heading);
	font-size: 18px;
}

.dupcheck__state {
	padding: 10px 14px;
	border-radius: var(--radius-sm);
	font-weight: 600;
}

.dupcheck__state--idle {
	background: var(--surface-muted);
	color: var(--text-muted);
	font-weight: 400;
}

.dupcheck__state--none {
	background: #1f8a24;
	color: #fff;
}

.dupcheck__state--found {
	background: #f5c400;
	color: #3d2c00;
	border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.dupcheck__state--block {
	background: var(--danger);
	color: #fff;
	border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.dupcheck__list {
	margin: 0;
	padding: 0;
	list-style: none;
	border: 1px solid #f5c400;
	border-top: 0;
	border-radius: 0 0 var(--radius-sm) var(--radius-sm);
	background: var(--surface);
}

.dupcheck__item + .dupcheck__item {
	border-top: 1px solid var(--border);
}

.dupcheck__link {
	display: grid;
	gap: 2px;
	padding: 10px 14px;
	color: var(--text);
}

.dupcheck__link:hover {
	background: var(--surface-muted);
}

.dupcheck__name {
	font-weight: 600;
	color: var(--heading);
}

.dupcheck__details {
	color: var(--text-muted);
	font-size: 13px;
}

.dupcheck__why {
	color: #8a4b00;
	font-size: 13px;
}

.dupcheck__open {
	color: var(--brand);
	font-size: 13px;
	font-weight: 600;
}

.dupcheck__confirm {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin-top: 12px;
	padding: 10px 14px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface-muted);
	font-weight: 600;
}

.dupcheck__error {
	color: var(--danger);
	font-size: 13px;
	font-weight: 600;
}

.newclient-summary {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 20px;
	margin: 0 0 16px;
	padding: 10px 14px;
	border: 1px solid var(--success-border);
	border-radius: var(--radius-md);
	background: var(--success-soft);
}

.newclient-summary dl {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 16px;
	margin: 0;
}

.newclient-summary dt {
	color: var(--text-muted);
}

.newclient-summary dd {
	margin: 0;
	font-weight: 600;
}

.dupcheck__link .chip {
	justify-self: start;
}

/* Forms built from labeled sections (New Case Action). The shared helpers
   print <tr><td>label</td><td>control</td></tr>, so sections are tables. */

.form-section {
	min-width: 0;
	margin: 0 0 16px;
	padding: 14px 16px 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface);
}

.form-section > legend {
	padding: 0 6px;
	color: var(--heading);
	font-size: 16px;
	font-weight: 700;
}

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

.form-table > tbody > tr > td,
.form-table > tr > td {
	padding: 8px 0;
	border-top: 0;
	vertical-align: top;
}

.form-table > tbody > tr > td:first-child,
.form-table > tr > td:first-child {
	width: 220px;
	padding-top: 16px;
	padding-right: 16px;
	color: #3b475c;
	font-weight: 600;
}

.form-table tr[hidden] {
	display: none;
}

.form-table select,
.form-table input[type=text] {
	max-width: 100%;
}

.form-hint {
	display: block;
	margin: 4px 0 0;
	color: var(--text-muted);
	font-size: 12px;
	font-weight: 400;
}

.check-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 6px 16px;
	padding-top: 8px;
}

.check-grid label,
.form-check {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-weight: 400;
}

.form-check {
	margin-top: 8px;
}

/* Services Provided on case actions (fs_services_picker_html(),
   inc/services.inc.php, www/service-picker.js): one row of drop-downs per
   service. */
.service-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin: 0 0 6px;
}

.service-row select {
	width: auto;
	min-width: 0;
	max-width: 100%;
	flex: 0 1 auto;
}

.service-row-number {
	min-width: 1.5em;
	color: var(--text-muted);
}

.service-chosen-list {
	margin: 0 0 6px;
}

.inline-fields {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
}

.amount-field {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
	color: #3b475c;
	font-weight: 600;
}

.amount-field input {
	width: 110px;
}

.reveal-next {
	margin-top: 6px;
}

.reveal-next[hidden] {
	display: none;
}

.form-actions {
	position: sticky;
	bottom: 0;
	z-index: 5;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 -16px -16px;
	padding: 12px 16px;
	border-top: 1px solid var(--border);
	background: var(--surface);
}

.form-actions .buttons + .buttons {
	margin: 0;
}

@media (max-width: 640px) {
	.form-table,
	.form-table > tbody,
	.form-table > tbody > tr,
	.form-table > tr {
		display: block;
		width: 100%;
	}

	.form-table > tbody > tr > td,
	.form-table > tr > td {
		display: block;
		width: auto;
	}

	.form-table > tbody > tr > td:first-child,
	.form-table > tr > td:first-child {
		width: auto;
		padding: 10px 0 0;
	}

	.form-table > tbody > tr[hidden],
	.form-table > tr[hidden] {
		display: none;
	}
}

/* input.buttons / button.buttons outrank .buttons-secondary above, so a
   secondary <input> or <button> (Reset, Clear, Add another...) showed green. */
.buttons.buttons-secondary {
	border-color: var(--border-strong);
	background: var(--surface);
	color: var(--text);
}

.buttons.buttons-secondary:hover {
	border-color: var(--border-strong);
	background: var(--surface-subtle);
	color: var(--heading);
}

/* npi.inc.php sets fixed widths inline (600px picker, 500px list); let them
   shrink to the form on narrow screens. */
#npi_picker,
#npi_listing {
	max-width: 100%;
}

/* Admin list pages (inc/list_page.inc.php): search, count, Add. */
.list-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 16px;
	margin: 0 0 14px;
}

.list-search {
	flex: 1 1 260px;
	max-width: 420px;
}

.list-search input[type=search] {
	width: 100%;
	height: 40px;
	padding: 0 12px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	font: inherit;
	font-size: 14px;
}

.list-count {
	font-size: 13px;
}

.list-toolbar .buttons {
	margin-left: auto;
}

.data-table tbody tr[hidden] {
	display: none;
}

/* Hide hidden / disabled rows until "Show hidden" is ticked (www/list-filter.js). */
.list-show-hidden {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--text-muted);
	font-size: 13px;
	cursor: pointer;
}

.list-show-hidden input {
	margin: 0;
}

/* Sortable headings (www/table-sort.js): the heading text is a button. */
.data-table th .th-sort {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: -4px -6px;
	padding: 4px 6px;
	border: 0;
	border-radius: var(--radius-sm);
	background: none;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	cursor: pointer;
}

.data-table th .th-sort:hover {
	background: var(--surface-subtle);
	color: var(--heading);
}

.data-table th .th-sort:focus-visible {
	outline: 2px solid var(--brand);
	outline-offset: 1px;
}

/* A faint double arrow until sorted, then one arrow for the direction. */
.data-table th .th-sort::after {
	content: "\2195";
	opacity: 0.35;
	font-size: 11px;
	letter-spacing: 0;
}

.data-table th[aria-sort="ascending"] .th-sort,
.data-table th[aria-sort="descending"] .th-sort {
	color: var(--brand-strong);
}

.data-table th[aria-sort="ascending"] .th-sort::after {
	content: "\2191";
	opacity: 1;
}

.data-table th[aria-sort="descending"] .th-sort::after {
	content: "\2193";
	opacity: 1;
}

/* ── /admin/usage ───────────────────────────────────────────────────────── */

.usage__meta {
	margin: -6px 0 16px;
	font-size: 13px;
}

.usage .table-card {
	margin-bottom: 18px;
}

.usage-chart__plot {
	position: relative;
	padding: 4px 16px 12px;
}

.usage-chart__plot svg {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
}

.usage-chart__grid {
	stroke: var(--border);
	stroke-width: 1;
	stroke-dasharray: 2 4;
}

.usage-chart__axis {
	stroke: var(--border-strong);
	stroke-width: 1;
}

.usage-chart__tick {
	fill: var(--text-muted);
	font-size: 11px;
	font-variant-numeric: tabular-nums;
}

.usage-chart__hit {
	fill: transparent;
	cursor: pointer;
}

.usage-chart__bar {
	fill: var(--brand);
	transition: fill var(--transition);
}

.usage-chart__day.is-active .usage-chart__hit {
	fill: var(--surface-subtle);
}

.usage-chart__day.is-active .usage-chart__bar {
	fill: var(--brand-strong);
}

.usage-chart__tip {
	position: absolute;
	top: 0;
	transform: translate(-50%, -100%);
	padding: 6px 10px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface);
	box-shadow: var(--shadow-md);
	color: var(--text);
	font-size: 13px;
	white-space: nowrap;
	pointer-events: none;
}

.usage-chart__table {
	border-top: 1px solid var(--border);
}

.usage-chart__table summary {
	padding: 10px 16px;
	color: var(--text-muted);
	font-size: 13px;
	cursor: pointer;
}

.usage-columns {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
	gap: 18px;
	align-items: start;
}

.usage-columns .table-card {
	margin-bottom: 0;
}

.usage-table {
	min-width: 0;
}

.usage-table .num {
	white-space: nowrap;
}

.usage-meter {
	display: inline-block;
	width: 64px;
	height: 6px;
	margin-right: 10px;
	border-radius: 999px;
	background: linear-gradient(to right, var(--brand) var(--share), var(--surface-subtle) var(--share));
	vertical-align: middle;
}

/* ------------------------------------------------------------------------
   Assessment form (aform/). The step list (www/body.php), the save bar
   (aform/index.php) and the redesigned pages' fields (aform/pages/pageN.php,
   aform/form-ui.js). Pages not yet redesigned keep their tables.
   ------------------------------------------------------------------------ */

/* Step list on the right of the form (where staff are used to it). On narrow
   screens the #menu rule above moves it over the form. */
#page.has-steps {
	grid-template-columns: minmax(0, 1fr) 250px;
}

/* No inner scroll: the list runs the full length beside the form, so
   Submit Assessment and History below it are always reachable. */

.assess-steps {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.assess-step__title {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 8px 4px;
	color: var(--text-muted);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.assess-step__num {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border-radius: 999px;
	background: var(--surface-subtle);
	color: var(--brand-strong);
	font-size: 11px;
	letter-spacing: 0;
}

.assess-step.is-current .assess-step__num {
	background: var(--brand);
	color: #fff;
}

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

.assess-page {
	display: flex;
	align-items: center;
	gap: 6px;
}

.assess-page a.dubsubmenuitem {
	flex: 1 1 auto;
	min-width: 0;
}

.assess-page--member a.dubsubmenuitem {
	padding-left: 22px;
}

/* Status markers (inc/assessment_steps.inc.php): a ring before each page, filled
   with a tick once the page has an answer, and a label on each step. */
.assess-page__mark {
	position: relative;
	flex: none;
	width: 12px;
	height: 12px;
	margin-left: 6px;
	border: 1.5px solid var(--border-strong);
	border-radius: 999px;
	box-sizing: border-box;
}

.assess-page.is-answered .assess-page__mark {
	border-color: var(--brand);
	background: var(--brand);
}

.assess-page.is-answered .assess-page__mark::after {
	content: "";
	position: absolute;
	left: 3px;
	top: 1px;
	width: 3px;
	height: 6px;
	border: solid #fff;
	border-width: 0 1.5px 1.5px 0;
	transform: rotate(45deg);
}

.assess-page--member .assess-page__mark {
	margin-left: 22px;
}

.assess-page--member .assess-page__mark + a.dubsubmenuitem {
	padding-left: 8px;
}

/* "Add household member" / "Add another job" (item 114): a plus in place of
   the status ring, never ticked. */
.assess-page__plus {
	flex: none;
	width: 12px;
	margin-left: 6px;
	color: var(--brand);
	font-weight: 700;
	line-height: 12px;
	text-align: center;
}

.assess-page--member .assess-page__plus {
	margin-left: 22px;
}

.assess-page--add a.dubsubmenuitem,
.assess-page--member .assess-page__plus + a.dubsubmenuitem {
	padding-left: 8px;
	color: var(--brand);
}

.assess-step__name {
	flex: 1 1 auto;
	min-width: 0;
}

.assess-step__state {
	flex: none;
	padding: 1px 7px;
	border-radius: 999px;
	background: var(--surface-subtle);
	color: var(--text-muted);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0;
	text-transform: none;
}

.assess-step.is-started .assess-step__state {
	background: #fff4e5;
	color: #8a4b00;
}

.assess-step.is-done .assess-step__state {
	background: var(--brand-soft);
	color: var(--brand-strong);
}

.assess-step.is-done .assess-step__num {
	background: var(--brand-strong);
	color: #fff;
}

.assess-page__note {
	flex: none;
	max-width: 90px;
	overflow: hidden;
	padding-right: 8px;
	color: var(--text-muted);
	font-size: 12px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

a:link.dubsubmenuitem.is-current,
a:visited.dubsubmenuitem.is-current {
	background: var(--brand-soft);
	color: var(--heading);
	font-weight: 600;
}

@media (max-width: 1120px) {
	#page.has-steps {
		grid-template-columns: minmax(0, 1fr);
	}

	/* Above the form: the steps side by side instead of one long list. */
	.assess-steps {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
		gap: 10px 16px;
	}
}

/* Sections and fields: labels above, two columns. */
.af-section {
	margin: 0 0 22px;
}

#root .af-section > .topsection {
	margin: 0 0 14px;
	padding: 0;
	background: none;
	color: var(--heading);
	font-size: 18px;
	font-weight: 700;
}

.af-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px 22px;
	align-items: start;
}

.af-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
	margin: 0;
}

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

/* Required answers (item 11, aform/required.js). The * shows only while the
   question is required; a missing answer is outlined after Save. */
.af-req-legend .af-req-mark,
.af-req .af-req-after::after,
.af-req .af-req-before::before {
	color: var(--danger);
	font-weight: 700;
}
.af-req .af-req-after::after {
	content: "*";
	margin-left: 3px;
}
.af-req .af-req-before::before {
	content: "* ";
}
.af-req-legend {
	margin: 0 0 10px;
	font-size: 0.9em;
	color: #555;
}
.af-missing {
	outline: 2px solid var(--danger);
	outline-offset: 3px;
	border-radius: 4px;
	background-color: var(--danger-soft);
}
.af-req-dialog {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 8vh 16px 16px;
	background: rgba(0, 0, 0, 0.45);
}
.af-req-dialog__box {
	width: 100%;
	max-width: 540px;
	max-height: 80vh;
	overflow: auto;
	padding: 18px 20px;
	border-radius: 8px;
	background: #fff;
	color: #222;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}
.af-req-dialog__title {
	margin: 0 0 8px;
	font-size: 1.15em;
	color: var(--danger);
}
.af-req-dialog__list {
	margin: 8px 0 16px 20px;
	padding: 0;
}
.af-req-dialog__list li {
	margin: 4px 0;
}
.af-req-dialog__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: flex-end;
}

.af-label {
	color: #3b475c;
	font-size: 13px;
	font-weight: 600;
}

/* A value the page shows but doesn't ask for (Employment (PHP): the PHP's name). */
.af-static {
	font-size: 15px;
	padding: 6px 0;
}

.af-hint,
.af-phone__hint {
	color: var(--text-muted);
	font-size: 12px;
	font-weight: 400;
}

.af-field input[type=text],
.af-field input[type=tel],
.af-field input[type=number],
.af-field input[type=email],
.af-field select,
.af-field textarea {
	width: 100%;
	max-width: none;
	min-height: 40px;
	box-sizing: border-box;
}

.af-field .af-other-box {
	margin-top: 6px;
}

.af-field .af-other-box[hidden] {
	display: none;
}

/* "N/A" next to a box that may not apply (Oth. Member phone and email). */
.af-field .af-na {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 6px;
	font-weight: 400;
}

.af-field .fs-date {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 10px;
}

.af-field .fs-date input[type=date] {
	width: 100%;
	min-height: 40px;
	box-sizing: border-box;
}

.af-field input[type=tel],
.af-field .fs-date input[type=date] {
	padding: 8px 10px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--text);
}

.af-field textarea {
	min-height: 110px;
}

.af-phone {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.af-phone .af-phone__input {
	max-width: 240px;
}

/* Masked SSN: one box plus Show, hint below. */
.af-ssn {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 8px;
}

.af-field .af-ssn .af-ssn__input {
	flex: 0 1 180px;
	width: 180px;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.04em;
}

.af-ssn__toggle {
	min-height: 40px;
	padding: 0 12px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--brand-strong);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.af-ssn__toggle:hover {
	background: var(--surface-muted);
}

.af-ssn__hint {
	flex-basis: 100%;
	color: var(--text-muted);
	font-size: 12px;
}

/* The date picker with its "Unknown" box beside it (dispDatePickerNoEcho()). */
.af-date-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 12px;
}

.af-date-row .fs-date {
	flex: 1 1 200px;
}

.af-date-row > label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: #3b475c;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
}

/* Month and year dropdowns (dispDatePickerNoEchoNoUnkNoDay(), Agency: FSS). */
.af-field .af-date {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 8px;
}

.af-field .af-date select {
	width: auto;
	flex: 1 1 120px;
}

/* Agency: FSS: one goal or objective with its dates beside it. */
.af-plan-item {
	display: grid;
	grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
	gap: 12px 22px;
	align-items: start;
	margin: 0 0 16px;
	padding: 14px 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--surface-muted);
}

.af-grid + .af-grid {
	margin-top: 16px;
}

.af-plan-item > .af-field--wide {
	grid-column: auto;
}

.af-plan-item__dates {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

@media (max-width: 640px) {
	.af-plan-item {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* A checkbox that qualifies the field above it ("Unknown"). */
.af-inline-check {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	width: fit-content;
	color: #3b475c;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
}

.af-inline-check input {
	margin: 0;
}

/* Longer single- or multi-choice lists (race, household type, education). */
.af-choices {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.af-choices--cols {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 6px 18px;
}

/* A long list of boxes (Medical: other conditions): scrolls inside its own box. */
.af-choices--scroll {
	max-height: 280px;
	overflow-y: auto;
	padding: 8px 10px;
	border: 1px solid var(--border, #d6d9de);
	border-radius: 6px;
}

/* Who in the household, inside a table row (Medical: Conditions and needs). */
.af-choices--who {
	gap: 2px;
}

.af-choices--who label {
	font-size: 13px;
}

.af-choices label {
	display: inline-flex;
	align-items: flex-start;
	gap: 8px;
	color: var(--text);
	font-size: 14px;
	line-height: 1.35;
	cursor: pointer;
}

.af-choices input[type=radio],
.af-choices input[type=checkbox] {
	flex: none;
	margin: 2px 0 0;
}

.af-choices input[type=text] {
	min-height: 34px;
	margin-left: 8px;
}

/* A group of related questions inside a section, with its own small heading. */
.af-subhead {
	grid-column: 1 / -1;
	margin: 6px 0 -4px;
	padding-top: 12px;
	border-top: 1px solid var(--border);
	color: var(--text-muted);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.af-notice:empty {
	display: none;
}

.af-notice {
	grid-column: 1 / -1;
	margin: 0;
	padding: 10px 12px;
	border-left: 3px solid var(--brand);
	border-radius: var(--radius-sm);
	background: var(--surface-subtle);
	color: #3b475c;
	font-size: 13px;
	line-height: 1.45;
}

.af-actions-inline {
	display: flex;
	justify-content: flex-end;
	margin: -8px 0 14px;
}

/* Yes / No toggles: real radios, laid over each option (so they stay
   clickable and visible to tests) and drawn by the span after them. */
.af-seg {
	display: inline-flex;
	flex-wrap: wrap;
	width: fit-content;
	max-width: 100%;
	overflow: hidden;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
}

.af-seg__opt {
	position: relative;
	display: inline-flex;
	margin: 0;
	cursor: pointer;
}

.af-seg__opt + .af-seg__opt {
	border-left: 1px solid var(--border-strong);
}

.af-seg__opt input {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.af-seg__opt span {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 0 16px;
	color: #3b475c;
	font-size: 14px;
	font-weight: 500;
}

.af-seg__opt:hover input:not(:checked):not(:disabled) + span {
	background: var(--surface-muted);
}

.af-seg__opt input:checked + span {
	background: var(--brand-soft);
	color: var(--brand-strong);
	font-weight: 600;
	box-shadow: inset 0 -2px 0 var(--brand);
}

.af-seg__opt input:focus-visible + span {
	outline: 2px solid var(--brand);
	outline-offset: -2px;
}

/* A locked follow-up (aform/followups.js) greys the option itself; the radio
   stays invisible over it (followups.php's lock style would show it at 0.55). */
#root .af-seg__opt input.fs-followup-locked {
	opacity: 0;
}

.af-seg__opt input:disabled + span {
	cursor: not-allowed;
}

/* The grey look comes from the lock class. aform/followups.js also disables
   a locked question's unchosen options, but greying on :disabled too would
   keep them grey when nothing else marks them locked. */
.af-seg__opt input.fs-followup-locked + span {
	background: #f3f4f6;
	color: #6b7280;
	cursor: not-allowed;
}

.af-seg__opt input.fs-followup-locked:checked + span {
	background: #e5e7eb;
	color: #374151;
	box-shadow: none;
}

/* Short boxes (hours, counts) and money boxes with a "$" in front. */
.af-field input.af-input-short {
	max-width: 120px;
}

.af-money {
	position: relative;
	display: inline-flex;
	align-items: center;
	width: 100%;
	max-width: 200px;
}

.af-money::before {
	content: "$";
	position: absolute;
	left: 10px;
	color: var(--text-muted);
	font-size: 14px;
	pointer-events: none;
}

.af-money input[type=text] {
	width: 100%;
	min-height: 36px;
	padding-left: 22px;
	box-sizing: border-box;
}

/* "Other (specify)" and its box: a row of their own at the end of a list. */
.af-choices--cols .af-choices__other {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 4px;
	grid-column: 1 / -1;
}

.af-choices__other input[type=text] {
	max-width: 280px;
}

.af-intro {
	margin: -6px 0 14px;
	color: var(--text-muted);
	font-size: 14px;
	line-height: 1.45;
}

.af-result {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	color: var(--heading);
	font-size: 15px;
}

/* Grids of answers (Income, Benefits): a table that scrolls sideways on a
   narrow screen instead of squeezing the boxes. */
.af-table-scroll {
	overflow-x: auto;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--surface);
}

#root table.af-table {
	width: 100%;
	min-width: 680px;
	margin: 0;
	border: 0;
	border-collapse: collapse;
}

#root .af-table th,
#root .af-table td {
	padding: 8px 10px;
	border: 0;
	border-bottom: 1px solid var(--border);
	text-align: left;
	vertical-align: middle;
}

#root .af-table thead th {
	background: var(--surface-muted);
	color: #3b475c;
	font-size: 13px;
	font-weight: 600;
	vertical-align: bottom;
}

#root .af-table tbody th {
	color: var(--text);
	font-size: 14px;
	font-weight: 600;
}

#root .af-table tbody tr:last-child th,
#root .af-table tbody tr:last-child td {
	border-bottom: 0;
}

#root .af-table tfoot th,
#root .af-table tfoot td {
	border-top: 2px solid var(--border-strong);
	border-bottom: 0;
	background: var(--surface-muted);
}

#root .af-table input[type=text] {
	width: 100%;
	min-height: 36px;
	box-sizing: border-box;
}

.af-income__who {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.af-income__define {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 8px;
	margin-top: 4px;
	color: var(--text-muted);
	font-size: 12px;
	font-weight: 400;
}

#root .af-income__define input[type=text] {
	flex: 1 1 120px;
	width: auto;
	min-height: 32px;
}

#root .af-income__who select {
	width: 100%;
	min-height: 36px;
	box-sizing: border-box;
	font-weight: 400;
}

/* Income: the documentation spot under each amount (aform/income-docs.js). */
.af-income-doc {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
	margin-top: 4px;
	font-size: 13px;
}

.af-income-doc__add[hidden],
.af-income-doc__warn[hidden] {
	display: none;
}

.af-income-doc__legacy,
.af-income-doc__status,
.af-income-doc__warn,
.af-income-doc__summary {
	margin: 0;
	line-height: 1.4;
}

.af-income-doc__files {
	margin: 0;
	padding: 0;
	list-style: none;
}

.af-income-doc__files:empty,
.af-income-doc__status:empty {
	display: none;
}

.af-income-doc__files li {
	overflow-wrap: anywhere;
}

#root .af-income-doc__add {
	min-height: 32px;
	padding: 4px 12px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface-muted);
	cursor: pointer;
	font-size: 13px;
}

.af-income-doc__warn,
.af-income-doc__summary {
	color: var(--warn);
}

.af-income-doc__summary {
	margin: 8px 0 0;
	padding: 8px 12px;
	border-left: 3px solid var(--warn-border);
	border-radius: var(--radius-sm);
	background: var(--warn-soft);
}

.af-income-doc__summary[hidden] {
	display: none;
}

/* Benefits: one row per benefit, one radio per answer column. The whole
   cell is the click target. */
#root .af-matrix thead th:nth-child(2),
#root .af-matrix thead th:nth-child(3),
#root .af-matrix thead th:nth-child(4) {
	width: 17%;
	text-align: center;
}

#root .af-matrix td:nth-child(2),
#root .af-matrix td:nth-child(3),
#root .af-matrix td:nth-child(4) {
	text-align: center;
}

#root .af-matrix input.af-input-amount {
	max-width: 140px;
}

.af-matrix__opt {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 40px;
	min-height: 36px;
	cursor: pointer;
}

.af-matrix__opt input[type=radio] {
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: var(--brand);
	cursor: pointer;
}

.af-matrix__opt--text {
	font-size: 13px;
	text-align: left;
}

#root .af-matrix td:nth-child(2) .af-matrix__opt--text + input[type=text] {
	max-width: 160px;
	margin-top: 4px;
}

/* Short answer tables (Yes / No / I don't know): narrower answer columns. */
#root table.af-matrix--compact {
	min-width: 460px;
}

#root .af-matrix--compact thead th:nth-child(n+2) {
	width: 15%;
	text-align: center;
}

#root .af-matrix--compact thead th.af-matrix__extra,
#root .af-matrix--compact td.af-matrix__extra {
	width: 40%;
	text-align: left;
}

#root .af-matrix--compact td input[type=text] {
	max-width: 260px;
}

/* Medical: one condition's who / provider / prescriptions, side by side.
   Under a table row answered Yes (.af-matrix__detail) or, for a condition
   ticked in a list, as a named block (.af-cond-item). */
.af-cond {
	padding: 10px 12px;
	border-left: 3px solid var(--brand);
	border-radius: var(--radius-sm);
	background: var(--surface-subtle);
}

.af-cond__name {
	margin-bottom: 8px;
	color: var(--text);
	font-size: 14px;
	font-weight: 700;
}

.af-cond__qs {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 12px 28px;
}

.af-cond__q {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.af-cond__q--who {
	flex: 1 1 220px;
}

.af-cond__q--who .af-choices--who {
	flex-direction: row;
	flex-wrap: wrap;
	gap: 6px 18px;
}

.af-cond__q--who input[type=text] {
	max-width: 320px;
	margin-top: 4px;
}

.af-cond-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.af-cond-list[hidden],
.af-cond-item[hidden],
.af-field[hidden],
#root .af-matrix__detail[hidden] {
	display: none;
}

#root .af-matrix tr.af-matrix__detail > td {
	padding: 0 10px 12px 28px;
	text-align: left;
}

#root .af-matrix tbody tr.af-matrix__detail:hover td {
	background: transparent;
}

/* A payment box after a choice (Housing: Rent / Own). */
.af-inline-amount {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-left: 10px;
	color: var(--text-muted);
	font-size: 13px;
}

.af-inline-amount .af-money {
	width: 130px;
}

#root .af-matrix tbody tr:hover th,
#root .af-matrix tbody tr:hover td {
	background: var(--surface-muted);
}

@media (max-width: 640px) {
	.af-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Save bar: stays at the bottom of the screen while the form scrolls. */
/* Tabbing to a field near the bottom scrolls it clear of the save bar. */
html:has(.af-actionbar) {
	scroll-padding-bottom: 96px;
}

.aform-actions.af-actionbar {
	position: sticky;
	bottom: 0;
	z-index: 5;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px 16px;
	margin: 22px -16px -16px;
	padding: 12px 16px;
	border-top: 1px solid var(--border);
	border-radius: 0 0 var(--radius-xl) var(--radius-xl);
	background: var(--surface);
	box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.06);
	text-align: left;
}

.af-actionbar__status {
	color: var(--text-muted);
	font-size: 13px;
}

.af-actionbar__status.is-saved {
	color: var(--brand-strong);
	font-weight: 600;
}

.af-actionbar__status.is-dirty {
	color: #8a4b00;
	font-weight: 600;
}

.af-actionbar__buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-left: auto;
}

.af-actionbar__buttons > .buttons + .buttons {
	margin-left: 0;
}

/* Last page: no Save & Next, so Save is the main button. */
.af-actionbar__buttons:has(.aform-pagenav-next[hidden]) [data-aform-save] {
	border-color: var(--brand);
	background: var(--brand);
	color: #fff;
}

.aform-pagenav[hidden] {
	display: none;
}

/* Secure Documents (inc/documents.php, www/documents.js). */
.docs-page [hidden] {
	display: none !important;
}

.docs-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 12px;
}

.docs-empty {
	margin: 0 0 16px;
	color: var(--text-muted);
}

.docs-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 12px 20px;
	margin: 0 0 16px;
	padding: 14px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface-muted);
}

.docs-search {
	flex: 0 1 280px;
}

.docs-filter {
	display: grid;
	gap: 6px;
	min-width: 0;
}

.docs-filter__label {
	color: #3b475c;
	font-size: 13px;
	font-weight: 600;
}

.docs-filter__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.docs-chip {
	min-height: 36px;
	padding: 0 14px;
	border: 1px solid var(--border-strong);
	border-radius: 999px;
	background: var(--surface);
	color: var(--text);
	font: inherit;
	font-size: 14px;
	cursor: pointer;
}

.docs-chip:hover {
	background: var(--surface-subtle);
}

.docs-chip[aria-pressed="true"] {
	border-color: var(--brand);
	background: var(--brand);
	color: #fff;
	font-weight: 600;
}

.docs-chip:focus-visible,
.doc-group__toggle:focus-visible {
	outline: 2px solid var(--brand);
	outline-offset: 2px;
}

#doc-groups {
	display: grid;
	gap: 16px;
	margin: 0 0 24px;
}

.doc-group {
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface);
	overflow: hidden;
}

.doc-group__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 10px 16px;
	background: var(--surface-muted);
}

.doc-group__title {
	margin: 0;
	color: var(--heading);
	font-size: 16px;
}

.doc-group__count {
	color: var(--text-muted);
	font-weight: 400;
}

.doc-group__toggle {
	min-height: 32px;
	padding: 0 10px;
	border: 0;
	border-radius: var(--radius-sm);
	background: none;
	color: var(--text-muted);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}

.doc-group__toggle:hover {
	background: var(--surface-subtle);
	color: var(--heading);
}

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

.doc-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 16px;
	padding: 12px 16px;
	border-top: 1px solid #edf1ed;
}

.doc-row__main {
	display: grid;
	gap: 2px;
	flex: 1 1 280px;
	min-width: 0;
}

.doc-row__name:link,
.doc-row__name:visited {
	color: var(--heading);
	font-weight: 600;
	overflow-wrap: anywhere;
}

.doc-row__orig,
.doc-row__meta {
	color: var(--text-muted);
	font-size: 13px;
}

.doc-row__actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.doc-row__actions form {
	margin: 0;
}

.doc-row__actions .buttons {
	min-height: 32px;
	margin: 0;
	font-size: 13px;
}

/* button.buttons (above) outranks .buttons-danger; keep Delete red-outlined,
   with a soft border so it doesn't outshout Edit. */
.docs-page button.buttons-danger {
	border-color: #e3b8ae;
	background: var(--surface);
	color: var(--danger);
}

.docs-page button.buttons-danger:hover {
	border-color: var(--danger);
	background: var(--danger);
	color: #fff;
}

.doc-edit {
	display: grid;
	flex: 1 1 100%;
	gap: 8px;
	margin: 4px 0 0;
	padding: 14px;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--brand-soft);
}

.doc-edit__fields {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 12px;
}

.doc-edit__label {
	flex: 2 1 260px;
}

.doc-edit__category {
	flex: 1 1 200px;
}

.doc-edit__actions {
	display: flex;
	gap: 8px;
}

.doc-edit__actions .buttons {
	margin: 0;
	min-height: 40px;
}

.doc-edit__note {
	margin: 0;
	color: var(--text-muted);
	font-size: 13px;
}

.doc-edit__error {
	margin: 0;
	color: var(--danger);
	font-weight: 600;
}

.docs-upload-title {
	margin-top: 8px;
}

.docs-upload {
	max-width: 960px;
}

/* Upload box (markup built by www/fileupload-v3.js). */
.docs-dropzone {
	display: grid;
	gap: 10px;
	padding: 20px 22px;
	border: 2px dashed var(--border-strong);
	border-radius: var(--radius-lg);
	background: var(--surface-muted);
	transition: border-color var(--transition), background var(--transition);
}

.docs-dropzone.dragover {
	border-color: var(--brand);
	background: var(--brand-soft);
}

.docs-dropzone__row {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 12px 16px;
}

.docs-dropzone__category {
	flex: 0 1 300px;
	margin: 0;
}

.docs-dropzone__drop {
	margin: 0;
	padding-bottom: 10px;
	color: var(--text);
	font-size: 15px;
}

.docs-dropzone__row .buttons {
	min-height: 40px;
	margin: 0;
}

.docs-page .docs-dropzone__row button.buttons:disabled {
	border-color: var(--border-strong);
	background: var(--surface-subtle);
	color: var(--text-muted);
	cursor: not-allowed;
}

.docs-dropzone__help {
	margin: 0;
	color: var(--text-muted);
	font-size: 13px;
}

.docs-dropzone__error {
	margin: 0;
	color: var(--danger);
	font-weight: 600;
}

.docs-dropzone__files {
	display: grid;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.docs-dropzone__files:empty {
	display: none;
}

.docs-dropzone__files li {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 12px;
	padding: 8px 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface);
	font-size: 14px;
}

.docs-dropzone__files .file-name {
	flex: 1 1 200px;
	min-width: 0;
	overflow-wrap: anywhere;
}

.docs-dropzone__files select {
	min-height: 34px;
	max-width: 240px;
	font: inherit;
}

.docs-dropzone__files .file-remove {
	min-height: 32px;
	padding: 0 8px;
	border: 0;
	border-radius: var(--radius-sm);
	background: none;
	color: var(--text-muted);
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

.docs-dropzone__files .file-remove:hover {
	background: var(--surface-subtle);
	color: var(--heading);
}

.docs-dropzone__files .file-problem {
	flex: 1 1 100%;
	color: var(--danger);
	font-weight: 600;
}

/* Document rows: name | category | date · uploader | actions. */
.doc-row--cols {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 170px 210px auto;
	gap: 8px 16px;
}

.doc-row__cat,
.doc-row__when {
	color: #3b475c;
	font-size: 14px;
	overflow-wrap: anywhere;
}

.doc-row--cols .doc-edit,
.doc-row--cols .doc-history {
	grid-column: 1 / -1;
}

@media (max-width: 860px) {
	.doc-row--cols {
		grid-template-columns: minmax(0, 1fr) auto;
	}

	/* The group heading already names the category. */
	.doc-row__cat {
		display: none;
	}

	.doc-row__when {
		grid-row: 2;
		grid-column: 1;
		color: var(--text-muted);
		font-size: 13px;
	}

	.doc-row--cols .doc-row__actions {
		grid-row: 1 / span 2;
		grid-column: 2;
	}
}

@media (max-width: 560px) {
	.doc-row--cols {
		grid-template-columns: minmax(0, 1fr);
	}

	.doc-row--cols .doc-row__actions {
		grid-row: auto;
		grid-column: 1;
		flex-wrap: wrap;
	}

	/* Phone-width .buttons are full width app-wide; keep a row's actions on
	   one line. */
	.docs-page .doc-row__actions .buttons,
	.docs-page .doc-row__actions button.buttons {
		width: auto;
		margin: 0;
	}
}

/* Secure Documents phase 2: expiry badges, history, trash, replace,
   admin categories (inc/documents.php, www/doccategories.php). */
.docs-head__link {
	font-size: 14px;
	font-weight: 600;
}

.docs-notice {
	margin: 0 0 16px;
	padding: 10px 14px;
	border: 1px solid var(--success-border);
	border-radius: var(--radius-md);
	background: var(--success-soft);
	color: var(--heading);
}

.docs-help {
	margin: 0 0 16px;
	color: var(--text-muted);
	font-size: 14px;
	max-width: 760px;
}

.docs-chip--expired[aria-pressed="false"] {
	border-color: #e3b8ae;
	color: var(--danger);
}

.docs-chip--soon[aria-pressed="false"] {
	border-color: #f0c98b;
	color: #8a4b00;
}

.doc-row__line {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 8px;
}

.doc-badge {
	display: inline-flex;
	align-items: center;
	padding: 1px 8px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
}

.doc-badge--expired {
	background: #fdecea;
	color: var(--danger);
}

.doc-badge--soon {
	background: #fff4e5;
	color: #8a4b00;
}

.doc-edit__expires {
	flex: 0 1 180px;
}

.doc-edit__hint {
	margin: 0;
	color: #8a4b00;
	font-size: 13px;
	font-weight: 600;
}

.doc-replace {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 8px 12px;
	padding-top: 10px;
	border-top: 1px solid var(--border);
}

.doc-replace__file {
	flex: 1 1 260px;
}

.doc-replace .doc-edit__note {
	flex: 1 1 100%;
}

.doc-replace .buttons {
	margin: 0;
	min-height: 40px;
}

.doc-history {
	flex: 1 1 100%;
	display: grid;
	gap: 6px;
	margin: 4px 0 0;
	padding: 12px 14px;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--surface-muted);
	font-size: 14px;
}

.doc-history__title {
	margin: 0;
	color: var(--heading);
	font-size: 14px;
}

.doc-history__list {
	display: grid;
	gap: 4px;
	margin: 0;
	padding-left: 18px;
}

.doc-history__when {
	color: var(--text-muted);
	font-size: 13px;
}

.doc-list--trash {
	margin: 0 0 24px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface);
	overflow: hidden;
}

.doc-list--trash .doc-row:first-child {
	border-top: 0;
}

.doccats-list {
	display: grid;
	gap: 8px;
	margin: 0 0 24px;
	padding: 0;
	list-style: none;
}

.doccats-row {
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--surface);
}

.doccats-row--retired {
	background: var(--surface-muted);
}

.doccats-form {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 8px 14px;
	margin: 0;
	padding: 10px 14px;
}

.doccats-form--new {
	max-width: 960px;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--surface-muted);
}

.doccats-name {
	flex: 2 1 220px;
}

.doccats-order {
	flex: 0 1 90px;
}

.doccats-flags {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 14px;
	padding-bottom: 10px;
	font-size: 14px;
}

.doccats-flags label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.doccats-count {
	padding-bottom: 10px;
	font-size: 13px;
}

.doccats-form .buttons {
	margin: 0;
	min-height: 40px;
}

/* Printed assessment: show the toggles' radio buttons, because the chosen
   answer's tint doesn't print by default and is lost on black and white. */
@media print {
	.af-seg__opt {
		display: inline-flex;
		align-items: center;
	}
	.af-seg__opt input {
		position: static;
		width: auto;
		height: auto;
		margin: 0 0 0 10px;
		opacity: 1;
	}
	.af-seg__opt span {
		min-height: 0;
		padding: 4px 10px 4px 6px;
	}
	.af-seg__opt input:checked + span {
		background: none;
		box-shadow: none;
		color: #000;
		font-weight: 700;
		text-decoration: underline;
	}
}

.af-phone__onfile {
	display: block;
	margin-top: 4px;
	color: var(--text-muted);
	font-size: 12px;
}

/* AI charts (www/ai-chart.js): Chart.js canvas plus the control row */
.ai-chart {
	margin: 14px 0;
}
.ai-chart-controls {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 16px;
	align-items: center;
	margin-bottom: 10px;
	font-size: 13px;
	color: var(--text-muted);
}
.ai-chart-field select {
	margin-left: 4px;
	padding: 4px 8px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--text);
	font: inherit;
}
.ai-chart-ys {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 4px 12px;
	align-items: center;
}
.ai-chart-check {
	color: var(--text);
	white-space: nowrap;
}
.ai-chart-canvas {
	position: relative;
	height: 320px;
	padding: 10px;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--surface);
}
.ai-chart-note {
	margin: 6px 0 0;
	font-size: 12px;
	color: var(--text-muted);
}
@media print {
	.ai-chart-controls {
		display: none;
	}
}

/* ------------------------------------------------------------------------
   Admin: the grouped list of admin pages beside every admin page
   (www/body.php, fs_admin_nav() in inc/shell.inc.php) and the overview
   cards on /admin (www/admin_home.php).
   ------------------------------------------------------------------------ */
#page.has-admin-nav {
	grid-template-columns: 220px minmax(0, 1fr);
}

#page.has-admin-nav #menu {
	order: -1;
}

#page.has-admin-nav #menu .m_c {
	position: sticky;
	top: 14px;
	max-height: calc(100vh - 28px);
	overflow-y: auto;
}

/* Beside the page it is always open, so the heading is just a label. */
.admin-nav__panel > summary {
	list-style: none;
	pointer-events: none;
}

.admin-nav__panel > summary::-webkit-details-marker {
	display: none;
}

.admin-nav__group + .admin-nav__group {
	margin-top: 12px;
}

.admin-nav__title {
	margin: 0 8px 4px;
	color: var(--text-muted);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.admin-nav ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.admin-nav a:link,
.admin-nav a:visited {
	display: block;
	padding: 6px 10px;
	border-radius: var(--radius-sm);
	color: #3b475c;
	font-weight: 500;
}

.admin-nav a:hover {
	background: var(--surface-subtle);
	color: var(--heading);
}

.admin-nav a.is-active {
	background: var(--brand-soft);
	color: var(--brand-strong);
	font-weight: 600;
}

@media (max-width: 1120px) {
	#page.has-admin-nav {
		grid-template-columns: minmax(0, 1fr);
	}

	#page.has-admin-nav #menu .m_c {
		position: static;
		max-height: none;
	}

	/* Above the page: folded to an "Admin" button, groups side by side when open. */
	.admin-nav__panel > summary {
		display: flex;
		align-items: center;
		justify-content: space-between;
		min-height: 36px;
		margin: 0 8px;
		pointer-events: auto;
		cursor: pointer;
	}

	/* A chevron shows it opens; it turns when open. */
	.admin-nav__panel > summary::after {
		content: "";
		width: 7px;
		height: 7px;
		margin-right: 4px;
		border: solid currentColor;
		border-width: 0 2px 2px 0;
		transform: rotate(45deg);
		transition: transform var(--transition);
	}

	.admin-nav__panel[open] > summary::after {
		transform: rotate(-135deg);
	}

	.admin-nav__groups {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
		gap: 10px 16px;
		margin-top: 6px;
	}

	.admin-nav__group + .admin-nav__group {
		margin-top: 0;
	}
}

.admin-home__groups {
	display: grid;
	gap: 22px;
}

.admin-home__group h2 {
	margin: 0 0 10px;
	color: var(--text-muted);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.admin-home__cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.admin-home__cards a:link,
.admin-home__cards a:visited {
	display: block;
	height: 100%;
	padding: 14px 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface);
	color: var(--text);
}

.admin-home__cards a:hover {
	border-color: var(--brand);
	box-shadow: var(--shadow-sm);
}

.admin-home__name {
	display: block;
	margin-bottom: 4px;
	color: var(--heading);
	font-weight: 600;
}

.admin-home__about {
	display: block;
	color: var(--text-muted);
	font-size: 13px;
}

/* Admin > Activity log (www/activity_log.php): the filter bar's check boxes,
   sortable headings, the Details row under each entry and the pager. */
.activity-check {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	color: #3b475c;
	font-size: 13px;
	font-weight: 600;
}

.activity-check input {
	margin: 0;
}

.activity-export {
	margin: 0;
}

.activity-export-note {
	margin: 0;
	padding: 0 16px 12px;
	font-size: 13px;
}

.data-table th a.activity-sort:link,
.data-table th a.activity-sort:visited {
	color: inherit;
}

.data-table th a.activity-sort:hover {
	color: var(--brand-strong);
}

.activity-table td {
	vertical-align: top;
}

.activity-table tr.activity-row td {
	padding-bottom: 4px;
	border-bottom: 0;
}

.activity-table tr.activity-detail td,
.activity-table tr.activity-detail td:first-child {
	padding-top: 0;
	white-space: normal;
}

.activity-detail summary {
	color: var(--text-muted);
	font-size: 13px;
	cursor: pointer;
}

.activity-detail details[open] > summary {
	margin-bottom: 8px;
}

.activity-changes {
	width: 100%;
	margin: 0 0 10px;
	border-collapse: collapse;
	font-size: 13px;
}

/* Nested in .data-table: undo its cell, heading and hover styles. */
.activity-table .activity-changes th,
.activity-table .activity-changes td,
.activity-table .activity-changes td:first-child {
	padding: 4px 8px;
	border: 0;
	border-bottom: 1px solid #edf1ed;
	background: transparent;
	letter-spacing: 0;
	text-transform: none;
	white-space: normal;
	overflow-wrap: anywhere;
}

.activity-table .activity-changes tbody tr:hover {
	background: transparent;
}

.activity-table .activity-changes tbody tr:last-child td {
	border-bottom: 0;
}

.activity-table .activity-changes td.activity-old,
.activity-table .activity-changes td.activity-new {
	white-space: pre-wrap;
}

.activity-table .activity-changes td.activity-old {
	color: var(--danger);
}

.activity-table .activity-changes td.activity-new {
	color: var(--brand-strong);
}

/* The stored name or value under a readable one: what the log keeps. */
.activity-table .activity-changes .activity-raw {
	display: block;
	margin-top: 2px;
	color: var(--text-muted);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 11px;
	white-space: pre-wrap;
}

.activity-meta {
	display: grid;
	grid-template-columns: max-content minmax(0, 1fr);
	gap: 2px 12px;
	margin: 0;
	font-size: 13px;
}

.activity-meta dt {
	color: var(--text-muted);
}

.activity-meta dd {
	margin: 0;
	overflow-wrap: anywhere;
}

.activity-pager {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 16px;
	padding: 12px 16px;
	border-top: 1px solid var(--border);
}
.activity-pager__pages {
	display: flex;
	align-items: center;
	gap: 4px;
}
.activity-pager__pages a,
.activity-pager__current {
	min-width: 28px;
	padding: 2px 6px;
	text-align: center;
	border-radius: 4px;
}
.activity-pager__current {
	font-weight: 600;
	background: var(--border);
}

.chip--danger {
	background: #fdecea;
	color: var(--danger);
}

/* Submit Assessment, under the step list and on the last page (inc/assessment_submit.inc.php). */
.assess-submit {
	margin: 14px 0 0;
	padding: 12px 0 0;
	border-top: 1px solid var(--border);
}

.assess-submit--page {
	margin: 24px 0 8px;
	padding: 16px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--surface);
}

.assess-submit__status {
	margin: 0 0 8px;
	font-size: 13px;
}

.assess-submit__field {
	display: block;
	margin: 0 0 4px;
	font-size: 13px;
	font-weight: 600;
}

.assess-submit__select {
	display: block;
	width: 100%;
	max-width: 20rem;
	margin: 0 0 10px;
}

.assess-submit--steps .assess-submit__button {
	width: 100%;
}

.assess-submit__hint {
	margin: 8px 0 0;
	color: var(--text-muted);
	font-size: 12px;
}

.assess-submit-missing {
	margin: 12px 0 16px 20px;
}

/* The History link under the assessment step list (www/body.php). */
.assess-history {
	margin: 10px 0 0;
	font-size: 13px;
}

/* Reports > Saved (www/aisaved.php) */
.ai-saved-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-bottom: 12px;
}

a.ai-saved-filter,
a.ai-saved-filter:link,
a.ai-saved-filter:visited {
	padding: 3px 12px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--surface);
	color: var(--text);
	font-size: 13px;
	text-decoration: none;
}

a.ai-saved-filter:hover {
	background: var(--border);
}

a.ai-saved-filter.is-active {
	border-color: var(--brand);
	background: var(--brand);
	color: #fff;
}

.ai-saved-filter-gap {
	width: 12px;
}

.ai-saved-table td.ai-saved-star,
.ai-saved-table td.ai-saved-menu {
	position: relative;
	width: 32px;
	white-space: nowrap;
}

/* Pattern library (docs/design/): ui-* classes. */

.ui-btn, .ui-btn:link, .ui-btn:visited {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-height: 36px;
	padding: 0 14px;
	border: 1px solid var(--brand);
	border-radius: var(--radius-sm);
	background: var(--brand);
	color: #fff;
	font-family: inherit;
	font-size: var(--text-md);
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
}

.ui-btn:hover, .ui-btn:link:hover, .ui-btn:visited:hover {
	background: var(--brand-strong);
	border-color: var(--brand-strong);
	color: #fff;
	text-decoration: none;
}

.ui-btn:focus-visible, .ui-btn:link:focus-visible, .ui-btn:visited:focus-visible {
	outline: 2px solid var(--brand);
	outline-offset: 2px;
}

.ui-btn--secondary, .ui-btn--secondary:link, .ui-btn--secondary:visited {
	background: var(--surface);
	border-color: var(--border-strong);
	color: var(--text);
}

.ui-btn--secondary:hover, .ui-btn--secondary:link:hover, .ui-btn--secondary:visited:hover {
	background: var(--surface-muted);
	border-color: var(--border-strong);
	color: var(--text);
}

.ui-btn--danger, .ui-btn--danger:link, .ui-btn--danger:visited {
	background: var(--surface);
	border-color: var(--danger-border);
	color: var(--danger);
}

.ui-btn--danger:hover, .ui-btn--danger:link:hover, .ui-btn--danger:visited:hover {
	background: var(--danger-soft);
	border-color: var(--danger-border);
	color: var(--danger);
}

.ui-btn--confirm, .ui-btn--confirm:link, .ui-btn--confirm:visited {
	background: var(--danger);
	border-color: var(--danger);
	color: #fff;
}

.ui-btn--confirm:hover, .ui-btn--confirm:link:hover, .ui-btn--confirm:visited:hover {
	background: var(--danger);
	border-color: var(--danger);
	color: #fff;
	opacity: 0.9;
}

.ui-btn--quiet, .ui-btn--quiet:link, .ui-btn--quiet:visited {
	background: transparent;
	border-color: transparent;
	color: var(--brand-strong);
}

.ui-btn--quiet:hover, .ui-btn--quiet:link:hover, .ui-btn--quiet:visited:hover {
	background: var(--brand-soft);
	border-color: transparent;
	color: var(--brand-strong);
}

.ui-btn--small, .ui-btn--small:link, .ui-btn--small:visited {
	min-height: 30px;
	padding: 0 10px;
	font-size: var(--text-sm);
}

.ui-btn[disabled], .ui-btn[aria-disabled="true"] {
	opacity: 0.45;
	cursor: not-allowed;
}

.ui-btn-row {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
}

@media (max-width: 640px) {
	.ui-btn, .ui-btn:link, .ui-btn:visited {
		width: 100%;
	}

	.ui-btn--small, .ui-btn--small:link, .ui-btn--small:visited, .ui-btn--quiet, .ui-btn--quiet:link, .ui-btn--quiet:visited {
		width: auto;
	}

	.ui-pager .ui-btn, .ui-pager .ui-btn:link, .ui-pager .ui-btn:visited {
		width: auto;
	}
}

/* Page header, notices, empty state. */
.ui-page-head {
	margin: 0 0 var(--space-4);
}

.ui-page-head__row {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: flex-start;
	gap: var(--space-4);
}

.ui-page-head__title {
	margin: 0;
	font-size: clamp(1.35rem, 2.4vw, 1.7rem);
	font-weight: 700;
	color: var(--heading);
	letter-spacing: -0.02em;
}

.ui-page-head__sub {
	margin: var(--space-1) 0 0;
	color: var(--text-muted);
}

.ui-page-head__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
}

.ui-page-head__back, .ui-page-head__back:link, .ui-page-head__back:visited {
	display: inline-block;
	margin: 0 0 var(--space-2);
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--brand-strong);
	text-decoration: none;
}

.ui-notice {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	padding: 10px 14px;
	border: 1px solid var(--info-border);
	border-radius: var(--radius-md);
	background: var(--info-soft);
	color: var(--info);
}

.ui-notice p {
	margin: 0;
}

.ui-notice__mark {
	flex: none;
	font-weight: 700;
}

.ui-notice--ok {
	background: var(--brand-soft);
	border-color: var(--success-border);
	color: var(--brand-strong);
}

.ui-notice--error {
	background: var(--danger-soft);
	border-color: var(--danger-border);
	color: var(--danger);
}

.ui-notice--warn {
	background: var(--warn-soft);
	border-color: var(--warn-border);
	color: var(--warn);
}

.ui-empty {
	padding: 28px var(--space-4);
	text-align: center;
	color: var(--text-muted);
}

.ui-empty p {
	margin: 0;
}

.ui-empty__title {
	font-weight: 700;
	color: var(--heading);
	font-size: var(--text-lg);
}

.ui-tabs {
	position: relative;
	display: inline-block;
	max-width: 100%;
	vertical-align: top;
}

.ui-tabs__scroll {
	display: inline-flex;
	max-width: 100%;
	overflow-x: auto;
	scrollbar-width: none;
	vertical-align: top;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-md);
	background: #fff;
}

.ui-tabs__scroll::-webkit-scrollbar {
	display: none;
}

.ui-tabs__tab,
.ui-tabs__tab:link,
.ui-tabs__tab:visited {
	flex: none;
	margin: 0;
	padding: 7px 12px;
	border: 0;
	border-right: 1px solid var(--border);
	border-radius: 0;
	background: transparent;
	color: var(--text);
	font: inherit;
	font-size: var(--text-sm);
	font-weight: 600;
	line-height: 1.3;
	white-space: nowrap;
	text-decoration: none;
	cursor: pointer;
}

.ui-tabs__tab:last-child {
	border-right: 0;
}

.ui-tabs__tab:hover {
	background: var(--surface-muted);
}

.ui-tabs__tab[aria-current="page"],
.ui-tabs__tab[aria-pressed="true"] {
	background: var(--brand-soft);
	color: var(--brand-strong);
	box-shadow: inset 0 -2px 0 var(--brand);
}

.ui-tabs__tab:focus-visible {
	outline: 2px solid var(--brand);
	outline-offset: -2px;
}

.ui-tabs__count {
	font-weight: 500;
	opacity: 0.75;
}

.ui-tabs--more-left::before,
.ui-tabs--more-right::after {
	content: "";
	position: absolute;
	top: 1px;
	bottom: 1px;
	width: 36px;
	pointer-events: none;
	border-radius: var(--radius-md);
}

.ui-tabs--more-left::before {
	left: 1px;
	background: linear-gradient(to left, transparent, var(--surface));
}

.ui-tabs--more-right::after {
	right: 1px;
	background: linear-gradient(to right, transparent, var(--surface));
}

.chip--info {
	background: var(--info-soft);
	color: var(--info);
}

.ui-pager {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-3);
	margin-top: var(--space-4);
}

.ui-pager__range {
	color: var(--text-muted);
	font-size: var(--text-sm);
}

.ui-form-section {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 14px 16px 16px;
	margin-bottom: var(--space-4);
}

.ui-form-section__title {
	font-size: var(--text-lg);
	color: var(--heading);
	margin: 0 0 12px;
}

.ui-form-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px 16px;
}

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

@media (max-width: 640px) {
	.ui-form-grid {
		grid-template-columns: 1fr;
	}
}

.ui-field__label {
	display: block;
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--label);
	margin: 0 0 var(--space-1);
}

.ui-field input,
.ui-field select,
.ui-field textarea {
	box-sizing: border-box;
	width: 100%;
	min-height: 36px;
	padding: 0 12px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-md);
	background: var(--surface);
	font-size: var(--text-md);
}

.ui-field textarea {
	padding: 8px 12px;
}

.ui-field input:focus,
.ui-field select:focus,
.ui-field textarea:focus {
	outline: 2px solid var(--brand);
	outline-offset: 1px;
}

.ui-field__req {
	color: var(--danger);
	margin-left: 2px;
}

.ui-field__hint {
	font-size: var(--text-xs);
	color: var(--text-muted);
	margin: var(--space-1) 0 0;
}

.ui-field__error {
	font-size: var(--text-sm);
	color: var(--danger);
	margin: var(--space-1) 0 0;
}

.ui-field--error input,
.ui-field--error select,
.ui-field--error textarea {
	border-color: var(--danger);
}

/* Row buttons stay clickable above a .row-link overlay. */
.data-table tbody td .ui-btn, .data-table tbody td .ui-btn-row {
	position: relative;
	z-index: 1;
}

/* Disabled buttons keep their resting colours and ignore clicks. */
.ui-btn[aria-disabled="true"] {
	pointer-events: none;
}

.ui-btn[disabled]:hover, .ui-btn[disabled]:link:hover, .ui-btn[disabled]:visited:hover,
.ui-btn[aria-disabled="true"]:hover, .ui-btn[aria-disabled="true"]:link:hover, .ui-btn[aria-disabled="true"]:visited:hover {
	background: var(--brand);
	border-color: var(--brand);
	color: #fff;
}

.ui-btn--secondary[disabled]:hover, .ui-btn--secondary[disabled]:link:hover, .ui-btn--secondary[disabled]:visited:hover,
.ui-btn--secondary[aria-disabled="true"]:hover, .ui-btn--secondary[aria-disabled="true"]:link:hover, .ui-btn--secondary[aria-disabled="true"]:visited:hover {
	background: var(--surface);
	border-color: var(--border-strong);
	color: var(--text);
}

.ui-btn--danger[disabled]:hover, .ui-btn--danger[disabled]:link:hover, .ui-btn--danger[disabled]:visited:hover,
.ui-btn--danger[aria-disabled="true"]:hover, .ui-btn--danger[aria-disabled="true"]:link:hover, .ui-btn--danger[aria-disabled="true"]:visited:hover {
	background: var(--surface);
	border-color: var(--danger-border);
	color: var(--danger);
}

.ui-btn--confirm[disabled]:hover, .ui-btn--confirm[disabled]:link:hover, .ui-btn--confirm[disabled]:visited:hover,
.ui-btn--confirm[aria-disabled="true"]:hover, .ui-btn--confirm[aria-disabled="true"]:link:hover, .ui-btn--confirm[aria-disabled="true"]:visited:hover {
	background: var(--danger);
	border-color: var(--danger);
	color: #fff;
	opacity: 0.45;
}

.ui-btn--quiet[disabled]:hover, .ui-btn--quiet[disabled]:link:hover, .ui-btn--quiet[disabled]:visited:hover,
.ui-btn--quiet[aria-disabled="true"]:hover, .ui-btn--quiet[aria-disabled="true"]:link:hover, .ui-btn--quiet[aria-disabled="true"]:visited:hover {
	background: transparent;
	border-color: transparent;
	color: var(--brand-strong);
}

/* Form controls: beat the global typed-input width and focus rules. */
.ui-field input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]),
.ui-field select,
.ui-field textarea {
	width: 100%;
	max-width: none;
	box-shadow: none;
}

.ui-field input[type=checkbox],
.ui-field input[type=radio] {
	width: auto;
	min-height: 0;
	padding: 0;
}

.ui-field input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]):focus,
.ui-field select:focus,
.ui-field textarea:focus {
	outline: 2px solid var(--brand);
	outline-offset: 1px;
	border-color: var(--border-strong);
	box-shadow: none;
}

.ui-field--error input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]),
.ui-field--error select,
.ui-field--error textarea,
.ui-field--error input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]):focus,
.ui-field--error select:focus,
.ui-field--error textarea:focus {
	border-color: var(--danger);
}

/* Checklist: a compact, scrolling list of tick boxes (fs_ui_checklist()). */
.ui-checklist {
	max-width: 520px;
}

.ui-checklist__list {
	max-height: 240px;
	overflow-y: auto;
	padding: 4px 10px;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--surface);
}

.ui-checklist__item {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 36px;
	margin: 0;
	font-size: 14px;
	font-weight: 400;
	color: var(--text);
	cursor: pointer;
}

.ui-checklist__item input[type=checkbox] {
	flex: none;
	width: 18px;
	height: 18px;
	min-height: 0;
	margin: 0;
	padding: 0;
	accent-color: var(--brand);
}

.ui-checklist__count,
.ui-checklist__empty {
	margin: var(--space-1) 0 0;
	font-size: var(--text-sm);
	color: var(--text-muted);
}
