/* Admin UI base styles. All values come from tokens.css (D14): change tokens and partials to restyle. */

/* Field and button height (owner, 23 October 2026: compact, not bulky). Touch screens keep the 44px touch size. */
:root {
	/* Colour (owner, 25 October 2026: "add some color"): tints of the brand and status tokens, never new hues. */
	--color-brand-tint: color-mix(in srgb, var(--color-brand-primary) 8%, var(--color-surface-panel));
	--color-brand-tint-strong: color-mix(in srgb, var(--color-brand-primary) 16%, var(--color-surface-panel));
	--color-brand-hover: color-mix(in srgb, var(--color-brand-primary) 85%, var(--color-text-primary));
	--color-row-hover: color-mix(in srgb, var(--color-brand-primary) 4%, var(--color-surface-panel));
	--tint-success: color-mix(in srgb, var(--color-status-success) 8%, var(--color-surface-panel));
	--tint-warning: color-mix(in srgb, var(--color-status-warning) 9%, var(--color-surface-panel));
	--tint-danger: color-mix(in srgb, var(--color-status-danger) 7%, var(--color-surface-panel));
	--tint-info: color-mix(in srgb, var(--color-status-info) 8%, var(--color-surface-panel));
}

@media (pointer: coarse) {
	:root {
		--control-h: var(--touch-min);
	}
}

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

/* The hidden attribute always wins: components set display (grid, flex) and must not reveal hidden steps. */
[hidden] {
	display: none !important;
}

body {
	margin: 0;
	font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans", sans-serif;
	font-size: var(--type-size-body);
	line-height: var(--type-line-height-body);
	font-weight: var(--type-weight-regular);
	color: var(--color-text-primary);
	background: var(--color-surface-page);
}

h1,
h2,
h3 {
	font-weight: var(--type-weight-bold);
	line-height: 1.25;
	margin: 0 0 var(--space-md);
}

h1 {
	font-size: var(--type-size-headline);
}

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

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

.skip-link {
	position: absolute;
	left: var(--space-sm);
	top: -40px;
	padding: var(--space-sm) var(--space-md);
	background: var(--color-surface-panel);
	border-radius: var(--radius-md);
}

.skip-link:focus {
	top: var(--space-sm);
}

/* Buttons */

button,
.button-primary,
.button-quiet {
	min-height: var(--control-h);
	padding: 0 var(--space-md);
	border-radius: var(--radius-md);
	font: inherit;
	cursor: pointer;
}

.button-primary {
	border: 0;
	color: var(--color-brand-on-primary);
	background: var(--color-brand-primary);
	font-weight: var(--type-weight-medium);
}

.button-quiet {
	border: 1px solid var(--color-border-default);
	color: var(--color-text-primary);
	background: var(--color-surface-panel);
}

button:disabled {
	opacity: 0.6;
	cursor: progress;
}

/* Forms */

label {
	display: block;
	margin: var(--space-md) 0 var(--space-xs);
	color: var(--color-text-secondary);
}

input,
select,
textarea {
	width: 100%;
	min-height: var(--control-h);
	padding: 0 var(--space-sm);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
	background: var(--color-surface-panel);
	color: var(--color-text-primary);
	font: inherit;
}

/* File picker: the same box as the other fields, with the browser's button drawn as a quiet button inside it. */
input[type="file"] {
	display: flex;
	align-items: center;
	padding: 0 var(--space-xs);
	color: var(--color-text-secondary);
	cursor: pointer;
}

input[type="file"]::file-selector-button {
	min-height: calc(var(--control-h) - 8px);
	margin: 4px var(--space-md) 4px 0;
	padding: 0 var(--space-md);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-sm);
	background: var(--color-surface-subtle);
	color: var(--color-text-primary);
	font: inherit;
	font-weight: var(--type-weight-medium);
	cursor: pointer;
}

input[type="file"]:hover::file-selector-button {
	border-color: var(--color-text-secondary);
}

.form-error {
	color: var(--color-status-danger);
	margin: var(--space-md) 0 0;
}

/* Login */

.page-login {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: var(--space-xl);
	min-height: 100vh;
	padding: var(--space-lg);
}

/* Logo bar above every public card: the logo, and the language switch on the same line. Same width as the card. */
.public-top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm) var(--space-lg);
	width: min(100%, 860px);
	margin: 0 auto var(--space-xl);
}

.page-login .public-top {
	width: min(100%, 420px);
	margin: 0;
}

.page-login .public-top:not(:has(.public-lang)) {
	justify-content: center;
}

.page-public:has(.public-panel-narrow) .public-top {
	width: min(100%, 480px);
	margin-top: 10vh;
}

.public-top + .public-panel-narrow {
	margin-top: 0;
}

.public-brand img {
	display: block;
	width: auto;
	height: 56px;
}

.portal-brand img {
	display: block;
	width: auto;
	height: 36px;
	opacity: 0.85;
}

.login-panel {
	width: min(100%, 420px);
	padding: var(--space-xxl);
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
}

.login-panel button {
	width: 100%;
	margin-top: var(--space-xl);
}

.login-forgot {
	margin: var(--space-sm) 0 0;
	text-align: right;
	font-size: 0.875rem;
}

#forgot-form,
#reset-form {
	display: grid;
	gap: var(--space-sm);
}

#forgot-form button,
#reset-form button {
	justify-self: start;
	margin-top: var(--space-md);
}

/* Application shell */

.page-app {
	display: grid;
	grid-template-columns: 220px 1fr;
	grid-template-rows: auto 1fr;
	min-height: 100vh;
}

.app-header {
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	gap: var(--space-lg);
	padding: var(--space-sm) var(--space-lg);
	background: var(--color-surface-panel);
	border-bottom: 1px solid var(--color-border-default);
}

.inbox-button {
	position: relative;
	display: inline-flex;
	align-items: center;
	padding-inline: var(--space-sm);
}

.inbox-count {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 18px;
	padding: 0 4px;
	border-radius: 9px;
	background: var(--color-status-danger);
	color: var(--color-brand-on-primary);
	font-size: 0.75rem;
	line-height: 18px;
	text-align: center;
}

.inbox-list {
	display: grid;
	gap: var(--space-sm);
	margin: 0;
	padding: 0;
	list-style: none;
}

.inbox-item {
	padding: var(--space-md);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
}

.inbox-item[data-unread="true"] {
	border-left: 3px solid var(--color-brand-primary);
}

.inbox-item p {
	margin: 0;
}

.inbox-subject {
	font-weight: 600;
}

.inbox-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-sm) var(--space-md);
}

.inbox-text {
	margin-top: var(--space-sm) !important;
}

.inbox-time,
.inbox-empty {
	color: var(--color-text-secondary);
	font-size: 0.875rem;
}

.app-brand {
	display: flex;
	align-items: center;
	flex: none;
}

.app-brand img {
	display: block;
	width: auto;
	height: 36px;
}

.env-badge {
	padding: var(--space-xxs) var(--space-sm);
	border-radius: var(--radius-sm);
	background: var(--color-surface-subtle);
	color: var(--color-status-warning);
	font-size: var(--type-size-caption);
}

/* D24: a demo account, plainly. */
.demo-badge {
	background: var(--color-status-danger);
	color: #FFFFFF;
	font-weight: var(--type-weight-bold);
}

.company-switcher {
	margin: 0 0 0 auto;
	min-width: 220px;
}

.app-nav {
	background: var(--color-surface-panel);
	border-right: 1px solid var(--color-border-default);
}

.app-nav ul {
	list-style: none;
	margin: 0;
	padding: var(--space-md) var(--space-sm);
}

.app-nav a {
	display: block;
	padding: var(--space-sm) var(--space-md);
	border-radius: var(--radius-md);
	color: var(--color-text-primary);
	text-decoration: none;
}

.app-nav a[aria-current] {
	background: var(--color-surface-subtle);
	font-weight: var(--type-weight-medium);
}

.app-main {
	padding: var(--space-xl);
	min-width: 0;
}

/* Status chips: always text plus colour, never colour alone (A01 accessibility, G-71). */

.chip {
	display: inline-block;
	padding: var(--space-xxs) var(--space-sm);
	border-radius: var(--radius-sm);
	border: 1px solid var(--color-border-default);
	font-size: var(--type-size-caption);
	white-space: nowrap;
}

.chip[data-tone="success"] {
	color: var(--color-status-success);
}

.chip[data-tone="warning"] {
	color: var(--color-status-warning);
}

.chip[data-tone="danger"] {
	color: var(--color-status-danger);
}

@media (max-width: 820px) {
	.page-app {
		grid-template-columns: 1fr;
	}

	.app-nav ul {
		display: flex;
		overflow-x: auto;
	}
}

/* ===================================================================== Screens (UI work package)
   Calm, compact and token-only: white panels on the neutral page, restrained borders, bold only for
   headings and key values, no shadows or gradients. Derived tints use color-mix() on tokens. */

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

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

/* Buttons: extra variants (44px targets kept) */

.button-danger {
	border: 1px solid var(--color-status-danger);
	color: var(--color-status-danger);
	background: var(--color-surface-panel);
	font-weight: var(--type-weight-medium);
}

.button-link {
	min-height: var(--control-h);
	padding: 0 var(--space-sm);
	border: 0;
	background: transparent;
	color: var(--color-status-info);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.button-primary,
.button-quiet,
.button-danger {
	white-space: normal;
	line-height: 1.25;
}

button[aria-busy="true"] {
	cursor: progress;
}

a {
	color: var(--color-status-info);
	text-underline-offset: 2px;
}

/* Page structure */

.screen {
	display: flex;
	flex-direction: column;
	gap: var(--space-lg);
	/* Use the width there is (owner, F16): forms keep their fields on one row instead of wrapping beside empty space. */
	max-width: 1840px;
}

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

.page-header h1 {
	margin: 0;
}

.page-heading {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
	min-width: 0;
}

.page-description {
	margin: 0;
	color: var(--color-text-secondary);
	max-width: 70ch;
}

.page-actions,
.row-actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-sm);
	align-items: center;
}

.panel {
	padding: var(--space-lg);
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
	min-width: 0;
}

.panel-title,
.section-title {
	font-size: var(--type-size-title);
	margin: 0 0 var(--space-md);
}

.section-title {
	font-size: var(--type-size-body-large);
	color: var(--color-text-secondary);
}

.plain-list {
	margin: 0;
	padding-left: var(--space-xl);
}

.plain-list li + li {
	margin-top: var(--space-xs);
}

/* A table cell that folds a long list (Team › amount limits): one line, the list opens under it. */
.cell-details > summary {
	cursor: pointer;
}

.cell-details[open] > summary {
	margin-bottom: var(--space-xs);
}

/* Date filters need less room than lists, so a full filter row fits on one line. */
.filter-field.filter-date {
	flex-basis: 150px;
}

/* Audit log: each field before and after a change, changed fields marked. */
.audit-details > p {
	margin: 0 0 var(--space-xs);
}

.audit-diff {
	display: grid;
	grid-template-columns: max-content minmax(0, 1fr);
	gap: var(--space-xs) var(--space-md);
	margin: 0 0 var(--space-xs);
	font-size: var(--type-size-caption);
}

.audit-diff dt {
	color: var(--color-text-secondary);
}

.audit-diff dd {
	margin: 0;
	overflow-wrap: break-word;
	min-width: 0;
}

.audit-diff [data-changed] {
	font-weight: var(--type-weight-medium);
}

.audit-before {
	color: var(--color-text-secondary);
	text-decoration: line-through;
}

.back-link {
	display: inline-flex;
	align-items: center;
	min-height: var(--control-h);
}

/* Notices and states */

.notice {
	padding: var(--space-md) var(--space-lg);
	border: 1px solid var(--color-border-default);
	border-left-width: 4px;
	border-radius: var(--radius-md);
	background: var(--color-surface-panel);
}

.notice > * {
	margin: 0;
}

.notice > * + * {
	margin-top: var(--space-sm);
}

.notice-title {
	font-weight: var(--type-weight-bold);
}

.notice-meta,
.rule-id {
	color: var(--color-text-secondary);
	font-size: var(--type-size-caption);
}

.notice-list {
	padding-left: var(--space-xl);
}

.notice[data-tone="info"] {
	border-left-color: var(--color-status-info);
}

.notice[data-tone="success"] {
	border-left-color: var(--color-status-success);
}

.notice[data-tone="warning"] {
	border-left-color: var(--color-status-warning);
}

.notice[data-tone="danger"] {
	border-left-color: var(--color-status-danger);
	background: color-mix(in srgb, var(--color-status-danger) 5%, var(--color-surface-panel));
}

.notice[data-tone="neutral"] {
	border-left-color: var(--color-border-default);
}

.loading-state,
.empty-state {
	margin: 0;
	padding: var(--space-lg);
	color: var(--color-text-secondary);
	background: var(--color-surface-panel);
	border: 1px dashed var(--color-border-default);
	border-radius: var(--radius-md);
}

[aria-busy="true"] > .table-wrap {
	opacity: 0.6;
}

/* Status chips: tones add a tinted border and background to the text label */

.chip {
	background: var(--color-surface-panel);
	line-height: 1.4;
}

.chip[data-tone="success"] {
	border-color: color-mix(in srgb, var(--color-status-success) 45%, var(--color-border-default));
	background: color-mix(in srgb, var(--color-status-success) 7%, var(--color-surface-panel));
}

.chip[data-tone="warning"] {
	border-color: color-mix(in srgb, var(--color-status-warning) 45%, var(--color-border-default));
	background: color-mix(in srgb, var(--color-status-warning) 7%, var(--color-surface-panel));
}

.chip[data-tone="danger"] {
	border-color: color-mix(in srgb, var(--color-status-danger) 45%, var(--color-border-default));
	background: color-mix(in srgb, var(--color-status-danger) 7%, var(--color-surface-panel));
}

.chip[data-tone="info"] {
	color: var(--color-status-info);
	border-color: color-mix(in srgb, var(--color-status-info) 40%, var(--color-border-default));
}

.chip[data-tone="neutral"] {
	color: var(--color-text-primary);
}

.chip[data-tone="muted"] {
	color: var(--color-text-secondary);
	background: var(--color-surface-subtle);
}

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

.chip-list li {
	display: inline-flex;
	align-items: center;
	gap: var(--space-xs);
}

.chip-dimension {
	color: var(--color-text-secondary);
	font-size: var(--type-size-caption);
}

/* Filters and lists */

/* The search box takes whatever the other filters leave, so the bar has no empty space on the right. A check box
   filter sits on the search box's line, level with the box (below the label line). */
.filter-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: var(--space-sm) var(--space-md);
	padding: var(--space-md) var(--space-lg);
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
}

.filter-field {
	display: flex;
	/* Filters share the row (no empty band beside them, F17). */
	flex: 1 1 200px;
	flex-direction: column;
	min-width: 0;
}

.filter-search {
	flex: 1 1 320px;
}

.filter-actions {
	flex: 0 0 auto;
	align-items: flex-start;
}

.filter-check {
	flex: 0 0 auto;
	align-self: flex-start;
	padding-top: calc(var(--type-size-caption) * var(--type-line-height-body) + var(--space-xs));
}

.filter-check .inline-label {
	white-space: nowrap;
}

.field-label,
.filter-field .field-label {
	margin: 0 0 var(--space-xs);
	font-size: var(--type-size-caption);
	color: var(--color-text-secondary);
}

.list-summary {
	margin: 0;
	color: var(--color-text-secondary);
	font-size: var(--type-size-caption);
}

/* Counter: "Add a service charge" with its box before the text. */
.counter-aside .checkbox-row {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: var(--space-sm);
}

/* Attached files on a document. */
.attachment-list {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
	margin: 0;
	padding: 0;
	list-style: none;
}

.attachment-item {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: var(--space-xs) var(--space-sm);
}

/* Bulk issue: what is ticked and what to do with it, right above the list. */
.bulk-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-sm) var(--space-md);
	padding: var(--space-xs) var(--space-sm);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-sm);
	background: var(--color-surface-subtle);
}

.bulk-bar[hidden] {
	display: none;
}

.data-table .col-select {
	width: 2.5rem;
}

.bulk-failures {
	margin: 0;
	padding-left: var(--space-lg);
}

.list-footer {
	display: flex;
	justify-content: center;
}

/* Data table */

.table-wrap {
	overflow-x: auto;
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
}

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

.data-table th,
.data-table td {
	padding: var(--space-sm) var(--space-md);
	text-align: left;
	vertical-align: middle;
	border-bottom: 1px solid var(--color-border-default);
}

.data-table thead th {
	font-size: var(--type-size-caption);
	font-weight: var(--type-weight-medium);
	color: var(--color-text-secondary);
	background: var(--color-surface-subtle);
	white-space: nowrap;
}

.data-table tbody th {
	font-weight: var(--type-weight-medium);
}

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

.data-table .num {
	text-align: right;
}

.data-table a {
	display: inline-flex;
	align-items: center;
	min-height: var(--control-h);
}

.table-caption {
	text-align: left;
	padding: var(--space-sm) var(--space-md);
	font-weight: var(--type-weight-bold);
}

/* Dashboard queues */

.dashboard-groups {
	display: flex;
	flex-direction: column;
	gap: var(--space-xl);
}

.queue-grid {
	/* Wrapping flex rows: every row is filled, the last one too (3 cards in 2 columns leave no hole; F17). */
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-md);
	margin: 0;
	padding: 0;
	list-style: none;
}

.queue-grid > li {
	display: flex;
	flex: 1 1 220px;
}

/* The cards and what follows them (the per-client table) keep apart. */
.queue-grid + *,
.queue-totals:not(:empty) + * {
	margin-top: var(--space-lg);
}

.queue-card {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: var(--space-xs);
	padding: var(--space-lg);
	min-height: 120px;
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-top-width: 3px;
	border-radius: var(--radius-lg);
	color: var(--color-text-primary);
	text-decoration: none;
}

a.queue-card:hover {
	border-color: var(--color-brand-primary);
}

.queue-card[data-tone="danger"] {
	border-top-color: var(--color-status-danger);
}

.queue-card[data-tone="warning"] {
	border-top-color: var(--color-status-warning);
}

.queue-card[data-tone="info"] {
	border-top-color: var(--color-status-info);
}

.queue-card[data-tone="neutral"] {
	border-top-color: var(--color-brand-primary);
}

.queue-count {
	font-size: var(--type-size-headline);
	font-weight: var(--type-weight-bold);
	font-variant-numeric: tabular-nums;
}

.queue-card[data-tone="muted"] .queue-count {
	color: var(--color-text-secondary);
	font-weight: var(--type-weight-regular);
}

.queue-label {
	font-weight: var(--type-weight-medium);
}

.queue-hint {
	color: var(--color-text-secondary);
	font-size: var(--type-size-caption);
}

/* Forms */

.field {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.field > label {
	margin: 0 0 var(--space-xs);
}

/* Every label line has the same height (a "?" beside a label doesn't push its field down), so fields in a row align. */
.field > label,
.field-label-row {
	min-height: 20px;
	line-height: 20px;
}

.field-required {
	color: var(--color-text-secondary);
	font-size: var(--type-size-caption);
}

.field-hint {
	margin: var(--space-xs) 0 0;
	color: var(--color-text-secondary);
	font-size: var(--type-size-caption);
}

.field-error {
	margin: var(--space-xs) 0 0;
	color: var(--color-status-danger);
	font-size: var(--type-size-caption);
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
	border-color: var(--color-status-danger);
	border-width: 2px;
}

/* Fields wrap and stretch so every row is full: a field left alone on a row takes the whole row, never one column
   of three. Several .form-grid blocks in one section are rows that always start on a new line. A row of short
   fields (.form-grid-compact: country, currency, time zone, language) fits four across. */
.form-grid {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-md) var(--space-lg);
}

.form-grid > * {
	flex: 1 1 170px;
	min-width: 0;
}

/* A field that holds a name (the customer) takes two shares of the row. */
.form-grid > .field-wide {
	flex: 2 1 320px;
}

.form-grid-compact > * {
	flex-basis: 140px;
}

.form-grid + .form-grid {
	margin-top: var(--space-md);
}

.form-grid .input-short {
	max-width: none;
}

.form-section {
	margin: 0 0 var(--space-lg);
	padding: 0;
	border: 0;
}

.form-section > legend {
	margin-bottom: var(--space-sm);
	padding: 0;
	font-weight: var(--type-weight-bold);
}

textarea {
	padding: var(--space-sm) var(--space-md);
	resize: vertical;
}

.input-amount {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.input-short {
	max-width: 10em;
}

.inline-label {
	display: inline;
	margin: 0;
	color: inherit;
}

input:disabled,
select:disabled,
textarea:disabled {
	background: var(--color-surface-subtle);
	color: var(--color-text-disabled);
}

/* Combobox (customer picker) */

.combo {
	position: relative;
}

.combo-list {
	position: absolute;
	z-index: 20;
	left: 0;
	right: 0;
	max-height: 280px;
	overflow-y: auto;
	margin: var(--space-xs) 0 0;
	padding: var(--space-xs) 0;
	list-style: none;
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
}

.combo-option {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: var(--space-sm);
	min-height: var(--control-h);
	align-items: center;
	padding: var(--space-xs) var(--space-md);
	cursor: pointer;
}

.combo-option[aria-selected="true"],
.combo-option:hover {
	background: var(--color-surface-subtle);
	outline: 2px solid var(--color-focus-ring);
	outline-offset: -2px;
}

.combo-option-meta {
	color: var(--color-text-secondary);
	font-size: var(--type-size-caption);
}

/* Searchable dropdowns (select-search.js): the real <select> stays underneath for its value and events; the search box
   looks like a select, with its arrow. */
.select-search {
	width: 100%;
}

.select-search-inline {
	flex: none;
	max-width: 100%;
}

.select-search-native {
	position: absolute;
	inset: 0;
	width: 100%;
	opacity: 0;
	pointer-events: none;
}

.select-search-input {
	width: 100%;
	padding-right: 2rem;
	background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
	background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
	background-size: 5px 5px, 5px 5px;
	background-repeat: no-repeat;
	text-overflow: ellipsis;
	cursor: pointer;
}

.select-search-input:focus {
	cursor: text;
}

.combo-empty {
	padding: var(--space-sm) var(--space-md);
	color: var(--color-text-secondary);
}

/* Dialog */

.dialog {
	width: min(560px, calc(100vw - 2 * var(--space-lg)));
	max-height: calc(100vh - 2 * var(--space-lg));
	padding: 0;
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
	background: var(--color-surface-panel);
	color: var(--color-text-primary);
}

.dialog[data-size="lg"] {
	width: min(880px, calc(100vw - 2 * var(--space-lg)));
}

.dialog[data-size="xl"] {
	width: min(1180px, calc(100vw - 2 * var(--space-lg)));
}

/* Supplier bill lines typed in by hand: inputs fill their cells. */
.bill-lines {
	width: 100%;
	border-collapse: collapse;
}

.bill-lines th {
	text-align: left;
	font-weight: 600;
	font-size: var(--type-size-caption);
	padding: 0 var(--space-xxs) var(--space-xxs);
}

.bill-lines td {
	padding: var(--space-xxs);
	vertical-align: top;
}

.bill-lines input,
.bill-lines select {
	width: 100%;
	min-width: 5rem;
}

.bill-lines {
	min-width: 980px;
}

.bill-lines td:nth-child(1) select {
	min-width: 9rem;
}

.bill-lines td:nth-child(2) input {
	min-width: 12rem;
}

.bill-lines td:nth-child(7) {
	min-width: 13rem;
}

.bill-lines .inline-create {
	flex-wrap: nowrap;
}

.bill-totals {
	text-align: right;
	font-weight: 600;
	margin: var(--space-xs) 0 0;
}

.dialog::backdrop {
	background: rgb(8 12 18 / 0.5); /* ::backdrop does not inherit custom properties everywhere */
}

.dialog-form {
	display: flex;
	flex-direction: column;
	max-height: calc(100vh - 2 * var(--space-lg));
}

.dialog-title {
	margin: 0;
	padding: var(--space-lg) var(--space-xl) var(--space-md);
	font-size: var(--type-size-title);
}

.dialog-body {
	display: flex;
	flex-direction: column;
	gap: var(--space-md);
	padding: 0 var(--space-xl) var(--space-lg);
	overflow-y: auto;
}

.dialog-message {
	margin: 0;
}

.dialog-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: var(--space-sm);
	padding: var(--space-md) var(--space-xl);
	border-top: 1px solid var(--color-border-default);
	background: var(--color-surface-subtle);
}

/* Settings › Payments: one card per gateway; cards stretch so a row is never left half empty. */
.gateway-cards {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-md);
	margin: 0;
	padding: 0;
	list-style: none;
}

.gateway-card {
	display: flex;
	flex: 1 1 220px;
	flex-direction: column;
	gap: var(--space-sm);
	padding: var(--space-md) var(--space-lg);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
	background: var(--color-surface-panel);
}

.gateway-card > p {
	flex: 1 1 auto;
	margin: 0;
	color: var(--color-text-secondary);
}

.gateway-card-title {
	margin: 0;
	font-size: var(--type-size-body);
}

/* Customer portal: Pay now form and the bank transfer box with its QR code. */
.portal-pay,
.portal-bank {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
	margin-top: var(--space-lg);
	padding-top: var(--space-lg);
	border-top: 1px solid var(--color-border-default);
}

.portal-bank h2 {
	margin: 0;
	font-size: var(--type-size-body);
}

.portal-bank p,
.portal-pay p {
	margin: 0;
}

/* Customer queries on the invoice view. */
.dispute-list {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
	margin: 0;
	padding: 0;
	list-style: none;
}

.dispute-item {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
	align-items: flex-start;
}

.dispute-item p {
	margin: 0;
}

.dispute-reason {
	margin: 0;
	padding: var(--space-xs) var(--space-sm);
	border-left: 3px solid var(--color-border-default);
	white-space: pre-wrap;
}

/* The customer's question about the invoice, as they wrote it. */
.portal-facts {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: var(--space-xs) var(--space-md);
	margin: var(--space-md) 0;
}

.portal-facts dt {
	color: var(--color-muted, inherit);
}

.portal-facts dd {
	margin: 0;
}

.portal-quote {
	margin: 0;
	padding: var(--space-xs) var(--space-sm);
	border-left: 3px solid var(--color-border-default);
	white-space: pre-wrap;
}

/* A conversation with the company's support desk about the invoice (D45). */
.portal-ticket {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
}

.portal-message {
	padding: var(--space-xs) var(--space-sm);
	border-left: 3px solid var(--color-border-default);
}

.portal-message[data-kind="staff"] {
	border-left-color: var(--color-brand-primary, var(--color-border-default));
}

.portal-message-meta,
.portal-message-body {
	margin: 0;
}

.portal-bank form {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
	align-items: flex-start;
}

.portal-bank textarea {
	width: 100%;
}

.portal-qr {
	display: block;
	width: 180px;
	height: 180px;
	image-rendering: pixelated;
}

/* A panel title with a small control on the same line (a filter), instead of a bar of its own. */
.panel-title-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm) var(--space-lg);
}

.inline-filter {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	margin: 0;
}

.inline-filter .field-label {
	margin: 0;
	white-space: nowrap;
}

.inline-filter select {
	width: auto;
	min-width: 14em;
}

.meta-list,
.confirm-summary {
	display: grid;
	grid-template-columns: minmax(8em, max-content) 1fr;
	gap: var(--space-xs) var(--space-lg);
	margin: 0;
}

.confirm-summary dt,
.meta-list dt {
	color: var(--color-text-secondary);
}

.confirm-summary dd,
.meta-list dd {
	margin: 0;
	min-width: 0;
	overflow-wrap: anywhere;
}

.confirm-summary dd {
	font-weight: var(--type-weight-bold);
}

/* Toasts */

.toast-region {
	position: fixed;
	z-index: 50;
	right: var(--space-lg);
	bottom: var(--space-lg);
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
	max-width: min(420px, calc(100vw - 2 * var(--space-lg)));
}

.toast-stack {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
}

.toast {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-md);
	padding: var(--space-xs) var(--space-xs) var(--space-xs) var(--space-lg);
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-left: 4px solid var(--color-status-success);
	border-radius: var(--radius-md);
}

.toast[data-tone="danger"] {
	border-left-color: var(--color-status-danger);
}

.toast[data-tone="warning"] {
	border-left-color: var(--color-status-warning);
}

.toast-close {
	flex: 0 0 auto;
	font-size: var(--type-size-caption);
}

/* Document editor and view */

.editor {
	display: flex;
	flex-direction: column;
	gap: var(--space-lg);
}

.editor-topbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-md);
}

.save-state-wrap {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-sm);
}

.save-state {
	margin: 0;
	padding: var(--space-xxs) var(--space-sm);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-sm);
	font-size: var(--type-size-caption);
	color: var(--color-text-secondary);
	background: var(--color-surface-panel);
}

.save-state[data-state="saved"] {
	color: var(--color-status-success);
}

.save-state[data-state="saving"] {
	color: var(--color-status-info);
}

.save-state[data-state="invalid"],
.save-state[data-state="unsaved"] {
	color: var(--color-status-warning);
}

.save-state[data-state="conflict"],
.save-state[data-state="error"] {
	color: var(--color-status-danger);
	border-color: var(--color-status-danger);
}

.save-state-actions {
	display: inline-flex;
	gap: var(--space-sm);
}

.editor-notices:empty,
.editor-errors:empty,
.issue-message:empty {
	display: none;
}

.editor-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
	gap: var(--space-lg);
	align-items: start;
}

.editor-main,
.editor-aside {
	display: flex;
	flex-direction: column;
	gap: var(--space-lg);
	min-width: 0;
}

.editor-aside {
	position: sticky;
	top: var(--space-lg);
}

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

.line-fieldset {
	margin: 0;
	padding: var(--space-md);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
}

.line-legend {
	padding: 0 var(--space-xs);
	font-size: var(--type-size-caption);
	font-weight: var(--type-weight-medium);
	color: var(--color-text-secondary);
}

.line-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
	gap: var(--space-sm) var(--space-md);
}

.line-costing {
	margin-top: 8px;
}

.line-costing-fields {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.line-costing-fields input {
	flex: 1 1 140px;
	min-width: 0;
}

.line-field-description {
	grid-column: 1 / -1;
}

/* One row per line (owner, F16): quantity, unit, unit price, VAT rate (wider), discount type, discount; the
   description above. Only narrow screens stack the fields. */
@media (min-width: 1000px) {
	.line-grid {
		grid-template-columns: minmax(64px, 0.7fr) minmax(84px, 1fr) minmax(84px, 1fr) minmax(140px, 2fr) minmax(104px, 1fr) minmax(80px, 1fr);
		gap: var(--space-sm) var(--space-sm);
	}
}

.line-description {
	min-height: var(--control-h);
}

.line-actions {
	display: flex;
	justify-content: flex-end;
	margin-top: var(--space-sm);
}

.totals-list {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: var(--space-xs) var(--space-md);
	margin: 0;
}

.totals-list dt {
	color: var(--color-text-secondary);
}

.totals-list dd {
	margin: 0;
}

.totals-list .totals-due {
	padding-top: var(--space-sm);
	border-top: 1px solid var(--color-border-default);
	color: var(--color-text-primary);
	font-weight: var(--type-weight-bold);
}

.totals-stale-note {
	display: none;
	margin: var(--space-sm) 0 0;
	color: var(--color-status-warning);
	font-size: var(--type-size-caption);
}

.totals-box.is-stale .totals-list {
	opacity: 0.55;
}

.totals-box.is-stale .totals-stale-note {
	display: block;
}

.preview-panel {
	margin-top: var(--space-md);
	padding: var(--space-md);
	border: 1px dashed var(--color-border-default);
	border-radius: var(--radius-md);
	background: var(--color-surface-subtle);
}

/* The estimate's lines and its note never touch (found by the browser tests). */
.preview-panel > .totals-list + .field-hint {
	margin-top: var(--space-sm);
}

.preview-label {
	margin: 0 0 var(--space-sm);
	font-size: var(--type-size-caption);
	font-weight: var(--type-weight-medium);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--color-text-secondary);
}

.issue-box,
.issue-message,
.readiness-box {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
}

.issue-message {
	margin-top: var(--space-md);
}

.panel > .field-hint:first-of-type {
	margin: 0 0 var(--space-md);
}

.allocation-total {
	margin: 0;
	font-weight: var(--type-weight-medium);
}

.allocation-total[data-tone="warning"] {
	color: var(--color-status-warning);
}

/* Tablet and narrower: one column, tables stack into labelled rows */

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

	.editor-aside {
		position: static;
	}
}

@media (max-width: 720px) {
	.app-main {
		padding: var(--space-lg);
	}
}

@media (max-width: 900px) {
	.data-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
	}

	.data-table,
	.data-table tbody,
	.data-table tr,
	.data-table th,
	.data-table td {
		display: block;
		width: 100%;
	}

	.data-table tr {
		padding: var(--space-sm) 0;
		border-bottom: 1px solid var(--color-border-default);
	}

	.data-table tbody th,
	.data-table td {
		display: grid;
		grid-template-columns: minmax(7em, 35%) 1fr;
		align-items: center;
		gap: var(--space-sm);
		border-bottom: 0;
		padding: var(--space-xs) var(--space-md);
		text-align: left;
	}

	.data-table td::before,
	.data-table tbody th::before {
		content: attr(data-label);
		color: var(--color-text-secondary);
		font-size: var(--type-size-caption);
		font-weight: var(--type-weight-regular);
	}

	.data-table .num {
		text-align: left;
	}
}

@media (max-width: 720px) {
	.confirm-summary,
	.meta-list {
		grid-template-columns: 1fr;
	}

	.confirm-summary dd,
	.meta-list dd {
		margin-bottom: var(--space-sm);
	}
}

@media (prefers-reduced-motion: reduce) {
	* {
		scroll-behavior: auto !important;
		transition: none !important;
		animation: none !important;
	}
}

.nowrap {
	white-space: nowrap;
}

/* Shell at tablet width: keep every column shrinkable so wide content scrolls inside its own box,
   and let the main area take the remaining height (header, horizontal nav, main). */

.page-app {
	grid-template-columns: 220px minmax(0, 1fr);
}

@media (max-width: 820px) {
	.page-app {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: auto auto 1fr;
	}

	.app-nav {
		min-width: 0;
		border-right: 0;
		border-bottom: 1px solid var(--color-border-default);
	}

	.app-nav ul {
		padding: var(--space-xs) var(--space-sm);
		gap: var(--space-xs);
	}

	.app-nav a {
		white-space: nowrap;
	}

	.app-header {
		flex-wrap: wrap;
	}

	.company-switcher {
		min-width: 0;
		flex: 1 1 200px;
	}
}

/* ===================================================================== Receipts, Autopilot, AI, practice,
   settings sections and public pages (UI round 2). Same rules: tokens only, derived sizes use calc()
   on tokens, no shadows. The counter uses the till touch size (--till-touch-min) for every target. */

.panel-header {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--space-md);
	margin-bottom: var(--space-md);
}

.panel-header .panel-title {
	margin: 0;
}

.panel-header select {
	width: auto;
	min-width: 12em;
}

.section-body,
.dialog-stack,
.column-stack {
	display: flex;
	flex-direction: column;
	gap: var(--space-md);
	min-width: 0;
}

/* The stack's gap is the spacing: titles and paragraphs add no margins of their own (no double gaps). */
.column-stack > :is(h2, h3, p, .panel-title) {
	margin-top: 0;
	margin-bottom: 0;
}

.dialog-stack > p {
	margin: 0;
}

.two-column {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
	gap: var(--space-lg);
	align-items: start;
}

.text-danger {
	color: var(--color-status-danger);
}

dd[data-tone="success"] {
	color: var(--color-status-success);
}

dd[data-tone="warning"],
span[data-tone="warning"] {
	color: var(--color-status-warning);
}

a.button-link-like {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--control-h);
	padding: 0 var(--space-lg);
	border-radius: var(--radius-md);
	text-decoration: none;
	font-weight: var(--type-weight-medium);
}

a.button-primary.button-link-like {
	color: var(--color-brand-on-primary);
	background: var(--color-brand-primary);
}

.check-row {
	display: flex;
	align-items: center;
	gap: var(--space-xs);
	margin: 0;
}

/* Who works on a client: the person, then their access level. */
.assign-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm);
	flex-wrap: wrap;
}

.assign-row select {
	width: auto;
	min-width: 12rem;
}

/* Working in a client company through a practice grant. */
.grant-banner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm);
	flex-wrap: wrap;
	margin: 0 0 var(--space-sm);
	padding: var(--space-xs) var(--space-sm);
	border-radius: var(--radius-md, 8px);
	background: var(--tint-info);
	border: 1px solid var(--color-status-info);
}

.grant-banner p {
	margin: 0;
}

/* Links wrap and stretch like form fields: a link left alone on the last row takes the whole row (no empty space). */
.link-list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-sm) var(--space-lg);
	margin: 0;
	padding: 0;
	list-style: none;
}

.link-list li {
	flex: 1 1 240px;
	min-width: 0;
	display: flex;
	flex-direction: column;
	padding: var(--space-sm) 0;
	border-top: 1px solid var(--color-border-default);
}

.link-list a {
	display: inline-flex;
	align-items: center;
	min-height: var(--control-h);
	font-weight: var(--type-weight-medium);
}

.link-list-meta {
	color: var(--color-text-secondary);
	font-size: var(--type-size-caption);
}

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

.scope-list code,
.code-display {
	font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* One-time enrolment code: large, spaced, selectable */

.code-display {
	margin: 0;
	padding: var(--space-lg);
	text-align: center;
	font-size: calc(var(--type-size-headline) * 1.4);
	font-weight: var(--type-weight-bold);
	letter-spacing: 0.12em;
	font-variant-numeric: tabular-nums;
	background: var(--color-surface-subtle);
	border: 1px dashed var(--color-border-default);
	border-radius: var(--radius-md);
	user-select: all;
}

/* Till reports */

.till-report {
	display: flex;
	flex-direction: column;
	gap: var(--space-md);
}

.till-report-title {
	margin: 0;
	font-weight: var(--type-weight-bold);
}

.till-report .section-title {
	margin: var(--space-sm) 0 0;
}

/* Web till (counter) */

.counter-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
	gap: var(--space-lg);
	align-items: start;
}

.counter-main,
.counter-aside {
	display: flex;
	flex-direction: column;
	gap: var(--space-lg);
	min-width: 0;
}

.counter-aside {
	position: sticky;
	top: var(--space-lg);
}

.tile-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: var(--space-sm);
	margin: var(--space-md) 0 0;
	padding: 0;
	list-style: none;
}

.tile-grid > li {
	display: flex;
}

.tile {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--space-xs);
	min-height: calc(var(--till-touch-min) * 1.5);
	padding: var(--space-sm) var(--space-md);
	text-align: left;
	color: var(--color-text-primary);
	text-decoration: none;
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
}

.tile:hover {
	border-color: var(--color-brand-primary);
}

.tile:active {
	background: var(--color-surface-subtle);
}

.tile-title {
	font-weight: var(--type-weight-medium);
	overflow-wrap: anywhere;
}

.tile-meta {
	color: var(--color-text-secondary);
	font-size: var(--type-size-caption);
}

.counter-line-form .row-actions {
	margin-top: var(--space-md);
}

.basket-list {
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 0;
	list-style: none;
}

.basket-line {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-areas:
		"name amount"
		"qty remove";
	align-items: center;
	gap: var(--space-xs) var(--space-sm);
	padding: var(--space-sm) 0;
	border-bottom: 1px solid var(--color-border-default);
}

.basket-name {
	grid-area: name;
	overflow-wrap: anywhere;
}

.basket-amount {
	grid-area: amount;
	font-weight: var(--type-weight-medium);
}

.basket-qty {
	grid-area: qty;
	display: inline-flex;
	align-items: center;
	gap: var(--space-sm);
}

.basket-qty .num {
	min-width: 3ch;
	text-align: center;
}

.basket-line .button-link {
	grid-area: remove;
	justify-self: end;
}

.button-icon {
	min-width: var(--till-touch-min);
	min-height: var(--till-touch-min);
	padding: 0;
	font-size: var(--type-size-title);
	font-weight: var(--type-weight-bold);
}

.counter-total-box {
	margin: var(--space-md) 0;
	padding: var(--space-md) var(--space-lg);
	border-radius: var(--radius-md);
	background: var(--color-surface-subtle);
}

.counter-total-box > p {
	margin: 0;
}

.counter-total {
	font-size: calc(var(--type-size-headline) * 1.6);
	font-weight: var(--type-weight-bold);
	line-height: 1.1;
	text-align: left;
}

.counter-change {
	margin: var(--space-xs) 0 var(--space-md);
	min-height: 1.45em;
	font-weight: var(--type-weight-medium);
}

.button-till {
	width: 100%;
	min-height: var(--till-touch-min);
	margin-top: var(--space-md);
	font-size: var(--type-size-body-large);
}

.segmented {
	position: relative;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
	overflow: hidden;
}

.segmented-input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.segmented-option {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: var(--till-touch-min);
	margin: 0;
	color: var(--color-text-primary);
	background: var(--color-surface-panel);
	cursor: pointer;
}

.segmented-option + .segmented-input + .segmented-option,
.segmented-input + .segmented-option ~ .segmented-option {
	border-left: 1px solid var(--color-border-default);
}

.segmented-input:checked + .segmented-option {
	color: var(--color-brand-on-primary);
	background: var(--color-brand-primary);
	font-weight: var(--type-weight-medium);
}

.segmented-input:focus-visible + .segmented-option {
	outline: 2px solid var(--color-focus-ring);
	outline-offset: -4px;
}

.receipt-card:focus {
	outline: 2px solid var(--color-focus-ring);
	outline-offset: 2px;
}

.segmented.segmented-2 {
	grid-template-columns: repeat(2, 1fr);
}

/* Split payment: first amount, second method and second amount on one row where they fit. */
.counter-split {
	grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
	margin-top: var(--space-sm);
}

.counter-aside > .panel .row-actions .button-quiet,
.receipt-card .row-actions button,
.recent-receipt-actions .button-quiet {
	min-height: var(--till-touch-min);
}

.recent-receipts {
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 0;
	list-style: none;
}

.recent-receipt {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-areas:
		"number amount"
		"time time"
		"actions actions";
	gap: var(--space-xs) var(--space-sm);
	padding: var(--space-sm) 0;
	border-bottom: 1px solid var(--color-border-default);
}

.recent-receipt:last-child {
	border-bottom: 0;
}

.recent-receipt-number {
	grid-area: number;
	font-weight: var(--type-weight-medium);
	overflow-wrap: anywhere;
}

.recent-receipt-amount {
	grid-area: amount;
}

.recent-receipt-time {
	grid-area: time;
	font-size: var(--type-size-caption);
}

.recent-receipt-actions {
	grid-area: actions;
}

/* No change to give yet: no empty line under the payment fields. */
.counter-change:empty {
	display: none;
}

.recent-receipt-actions:empty {
	display: none;
}

.refund-lines td .field {
	margin: 0;
}

.refund-lines .input-amount {
	max-width: 7rem;
	margin-left: auto;
}

.refund-total {
	margin: var(--space-sm) 0 var(--space-md);
	font-weight: var(--type-weight-medium);
}

/* AI */

.answer-box {
	margin-top: var(--space-md);
	padding: var(--space-md) var(--space-lg);
	border-left: 4px solid var(--color-status-info);
	background: var(--color-surface-subtle);
	border-radius: var(--radius-md);
}

.answer-text {
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.proposal-content {
	padding: var(--space-md);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
	background: var(--color-surface-subtle);
}

.policy-form,
.assistant-form,
.stage-form {
	display: flex;
	flex-direction: column;
	gap: var(--space-md);
}

.policy-form .form-section,
.stage-form .form-section {
	margin: 0;
}

/* Reminder stages */

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

/* Public pages (sign-up, email confirmation): no shell, one calm panel */

.page-public {
	min-height: 100vh;
	padding: var(--space-xl) var(--space-lg);
}

.public-panel {
	width: min(100%, 860px);
	margin: 0 auto;
	padding: var(--space-xxl);
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
}

.public-panel-narrow {
	width: min(100%, 480px);
	margin-top: 10vh;
}

.public-panel h1 {
	margin-bottom: var(--space-sm);
}

.public-panel .page-description {
	margin-bottom: var(--space-xl);
}

.public-panel form > .button-primary {
	margin-top: var(--space-md);
	min-width: 12em;
}

.public-lang,
.public-footer a {
	display: inline-flex;
	align-items: center;
	min-height: var(--touch-min);
}

.public-footer {
	margin: var(--space-xl) 0 0;
	padding-top: var(--space-md);
	border-top: 1px solid var(--color-border-default);
	color: var(--color-text-secondary);
}

#signup-done:focus,
#signup-summary:focus,
[data-verify]:focus {
	outline: 2px solid var(--color-focus-ring);
	outline-offset: 2px;
}

@media (max-width: 900px) {
	/* Stacked table cells are grids: keep chips and single controls at their natural width. */
	.data-table td > .chip,
	.data-table td > button,
	.data-table td > code {
		justify-self: start;
	}
}

@media (max-width: 1100px) {
	.counter-layout,
	.two-column {
		grid-template-columns: minmax(0, 1fr);
	}

	.counter-aside {
		position: static;
	}
}

@media (max-width: 720px) {
	.public-panel {
		padding: var(--space-lg);
	}

	.public-brand img {
		height: 44px;
	}
}

/* Two-step verification: setup key and recovery codes (login page and Settings › Two-step verification). */
.mfa-panel {
	display: grid;
	gap: var(--space-sm);
}

code.secret {
	font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
	letter-spacing: 0.08em;
	padding: var(--space-xs) var(--space-sm);
	background: var(--color-surface-subtle);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
	word-break: break-all;
}

.recovery-codes {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--space-xs) var(--space-lg);
	padding-inline-start: var(--space-lg);
	font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* In-app help (DOCS/help): Help button, (?) tooltips, the side panel and the help screen. */
.help-button {
	display: inline-flex;
	align-items: center;
	gap: var(--space-sm);
}

.help-button-icon {
	display: inline-grid;
	place-items: center;
	width: 20px;
	height: 20px;
	border: 1.5px solid currentColor;
	border-radius: 50%;
	font-size: var(--type-size-caption);
	font-weight: var(--type-weight-bold);
	line-height: 1;
}

.field-label-row,
.title-with-tip {
	display: flex;
	align-items: center;
	gap: var(--space-xs);
	min-width: 0;
}

.field-label-row {
	margin: 0 0 var(--space-xs);
}

.field-label-row > label {
	margin: 0;
}

.title-with-tip {
	margin: 0 0 var(--space-md);
}

.title-with-tip > h2,
.title-with-tip > h3 {
	margin: 0;
}

.with-tip {
	display: inline-flex;
	align-items: center;
	gap: var(--space-xs);
}

legend .with-tip {
	vertical-align: middle;
}

.help-tip-wrap {
	display: inline-flex;
	flex: none;
}

.help-tip {
	position: relative;
	display: inline-grid;
	place-items: center;
	width: 20px;
	height: 20px;
	min-height: 0;
	padding: 0;
	border: 1px solid var(--color-border-default);
	border-radius: 50%;
	background: var(--color-surface-subtle);
	color: var(--color-text-secondary);
	font-size: var(--type-size-caption);
	font-weight: var(--type-weight-bold);
	line-height: 1;
	cursor: help;
}

/* A 44 px touch target around the small circle, without taking layout space. */
.help-tip::before {
	content: "";
	position: absolute;
	inset: -12px;
}

.help-tip:hover,
.help-tip[aria-expanded="true"] {
	border-color: var(--color-brand-primary);
	color: var(--color-brand-primary);
}

.help-tip-bubble {
	position: fixed;
	z-index: 1000;
	max-width: 288px;
	padding: var(--space-sm) var(--space-md);
	border-radius: var(--radius-md);
	background: var(--color-text-primary);
	color: var(--color-surface-panel);
	font-size: var(--type-size-caption);
	font-weight: var(--type-weight-regular);
	line-height: var(--type-line-height-body);
	text-align: start;
	text-transform: none;
	white-space: normal;
	box-shadow: 0 4px 16px rgb(8 12 18 / 0.25);
}

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

.help-panel {
	width: min(460px, 100vw);
	max-width: 100vw;
	height: 100vh;
	max-height: 100vh;
	margin: 0 0 0 auto;
	padding: 0;
	border: 0;
	border-left: 1px solid var(--color-border-default);
	background: var(--color-surface-panel);
	color: var(--color-text-primary);
}

.help-panel[open] {
	display: flex;
	flex-direction: column;
}

.help-panel::backdrop {
	background: rgb(8 12 18 / 0.5); /* ::backdrop does not inherit custom properties everywhere */
}

.help-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-md);
	padding: var(--space-md) var(--space-md) var(--space-md) var(--space-xl);
	border-bottom: 1px solid var(--color-border-default);
}

.help-panel-title {
	margin: 0;
	font-size: var(--type-size-title);
}

.help-panel-close {
	flex: none;
	width: var(--touch-min);
	padding: 0;
	font-size: var(--type-size-headline);
	line-height: 1;
}

.help-panel-body {
	flex: 1;
	overflow-y: auto;
	padding: var(--space-lg) var(--space-xl);
}

.help-panel-footer {
	display: flex;
	padding: var(--space-md) var(--space-xl);
	border-top: 1px solid var(--color-border-default);
}

.help-panel-full {
	display: inline-flex;
	align-items: center;
	flex: 1;
	justify-content: center;
	text-decoration: none;
}

.help-content {
	line-height: var(--type-line-height-body);
	overflow-wrap: anywhere;
}

.help-content > :first-child {
	margin-top: 0;
}

.help-content h2 {
	margin: var(--space-xl) 0 var(--space-sm);
	font-size: var(--type-size-title);
	scroll-margin-top: var(--space-lg);
}

.help-content h3,
.help-content h4 {
	margin: var(--space-lg) 0 var(--space-sm);
	font-size: var(--type-size-body-large);
	scroll-margin-top: var(--space-lg);
}

.help-content p,
.help-content ul,
.help-content ol {
	margin: 0 0 var(--space-md);
}

.help-content ul,
.help-content ol {
	padding-inline-start: var(--space-xl);
}

.help-content li + li {
	margin-top: var(--space-xs);
}

.help-content li > ul,
.help-content li > ol {
	margin: var(--space-xs) 0 0;
}

.help-content blockquote {
	margin: 0 0 var(--space-md);
	padding: var(--space-md) var(--space-lg);
	border-left: 3px solid var(--color-status-info);
	border-radius: var(--radius-md);
	background: var(--color-surface-subtle);
}

.help-content blockquote > :last-child {
	margin-bottom: 0;
}

.help-content code {
	padding: 0 var(--space-xs);
	border-radius: var(--radius-sm);
	background: var(--color-surface-subtle);
	font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
	font-size: 0.92em;
}

.help-content hr {
	margin: var(--space-xl) 0;
	border: 0;
	border-top: 1px solid var(--color-border-default);
}

.help-table {
	margin: 0 0 var(--space-md);
	overflow-x: auto;
}

.help-table table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--type-size-body);
}

.help-table th,
.help-table td {
	padding: var(--space-sm) var(--space-md);
	border-bottom: 1px solid var(--color-border-default);
	text-align: start;
	vertical-align: top;
}

.help-table th {
	color: var(--color-text-secondary);
	font-weight: var(--type-weight-medium);
	background: var(--color-surface-subtle);
}

.screen-help .page-actions a {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
}

.help-layout {
	display: grid;
	grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
	gap: var(--space-xl);
	align-items: start;
}

.help-layout-single {
	grid-template-columns: minmax(0, 1fr);
}

.help-toc {
	position: sticky;
	top: var(--space-lg);
}

.help-toc-title {
	margin: 0 0 var(--space-sm);
	font-size: var(--type-size-body-large);
}

.help-toc ol {
	margin: 0;
	padding-inline-start: var(--space-lg);
	line-height: var(--type-line-height-body);
}

.help-toc li + li {
	margin-top: var(--space-xs);
}

.help-article {
	padding: var(--space-xl);
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
	min-width: 0;
}

.queue-card.help-card {
	min-height: 0;
}

.help-card-more {
	margin: var(--space-sm) 0 0;
}

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

	.help-toc {
		position: static;
	}

	.help-article {
		padding: var(--space-lg);
	}
}

@media (max-width: 720px) {
	.help-table td[data-label] {
		min-width: 8rem;
	}
}

/* "Check in VIES" next to a VAT number (components/vat-check.js) */
.vat-check {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
	margin-top: var(--space-xs);
}

.vat-check-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-sm);
}

.vat-check-result:empty {
	display: none;
}

.vat-check-result p {
	margin: 0;
}

.vat-check-trader {
	white-space: pre-line;
	font-weight: 600;
}

.button-quiet.button-small {
	padding: 0.25rem 0.625rem;
	font-size: 0.8125rem;
	min-height: 0;
}

/* While a VIES result shows, the VAT number field takes the whole row (no empty space beside a tall result). */
.form-grid > .field:has(.vat-check-result:not(:empty)) {
	flex-basis: 100%;
}

/* "+ New …" beside a field that needs set-up data (components/inline-create.js) */
.inline-create {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-xs) var(--space-sm);
}

/* The list takes the field's width; inside a field, "+ New …" is a small link at the right end of the label line
   (owner, 23 October 2026: compact), so every field in a row keeps the same height and lines up. */
.inline-create > select,
.inline-create > input,
.inline-create > .combo {
	flex: 1 1 9em;
	min-width: 9em;
}

.inline-create-button {
	flex: 0 0 auto;
	white-space: nowrap;
}

.field .inline-create {
	position: relative;
}

.field .inline-create > .inline-create-button {
	position: absolute;
	right: 0;
	bottom: calc(100% + var(--space-xs));
	min-height: 0;
	height: 20px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--color-brand-primary);
	font-size: var(--type-size-caption);
	font-weight: var(--type-weight-medium);
	line-height: 20px;
}

.field .inline-create > .inline-create-button:hover,
.field .inline-create > .inline-create-button:focus-visible {
	text-decoration: underline;
}

/* The label leaves room for the link. */
.field:has(.inline-create-button) > label,
.field:has(.inline-create-button) > .field-label-row {
	padding-right: 6em;
}

/* Invoice preview (PDF) on top of the editor */
.dialog[data-size="lg"]:has(.pdf-preview) {
	width: min(1100px, calc(100vw - 2 * var(--space-lg)));
}

.pdf-preview {
	display: block;
	width: 100%;
	height: min(78vh, 1100px);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
	background: #fff;
}

/* A list among the page's header actions ("New quote or other…") is as wide as its text, like the buttons. */
.page-actions select {
	width: auto;
	max-width: 100%;
}

/* Notes keep the person's line breaks. */
.pre-line {
	white-space: pre-line;
}

/* A warning under a field or in a confirmation: allowed, but worth a second look (owner: warn, don't block). */
.field-warning {
	margin: var(--space-xs) 0 0;
	color: var(--color-status-warning);
	font-size: var(--type-size-caption);
	font-weight: var(--type-weight-medium);
}

/* Company logo (Settings › Company profile): the preview beside its controls. */
.logo-row {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-lg);
	align-items: flex-start;
}

.logo-preview {
	flex: 0 0 auto;
	display: grid;
	place-items: center;
	min-width: 200px;
	min-height: 70px;
	padding: var(--space-sm);
	border: 1px dashed var(--color-border-default);
	border-radius: var(--radius-md);
	background: var(--color-surface-panel);
}

.logo-preview img {
	max-width: 300px;
	max-height: 100px;
}

.logo-actions {
	flex: 1 1 260px;
	display: grid;
	gap: var(--space-sm);
	justify-items: start;
}


/* Accounting export (Reports): the account codes fold away; what, format and the button on one row. */
.export-mapping {
	margin: var(--space-md) 0;
}

.export-mapping > summary {
	cursor: pointer;
	font-weight: var(--type-weight-medium);
	margin-bottom: var(--space-sm);
}

/* The client's package codes: VAT codes per rate, sales and purchases side by side. */
.export-codes {
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md, 8px);
	padding: var(--space-sm) var(--space-md);
	margin: 0;
	display: grid;
	gap: var(--space-xs);
}

.export-codes > .field {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 7rem;
	align-items: center;
	gap: 0 var(--space-sm);
}

.export-codes > .field > .field-error {
	grid-column: 1 / -1;
}

.export-codes > legend {
	font-weight: var(--type-weight-medium);
	padding: 0 var(--space-xxs);
}

.export-create {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: var(--space-md) var(--space-lg);
	margin: var(--space-md) 0;
}

.export-create .checkbox-row {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-md);
	margin: 0;
	padding: 0;
	border: 0;
}

/* Customer portal (review C13): the brand on top, the seller's details and a readable statement. */
.page-portal {
	flex-direction: column;
	gap: var(--space-lg);
}

.portal-panel {
	width: min(100%, 640px);
}

.portal-title {
	margin: 0 0 var(--space-md);
	color: var(--color-text-secondary);
}

.portal-facts {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: var(--space-xs) var(--space-lg);
	margin: 0 0 var(--space-lg);
}

.portal-facts dd {
	margin: 0;
}

.portal-table {
	width: 100%;
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
}

.portal-table th,
.portal-table td {
	padding: var(--space-xs) var(--space-sm);
	border-bottom: 1px solid var(--color-border-default);
	text-align: left;
}

.portal-table .num {
	text-align: right;
	white-space: nowrap;
}

.portal-table tfoot th,
.portal-table tfoot td {
	border-bottom: 0;
	padding-top: var(--space-sm);
}

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

/* Integrations: a webhook address wraps inside its cell; the event groups sit side by side without a bottom gap. */
.url-text {
	overflow-wrap: anywhere;
}

.webhook-events > .form-section {
	margin-bottom: 0;
}

/* Support desk (D45): views with counts, the conversation, unread and late tickets. */
.support-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-sm);
	align-items: center;
	justify-content: space-between;
}

.support-views {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-xs);
}

.support-view {
	display: inline-flex;
	gap: var(--space-xs);
	align-items: center;
	padding: var(--space-xs) var(--space-sm);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
	color: var(--color-text-primary);
	text-decoration: none;
}

.support-view[aria-current="page"] {
	color: var(--color-brand-on-primary);
	background: var(--color-brand-primary);
	border-color: var(--color-brand-primary);
}

.support-count {
	font-weight: var(--type-weight-medium);
}

.support-unread {
	font-weight: var(--type-weight-bold);
}

.support-breach {
	color: var(--color-status-danger);
}

.support-message {
	padding: var(--space-sm);
	border-left: 3px solid var(--color-border-default);
	background: var(--color-surface-panel);
}

.support-message[data-kind="staff"] {
	border-left-color: var(--color-brand-primary);
}

.support-message[data-kind="note"] {
	border-left-color: var(--color-status-warning);
	background: var(--color-surface-subtle);
}

.support-message-meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-xs);
	align-items: center;
	margin: 0 0 var(--space-sm);
}

.support-message-body {
	margin: 0;
	white-space: pre-wrap;
}

/* Files kept with a message (quick wins) */
.support-message-files {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-xs) var(--space-md);
	margin: var(--space-sm) 0 0;
	padding: 0;
	list-style: none;
}

/* Click to take a value: the bill's page with its words as buttons, beside the main fields. */
.take-layout {
	display: grid;
	grid-template-columns: minmax(0, 3fr) minmax(14rem, 1fr);
	gap: var(--space-md);
	align-items: start;
}

@media (max-width: 900px) {
	.take-layout {
		grid-template-columns: 1fr;
	}
}

.page-view {
	position: relative;
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md, 8px);
	overflow: hidden;
	background: #fff;
}

.page-view img {
	display: block;
	width: 100%;
	height: auto;
}

/* The uploaded file when nothing was read from it: a page-tall view to type the bill from. */
.page-original {
	display: block;
	width: 100%;
	height: min(80vh, 1100px);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md, 8px);
	background: #fff;
	object-fit: contain;
}

.page-word {
	position: absolute;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}

.page-word:hover,
.page-word:focus-visible {
	background: color-mix(in srgb, #f5c400 40%, transparent);
	outline: 1px solid #c79a00;
}

/* The text the reader saw: scrollable, as the file gives it (columns kept). */
.reading-text {
	margin: 0 0 var(--space-sm);
}

.reading-text > summary {
	cursor: pointer;
	font-size: var(--type-size-caption);
}

.reading-text pre {
	max-height: 24rem;
	overflow: auto;
	padding: var(--space-sm);
	background: var(--color-surface-subtle);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-sm, 6px);
	font-size: 0.75rem;
	line-height: 1.35;
	white-space: pre;
}

/* Where each value came from (blue); the field you are on (amber); words being dragged across. */
.page-word[data-taken] {
	outline: 1px solid #2f6db3;
	background: color-mix(in srgb, #2f6db3 12%, transparent);
}

.page-word[data-current],
.page-word[data-picking] {
	outline: 2px solid #c79a00;
	background: color-mix(in srgb, #f5c400 35%, transparent);
}

.page-view {
	user-select: none;
	touch-action: pinch-zoom;
}

.take-form .field-hint[data-tone='success'] {
	color: var(--color-status-success);
}

.take-form .field-hint[data-tone='danger'] {
	color: var(--color-status-danger);
	font-weight: 600;
}

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

.take-field {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: var(--space-xxs);
	border-radius: var(--radius-sm, 6px);
}

.take-field[data-active] {
	background: color-mix(in srgb, #f5c400 18%, transparent);
	outline: 2px solid #c79a00;
}

/* ------------------------------------------------------------------------------------------------------------------
   UI polish (owner, 25 October 2026): normal-size checkboxes, buttons that never touch borders or each other, and some
   colour. Later rules here deliberately override the base rules above.
   ------------------------------------------------------------------------------------------------------------------ */

/* Checkboxes and radios: one size everywhere (the generic field rule made them 34px, or a whole cell wide). */
input[type="checkbox"],
input[type="radio"]:not(.segmented-input) {
	flex: none;
	width: 18px;
	height: 18px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	vertical-align: middle;
	accent-color: var(--color-brand-primary);
	cursor: pointer;
}

input[type="checkbox"]:disabled {
	cursor: not-allowed;
}

@media (pointer: coarse) {
	input[type="checkbox"],
	input[type="radio"]:not(.segmented-input) {
		width: 22px;
		height: 22px;
	}
}

/* The row, not the box, is the target; a box lines up with a field in the same row. */
.check-row {
	gap: var(--space-sm);
	min-height: var(--control-h);
}

/* A list of check boxes one under the other: the rows never touch (found by the browser tests, P5). */
.check-row + .check-row {
	margin-top: var(--space-sm);
}

.checkbox-label,
label.check,
label:has(> input[type="checkbox"]) {
	display: inline-flex;
	align-items: center;
	gap: var(--space-sm);
	margin: 0;
	color: inherit;
	cursor: pointer;
}

.data-table .col-select {
	width: 1%;
	padding-inline: var(--space-md) var(--space-xs);
}

.data-table .col-select > input {
	display: block;
}

.data-table tbody tr:has(input[type="checkbox"]:checked) > * {
	background: var(--color-brand-tint);
}

/* Panels: what is stacked inside keeps apart, and a row of buttons never sits on the content above it. */
.panel:not(.column-stack) > * + * {
	margin-top: var(--space-md);
}

.panel > .row-actions:last-child {
	margin-top: var(--space-lg);
}

/* Bars and banners with buttons inside: room around the buttons. */
.bulk-bar,
.grant-banner {
	padding: var(--space-sm) var(--space-md);
}

.toast {
	padding: var(--space-sm) var(--space-sm) var(--space-sm) var(--space-lg);
}

/* A button alone in a column keeps its own width instead of spanning the column. */
:is(.dialog-body, .column-stack, .take-form, .section-body) > :is(button, a[class*="button-"]) {
	align-self: flex-start;
}

/* Links drawn as buttons: centred, no underline, the same height as buttons. */
a:is(.button-primary, .button-quiet, .button-danger) {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--control-h);
	padding: 0 var(--space-md);
	border-radius: var(--radius-md);
	text-decoration: none;
}

/* Small buttons line up with fields beside them. */
.button-small,
.button-quiet.button-small {
	min-height: calc(var(--control-h) - 6px);
	padding: 0 var(--space-sm);
	font-size: var(--type-size-caption);
}

/* Bill lines: the wide table scrolls on its own, and its fields don't touch. */
.table-scroll {
	overflow-x: auto;
}

.bill-lines td {
	padding: var(--space-xs) var(--space-sm) var(--space-xs) 0;
	vertical-align: middle;
}

.save-state-actions {
	flex-wrap: wrap;
}

.take-field {
	margin: 0;
	color: inherit;
}

.meta-list dd.num {
	text-align: left;
}

/* Compact rows with a mouse; touch keeps the tall link target. */
@media (pointer: fine) {
	.data-table a {
		min-height: 0;
	}
}

button:disabled {
	cursor: not-allowed;
}

/* Colour: the shell. */
.app-header {
	border-top: 3px solid var(--color-brand-primary);
}

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

.app-nav a[aria-current] {
	padding-left: calc(var(--space-md) - 3px);
	border-left: 3px solid var(--color-brand-primary);
	background: var(--color-brand-tint);
	color: var(--color-brand-primary);
}

/* Colour: tables. */
.data-table thead th {
	background: var(--color-brand-tint);
	color: var(--color-brand-primary);
}

.data-table tbody tr:hover > * {
	background: var(--color-row-hover);
}

/* Colour: headings, page headers, dialogs. */
.page-header {
	padding-bottom: var(--space-md);
	border-bottom: 2px solid var(--color-brand-tint-strong);
}

.panel-title,
.section-title {
	color: var(--color-brand-primary);
}

.dialog {
	border-top: 3px solid var(--color-brand-primary);
}

/* Colour: buttons answer the pointer. */
.button-primary:hover:not(:disabled) {
	background: var(--color-brand-hover);
}

.button-quiet:hover:not(:disabled) {
	border-color: var(--color-brand-primary);
	background: var(--color-brand-tint);
}

.button-danger:hover:not(:disabled) {
	background: var(--tint-danger);
}

/* Colour: notices and chips by tone. */
.notice[data-tone="info"] {
	background: var(--tint-info);
}

.notice[data-tone="success"] {
	background: var(--tint-success);
}

.notice[data-tone="warning"] {
	background: var(--tint-warning);
}

.notice[data-tone="danger"] {
	background: var(--tint-danger);
}

.chip[data-tone="info"] {
	background: var(--tint-info);
}

.bulk-bar {
	background: var(--color-brand-tint);
	border-color: var(--color-brand-tint-strong);
}

/* Colour: dashboard tiles. */
.queue-card[data-tone="danger"] {
	background: var(--tint-danger);
}

.queue-card[data-tone="danger"] .queue-count {
	color: var(--color-status-danger);
}

.queue-card[data-tone="warning"] .queue-count {
	color: var(--color-status-warning);
}

.queue-card[data-tone="info"] .queue-count {
	color: var(--color-status-info);
}

.queue-card[data-tone="neutral"] .queue-count {
	color: var(--color-brand-primary);
}

/* Dark mode: backdrops dark in both modes, and text that stays readable on its badge. */
.demo-badge {
	color: var(--color-brand-on-primary);
}

/* The bill panel without a page picture: a one-line note, and the fields across the whole width. */
.take-layout.take-layout-fields {
	grid-template-columns: 1fr;
}

/* A file that was split: its pages alone, across the whole width. */
.take-layout.take-layout-pages {
	grid-template-columns: 1fr;
}

.take-layout-fields .take-form {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
	gap: var(--space-sm) var(--space-md);
	align-items: end;
}

.take-layout-fields .take-form > :is(p, button) {
	grid-column: 1 / -1;
}

.take-layout-fields .take-form > button {
	justify-self: start;
}

/* The words on a bill's page are buttons, but exactly the size of the word (not a control's minimum height). */
.page-word {
	min-height: 0;
	border-radius: 2px;
}

/* Table cells that stay on one line (dates, action buttons). */
.data-table .nowrap,
.data-table td > button {
	white-space: nowrap;
}

/* Accounting: P&L and balance sheet as two columns of account lists with totals; a total row in the trial balance. */
.books-columns {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
	gap: var(--space-lg);
	margin-top: var(--space-md);
}

.books-section + .books-section {
	margin-top: var(--space-lg);
}

.books-list {
	display: grid;
	grid-template-columns: minmax(0, 1fr) max-content;
	gap: var(--space-xs) var(--space-lg);
	margin: 0;
}

.books-list dd {
	margin: 0;
	font-variant-numeric: tabular-nums;
}

.books-list .books-total {
	padding-top: var(--space-xs);
	border-top: 1px solid var(--color-border-default);
	font-weight: var(--type-weight-bold);
}

.books-result {
	margin-top: var(--space-lg);
	font-size: var(--type-size-title);
	font-weight: var(--type-weight-bold);
}

.books-result[data-tone='success'],
.field-hint[data-tone='success'] {
	color: var(--color-status-success);
}

.books-result[data-tone='danger'],
.field-hint[data-tone='danger'] {
	color: var(--color-status-danger);
}

.data-table .totals-row > * {
	font-weight: var(--type-weight-bold);
	background: var(--color-surface-subtle);
}

.journal-lines td:first-child {
	min-width: 16rem;
}


/* Payroll (D55): the run's and the preview's figures, short lists of items, loans and leave, net to gross. */
.payroll-figures {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: var(--space-sm);
	margin: var(--space-sm) 0 var(--space-md);
}

.payroll-figure {
	padding: var(--space-sm) var(--space-md);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
	background: var(--color-brand-tint);
}

.payroll-figure dt {
	color: var(--color-text-secondary);
	font-size: var(--type-size-caption);
}

.payroll-figure dd {
	margin: var(--space-xxs) 0 0;
	font-size: var(--type-size-title);
	font-weight: var(--type-weight-bold);
}

.payroll-figure[data-tone='success'] {
	border-color: var(--color-status-success);
}

.payroll-figure[data-tone='success'] dd {
	color: var(--color-status-success);
}

.payroll-preview:empty {
	display: none;
}

.payroll-net-to-gross {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: var(--space-sm) var(--space-md);
	margin-top: var(--space-md);
	padding: var(--space-sm) var(--space-md);
	border: 1px dashed var(--color-border-default);
	border-radius: var(--radius-md);
}

.payroll-net-to-gross .button-quiet {
	margin-bottom: var(--space-lg);
}

.payroll-net-to-gross .field {
	margin: 0;
}

.payroll-list > li {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-sm);
	padding: var(--space-xs) 0;
	border-bottom: 1px solid var(--color-border-default);
}

.payroll-employee-form .form-section + .form-section {
	margin-top: var(--space-md);
}

/* Payroll forms: even columns, so the last field of a row never stretches across it. */
.form-grid.payroll-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.form-grid-compact.payroll-grid {
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.payroll-employee-form ~ .books-section {
	margin-top: var(--space-xl);
	padding-top: var(--space-lg);
	border-top: 1px solid var(--color-border-default);
}

/* Payroll: room around the action rows, so buttons never touch the boxes above and below. */
.screen-payroll .row-actions {
	margin: var(--space-md) 0;
}

.screen-payroll .row-actions + .field-hint {
	margin-bottom: var(--space-md);
}

.payroll-slip-items {
	min-width: 14rem;
}

.payroll-slip-items > li {
	display: flex;
	justify-content: space-between;
	gap: var(--space-md);
	white-space: nowrap;
}

.screen-payroll .filter-bar + .books-section {
	margin-top: var(--space-lg);
}

/* Payroll forms (owner, 26 October 2026: "align and use a better styling"). Fields in a row share their label, input
   and hint lines (subgrid), so a label that wraps to two lines never pushes its input below its neighbours'. */
.form-grid.payroll-grid {
	row-gap: 0;
	align-items: start;
}

.form-grid.payroll-grid > .field {
	display: grid;
	grid-row: span 4;
	grid-template-rows: subgrid;
	row-gap: 0;
	padding-bottom: var(--space-md);
}

.form-grid.payroll-grid > .field > label,
.form-grid.payroll-grid > .field > .field-label-row {
	align-self: end;
}

.form-grid.payroll-grid > .field[hidden] {
	display: none;
}

/* Each group of fields in its own card with its title. */
.screen-payroll .payroll-card {
	margin: 0 0 var(--space-lg);
	padding: var(--space-md) var(--space-lg) var(--space-sm);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
	background: var(--color-surface-panel);
}

.screen-payroll .payroll-card > legend {
	float: left;
	width: 100%;
	margin: 0 0 var(--space-md);
	padding: 0 0 var(--space-sm);
	border-bottom: 1px solid var(--color-border-default);
	color: var(--color-brand-primary);
	font-size: var(--type-size-title);
}

.screen-payroll .payroll-card > legend + * {
	clear: both;
}

/* A checkbox beside its label and hint, on its own row (stronger than the general label:has(checkbox) rule, which
   centres the box against the label and hint together). */
label.payroll-check:has(> input[type="checkbox"]) {
	display: flex;
	align-items: flex-start;
	gap: var(--space-sm);
	max-width: 46rem;
	margin: 0 0 var(--space-md);
	cursor: pointer;
}

.payroll-check > input[type="checkbox"] {
	margin-top: 1px;
}

.payroll-check-text {
	display: flex;
	flex-direction: column;
	gap: var(--space-xxs);
}

.payroll-check-label {
	font-weight: var(--type-weight-medium);
	line-height: 20px;
}

.payroll-check .field-hint {
	margin: 0;
}

.payroll-checks {
	display: flex;
	flex-wrap: wrap;
	gap: 0 var(--space-xl);
	margin-top: var(--space-sm);
}

/* Budgets (the accountant's list): month-by-month amounts under an account, and the difference coloured by whether it is
   good (more income, less expense) or not. */
.budget-lines .budget-section th {
	padding-top: var(--space-md);
	color: var(--color-brand-primary);
	text-align: left;
}

.budget-month-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
	gap: var(--space-xs) var(--space-sm);
	padding: var(--space-xs) 0 var(--space-sm);
}

.budget-month-grid label {
	display: flex;
	flex-direction: column;
	gap: var(--space-xxs);
	color: var(--color-text-secondary);
	font-size: var(--type-size-caption);
}

.budget-diff[data-tone='success'] {
	color: var(--color-status-success);
}

.budget-diff[data-tone='danger'] {
	color: var(--color-status-danger);
}

/* The cash forecast: the lowest week stands out; each week's items under it. */
.forecast-table .forecast-lowest > * {
	background: var(--color-brand-tint);
	font-weight: var(--type-weight-bold);
}

.forecast-table [data-tone='danger'],
.forecast-items [data-tone='danger'] {
	color: var(--color-status-danger);
}

.forecast-items [data-tone='success'] {
	color: var(--color-status-success);
}

.forecast-items .plain-list > li {
	display: flex;
	justify-content: space-between;
	gap: var(--space-md);
	padding: var(--space-xxs) 0;
}

/* Charts (components/chart.js; the data-viz method): validated series slots (blue, orange; light and dark steps checked
   against this app's surfaces), hairline solid grid, thin marks, a tooltip, a table view beneath. */
:root {
	--chart-series-1: #2a78d6;
	--chart-series-2: #eb6834;
	--chart-series-3: #1baf7a;
	--chart-series-4: #eda100;
	--chart-series-5: #e87ba4;
	--chart-series-6: #008300;
	--chart-series-7: #6250d6;
	--chart-series-8: #e34948;
	--chart-grid: color-mix(in srgb, var(--color-border-default) 70%, transparent);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--chart-series-1: #3987e5;
		--chart-series-2: #d95926;
		--chart-series-3: #199e70;
		--chart-series-4: #c98500;
		--chart-series-5: #d55181;
		--chart-series-6: #008300;
		--chart-series-7: #9085e9;
		--chart-series-8: #e66767;
	}
}

:root[data-theme="dark"] {
	--chart-series-1: #3987e5;
	--chart-series-2: #d95926;
	--chart-series-3: #199e70;
	--chart-series-4: #c98500;
	--chart-series-5: #d55181;
	--chart-series-6: #008300;
	--chart-series-7: #9085e9;
	--chart-series-8: #e66767;
}

/* Custom reports (Agreed 2.38) chart up to eight series: slots 3 to 8 of the validated categorical palette (aqua, yellow,
   magenta, green, violet, red; checked for colour blindness in light and dark; the table always sits beside them). */
.chart-mark[data-slot='3'], .chart-swatch[data-slot='3'], .chart-slice[data-slot='3'] { fill: var(--chart-series-3); background: var(--chart-series-3); }
.chart-line[data-slot='3'] { stroke: var(--chart-series-3); }
.chart-dot[data-slot='3'] { fill: var(--chart-series-3); }
.chart-mark[data-slot='4'], .chart-swatch[data-slot='4'], .chart-slice[data-slot='4'] { fill: var(--chart-series-4); background: var(--chart-series-4); }
.chart-line[data-slot='4'] { stroke: var(--chart-series-4); }
.chart-dot[data-slot='4'] { fill: var(--chart-series-4); }
.chart-mark[data-slot='5'], .chart-swatch[data-slot='5'], .chart-slice[data-slot='5'] { fill: var(--chart-series-5); background: var(--chart-series-5); }
.chart-line[data-slot='5'] { stroke: var(--chart-series-5); }
.chart-dot[data-slot='5'] { fill: var(--chart-series-5); }
.chart-mark[data-slot='6'], .chart-swatch[data-slot='6'], .chart-slice[data-slot='6'] { fill: var(--chart-series-6); background: var(--chart-series-6); }
.chart-line[data-slot='6'] { stroke: var(--chart-series-6); }
.chart-dot[data-slot='6'] { fill: var(--chart-series-6); }
.chart-mark[data-slot='7'], .chart-swatch[data-slot='7'], .chart-slice[data-slot='7'] { fill: var(--chart-series-7); background: var(--chart-series-7); }
.chart-line[data-slot='7'] { stroke: var(--chart-series-7); }
.chart-dot[data-slot='7'] { fill: var(--chart-series-7); }
.chart-mark[data-slot='8'], .chart-swatch[data-slot='8'], .chart-slice[data-slot='8'] { fill: var(--chart-series-8); background: var(--chart-series-8); }
.chart-line[data-slot='8'] { stroke: var(--chart-series-8); }
.chart-dot[data-slot='8'] { fill: var(--chart-series-8); }
.chart-slice[data-slot='1'] { fill: var(--chart-series-1); }
.chart-slice[data-slot='2'] { fill: var(--chart-series-2); }
.chart-slice { stroke: var(--color-surface-panel); stroke-width: 2; }
.chart-slice[data-slot='other'], .chart-swatch[data-slot='other'] { fill: var(--color-border-default); background: var(--color-border-default); }
.chart-donut-total { fill: var(--color-text-primary); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-donut-label { fill: var(--color-text-secondary); font-size: 11px; }

.chart-figure {
	margin: var(--space-md) 0 var(--space-lg);
}

.chart-caption {
	margin-bottom: var(--space-xs);
	font-weight: var(--type-weight-medium);
}

.chart-wrap {
	position: relative;
}

.chart {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
}

.chart-grid {
	stroke: var(--chart-grid);
	stroke-width: 1;
}

.chart-baseline {
	stroke: var(--color-border-default);
	stroke-width: 1;
}

.chart-tick {
	fill: var(--color-text-secondary);
	font-size: 11px;
	font-variant-numeric: tabular-nums;
}

.chart-mark[data-slot='1'],
.chart-bar[data-slot='1'],
.chart-swatch[data-slot='1'] {
	fill: var(--chart-series-1);
	background: var(--chart-series-1);
}

.chart-mark[data-slot='2'],
.chart-swatch[data-slot='2'] {
	fill: var(--chart-series-2);
	background: var(--chart-series-2);
}

.chart-line {
	fill: none;
	stroke-width: 2;
	stroke-linejoin: round;
	stroke-linecap: round;
}

.chart-line[data-slot='1'] {
	stroke: var(--chart-series-1);
}

.chart-line[data-slot='2'] {
	stroke: var(--chart-series-2);
}

.chart-dot {
	stroke: var(--color-surface-panel);
	stroke-width: 2;
}

.chart-dot[data-slot='1'] {
	fill: var(--chart-series-1);
}

.chart-dot[data-slot='2'] {
	fill: var(--chart-series-2);
}

.chart-crosshair {
	stroke: var(--color-text-secondary);
	stroke-width: 1;
}

.chart-hit {
	fill: transparent;
	cursor: default;
	outline: none;
}

.chart-hit:focus-visible {
	fill: color-mix(in srgb, var(--color-brand-primary) 8%, transparent);
}

.chart-tooltip {
	position: absolute;
	z-index: 2;
	padding: var(--space-xs) var(--space-sm);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
	background: var(--color-surface-panel);
	box-shadow: 0 4px 14px rgb(0 0 0 / 12%);
	font-size: var(--type-size-caption);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	pointer-events: none;
}

.chart-tooltip-title {
	font-weight: var(--type-weight-bold);
}

.chart-legend {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-xs) var(--space-md);
	margin: 0 0 var(--space-xs);
	padding: 0;
	list-style: none;
	color: var(--color-text-secondary);
	font-size: var(--type-size-caption);
}

.chart-legend li {
	display: flex;
	align-items: center;
	gap: var(--space-xs);
}

.chart-swatch {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 2px;
}

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

.chart-bars > li {
	display: grid;
	grid-template-columns: minmax(8rem, 14rem) 1fr max-content;
	align-items: center;
	gap: var(--space-sm);
	padding: 3px 0;
}

.chart-bar-label {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.chart-bar-track {
	display: block;
	height: 14px;
}

.chart-bar {
	display: block;
	height: 100%;
	border-radius: 0 4px 4px 0;
}

.chart-bar-value {
	color: var(--color-text-secondary);
	font-variant-numeric: tabular-nums;
}

.chart-table {
	margin-top: var(--space-xs);
	color: var(--color-text-secondary);
	font-size: var(--type-size-caption);
}

.chart-table summary {
	cursor: pointer;
}

/* The dashboard at a glance: chart cards side by side when there is room. */
.glance-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
	gap: var(--space-md);
}

.glance-card {
	padding: var(--space-sm) var(--space-md);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
	background: var(--color-surface-panel);
}

.glance-card .chart-figure {
	margin: 0;
}

/* On a narrow screen the name goes above its bar, so the bar keeps the width. */
@media (max-width: 560px) {
	.chart-bars > li {
		grid-template-columns: 1fr max-content;
		row-gap: 2px;
	}

	.chart-bar-label {
		grid-column: 1 / -1;
	}
}

/* People (HRM H1): the overview cards, the month's leave calendar with its key, and checklists. */
.hr-overview-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: var(--space-md);
	align-items: start;
}

.hr-overview-grid > .books-section {
	margin: 0;
	padding: var(--space-sm) var(--space-md);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
	background: var(--color-surface-panel);
}

.hr-month {
	align-self: center;
	min-width: 9rem;
	text-align: center;
}

.hr-calendar table {
	border-collapse: collapse;
	font-size: var(--type-size-caption);
}

.hr-calendar th,
.hr-calendar td {
	border: 1px solid var(--color-border-default);
	padding: var(--space-xxs);
}

.hr-calendar tbody th {
	position: sticky;
	left: 0;
	z-index: 1;
	min-width: 10rem;
	text-align: left;
	white-space: nowrap;
	background: var(--color-surface-panel);
}

.hr-calendar .hr-day {
	min-width: 1.5rem;
	text-align: center;
}

.hr-calendar thead .hr-day span {
	display: block;
}

.hr-day-name {
	color: var(--color-text-secondary);
}

.hr-day[data-off="weekend"],
.hr-key[data-off="weekend"] {
	background: var(--color-surface-subtle);
}

.hr-day[data-off="holiday"],
.hr-key[data-off="holiday"] {
	background: var(--color-brand-tint);
}

/* Approved leave is filled; leave asked for is outlined, so the two differ without colour too. */
.hr-day[data-status="approved"],
.hr-key[data-status="approved"] {
	background: var(--color-brand-primary);
	color: var(--color-brand-on-primary);
	font-weight: var(--type-weight-bold);
}

.hr-day[data-status="requested"],
.hr-key[data-status="requested"] {
	box-shadow: inset 0 0 0 2px var(--color-status-warning);
	color: var(--color-status-warning);
	font-weight: var(--type-weight-bold);
}

.hr-key {
	display: inline-block;
	width: 0.9rem;
	height: 0.9rem;
	vertical-align: middle;
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-sm);
}

.hr-checklist + .hr-checklist {
	margin-top: var(--space-md);
}

.hr-checklist-title {
	margin: 0 0 var(--space-xs);
}

.hr-checklist-items > li + li {
	margin-top: var(--space-xxs);
}

/* The public careers pages (HRM H2): the company's jobs and the application form. */
.careers-panel {
	max-width: 44rem;
}

.careers-language {
	margin: 0 0 var(--space-sm);
	text-align: right;
}

/* Documents' public pages (D63) share the careers layout: a hint above a heading keeps its distance. */
.careers-panel > .careers-jobs + h2,
.careers-panel > .notice + h2,
.careers-panel > .field-hint + .notice,
.careers-panel > .field-hint + h2,
.careers-panel > .field-hint + .careers-jobs,
.careers-panel > .field-hint + form {
	margin-top: var(--space-lg);
}

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

.careers-jobs > li {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
	padding: var(--space-sm) 0;
	border-bottom: 1px solid var(--color-border-default);
}

.careers-form input:not([type="checkbox"], [type="radio"], [type="file"]),
.careers-form textarea {
	width: 100%;
}

.careers-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
	gap: 0 var(--space-md);
}

.careers-question {
	margin: 0 0 var(--space-md);
	padding: var(--space-sm) var(--space-md);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
}

.careers-question legend {
	padding: 0 var(--space-xs);
	font-weight: var(--type-weight-medium);
}

.careers-option {
	display: block;
	padding: var(--space-xxs) 0;
}

.careers-check {
	display: flex;
	gap: var(--space-xs);
	align-items: flex-start;
}

/* The employee link (HRM H3): the name with Sign out on one row; space between the page's sections and lists. */
.employee-link-head {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-sm) var(--space-md);
	align-items: center;
	justify-content: space-between;
}

.page-employee-link .employee-link-head h1 {
	margin: 0;
}

.page-employee-link .careers-panel > * + h2 {
	margin-top: var(--space-xl);
}

.page-employee-link .careers-panel > * + h3,
.page-employee-link .careers-panel > .careers-jobs + form,
.page-employee-link .careers-panel > form + .careers-jobs,
.page-employee-link .careers-panel > .employee-link-head + .notice {
	margin-top: var(--space-md);
}

/* For robots only: out of sight and out of the tab order. */
.careers-trap {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* A view's blocks, one under the other, always with space between (owner, 26 Oct 2026; tools/dev/spacing-audit.js). */
.view-stack {
	display: flex;
	flex-direction: column;
	gap: var(--space-md);
}

.view-stack > * {
	margin-top: 0;
	margin-bottom: 0;
}

.hr-calendar-block {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
}

.hr-legend {
	margin: 0;
	line-height: 1.7;
}

/* A short form on one line: its fields and the button side by side, the button level with the inputs (owner, 26 Oct). */
.inline-form {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-sm) var(--space-md);
	align-items: flex-end;
}

.inline-form > * {
	margin: 0;
}

/* Inside a section or a card the parts (intro, list, fields, buttons) never touch (owner, 26 Oct 2026). */
.books-section > * + *,
.payroll-card > :not(legend) + * {
	margin-top: var(--space-sm);
}

/* ======================================================================================================================
   Admin refresh (owner, 26 October 2026, ui-fixes O1: "better styling needed urgently … white empty spaces that waste
   space … add some colour and logic"). One quiet system with one signature: the menu is a dark rail in the logo's ink
   with the logo's orange marking where you are. Everything else is compact and calm: panels with a soft edge, tables
   with small-capital headings and tight rows, view tabs as one segmented control, short lists as cards, colour only
   where it means something. Brand tokens are unchanged (shared/design/tokens.json); these are the web app's own.
   ==================================================================================================================== */

:root {
	--rail-bg: #16273F;
	--rail-text: #C5D0DE;
	--rail-muted: #7F91A8;
	--rail-hover: rgba(255, 255, 255, 0.06);
	--rail-active: rgba(255, 255, 255, 0.10);
	--accent: #F6921E;
	--panel-shadow: 0 1px 2px rgba(22, 39, 63, 0.06), 0 1px 1px rgba(22, 39, 63, 0.04);
	--head-tint: #F6F8FB;
	--row-hover: #F3F6FA;
	/* Muted but readable (4.8:1 on white): zeros, done states, quiet counts (plan §4; "disabled" grey is 2.6:1). */
	--text-muted: #6B7380;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--rail-bg: #0D1520;
		--rail-text: #B7C2D0;
		--rail-muted: #6D7D92;
		--panel-shadow: none;
		--head-tint: #20252D;
		--row-hover: #222832;
		--text-muted: #8A93A0;
	}
}

:root[data-theme="dark"] {
	--rail-bg: #0D1520;
	--rail-text: #B7C2D0;
	--rail-muted: #6D7D92;
	--panel-shadow: none;
	--head-tint: #20252D;
	--row-hover: #222832;
	--text-muted: #8A93A0;
}

/* The rail */
.page-app {
	grid-template-columns: 208px minmax(0, 1fr);
}

.app-header {
	box-shadow: var(--panel-shadow);
	position: relative;
	z-index: 2;
}

.app-nav {
	background: var(--rail-bg);
	border-right: 0;
	padding: var(--space-sm) 0 var(--space-xl);
}

.app-nav ul {
	padding: 0 var(--space-sm);
}

.app-nav-label {
	margin: var(--space-md) var(--space-lg) var(--space-xxs);
	color: var(--rail-muted);
	font-size: 11px;
	font-weight: var(--type-weight-bold);
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.app-nav a {
	position: relative;
	padding: 6px var(--space-md);
	color: var(--rail-text);
	font-size: 13.5px;
	transition: background var(--motion-fast), color var(--motion-fast);
}

.app-nav a:hover {
	background: var(--rail-hover);
	color: #FFFFFF;
}

.app-nav a[aria-current] {
	background: var(--rail-active);
	color: #FFFFFF;
	font-weight: var(--type-weight-medium);
}

.app-nav a[aria-current]::before {
	content: "";
	position: absolute;
	left: -8px;
	top: 6px;
	bottom: 6px;
	width: 3px;
	border-radius: 0 3px 3px 0;
	background: var(--accent);
}

.app-nav a:focus-visible {
	outline-color: var(--accent);
}

.app-main {
	padding: var(--space-lg) var(--space-xl) var(--space-xxl);
}

/* Page heading: compact, the description a quiet line under the title */
.page-header {
	padding-bottom: var(--space-md);
	border-bottom: 1px solid var(--color-border-default);
}

.page-header h1 {
	font-size: 20px;
	letter-spacing: -0.01em;
}

.page-description {
	font-size: 13px;
	max-width: 90ch;
}

/* View tabs: one segmented control */
.support-views {
	align-self: flex-start;
	/* Tabs that wrap onto a second line keep a visible space between the lines. */
	gap: 8px 2px;
	padding: 3px;
	background: var(--color-surface-subtle);
	border: 1px solid var(--color-border-default);
	border-radius: 9px;
}

.support-view {
	padding: 5px 12px;
	border: 0;
	border-radius: 6px;
	color: var(--color-text-secondary);
	font-size: 13px;
	font-weight: var(--type-weight-medium);
}

.support-view:hover {
	color: var(--color-text-primary);
	background: rgba(127, 145, 168, 0.12);
}

.support-view[aria-current="page"] {
	color: var(--color-brand-primary);
	background: var(--color-surface-panel);
	box-shadow: 0 1px 2px rgba(22, 39, 63, 0.12);
}

/* Panels and table blocks: a soft edge instead of a heavy frame */
.panel,
.table-block,
.glance-card,
.payroll-card,
.queue-card {
	box-shadow: var(--panel-shadow);
}

.panel {
	padding: var(--space-md) var(--space-lg);
}

/* Tables: small-capital headings, tight rows, numbers in columns */
.data-table th,
.data-table td {
	padding: 7px var(--space-md);
}

.data-table thead th {
	font-size: 11px;
	font-weight: var(--type-weight-bold);
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--color-text-secondary);
	background: var(--head-tint);
}

.data-table tbody tr:hover > * {
	background: var(--row-hover);
}

.data-table .num,
.num {
	font-variant-numeric: tabular-nums;
}

/* A zero carries no news: it steps back so the figures that matter stand out (O5). */
.data-table td.num-zero {
	color: var(--text-muted);
}

.data-table tr.totals-row > * {
	font-weight: var(--type-weight-bold);
	background: var(--head-tint);
	border-top: 2px solid var(--color-border-default);
}

@media (pointer: fine) {
	.data-table a {
		min-height: 0;
	}
}

/* Forms: labels small, fields compact */
label,
.field-label {
	font-size: 12.5px;
}

.chip {
	border-radius: 999px;
	padding: 1px 8px;
	font-weight: var(--type-weight-medium);
}

.chip[data-tone="success"] {
	background: color-mix(in srgb, var(--color-status-success) 10%, transparent);
	border-color: color-mix(in srgb, var(--color-status-success) 35%, transparent);
}

.chip[data-tone="warning"] {
	background: color-mix(in srgb, var(--color-status-warning) 10%, transparent);
	border-color: color-mix(in srgb, var(--color-status-warning) 35%, transparent);
}

.chip[data-tone="danger"] {
	background: color-mix(in srgb, var(--color-status-danger) 9%, transparent);
	border-color: color-mix(in srgb, var(--color-status-danger) 35%, transparent);
}

.chip[data-tone="info"] {
	background: color-mix(in srgb, var(--color-status-info) 9%, transparent);
	border-color: color-mix(in srgb, var(--color-status-info) 30%, transparent);
}

/* Short lists (holidays, pay items, leave, documents, changes): cards side by side, not full-width rows (O2). */
.payroll-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
	gap: var(--space-sm);
	padding: 0;
	list-style: none;
}

.payroll-list > li {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm);
	min-width: 0;
	margin: 0;
	padding: 7px var(--space-md);
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
	box-shadow: var(--panel-shadow);
}

.payroll-list > li + li {
	margin-top: 0;
}

.payroll-list .button-link,
.payroll-list .row-actions {
	flex: none;
}

/* A toolbar: controls of one task on one row, all the same height and level (O3). */
.toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: var(--space-sm) var(--space-md);
}

.toolbar > * {
	margin: 0;
}

.toolbar select,
.toolbar input {
	width: auto;
	min-width: 10rem;
}

/* Figures (summary tiles): a coloured edge says what the number is about */
.payroll-figure {
	box-shadow: var(--panel-shadow);
}

.payroll-figure[data-tone="success"] {
	border-left: 3px solid var(--color-status-success);
}

.payroll-figure[data-tone="warning"] {
	border-left: 3px solid var(--color-status-warning);
}

@media (max-width: 820px) {
	.page-app {
		grid-template-columns: 1fr;
	}

	.app-nav {
		display: flex;
		align-items: center;
		overflow-x: auto;
		padding: var(--space-xs) var(--space-sm);
	}

	.app-nav-label {
		display: none;
	}

	.app-nav ul {
		display: flex;
		padding: 0;
	}

	.app-nav a {
		white-space: nowrap;
	}

	.app-nav a[aria-current]::before {
		left: 6px;
		right: 6px;
		top: auto;
		bottom: 0;
		width: auto;
		height: 3px;
		border-radius: 3px 3px 0 0;
	}

	.app-main {
		padding: var(--space-md);
	}
}

/* Dashboard queue cards: compact, the count leads */
.queue-card {
	min-height: 0;
	padding: var(--space-md) var(--space-lg);
}

.report-heading {
	margin: 0 0 var(--space-xxs);
	color: var(--color-text-primary);
}

/* Filters: a grid of equal cells, so a last filter never stretches across a whole row (owner, O1). */
.filter-bar {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
	align-items: end;
	padding: var(--space-sm) var(--space-md) var(--space-md);
	box-shadow: var(--panel-shadow);
}

.filter-bar > .filter-search {
	grid-column: span 2;
}

.filter-bar > .filter-check {
	align-self: end;
	padding-top: 0;
	padding-bottom: 8px;
}

/* The link is as tall as the boxes beside it (--control-h), so it sits level with them without extra room below. */
.filter-bar > .filter-actions {
	align-self: end;
	justify-self: start;
}

/* Links in tables: the brand colour, underlined only on hover */
.data-table a {
	color: var(--color-brand-primary);
	font-weight: var(--type-weight-medium);
	text-decoration: none;
}

.data-table a:hover {
	text-decoration: underline;
}

/* Summary figures: label and number together, the number leading */
.payroll-figure {
	display: flex;
	flex-direction: column-reverse;
	justify-content: flex-end;
	gap: 2px;
	background: var(--color-surface-panel);
}

.payroll-figure dd {
	margin: 0;
	font-size: 22px;
	font-weight: var(--type-weight-bold);
	line-height: 1.15;
	text-align: left;
}

.payroll-figure dt {
	font-size: 12px;
}

.payroll-figure[data-tone="warning"] dd {
	color: var(--color-status-warning);
}

.payroll-figure[data-tone="success"] dd {
	color: var(--color-status-success);
}

/* Cards with nothing to show say so quietly */
.hr-overview-grid .section-title,
.books-section > .section-title {
	font-size: 15px;
	color: var(--color-text-primary);
}

/* Actions inside list cards: quiet until pointed at */
.payroll-list .button-link {
	color: var(--color-text-secondary);
	font-size: 12.5px;
	text-decoration: none;
}

.payroll-list .button-link:hover {
	color: var(--color-status-danger);
	text-decoration: underline;
}

.hr-month {
	min-width: 5rem;
}

/* Empty placeholders (a sandbox panel or a warning that is not there) take no room and add no gap. */
.screen > div:empty,
.view-stack > div:empty {
	display: none;
}

/* Sections of a view are cards like the forms beside them (employee page, accounting): no loose dividers. */
.view-stack > .books-section,
.payroll-employee-form ~ .books-section {
	margin: 0;
	padding: var(--space-md) var(--space-lg);
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
	box-shadow: var(--panel-shadow);
}

.view-stack > .books-section + .books-section,
.payroll-employee-form ~ .books-section {
	margin-top: 0;
}

.view-stack > .books-section > .section-title:first-child {
	color: var(--color-brand-primary);
	padding-bottom: var(--space-sm);
	border-bottom: 1px solid var(--color-border-default);
}

/* A short input beside a tall notes box keeps its own height (rows stretch, inputs don't). */
.form-grid input:not([type="checkbox"], [type="radio"]),
.form-grid select {
	height: var(--control-h);
	align-self: start;
}

/* List cards hold a line of text and its actions; wide enough for a leave line on one row */
.payroll-list {
	grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
}

.payroll-list > li > :first-child {
	min-width: 0;
}

.payroll-list .row-actions {
	margin: 0;
}

/* Dashboard: nothing waiting reads as quiet, so the cards with work stand out (O5) */
.queue-card[data-tone="muted"] {
	box-shadow: none;
	background: transparent;
	border-style: dashed;
}

.queue-card[data-tone="muted"] .queue-count {
	color: var(--text-muted);
}

/* Dashboard: queue groups two by two on a wide screen, and a queue with nothing waiting on one quiet line */
@media (min-width: 1200px) {
	.dashboard-groups {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--space-lg) var(--space-xl);
		align-items: start;
	}
}

.queue-card[data-tone="muted"] {
	flex-direction: row;
	flex-wrap: wrap;
	align-items: baseline;
	gap: var(--space-sm);
	padding: var(--space-sm) var(--space-md);
}

.queue-card[data-tone="muted"] .queue-count {
	font-size: var(--type-size-body-large);
}

.queue-card[data-tone="muted"] .queue-label {
	color: var(--color-text-secondary);
}

.queue-card[data-tone="muted"] .queue-hint {
	display: none;
}

.queue-grid > .queue-break {
	flex: 0 0 100%;
	height: 0;
}

.queue-grid > li:has(> .queue-card[data-tone="muted"]),
.queue-grid > li:has(> a > .queue-card[data-tone="muted"]),
.queue-grid > li:has(> [data-tone="muted"]) {
	flex: 0 1 auto;
}

.queue-grid > .queue-break {
	margin-top: calc(-1 * var(--space-md));
}

/* A short filter bar (two dates, one picker) is as wide as its fields, not the whole page */
.screen > .filter-bar:not(:has(> :nth-child(5))),
.view-stack > .filter-bar:not(:has(> :nth-child(5))) {
	display: flex;
	flex-wrap: wrap;
	align-self: flex-start;
	max-width: 100%;
}

.screen > .filter-bar:not(:has(> :nth-child(5))) > .filter-field,
.view-stack > .filter-bar:not(:has(> :nth-child(5))) > .filter-field,
.screen > .filter-bar:not(:has(> :nth-child(5))) > .field,
.view-stack > .filter-bar:not(:has(> :nth-child(5))) > .field {
	flex: 0 1 13rem;
	/* A date stays readable: buttons beside it wrap to the next line before it shrinks. */
	min-width: 9.5rem;
	margin: 0;
}

/* A choice from a short list needs no full-width box */
.panel select:not(.form-grid select) {
	max-width: 32rem;
}

@media (min-width: 821px) {
	.screen > .filter-bar:not(:has(> :nth-child(5))),
	.view-stack > .filter-bar:not(:has(> :nth-child(5))) {
		flex-wrap: nowrap;
		align-items: flex-end;
	}
}

.filter-bar > .accounting-downloads {
	flex: none;
	flex-wrap: nowrap;
	margin: 0;
	padding-bottom: 0;
}

/* A widget that couldn't load says so, with a way to try again: never a blank or a zero (spec §8, plan P0). */
.widget-failed {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-sm);
	padding: var(--space-md);
	border: 1px solid color-mix(in srgb, var(--color-status-danger) 40%, transparent);
	border-radius: var(--radius-md);
	color: var(--color-text-primary);
}

.widget-failed p {
	margin: 0;
}

/* Recruitment (HRM H2): a job's two lists side by side, the score against the pass mark, the rules editor */
.rec-lists {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
	gap: var(--space-md);
	/* Side by side, the same height (owner's rule: no empty gap under the shorter card). */
	align-items: stretch;
}

.toolbar-spacer {
	flex: 1;
}

.rec-score {
	font-weight: var(--type-weight-bold);
	font-variant-numeric: tabular-nums;
}

.rec-score[data-pass="yes"] {
	color: var(--color-status-success);
}

.rec-score[data-pass="no"] {
	color: var(--text-muted);
}

.criteria-rows {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
}

.criteria-row {
	display: grid;
	grid-template-columns: minmax(16rem, 2fr) 10rem minmax(14rem, 1.4fr) auto;
	gap: var(--space-sm);
	align-items: start;
	padding: var(--space-sm);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
	background: var(--head-tint);
}

.criteria-row textarea {
	grid-column: 3;
}

.criteria-yes-no {
	display: flex;
	gap: var(--space-sm);
	align-items: center;
}

.criteria-yes-no .inline-label {
	display: inline-flex;
	gap: var(--space-xs);
	align-items: center;
	margin: 0;
	white-space: nowrap;
}

.criteria-total {
	margin: 0;
	font-weight: var(--type-weight-bold);
}

.criteria-total[data-tone="success"] {
	color: var(--color-status-success);
}

.criteria-total[data-tone="warning"] {
	color: var(--color-status-warning);
}

@media (max-width: 820px) {
	.criteria-row {
		grid-template-columns: 1fr;
	}

	.criteria-row textarea {
		grid-column: auto;
	}
}

.rec-lists > .books-section {
	margin: 0;
	padding: var(--space-md) var(--space-lg);
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
	box-shadow: var(--panel-shadow);
}

.rec-lists > .books-section > .section-title:first-child {
	color: var(--color-brand-primary);
	padding-bottom: var(--space-sm);
	border-bottom: 1px solid var(--color-border-default);
}

.data-table .button-link {
	color: var(--color-brand-primary);
	font-weight: var(--type-weight-medium);
	text-decoration: none;
	white-space: nowrap;
}

.data-table .button-link:hover {
	text-decoration: underline;
}

.criteria-editor {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
}

.criteria-editor > .field-hint {
	margin: 0;
}

.criteria-row > .button-link {
	grid-column: 4;
	justify-self: end;
	align-self: center;
}

/* A comparison series (the same months last year): quiet grey, never a brand or status colour (plan §4). */
:root {
	--chart-ref: #A7AFBA;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--chart-ref: #59626F;
	}
}

:root[data-theme="dark"] {
	--chart-ref: #59626F;
}

.chart-mark[data-slot='ref'],
.chart-swatch[data-slot='ref'] {
	fill: var(--chart-ref);
	background: var(--chart-ref);
}

/* Dashboard (plan P1): attention and KPI figures side by side, then charts, then activity */
.dash-top {
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
	gap: var(--space-md);
	align-items: stretch;
}

@media (max-width: 1100px) {
	.dash-top {
		grid-template-columns: 1fr;
	}
}

.dash-attention-host > .panel,
.dash-attention {
	height: 100%;
	box-sizing: border-box;
}

.dash-updated {
	color: var(--color-text-secondary);
	font-size: 13px;
}

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

.attention-list > li {
	display: grid;
	grid-template-columns: 3rem minmax(0, 1fr) auto;
	gap: var(--space-sm);
	align-items: center;
	padding: var(--space-sm) var(--space-sm) var(--space-sm) var(--space-md);
	border: 1px solid var(--color-border-default);
	border-left: 3px solid var(--color-status-info);
	border-radius: var(--radius-md);
}

.attention-list > li[data-tone="warning"] {
	border-left-color: var(--color-status-warning);
}

.attention-list > li[data-tone="danger"] {
	border-left-color: var(--color-status-danger);
}

.attention-list > li[data-tone="neutral"] {
	border-left-color: var(--color-border-default);
}

.attention-count {
	font-size: 22px;
	font-weight: var(--type-weight-bold);
	font-variant-numeric: tabular-nums;
	text-align: right;
}

.attention-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.attention-label {
	font-weight: var(--type-weight-medium);
}

.attention-hint,
.attention-idle,
.attention-clear {
	color: var(--color-text-secondary);
	font-size: 13px;
}

.attention-idle {
	margin: var(--space-sm) 0 0;
}

.attention-clear {
	margin: 0;
}

.kpi-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--space-md);
}

.kpi-tile {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: var(--space-md) var(--space-lg);
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
	box-shadow: var(--panel-shadow);
	color: var(--color-text-primary);
	text-decoration: none;
}

.kpi-tile:hover {
	border-color: var(--color-brand-primary);
}

.kpi-label {
	color: var(--color-text-secondary);
	font-size: 13px;
}

.kpi-value {
	font-size: 24px;
	font-weight: var(--type-weight-bold);
	line-height: 1.2;
	letter-spacing: -0.01em;
}

.kpi-value[data-zero="true"] {
	color: var(--text-muted);
}

.kpi-sub {
	color: var(--color-text-secondary);
	font-size: 12.5px;
}

.kpi-sub[data-tone="success"] {
	color: var(--color-status-success);
}

.kpi-sub[data-tone="danger"] {
	color: var(--color-status-danger);
}

.kpi-sub[data-tone="warning"] {
	color: var(--color-status-warning);
}

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

.activity-list > li {
	display: grid;
	grid-template-columns: 9rem minmax(10rem, 1.2fr) minmax(0, 2fr) 9rem;
	gap: var(--space-md);
	align-items: baseline;
	padding: 6px 0;
	border-bottom: 1px solid var(--color-border-default);
}

.activity-list > li:last-child {
	border-bottom: 0;
}

.activity-time {
	color: var(--color-text-secondary);
	font-size: 12.5px;
	font-variant-numeric: tabular-nums;
}

.activity-what {
	color: var(--color-brand-primary);
	font-weight: var(--type-weight-medium);
	text-decoration: none;
}

.activity-party {
	color: var(--color-text-secondary);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.activity-amount {
	text-align: right;
}

@media (max-width: 820px) {
	.activity-list > li {
		grid-template-columns: 1fr auto;
	}

	.activity-time,
	.activity-party {
		grid-column: 1 / -1;
	}
}

/* Help: the guides for your role, as compact link cards above the guide list (moved from the dashboard, plan P1) */
.help-role-guides ul {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: var(--space-sm);
	margin: 0 0 var(--space-lg);
	padding: 0;
	list-style: none;
}

.help-role-guides a {
	display: flex;
	flex-direction: column;
	gap: 2px;
	height: 100%;
	box-sizing: border-box;
	padding: var(--space-sm) var(--space-md);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
	background: var(--color-surface-panel);
	color: var(--color-text-primary);
	text-decoration: none;
}

.help-role-guides a span {
	color: var(--color-text-secondary);
	font-size: 13px;
}

.help-role-guides a:hover {
	border-color: var(--color-brand-primary);
}

/* Done states step back: outline only, muted text (plan §4). */
.chip[data-tone="done"] {
	color: var(--text-muted);
	background: transparent;
	border-color: var(--color-border-default);
}

/* Brand colour roles (D57): ink for structure, orange for the main action with dark text (white on orange is 2.3:1),
   link blue for links only. The muted text token now comes from the shared tokens. */
:root {
	--text-muted: var(--color-text-muted);
	--accent: var(--color-brand-accent);
}

a {
	color: var(--color-link);
}

.button-primary {
	background: var(--color-brand-accent);
	color: var(--color-brand-on-accent);
	font-weight: var(--type-weight-bold);
}

/* As specific as the older ".button-primary:hover:not(:disabled)" (dark brand blue under a dark label), so this wins. */
.button-primary:hover:not(:disabled) {
	background: color-mix(in srgb, var(--color-brand-accent) 88%, #000);
}

.button-primary:focus-visible {
	outline-color: var(--color-focus-ring);
}

.data-table a,
.data-table .button-link,
.activity-what {
	color: var(--color-link);
}

.section-title,
.panel-title {
	color: var(--color-brand-primary);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .section-title,
	:root:not([data-theme="light"]) .panel-title {
		color: var(--color-text-primary);
	}
}

:root[data-theme="dark"] .section-title,
:root[data-theme="dark"] .panel-title {
	color: var(--color-text-primary);
}

/* A line of figures (People overview): compact, zeros quiet, figures needing action in amber */
.figure-line {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-xs) var(--space-xl);
	margin: 0;
	padding: var(--space-sm) var(--space-lg);
	list-style: none;
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
	box-shadow: var(--panel-shadow);
}

.figure-line strong {
	font-size: 18px;
	font-variant-numeric: tabular-nums;
}

.figure-line li[data-zero="true"] {
	color: var(--text-muted);
}

.figure-line li[data-tone="warning"] strong {
	color: var(--color-status-warning);
}

.coming-list {
	grid-template-columns: 1fr;
}

/* A KPI tile as tall as its row keeps its figure centred, not stranded at the top */
.kpi-tile {
	justify-content: center;
}

/* A record's heading with its save status beside it (plan P2) */
.record-heading {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-sm) var(--space-lg);
}

.record-heading > .section-title {
	margin: 0;
}

.autosave-status {
	display: inline-flex;
	align-items: center;
	gap: var(--space-sm);
	margin: 0;
	color: var(--color-text-secondary);
	font-size: 13px;
}

.autosave-status[data-state="saving"],
.autosave-status[data-state="unsaved"] {
	color: var(--color-text-secondary);
}

.autosave-status[data-state="saved"]::before {
	content: "✓";
	color: var(--color-status-success);
}

.autosave-status[data-state="offline"],
.autosave-status[data-state="invalid"] {
	color: var(--color-status-warning);
}

.autosave-status[data-state="error"],
.autosave-status[data-state="conflict"] {
	color: var(--color-status-danger);
}

/* The frame (plan P3): menu icons, a rail that folds to icons, the page finder */
.icon {
	width: 1.15em;
	height: 1.15em;
	flex: none;
	vertical-align: -0.2em;
}

/* A button with an icon and a text: the two never touch (found by the showcase, P5). */
:is(.button-primary, .button-quiet, .button-danger):has(> .icon + span) {
	display: inline-flex;
	gap: 6px;
	align-items: center;
}

.app-nav a {
	display: flex;
	align-items: center;
	gap: 10px;
}

.app-nav a .icon {
	opacity: 0.85;
}

.app-nav a[aria-current] .icon {
	opacity: 1;
	color: var(--accent);
}

.nav-fold {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 var(--space-sm);
}

body.page-app[data-nav="folded"] {
	grid-template-columns: 60px minmax(0, 1fr);
}

body[data-nav="folded"] .app-nav-label,
body[data-nav="folded"] .nav-label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

body[data-nav="folded"] .app-nav ul + .app-nav-label,
body[data-nav="folded"] .app-nav ul + ul {
	margin-top: var(--space-sm);
	padding-top: var(--space-sm);
	border-top: 1px solid rgba(255, 255, 255, 0.08);
}

body[data-nav="folded"] .app-nav a {
	justify-content: center;
	padding: 8px 0;
}

.shell-find {
	display: inline-flex;
	align-items: center;
	gap: var(--space-sm);
	margin-left: auto;
	color: var(--color-text-secondary);
}

.shell-find kbd {
	padding: 0 5px;
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-sm);
	font: inherit;
	font-size: 11px;
}

.shell-find + .company-switcher {
	margin-left: 0;
}

.finder-list {
	display: flex;
	flex-direction: column;
	gap: 2px;
	max-height: 50vh;
	overflow: auto;
	margin: var(--space-sm) 0 0;
	padding: 0;
	list-style: none;
}

.finder-item {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	width: 100%;
	min-height: 34px;
	padding: 0 var(--space-sm);
	border: 0;
	border-radius: var(--radius-md);
	background: transparent;
	color: var(--color-text-primary);
	text-align: left;
}

.finder-item:hover,
.finder-list li[aria-selected="true"] .finder-item {
	background: var(--color-surface-subtle);
}

@media (max-width: 820px) {
	body.page-app[data-nav="folded"] {
		grid-template-columns: 1fr;
	}

	.shell-find span,
	.shell-find kbd {
		display: none;
	}
}

/* Lists (plan P4): quick and saved views as pills, the list's actions at the end of the same row, active filters as
   chips that remove themselves, sortable headers. */
.list-tools {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-sm) var(--space-md);
}

.list-tools > .filter-search,
.list-tools > input[type="search"] {
	flex: 0 1 18rem;
	min-width: 12rem;
	margin: 0;
}

.view-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 2px;
	padding: 3px;
	background: var(--color-surface-subtle);
	border: 1px solid var(--color-border-default);
	border-radius: 9px;
	flex: 0 1 auto;
	min-width: 0;
}

.view-pill {
	display: inline-flex;
	align-items: center;
	border-radius: 6px;
}

/* The search, the quick views and the actions share one row; on narrower screens the actions stay beside the search
   and the quick views take the line below. The person's saved views have their own row, only when there are some. */
.list-words {
	margin-top: var(--space-sm);
}

.list-words-input {
	width: 100%;
}

.list-tools-block {
	display: grid;
	gap: var(--space-sm);
}

.saved-views {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-sm);
}

.saved-views[hidden] {
	display: none;
}

.saved-views-label {
	color: var(--color-text-secondary);
	font-size: var(--type-size-caption);
	font-weight: var(--type-weight-medium);
}

@media (max-width: 1180px) {
	.list-tools > .view-pills {
		order: 3;
	}
}

.view-pill-button {
	padding: 5px 12px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--color-text-secondary);
	font-size: 13px;
	font-weight: var(--type-weight-medium);
	cursor: pointer;
}

.view-pill[data-saved] .view-pill-button {
	padding-right: 4px;
}

.view-pill-button:hover {
	color: var(--color-text-primary);
	background: rgba(127, 145, 168, 0.12);
}

.view-pill-button[aria-pressed="true"] {
	color: var(--color-brand-primary);
	background: var(--color-surface-panel);
	box-shadow: 0 1px 2px rgba(22, 39, 63, 0.12);
}

.view-pill-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	align-self: center;
	margin-right: 4px;
	line-height: 0;
	padding: 4px;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: var(--color-text-muted);
	cursor: pointer;
}

.view-pill-remove:hover {
	color: var(--color-status-danger);
}

.list-tools-actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-xs);
	margin-left: auto;
}

.list-tools-actions .icon,
.filter-chip .icon,
.view-pill-remove .icon,
.sort-button .icon {
	width: 14px;
	height: 14px;
	flex: none;
}

.list-tools-actions button {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.filter-chips {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-xs) var(--space-sm);
}

.filter-chips[hidden] {
	display: none;
}

.filter-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 8px 3px 10px;
	border: 1px solid color-mix(in srgb, var(--color-link) 35%, transparent);
	border-radius: 999px;
	background: color-mix(in srgb, var(--color-link) 9%, var(--color-surface-panel));
	color: var(--color-text-primary);
	font-size: var(--type-size-caption);
	cursor: pointer;
}

.filter-chip:hover {
	border-color: var(--color-link);
}

.sort-button {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	cursor: pointer;
}

.sort-button .icon {
	opacity: 0.45;
}

th[aria-sort="ascending"] .sort-button .icon,
th[aria-sort="descending"] .sort-button .icon {
	opacity: 1;
	color: var(--color-brand-accent);
}

.num .sort-button {
	flex-direction: row-reverse;
}

.column-picker {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--space-xs) var(--space-lg);
}

.column-picker .check-row {
	margin: 0;
}

/* Accounting › Control accounts: themed cards of compact rows (owner, 26 Oct). The cards flow down two columns
   (three on very wide screens), so a short card never leaves a gap beside a long one. */
.control-groups {
	columns: 2 30rem;
	column-gap: var(--space-lg);
}

.control-groups > .books-section {
	break-inside: avoid;
	margin: 0 0 var(--space-lg);
	padding: var(--space-sm) var(--space-lg);
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
	box-shadow: var(--panel-shadow);
}

.control-groups > .books-section > .section-title {
	margin: 0;
	padding: var(--space-sm) 0;
	color: var(--color-brand-primary);
	border-bottom: 1px solid var(--color-border-default);
}

.control-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
	gap: var(--space-xs) var(--space-md);
	align-items: center;
	padding: var(--space-sm) 0;
	border-top: 1px solid var(--color-border-default);
}

.control-group > .section-title + .control-row,
.control-row-note + .control-row {
	border-top: 0;
}

.control-row-label {
	font-weight: var(--type-weight-medium);
}

.control-row-hint {
	margin: 2px 0 0;
	color: var(--color-text-muted);
	font-size: var(--type-size-caption);
	line-height: 1.35;
}

.control-row-note {
	margin: var(--space-sm) 0 0;
	padding: var(--space-sm) var(--space-md);
	border-radius: var(--radius-md);
	background: var(--color-surface-subtle);
	color: var(--color-text-secondary);
	font-size: var(--type-size-caption);
}

.control-row .inline-create > select {
	min-width: 0;
}

.support-view-divider {
	align-self: stretch;
	width: 1px;
	margin: 4px 4px;
	background: var(--color-border-default);
}

@media (max-width: 640px) {
	.control-row {
		grid-template-columns: 1fr;
	}
}

/* Settings: the section menu on the left, the chosen section on the right (plan P2, Settings template). */
.settings-layout {
	display: grid;
	grid-template-columns: 14rem minmax(0, 1fr);
	gap: var(--space-xl);
	align-items: start;
}

.settings-menu {
	position: sticky;
	top: var(--space-lg);
	display: grid;
	gap: var(--space-md);
	padding: var(--space-md);
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
	box-shadow: var(--panel-shadow);
}

.settings-menu-title {
	margin: 0 0 var(--space-sm);
	padding: 0 var(--space-sm);
	color: var(--color-text-muted);
	font-size: 11px;
	font-weight: var(--type-weight-bold);
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.settings-menu ul {
	display: grid;
	gap: 1px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.settings-menu-link {
	display: block;
	padding: 5px var(--space-sm);
	border-radius: var(--radius-md);
	color: var(--color-text-primary);
	font-size: 13px;
	text-decoration: none;
}

.settings-menu-link:hover {
	background: var(--color-surface-subtle);
}

.settings-menu-link[aria-current="page"] {
	background: color-mix(in srgb, var(--color-brand-accent) 14%, var(--color-surface-panel));
	box-shadow: inset 3px 0 0 var(--color-brand-accent);
	color: var(--color-brand-primary);
	font-weight: var(--type-weight-medium);
}

.settings-pane {
	display: grid;
	gap: var(--space-lg);
	min-width: 0;
}

.settings-me {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
	gap: var(--space-lg);
	align-items: start;
}

.settings-me > .panel {
	margin: 0;
}

@media (max-width: 900px) {
	.settings-layout {
		grid-template-columns: 1fr;
		gap: var(--space-lg);
	}

	.settings-menu {
		position: static;
		grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
	}
}

/* A hint under a check row or a definition list keeps the 8 px gap (spacing rule). */
.panel .check-row + .field-hint,
.panel .meta-list + .field-hint,
.meta-list + .plain-list {
	margin-top: var(--space-sm);
}

/* An explicit save button with a short note beside it, on one row. */
.form-save-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-sm) var(--space-md);
}

.form-save-row > .field-hint {
	margin: 0;
}

/* The user menu in the top bar (plan P3): who is signed in, account and language, appearance, sign out. */
.user-menu {
	position: relative;
}

.user-menu-button {
	display: inline-flex;
	align-items: center;
	gap: var(--space-sm);
	padding-left: 4px;
}

.user-avatar {
	display: inline-grid;
	place-items: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--color-brand-primary);
	color: var(--color-brand-on-primary);
	font-size: 12px;
	font-weight: var(--type-weight-bold);
}

.user-menu-name {
	max-width: 12rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.user-menu-button > .icon {
	width: 14px;
	height: 14px;
}

.user-menu-panel {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	z-index: 60;
	display: grid;
	gap: var(--space-xs);
	width: 19rem;
	padding: var(--space-sm);
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
	box-shadow: 0 12px 32px rgba(15, 25, 40, 0.18);
}

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

.user-menu-who {
	display: grid;
	gap: 2px;
	padding: var(--space-xs) var(--space-sm) var(--space-sm);
	border-bottom: 1px solid var(--color-border-default);
}

.user-menu-who > span {
	color: var(--color-text-secondary);
	font-size: var(--type-size-caption);
	overflow-wrap: anywhere;
}

.user-menu-item {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	width: 100%;
	min-height: 34px;
	padding: 6px var(--space-sm);
	border: 0;
	border-radius: var(--radius-md);
	background: transparent;
	color: var(--color-text-primary);
	font: inherit;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
}

.user-menu-item:hover {
	background: var(--color-surface-subtle);
}

.user-menu-item .icon,
.user-menu-choice .icon {
	width: 16px;
	height: 16px;
	flex: none;
}

.user-menu-choice {
	display: grid;
	gap: var(--space-xs);
	padding: var(--space-xs) var(--space-sm);
}

.user-menu-label {
	color: var(--color-text-muted);
	font-size: 11px;
	font-weight: var(--type-weight-bold);
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.user-menu-choice .view-pills {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 1fr;
}

.user-menu-choice .view-pill-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 5px 6px;
}

.user-menu-rule {
	margin: var(--space-xs) 0;
	border: 0;
	border-top: 1px solid var(--color-border-default);
}

.user-menu-signout {
	color: var(--color-status-danger);
}

@media (max-width: 900px) {
	.user-menu-name {
		display: none;
	}
}

/* Breadcrumbs on record pages (plan P3): where the record sits, each step a link back. */
.breadcrumbs ol {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-xs) var(--space-sm);
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 13px;
	color: var(--color-text-secondary);
}

.breadcrumbs li + li::before {
	content: '›';
	margin-right: var(--space-sm);
	color: var(--color-text-muted);
}

.breadcrumbs a {
	color: var(--color-link);
	text-decoration: none;
}

.breadcrumbs a:hover {
	text-decoration: underline;
}

.breadcrumbs [aria-current="page"] {
	color: var(--color-text-primary);
	font-weight: var(--type-weight-medium);
}

/* A record found by Ctrl/Cmd+K: what it is, after its name. */
.finder-meta {
	margin-left: auto;
	padding-left: var(--space-md);
	color: var(--color-text-muted);
	font-size: var(--type-size-caption);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Component showcase (plan P5, development only) */
.showcase-section {
	display: flex;
	flex-direction: column;
	gap: var(--space-md);
}

.showcase-row {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-sm);
	align-items: center;
}

.showcase-icons {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
	gap: var(--space-sm);
	margin: 0;
	padding: 0;
	list-style: none;
}

.showcase-icons li {
	display: flex;
	gap: var(--space-xs);
	align-items: center;
	color: var(--color-text-secondary);
	font-size: var(--type-size-caption);
}

/* Chart of accounts (27 October 2026): sub-accounts indented under their account; the template in use above the list */
.account-name[data-depth="1"] { padding-left: 1.25rem; }
.account-name[data-depth="2"] { padding-left: 2.5rem; }
.account-name[data-depth="3"],
.account-name[data-depth="4"],
.account-name[data-depth="5"],
.account-name[data-depth="6"] { padding-left: 3.75rem; }

.template-panel {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
}

.template-row {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-sm) var(--space-md);
	align-items: center;
	justify-content: space-between;
}

.template-row p {
	margin: 0;
}

/* Documents (D63) */
.dms-snippet {
	margin: var(--space-xs) 0 0;
	font-style: italic;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.dms-notes {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: var(--space-sm);
}

.dms-notes li {
	display: grid;
	gap: var(--space-sm);
	padding: var(--space-sm) var(--space-md);
	border-radius: var(--radius-md);
	background: var(--color-surface-subtle);
}

.dms-notes p {
	margin: 0;
	white-space: pre-wrap;
}

.dms-field-row {
	padding-bottom: var(--space-sm);
	border-bottom: 1px solid var(--color-border-default);
}

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

.dms-rows li {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm);
	padding: var(--space-sm) 0;
	border-top: 1px solid var(--color-border-default);
}

.dms-people summary {
	cursor: pointer;
	color: var(--color-text-link, inherit);
}

.dms-people-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: var(--space-xs) var(--space-lg);
	margin-top: var(--space-sm);
	max-height: 14rem;
	overflow-y: auto;
}

.dms-instructions {
	white-space: pre-wrap;
}

.dms-diff {
	font-family: var(--font-mono, ui-monospace, monospace);
	font-size: var(--type-size-caption, 0.875rem);
	max-height: 60vh;
	overflow: auto;
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
}

.dms-diff p {
	margin: 0;
	padding: 0 var(--space-sm);
	white-space: pre-wrap;
}

.dms-diff-added {
	background: color-mix(in srgb, var(--color-status-success) 14%, transparent);
}

.dms-diff-removed {
	background: color-mix(in srgb, var(--color-status-danger) 14%, transparent);
	text-decoration: line-through;
}

.dms-diff-skip {
	color: var(--color-text-secondary);
	font-style: italic;
}

.dms-stack {
	display: grid;
	gap: var(--space-sm);
}

.dms-stack p {
	margin: 0;
}

.dms-share-part + .dms-share-part {
	margin-top: var(--space-lg);
	padding-top: var(--space-lg);
	border-top: 1px solid var(--color-border-default);
}

/* The Documents editor (D63, D8): a toolbar over a sheet of paper. The sheet stays white with dark ink in dark mode
   too, because it is the letter as it will print. */
.editor {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
}

.editor-toolbar {
	position: sticky;
	top: 0;
	z-index: 2;
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-xxs);
	align-items: center;
	padding: var(--space-xs);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
	background: var(--color-surface-panel);
}

.editor-toolbar select {
	width: auto;
	min-width: 9rem;
}

.editor-tool {
	min-width: 2rem;
	height: 2rem;
	padding: 0 var(--space-xs);
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--color-text-primary);
	font-weight: var(--type-weight-medium);
	cursor: pointer;
}

.editor-tool:hover {
	background: var(--color-surface-subtle);
}

.editor-tool[aria-pressed="true"] {
	border-color: var(--color-brand-accent);
	background: var(--color-surface-subtle);
}

.editor-tool[data-tool="italic"] {
	font-style: italic;
}

.editor-tool[data-tool="underline"] {
	text-decoration: underline;
}

.editor-tool[data-tool="strike"] {
	text-decoration: line-through;
}

.editor-separator {
	width: 1px;
	height: 1.25rem;
	margin: 0 var(--space-xxs);
	background: var(--color-border-default);
}

.editor-page {
	padding: var(--space-xl);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
	background: #FFFFFF;
	color: #1B1F24;
}

.editor-body .ProseMirror {
	position: relative;
	white-space: pre-wrap;
	word-wrap: break-word;
	font-variant-ligatures: none;
	min-height: 22rem;
	max-width: 46rem;
	margin: 0 auto;
	outline: none;
	line-height: 1.55;
}

.editor-body .ProseMirror > * + * {
	margin-top: var(--space-sm);
}

.editor-body .ProseMirror p,
.editor-body .ProseMirror h1,
.editor-body .ProseMirror h2,
.editor-body .ProseMirror h3 {
	margin-bottom: 0;
}

.editor-body .ProseMirror blockquote {
	margin-left: 0;
	padding-left: var(--space-md);
	border-left: 3px solid #D9DDE3;
	color: #33425A;
	font-style: italic;
}

.editor-body .ProseMirror mark {
	background: #FDEAA7;
}

.editor-body .ProseMirror table {
	width: 100%;
	border-collapse: collapse;
}

.editor-body .ProseMirror th,
.editor-body .ProseMirror td {
	padding: var(--space-xs);
	border: 1px solid #C9D0DA;
	vertical-align: top;
}

.editor-body .ProseMirror th {
	background: #EEF2F8;
}

.editor-body .ProseMirror .selectedCell {
	background: #FFF4E5;
}

.editor-body .ProseMirror p.is-editor-empty:first-child::before {
	content: attr(data-placeholder);
	float: left;
	height: 0;
	color: #9AA1AC;
	pointer-events: none;
}

.editor-merge {
	display: inline-block;
	padding: 0 var(--space-xs);
	border: 1px solid #F6921E;
	border-radius: var(--radius-sm);
	background: #FFF4E5;
	color: #16273F;
	font-size: 0.92em;
	white-space: nowrap;
}

.editor-merge.ProseMirror-selectednode {
	outline: 2px solid #16273F;
}

.editor[data-editable="false"] .editor-page {
	background: #FCFCFD;
}
.editor-body .ProseMirror [data-text-align="left"] {
	text-align: left;
}

.editor-body .ProseMirror [data-text-align="center"] {
	text-align: center;
}

.editor-body .ProseMirror [data-text-align="right"] {
	text-align: right;
}

.editor-body .ProseMirror [data-text-align="justify"] {
	text-align: justify;
}

.editor-body .ProseMirror td > p,
.editor-body .ProseMirror th > p,
.editor-body .ProseMirror li > p {
	margin: 0;
}

.editor-body .ProseMirror .ProseMirror-gapcursor {
	display: none;
	position: absolute;
	pointer-events: none;
}

.editor-body .ProseMirror.ProseMirror-focused .ProseMirror-gapcursor {
	display: block;
}

.editor-body .ProseMirror .ProseMirror-gapcursor::after {
	content: "";
	display: block;
	position: absolute;
	top: -2px;
	width: 20px;
	border-top: 1px solid #1B1F24;
}

/* People › Time, Rota and Reviews (HRM H4). */
.hr-goal {
	display: grid;
	grid-template-columns: minmax(10rem, 2fr) minmax(8rem, 1fr) minmax(10rem, 2fr) auto;
	gap: var(--space-sm);
	align-items: center;
}

.column-stack:empty {
	display: none;
}

.dialog .hr-goal + .button-link,
.dialog .column-stack + .button-link {
	justify-self: start;
}

.hr-rota td {
	vertical-align: top;
}

.hr-shift {
	display: flex;
	flex-wrap: wrap;
	gap: 0 var(--space-xxs);
	align-items: baseline;
	white-space: nowrap;
}

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

.employee-review + .employee-review {
	margin-top: var(--space-lg);
	padding-top: var(--space-md);
	border-top: 1px solid var(--color-border-default);
}

@media (max-width: 720px) {
	.hr-goal {
		grid-template-columns: 1fr;
	}
}

/* Ask for help › My questions: rating a solved answer (support desk part 2, Agreed 2.19) */
.support-rating { padding-top: var(--space-sm); border-top: 1px solid var(--color-border-default); }
.support-rating-star { min-width: 40px; }
.support-rating-star[aria-pressed="true"] { background: var(--color-brand-accent); border-color: var(--color-brand-accent); color: var(--color-brand-on-accent); }

/* Practice list (Agreed 2.22): what waits at each client, one short line per kind */
.queue-attention { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.queue-attention li { margin: 0; white-space: nowrap; }
.queue-attention li[data-tone="danger"] strong { color: var(--color-status-danger); }
.queue-attention li[data-tone="warning"] strong { color: var(--color-status-warning); }
.queue-attention li[data-tone="success"] strong { color: var(--color-status-success); }
.grants-invitations { margin-top: var(--space-md); }

/* Report builder (Agreed 2.38): fields on the side, drop zones above the result; chips draggable or tapped. */
.rb-layout { display: grid; grid-template-columns: minmax(200px, 260px) 1fr; gap: var(--space-lg); align-items: start; }
.rb-main { display: grid; gap: var(--space-lg); min-width: 0; }
.rb-side .section-title { margin-top: var(--space-md); }
.rb-chips, .rb-zone-chips { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.rb-chips + .field-hint { margin-top: var(--space-sm); }
.rb-zones { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-md); margin-top: var(--space-md); }
.rb-zone { border: 1px dashed var(--color-border-default); border-radius: 8px; padding: var(--space-sm); min-height: 72px; display: grid; gap: var(--space-sm); align-content: start; }
.rb-zone.rb-over { border-color: var(--chart-series-1); background: color-mix(in srgb, var(--chart-series-1) 8%, transparent); }
.rb-zone-title { margin: 0; font-weight: var(--type-weight-medium); font-size: 13px; }
.rb-chip { display: inline-flex; align-items: center; gap: var(--space-xs); border: 1px solid var(--color-border-default); border-radius: 999px; padding: 2px var(--space-sm); background: var(--color-surface-panel); font-size: 13px; }
.rb-chip[data-kind='figure'] { border-color: color-mix(in srgb, var(--chart-series-1) 55%, var(--color-border-default)); }
.rb-source { cursor: grab; }
.rb-chip select, .rb-chip input { font-size: 12px; padding: 0 var(--space-xxs); }
.rb-filter { display: inline-flex; gap: var(--space-xxs); }
.rb-chip-remove { border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; color: var(--color-text-secondary); }
.rb-result { margin-top: var(--space-md); display: grid; gap: var(--space-md); }
.rb-table .rb-total th, .rb-table .rb-total td { font-weight: var(--type-weight-medium); border-top: 2px solid var(--color-border-default); }
@media (max-width: 860px) { .rb-layout { grid-template-columns: 1fr; } }
.chart.chart-donut { width: 240px; max-width: 100%; }
.rb-main .row-actions select { width: auto; }

/* The personal-return organiser (Agreed 2.40): figures beside the worksheet; on the person's page, one block per figure. */
.returns-layout { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.tax-organiser .tax-section { border-top: 1px solid var(--color-border-default); padding: var(--space-sm) 0; }
.tax-organiser .tax-section > summary { cursor: pointer; }
.tax-organiser .tax-section > summary .field-hint { display: block; margin-top: var(--space-xxs); }
.tax-organiser .tax-section[open] > summary { margin-bottom: var(--space-sm); }
.tax-organiser .tax-row + .tax-row { border-top: 1px dashed var(--color-border-default); padding-top: var(--space-sm); margin-top: var(--space-sm); }
.tax-organiser .tax-row-title { font-weight: 600; margin-bottom: var(--space-xs); }
@media (max-width: 860px) { .returns-layout { grid-template-columns: 1fr; } }
.returns-layout .data-table .select-search { min-width: 14rem; }
.returns-layout .data-table input[inputmode="decimal"] { width: 7.5rem; text-align: right; }
.returns-layout .data-table td { white-space: nowrap; }

/* The AML client file (Agreed 2.39): score and log beside the checklist and parties; services and flags in columns. */
.aml-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.aml-column { display: grid; gap: var(--space-md); align-content: start; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: var(--space-xxs) var(--space-md); }
.check-grid .check-row + .check-row { margin-top: 0; }
.aml-checklist li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); }
.aml-checklist .inline-label { flex: 1 1 14rem; }
.aml-figures { columns: 3 18rem; column-gap: var(--space-md); margin-bottom: var(--space-md); }
.aml-figures > .panel { break-inside: avoid; margin: 0 0 var(--space-md); }
.aml-year { width: auto; min-width: 7rem; }
.pre-wrap { white-space: pre-wrap; }
@media (max-width: 960px) { .aml-layout { grid-template-columns: 1fr; } }

/* The AML onboarding form (Agreed 2.41): the client's page, one block per officer, partner or bank. */
.aml-onboarding { max-width: 56rem; }
.aml-onboarding .aml-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: var(--space-xs) var(--space-md); align-items: start; }
.aml-onboarding .aml-grid > .aml-choice, .aml-onboarding .aml-grid > fieldset, .aml-onboarding .aml-grid > .aml-field:has(textarea) { grid-column: 1 / -1; }
.aml-onboarding .aml-block { border: 1px solid var(--color-border-default); border-radius: var(--radius-md, 8px); padding: var(--space-sm) var(--space-md); margin-bottom: var(--space-sm); display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: var(--space-xs) var(--space-md); align-items: start; }
.aml-onboarding .aml-block > .aml-block-head, .aml-onboarding .aml-block > .notice, .aml-onboarding .aml-block > fieldset, .aml-onboarding .aml-block > .aml-invite, .aml-onboarding .aml-block > .aml-field:has(textarea), .aml-onboarding .aml-block > .aml-file { grid-column: 1 / -1; }
.aml-onboarding .aml-block-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-sm); }
.aml-onboarding .aml-block-head h3 { margin: 0; }
.aml-onboarding .aml-choice { border: 0; padding: 0; margin: 0; }
.aml-onboarding .aml-options { display: flex; flex-wrap: wrap; gap: var(--space-xxs) var(--space-md); }
.aml-onboarding .aml-options .check-row { margin: 0; }
.aml-onboarding .aml-amounts { display: grid; grid-template-columns: minmax(10rem, 1fr) minmax(6rem, 10rem); gap: var(--space-xxs) var(--space-sm); align-items: center; }
.aml-onboarding .aml-invite { border-top: 1px dashed var(--color-border-default); padding-top: var(--space-xs); }
.aml-onboarding .aml-invite-row { display: flex; gap: var(--space-xs); }
.aml-onboarding .aml-invite-row input { flex: 1; }
.aml-onboarding .aml-actions { display: flex; gap: var(--space-sm); flex-wrap: wrap; padding: var(--space-sm) 0; }
@media (min-width: 720px) { .aml-onboarding .aml-actions { position: sticky; bottom: 0; background: var(--color-surface, #fff); border-top: 1px solid var(--color-border-default); } }
.aml-onboarding .aml-papers-needed { margin-bottom: var(--space-sm); }
.aml-onboarding [hidden] { display: none !important; }
.aml-password { font-family: var(--font-mono, ui-monospace, monospace); font-size: 1.25rem; letter-spacing: 0.08em; }
.aml-review-block + .aml-review-block { border-top: 1px solid var(--color-border-default); margin-top: var(--space-sm); padding-top: var(--space-sm); }
.aml-expiring li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xxs); }
.aml-review { columns: 2 26rem; column-gap: var(--space-md); }
.aml-review > .panel { break-inside: avoid; margin: 0 0 var(--space-md); }
.aml-review .meta-list { grid-template-columns: minmax(9rem, 2fr) minmax(0, 3fr); }
.aml-stack { display: grid; gap: var(--space-sm); align-content: start; }
.aml-stack .field-hint + .form-grid, .aml-stack .field-hint + .meta-list { margin-top: var(--space-sm); }

/* DueCheck (Agreed 2.42): screenings with their hits; the decisions sit beside each hit. */
.duecheck-list > li + li { border-top: 1px solid var(--color-border-default); padding-top: var(--space-sm); margin-top: var(--space-sm); }
.duecheck-hits { margin: var(--space-sm) 0 0 var(--space-md); }
.duecheck-hits li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); }
.duecheck-actions { display: inline-flex; gap: var(--space-sm); }
.duecheck-band { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); }
.duecheck-note:empty { display: none; }
.duecheck-note { margin-top: var(--space-xs); }

/* ==================================================================================================================
   Design refresh (Agreed 2.45, owner 31 October 2026), after the "OnPraxia by IXXO admin" boards in DOCS/design:
   the same app and class names, a calmer, roomier finish. Rules here come last on purpose, so this layer can be read
   (and, if ever needed, removed) on its own. Room around buttons is a rule: at least 12px from the edge of their box,
   8px between buttons (tools/dev/button-spacing-audit.js checks it).
   ================================================================================================================== */

/* Inter's font faces and the control height come from controls.css, shared with the Console. */

:root {
	--inset: 20px;
	--button-gap: var(--space-sm);
	--soft-success: #E3F3EA;
	--soft-warning: #FDF0E1;
	--soft-danger: #FCEAE8;
	--soft-info: #E8F0FA;
	--row-danger: #FEF6F5;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--soft-success: rgba(92, 201, 138, 0.14);
		--soft-warning: rgba(224, 178, 82, 0.14);
		--soft-danger: rgba(242, 133, 125, 0.14);
		--soft-info: rgba(127, 176, 240, 0.14);
		--row-danger: rgba(242, 133, 125, 0.07);
	}
}

:root[data-theme="dark"] {
	--soft-success: rgba(92, 201, 138, 0.14);
	--soft-warning: rgba(224, 178, 82, 0.14);
	--soft-danger: rgba(242, 133, 125, 0.14);
	--soft-info: rgba(127, 176, 240, 0.14);
	--row-danger: rgba(242, 133, 125, 0.07);
}

/* Type: Inter from this server; figures line up in tables and totals */
body {
	font-family: "Inter", system-ui, -apple-system, "Segoe UI", "Noto Sans", sans-serif;
	font-feature-settings: "cv11";
}

.num,
.data-table td.num,
.kpi-value,
.attention-count,
.activity-amount {
	font-variant-numeric: tabular-nums;
}

/* Boxes keep their content off the edges */
.panel {
	padding: var(--inset);
}

.panel > .row-actions:last-child,
.panel > .button-row:last-child {
	margin-top: var(--space-lg);
}

.row-actions,
.page-header .page-actions,
.list-tools-actions {
	gap: var(--button-gap);
}

/* The menu stays in place and scrolls on its own, so the last group is always in reach */
@media (min-width: 821px) {
	.page-app > .app-nav {
		position: sticky;
		top: 0;
		align-self: start;
		height: 100vh;
		overflow-y: auto;
		overscroll-behavior: contain;
		scrollbar-width: thin;
		scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
	}

	body:not([data-nav="folded"]) .app-nav ul.nav-closed {
		display: none;
	}
}

/* Jump to a page */
.nav-jump {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	margin: var(--space-xs) var(--space-sm) var(--space-sm);
	padding: 0 var(--space-sm);
	min-height: 34px;
	border: 1px solid rgba(255, 255, 255, 0.10);
	border-radius: var(--radius-md);
	background: rgba(255, 255, 255, 0.05);
	color: var(--rail-muted);
}

.nav-jump:focus-within {
	border-color: var(--accent);
}

.nav-jump-input {
	flex: 1;
	min-width: 0;
	padding: 6px 0;
	border: 0;
	background: transparent;
	color: #FFFFFF;
	font: inherit;
	font-size: 13px;
}

.nav-jump-input::placeholder {
	color: var(--rail-muted);
}

.nav-jump-input:focus {
	outline: none;
}

.nav-jump kbd {
	padding: 0 5px;
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: var(--radius-sm);
	font: inherit;
	font-size: 11px;
}

.app-nav li[data-jump-hidden],
.app-nav .app-nav-label[data-jump-hidden] {
	display: none;
}

/* Pinned pages and the pin beside each entry */
.app-nav li {
	position: relative;
}

.nav-pin {
	position: absolute;
	top: 50%;
	right: 6px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	border-radius: var(--radius-sm);
	background: var(--rail-bg);
	color: var(--rail-muted);
	opacity: 0;
	transform: translateY(-50%);
	transition: opacity var(--motion-fast);
}

.nav-pin .icon {
	width: 14px;
	height: 14px;
}

.app-nav li:hover > .nav-pin,
.nav-pin:focus-visible,
.nav-pin[aria-pressed="true"] {
	opacity: 1;
}

.nav-pin[aria-pressed="true"] {
	color: var(--accent);
}

.nav-pin:hover {
	background: var(--rail-hover);
	color: #FFFFFF;
}

.nav-pins ul a {
	padding-right: var(--space-md);
}

/* Group headings fold their group */
.nav-group-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	cursor: pointer;
}

.nav-group-toggle .icon {
	width: 12px;
	height: 12px;
	transition: transform var(--motion-fast);
}

.nav-group-toggle[aria-expanded="false"] .icon {
	transform: rotate(-90deg);
}

.nav-group-toggle:hover {
	color: var(--rail-text);
}

body[data-nav="folded"] .nav-jump,
body[data-nav="folded"] .nav-pin,
body[data-nav="folded"] .nav-pins .app-nav-label {
	display: none;
}

@media (max-width: 820px) {
	.nav-jump,
	.nav-pin,
	.nav-pins {
		display: none;
	}

}

/* Dashboard: the figures in one row, then "Needs attention" beside the charts, two by two */
.dash-attention-host > .panel,
.dash-attention {
	height: auto;
}

.kpi-grid {
	grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
	gap: var(--space-md);
	margin-bottom: var(--space-md);
}

.kpi-tile {
	justify-content: flex-start;
	gap: var(--space-xs);
	padding: var(--space-lg) var(--inset);
}

.kpi-value {
	font-size: 26px;
	letter-spacing: -0.02em;
}

.dash-board {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--space-md);
	align-items: stretch;
	margin-bottom: var(--space-md);
}

.dash-charts {
	display: contents;
}

.dash-board > .dash-attention-host > .panel {
	height: 100%;
	box-sizing: border-box;
}

.dash-board .glance-card {
	padding: var(--space-lg) var(--inset);
}

@media (max-width: 1100px) {
	.dash-board {
		grid-template-columns: 1fr;
	}
}

.attention-list {
	gap: var(--space-sm);
}

.attention-list > li {
	gap: var(--space-md);
	padding: var(--space-md) var(--space-md) var(--space-md) var(--space-lg);
}

/* Sales list: one main chip and a quiet line, the due date with how far off it is, late rows tinted */
.status-summary {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 3px;
}

.status-more,
.cell-note {
	color: var(--color-text-secondary);
	font-size: 12px;
	line-height: 1.3;
}

.cell-stack {
	display: inline-flex;
	flex-direction: column;
	gap: 2px;
}

.cell-note[data-tone="danger"] {
	color: var(--color-status-danger);
	font-weight: var(--type-weight-medium);
}

.cell-note[data-tone="warning"] {
	color: var(--color-status-warning);
	font-weight: var(--type-weight-medium);
}

.data-table tbody tr[data-tone="danger"] > * {
	background: var(--row-danger);
}

.party-cell {
	display: inline-flex;
	align-items: center;
	gap: var(--space-sm);
}

.party-initials {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--color-surface-subtle);
	color: var(--color-text-secondary);
	font-size: 10.5px;
	font-weight: var(--type-weight-bold);
	letter-spacing: 0.02em;
}

.chip[data-tone="success"] {
	background: var(--soft-success);
	border-color: transparent;
}

.overdue-strip {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-sm) var(--space-md);
	margin: var(--space-md) 0;
	padding: var(--space-md) var(--space-md) var(--space-md) var(--space-lg);
	border: 1px solid color-mix(in srgb, var(--color-status-danger) 30%, transparent);
	border-left: 3px solid var(--color-status-danger);
	border-radius: var(--radius-md);
	background: var(--soft-danger);
}

.overdue-strip[hidden] {
	display: none;
}

.overdue-strip-icon {
	display: inline-flex;
	color: var(--color-status-danger);
}

.overdue-strip-text {
	flex: 1;
	min-width: 12rem;
}

.overdue-strip-text strong {
	color: var(--color-status-danger);
}

/* A field with its buttons on one line (Settings › Security, the PIN), wrapping with room when narrow */
.form-row {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: var(--space-md);
}

/* A dialog's fields, then the check boxes under them: never touching */
.form-grid + .check-row,
.form-grid + div,
.form-grid + p {
	margin-top: var(--space-md);
}

.check-row + .field-hint {
	margin-top: var(--space-sm);
}

/* The letter editor's toolbar: one control, but its buttons and its frame get room too */
.editor-toolbar {
	gap: 6px;
	padding: var(--space-sm);
}

/* Utility bill details in the click-to-fill form (Agreed 2.46): a fold with the account, period and other amounts */
.take-extra {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
	margin: var(--space-sm) 0;
	padding: var(--space-sm) var(--space-md);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
	background: var(--color-surface-subtle);
}

.take-extra > summary {
	cursor: pointer;
	font-weight: var(--type-weight-medium);
}

.take-extra[open] > summary {
	margin-bottom: var(--space-sm);
}

.take-extra .field-hint {
	margin: 0 0 var(--space-sm);
}

/* Without a page picture the form is a grid: the utility fold takes the whole row, its fields on the same grid */
.take-layout-fields .take-extra {
	grid-column: 1 / -1;
}

.take-extra-fields {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
}

.take-layout-fields .take-extra-fields {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
	gap: var(--space-sm) var(--space-md);
	align-items: end;
}

/* The part of the net with no VAT, shown under the net as a part of it */
.totals-list .totals-part {
	color: var(--color-text-secondary);
	font-size: 13px;
	padding-left: var(--space-md);
}

/* ==================================================================================================================
   Reports (Agreed 2.47, owner 31 October 2026): answers first, a proper heading, Tabulator in the app's look, clean
   A4 printing; and buttons less rounded across the app ("buttons must be not so much rounded with the new template").
   ================================================================================================================== */

button,
.button-primary,
.button-quiet,
.button-small,
a.button-primary,
a.button-quiet,
.rb-chip {
	border-radius: var(--radius-sm);
}

/* Ask a question */
.report-ask {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	margin: var(--space-sm) 0;
}

.report-ask input {
	flex: 1;
	min-width: 0;
	font-size: 15px;
}

.report-ask-icon {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--soft-info);
	color: var(--color-link);
	font-weight: var(--type-weight-bold);
}

/* The reports as questions, by group */
.report-group {
	margin-top: var(--space-xl);
}

.report-group > .section-title {
	margin: 0 0 var(--space-md);
}

.report-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: var(--space-md);
}

.report-card {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
	padding: var(--space-lg) var(--inset);
	border: 1px solid var(--color-border-default);
	border-left: 3px solid var(--color-link);
	border-radius: var(--radius-md);
	background: var(--color-surface-panel);
	box-shadow: var(--panel-shadow);
	color: var(--color-text-primary);
	text-decoration: none;
	transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}

.report-card:hover,
.report-card:focus-visible {
	border-color: var(--color-link);
	box-shadow: 0 4px 14px rgba(22, 39, 63, 0.10);
}

.report-card-own {
	border-left-color: var(--accent);
}

.report-card-title {
	font-weight: var(--type-weight-bold);
	font-size: 15px;
}

.report-card-about {
	color: var(--color-text-secondary);
	font-size: 13px;
	line-height: 1.4;
}

/* One report: the heading under the title, the period and when it was run */
.report-meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-xs) var(--space-lg);
	margin: var(--space-md) 0;
	color: var(--color-text-secondary);
	font-size: 13px;
}

.report-meta p {
	margin: 0;
}

.report-company {
	color: var(--color-text-primary);
	font-weight: var(--type-weight-bold);
}

.report-filters {
	margin-bottom: var(--space-md);
}

.report-empty {
	padding: var(--space-xl) var(--inset);
	border: 1px dashed var(--color-border-default);
	border-radius: var(--radius-md);
	background: var(--color-surface-panel);
	text-align: center;
}

.report-empty .row-actions {
	justify-content: center;
	margin-top: var(--space-md);
}

.report-empty-title {
	margin: 0 0 var(--space-xs);
	font-weight: var(--type-weight-bold);
}

/* Tabulator in the app's look */
.report-table.tabulator {
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
	background: var(--color-surface-panel);
	font-family: inherit;
	font-size: 14px;
	color: var(--color-text-primary);
}

.report-table.tabulator .tabulator-header {
	border-bottom: 1px solid var(--color-border-default);
	background: var(--color-surface-subtle);
	color: var(--color-text-secondary);
}

.report-table.tabulator .tabulator-header .tabulator-col {
	background: var(--color-surface-subtle);
	border-right: 1px solid var(--color-border-default);
}

.report-table.tabulator .tabulator-header .tabulator-col .tabulator-col-title {
	font-size: 11.5px;
	font-weight: var(--type-weight-bold);
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.report-table.tabulator .tabulator-row {
	border-bottom: 1px solid var(--color-border-default);
	background: var(--color-surface-panel);
}

.report-table.tabulator .tabulator-row.tabulator-row-even {
	background: color-mix(in srgb, var(--color-surface-subtle) 45%, var(--color-surface-panel));
}

.report-table.tabulator .tabulator-row:hover {
	background: var(--soft-info);
}

.report-table.tabulator .tabulator-row .tabulator-cell {
	padding: 8px var(--space-md);
	border-right: 1px solid color-mix(in srgb, var(--color-border-default) 50%, transparent);
}

.report-table.tabulator .tabulator-row .tabulator-cell.num {
	font-variant-numeric: tabular-nums;
}

.report-table.tabulator .tabulator-frozen {
	background: inherit;
}

.report-table.tabulator .tabulator-calcs-holder,
.report-table.tabulator .tabulator-calcs-holder .tabulator-row {
	border-top: 2px solid var(--color-text-primary);
	background: var(--color-surface-subtle);
	font-weight: var(--type-weight-bold);
}

.report-table.tabulator .tabulator-col-resize-handle:hover {
	background: var(--color-link);
	opacity: 0.4;
}

/* Print: the report alone (made just before printing: the Print button or the browser's own), heading, every row,
   totals; a report with many columns prints across the page */
.report-print {
	display: none;
}

@media print {
	@page {
		size: A4;
		margin: 12mm;
	}

	@page wide {
		size: A4 landscape;
		margin: 10mm;
	}

	body.report-printing > :not(.report-print) {
		display: none !important;
	}

	body.report-printing {
		display: block;
		background: #FFFFFF;
	}

	.report-print {
		display: block;
		color: #1B1F24;
		font-family: "Inter", system-ui, sans-serif;
	}

	.report-print-wide {
		page: wide;
	}

	.report-print-heading {
		margin-bottom: 10px;
	}

	.report-print-heading h1 {
		margin: 2px 0;
		font-size: 17px;
	}

	.report-print-heading p {
		margin: 0;
		font-size: 10px;
		color: #5A6270;
	}

	.report-print-heading .report-print-company {
		color: #1B1F24;
		font-weight: 700;
	}

	.report-print-table {
		width: 100%;
		border-collapse: collapse;
		font-size: 9.5px;
		font-variant-numeric: tabular-nums;
	}

	.report-print-table thead {
		display: table-header-group;
	}

	.report-print-table th,
	.report-print-table td {
		padding: 3px 5px;
		border-bottom: 0.5px solid #C9CED6;
		text-align: left;
		vertical-align: top;
	}

	.report-print-table .num {
		text-align: right;
		white-space: nowrap;
	}

	.report-print-table th {
		border-bottom: 1px solid #1B1F24;
		font-size: 8px;
		letter-spacing: 0.04em;
		text-transform: uppercase;
	}

	.report-print-table tr {
		break-inside: avoid;
	}

	.report-print-table tfoot td {
		border-top: 1px solid #1B1F24;
		border-bottom: 0;
		font-weight: 700;
	}
}

/* The report as one sentence: words and choices on one line, wrapping as needed */
.rb-sentence {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-sm) var(--space-sm);
	margin: var(--space-sm) 0 var(--space-md);
	font-size: 16px;
}

.rb-sentence select {
	width: auto;
	min-width: 0;
	max-width: 18rem;
	font-size: 15px;
	font-weight: var(--type-weight-medium);
}

.rb-word {
	color: var(--color-text-secondary);
}

.rb-more {
	color: var(--color-link);
	font-size: 13px;
}

.rb-sentence-panel .report-ask {
	margin-top: var(--space-md);
	padding-top: var(--space-md);
	border-top: 1px solid var(--color-border-default);
}

.rb-fine > summary {
	cursor: pointer;
	font-weight: var(--type-weight-bold);
}

.rb-fine[open] > summary {
	margin-bottom: var(--space-sm);
}

.rb-fine .rb-layout {
	margin-top: var(--space-md);
}

/* Advanced analysis: Perspective fills the space below its bar */
.advanced-stage {
	height: 72vh;
	min-height: 420px;
	margin-top: var(--space-md);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
	background: var(--color-surface-panel);
	overflow: hidden;
}

.panel > .advanced-status {
	margin: var(--space-md) 0 0;
}

.advanced-viewer {
	--psp-interface-monospace--font-family: "Inter", system-ui, sans-serif;
	--psp-font-family: "Inter", system-ui, sans-serif;
	font-family: "Inter", system-ui, sans-serif;
	display: block;
	width: 100%;
	height: 100%;
}

/* Statements for accountants (Agreed 3.30): the basis under the period, the chart beside a statement, What changed? */
.report-basis {
	margin: 0;
	color: var(--color-text-secondary);
	font-size: 13px;
}

.statement-chart:empty {
	display: none;
}

.what-changed-summary {
	margin: 0;
	font-weight: var(--type-weight-medium);
}

.what-changed-list,
.what-changed-entries {
	margin: 0;
	padding-left: var(--space-lg);
	display: grid;
	gap: var(--space-sm);
}

.what-changed-driver p {
	margin: 0;
}

.what-changed-entries {
	margin-top: var(--space-sm);
	gap: var(--space-xs);
	color: var(--color-text-secondary);
	font-size: 13px;
}

/* Compared statements: the sections' tables share their column widths, so the figures line up from table to table. */
.data-table.statement-table {
	table-layout: fixed;
}

.data-table.statement-table th:first-child {
	width: 34%;
}

.report-chart:empty {
	display: none;
}

/* A client pack's issued versions (Agreed 3.30). */
.pack-issues {
	display: grid;
	gap: var(--space-sm);
	margin: 0;
	padding: 0;
	list-style: none;
}

.pack-issues:empty {
	display: none;
}

.pack-issue {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm) var(--space-md);
	padding: 12px var(--space-md);
	border: 1px solid var(--color-border-default);
	border-radius: var(--control-radius);
}

.form-section .payroll-checks + .field {
	margin-top: var(--space-md);
}

.pack-issue p {
	margin: 0;
}

/* The "+ New" beside a field's label sits higher than the label: room above it inside a filter box (12px from the edge). */
.filter-bar:has(.inline-create-button) {
	padding-top: calc(var(--space-md) + 4px);
}

/* Control accounts: "+ New" as tall as the dropdown beside it, on one line with it. */
.control-row .inline-create-button {
	min-height: var(--control-h);
}

.control-row .inline-create {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
}

/* A statement's downloads: words on one line; the group takes its own row when the filter box is full. */
.accounting-downloads button {
	white-space: nowrap;
}

.filter-bar > .accounting-downloads {
	flex: 0 0 auto;
	flex-direction: row;
	flex-wrap: nowrap;
}

/* The dashboard's band (owner, 31 October 2026: "boring"): the period's figures and its two-sided chart on the brand's
   ink, the one strong thing on the page; it joins the ink of the menu beside it. Its colours are its own, in both themes:
   each reads at 6.5:1 or better on the ink, and the two chart sides differ in place as well as hue. */
.dash-band {
	--band-ink: #16273F;
	--band-line: rgba(255, 255, 255, 0.14);
	--band-text: #FFFFFF;
	--band-quiet: #AEB9C7;
	--band-above: #7CC4F5;
	--band-below: #F6921E;
	display: grid;
	gap: var(--space-md);
	padding: var(--space-lg) var(--inset);
	margin-bottom: var(--space-md);
	background: var(--band-ink);
	color: var(--band-text);
	border-radius: var(--control-radius, 4px);
}

.dash-band[hidden] {
	display: none;
}

.dash-period {
	margin: 0;
	color: var(--band-quiet);
	font-size: var(--font-size-small, 13px);
}

.dash-band .kpi-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 0;
	margin: 0;
}

.dash-band .kpi-tile {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
	padding: 4px var(--space-md);
	background: none;
	border: 0;
	border-left: 1px solid var(--band-line);
	border-radius: 0;
	box-shadow: none;
	color: var(--band-text);
	text-decoration: none;
}

.dash-band .kpi-tile:first-child {
	padding-left: 0;
	border-left: 0;
}

.dash-band .kpi-tile:hover {
	background: none;
	transform: none;
	box-shadow: none;
}

.dash-band .kpi-tile:hover .kpi-value {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 4px;
	text-decoration-color: var(--band-below);
}

.dash-band .kpi-tile:focus-visible {
	outline: 2px solid var(--band-text);
	outline-offset: 2px;
}

.dash-band .kpi-label {
	color: var(--band-quiet);
}

.dash-band .kpi-value {
	color: var(--band-text);
	font-size: 26px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.dash-band .kpi-value[data-zero="true"] {
	color: var(--band-quiet);
}

.dash-band .kpi-sub {
	color: var(--band-quiet);
	font-size: var(--font-size-small, 13px);
}

.dash-band .kpi-sub[data-tone="success"] {
	color: #6FD39A;
}

.dash-band .kpi-sub[data-tone="danger"] {
	color: #FF9B8F;
}

.dash-band .kpi-sub[data-tone="warning"] {
	color: #FFC56B;
}

.sparkline {
	display: block;
	width: 100%;
	height: 32px;
	margin-top: auto;
	overflow: visible;
}

.sparkline polyline {
	fill: none;
	vector-effect: non-scaling-stroke;
	stroke-linejoin: round;
	stroke-linecap: round;
}

.sparkline-now {
	stroke: var(--band-above);
	stroke-width: 2px;
}

.sparkline-before {
	stroke: var(--band-quiet);
	stroke-width: 1px;
	opacity: 0.6;
}

.kpi-split {
	display: block;
	height: 6px;
	margin: auto 0 13px;
	background: var(--band-line);
	border-radius: 3px;
	overflow: hidden;
}

.kpi-late {
	display: block;
	height: 100%;
	background: #FFC56B;
}

.dash-flow {
	padding-top: var(--space-md);
	border-top: 1px solid var(--band-line);
}

.dash-flow-empty {
	margin: 0;
	color: var(--band-quiet);
}

.dash-band .chart-caption {
	color: var(--band-text);
}

.dash-band .chart-tick {
	fill: var(--band-quiet);
}

.dash-band .chart-baseline {
	stroke: var(--band-quiet);
	stroke-width: 1px;
}

.dash-band .chart-legend {
	color: var(--band-quiet);
}

.dash-band .chart-mark[data-slot="above"],
.dash-band .chart-swatch[data-slot="above"] {
	fill: var(--band-above);
	background: var(--band-above);
}

.dash-band .chart-mark[data-slot="below"],
.dash-band .chart-swatch[data-slot="below"] {
	fill: var(--band-below);
	background: var(--band-below);
}

.dash-band .chart-table summary {
	color: var(--band-quiet);
}

.dash-band .chart-table .table-scroll {
	margin-top: var(--space-sm);
	color: var(--color-text-primary);
	background: var(--color-surface-panel);
	border-radius: var(--control-radius, 4px);
}

.dash-band .chart-hit:focus-visible {
	outline: 2px solid var(--band-text);
}

.dash-board {
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
	align-items: stretch;
}

/* The last card of each column takes what is left, so both end level. */
.dash-column > :last-child,
.dash-charts-host:last-child > :last-child {
	flex: 1 1 auto;
}

.dash-charts-host {
	display: flex;
	flex-direction: column;
	gap: var(--space-md);
	flex: 0 0 auto;
	min-width: 0;
}

.dash-charts-host:empty {
	display: none;
}

.dash-charts-host:has(+ .dash-charts-host:empty),
.dash-charts-host:last-child {
	flex: 1 1 auto;
}

.dash-charts-host:has(+ .dash-charts-host:empty) > :last-child {
	flex: 1 1 auto;
}

.dash-pinned-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm);
	margin-bottom: var(--space-sm);
	font-weight: 600;
}

.dash-column > div:last-child > .panel {
	height: 100%;
	box-sizing: border-box;
}

.dash-column,
.dash-charts {
	display: flex;
	flex-direction: column;
	gap: var(--space-md);
	min-width: 0;
}

.dash-charts .glance-card {
	box-sizing: border-box;
	padding: var(--space-lg) var(--inset);
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-radius: var(--control-radius, 4px);
}

.dash-activity .activity-list > li {
	grid-template-columns: auto minmax(0, 1fr) auto;
}

.dash-activity .activity-list > li {
	row-gap: 8px;
	align-items: baseline;
}

.activity-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.dash-activity .activity-party {
	color: var(--color-text-muted);
	font-size: var(--font-size-small, 13px);
}

.dash-activity .activity-party:empty {
	display: none;
}


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

@media (max-width: 820px) {
	.dash-activity .activity-list > li {
		grid-template-columns: minmax(0, 1fr) auto;
	}

	.dash-activity .activity-time {
		grid-column: 1 / -1;
	}
}

@media (max-width: 640px) {
	.dash-band .kpi-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		row-gap: var(--space-md);
	}

	.dash-band .kpi-tile:nth-child(odd) {
		padding-left: 0;
		border-left: 0;
	}
}

/* Loading (To_Do 2.1): nothing for a quick answer; after 300 ms the lines of what is coming, so a wait looks like work and
   the page doesn't jump when it arrives. */
.loading-state {
	display: grid;
	gap: var(--space-sm);
	border-style: solid;
	opacity: 0;
	animation: loading-appear 1ms linear 300ms forwards;
}

.loading-line {
	display: block;
	height: 12px;
	border-radius: 3px;
	background: var(--color-surface-subtle);
}

.loading-line:nth-of-type(2) {
	width: 72%;
}

.loading-line:nth-of-type(3) {
	width: 48%;
}

@keyframes loading-appear {
	to {
		opacity: 1;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.loading-line {
		animation: loading-pulse 1.4s ease-in-out 300ms infinite;
	}
}

@keyframes loading-pulse {
	50% {
		opacity: 0.45;
	}
}

.toast-undo {
	margin-left: var(--space-sm);
	font-weight: 600;
}

/* A form on a public page (the security page): each field full width, room around the button. */
.portal-form {
	display: grid;
	gap: var(--space-md);
	margin-bottom: var(--space-lg);
}

.portal-form label {
	display: grid;
	gap: var(--space-xs);
}

.portal-form input:not([type="hidden"]),
.portal-form select,
.portal-form textarea {
	width: 100%;
	box-sizing: border-box;
	min-height: var(--control-h, 34px);
	padding: 6px 10px;
}

.portal-form p {
	margin: 0;
}

.portal-form button {
	min-height: var(--control-h, 34px);
}


/* The captcha widget on a public form (App\Core\Captcha). */
.captcha-box { margin: 8px 0 12px; min-height: 65px; }
