/* Console styles. Same look as IXXO's other staff console (MedConsole): dark navy top bar with an orange
   underline on the current page, centred content, white cards with a title bar, small-capital table headings,
   tinted status pills, orange primary buttons. Surfaces and text come from the shared design tokens
   (assets/css/tokens.css); no framework, no JavaScript. */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
	--bar: #172033;
	--bar-text: #E8ECF2;
	--bar-muted: #9AA6B8;
	--pill-blue: #1F5FAD;
	--env: var(--color-status-info);
	--font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
	--page-w: 1180px;
}

@media (prefers-color-scheme: dark) {
	:root { --bar: #0B1018; --pill-blue: #7FB0F0; }
}

body.env-production { --env: #F2857D; }
body.env-sandbox { --env: #E0B252; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
	margin: 0;
	min-height: 100vh;
	font: var(--type-weight-regular) 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: var(--color-text-primary);
	background: var(--color-surface-page);
	-webkit-font-smoothing: antialiased;
}

a { color: var(--pill-blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--color-focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }

.skip { position: absolute; left: var(--space-lg); top: -60px; z-index: 10; padding: var(--space-sm) var(--space-lg); border-radius: var(--radius-md); background: var(--accent); color: var(--on-accent); font-weight: var(--type-weight-bold); }
.skip:focus { top: var(--space-sm); }

h1 { font-size: 24px; font-weight: var(--type-weight-bold); letter-spacing: -.01em; line-height: 1.25; margin: 0 0 var(--space-xl); }
h2 { font-size: 16px; font-weight: var(--type-weight-bold); line-height: 1.3; margin: var(--space-xl) 0 var(--space-md); }
h3 { font-size: 15px; font-weight: var(--type-weight-bold); margin: var(--space-xl) 0 var(--space-xs); }
p { margin: 0 0 var(--space-md); }
ul { margin: 0 0 var(--space-md); padding-left: 1.2em; }
li + li { margin-top: var(--space-xs); }

code { font: 13px/1.4 var(--font-mono); overflow-wrap: anywhere; }

/* Top bar */
.console-header { background: var(--bar); color: var(--bar-text); position: sticky; top: 0; z-index: 5; }
.console-header .bar { display: flex; align-items: center; gap: var(--space-xl); min-height: 52px; padding: 0 var(--space-lg); }
.brand { display: flex; align-items: center; gap: 10px; flex: none; color: #FFFFFF; font-weight: var(--type-weight-bold); font-size: 15px; white-space: nowrap; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand img { display: block; width: auto; height: 34px; }
.brand span { color: #B9C3D0; font-weight: var(--type-weight-medium); padding-left: 10px; border-left: 1px solid rgba(255, 255, 255, 0.25); line-height: 20px; }
.console-header nav { display: flex; align-items: stretch; align-self: stretch; gap: var(--space-lg); min-width: 0; }
.console-header nav::-webkit-scrollbar { display: none; }
.console-header nav a {
	display: flex;
	align-items: center;
	flex: none;
	color: var(--bar-text);
	font-weight: var(--type-weight-medium);
	border-bottom: 2px solid transparent;
	border-top: 2px solid transparent;
	text-decoration: none;
}
.console-header nav a:hover { color: #FFFFFF; text-decoration: none; }
.console-header nav a[aria-current="page"] { color: #FFFFFF; border-bottom-color: var(--accent); }
.console-header .tools { margin-left: auto; display: flex; align-items: center; gap: var(--space-lg); flex: none; }
.who { display: flex; align-items: center; gap: var(--space-lg); margin: 0; }
.who-name { color: #FFFFFF; font-weight: var(--type-weight-medium); white-space: nowrap; }
.who button { min-height: 32px; padding: 0 var(--space-md); background: transparent; color: #FFFFFF; border-color: rgb(255 255 255 / .35); }
.who button:hover { background: rgb(255 255 255 / .1); border-color: rgb(255 255 255 / .6); }

/* Environment pill (in the top bar on every page) */
.env-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 2px 10px 2px 8px;
	border-radius: 999px;
	border: 1px solid color-mix(in srgb, var(--env) 55%, transparent);
	color: var(--env);
	font-size: 12px;
	font-weight: var(--type-weight-bold);
	letter-spacing: .06em;
	text-transform: uppercase;
	white-space: nowrap;
}
.env-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* The full width of the screen, a margin that grows on wide screens (owner, 29 October 2026: "this page should be 100% width or 90%"). */
.console-main { max-width: none; margin-inline: auto; padding: var(--space-xxl) clamp(var(--space-xl), 3vw, 56px) 64px; }

/* Sign-in and two-step verification: the top bar with the brand, then a centred card */
.auth-main { max-width: 440px; margin: clamp(32px, 8vh, 80px) auto var(--space-xxl); padding-inline: var(--space-lg); }
.auth-card { background: var(--color-surface-panel); border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); padding: var(--space-xxl); }
.auth-card h1 { font-size: 22px; margin-bottom: var(--space-lg); }
.auth-card h2 { font-size: 16px; margin-top: 0; }
.auth-card form:not(.inline) button.primary { width: 100%; }
.auth-card > .muted:last-child { margin: var(--space-lg) 0 0; font-size: 13px; }

/* Cards. A card's first heading becomes its title bar (as in MedConsole). */
.panel {
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
	padding: var(--space-lg);
	margin-bottom: var(--space-xl);
}
.panel > h2:first-child {
	margin: calc(-1 * var(--space-lg)) calc(-1 * var(--space-lg)) var(--space-lg);
	padding: var(--space-md) var(--space-lg);
	min-height: 50px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-md);
	border-bottom: 1px solid var(--color-border-default);
}
.panel > table { margin: 0; border: 0; border-radius: 0; }
.panel > h2:first-child .note { color: var(--color-text-secondary); font-size: 14px; font-weight: var(--type-weight-regular); }
.panel > h2:first-child form { margin: 0; }
.panel th { padding-top: var(--space-xs); }
.narrow { max-width: 480px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: var(--space-lg); align-items: stretch; margin-bottom: var(--space-xl); }
.grid > .panel { margin-bottom: 0; }
.muted { color: var(--color-text-secondary); }
.sub { display: block; color: var(--color-text-secondary); font-size: 13px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* Page heading row: title, a muted summary, actions on the right */
.page-head { display: flex; align-items: baseline; gap: var(--space-md) var(--space-lg); flex-wrap: wrap; margin-bottom: var(--space-xl); }
.page-head h1 { margin: 0; }
.page-head .actions { margin-left: auto; align-self: center; }

/* Forms */
label { display: block; margin: var(--space-md) 0 6px; color: var(--color-text-primary); }
label:first-of-type { margin-top: 0; }
.hint { display: block; margin-top: 4px; color: var(--color-text-secondary); font-size: 13px; }

input, select, textarea, button { font: inherit; color: var(--color-text-primary); }

input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select, textarea {
	min-height: var(--control-h);
	padding: 0 var(--space-md);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
	background: var(--color-surface-panel);
}
textarea { padding: var(--space-sm) var(--space-md); min-height: 88px; resize: vertical; font-family: var(--font-mono); font-size: 13px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--color-focus-ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-focus-ring) 22%, transparent); }
::placeholder { color: var(--color-text-disabled); }

:is(.panel form:not(.inline), form.panel) :is(input:not([type="hidden"]), select, textarea),
.auth-card form:not(.inline) :is(input:not([type="hidden"]), select, textarea),
.field :is(input, select, textarea) { width: 100%; }

.panel form:not(.inline) > button, .auth-card form:not(.inline) > button { margin-top: var(--space-lg); }
.panel > form:not(.inline) + form:not(.inline) { margin-top: var(--space-md); }

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md); }
@media (max-width: 640px) { .fields { grid-template-columns: 1fr; } }
.field label { margin-top: 0; }
.form-foot { display: flex; justify-content: flex-end; gap: var(--space-sm); margin-top: var(--space-lg); padding-top: var(--space-lg); border-top: 1px solid var(--color-border-default); }
.form-foot button { margin: 0; }

/* Buttons: outlined by default; orange for the main action */
button, .button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-sm);
	min-height: 36px;
	padding: 0 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);
	font-weight: var(--type-weight-medium);
	white-space: nowrap;
	cursor: pointer;
	text-decoration: none;
}
button:hover, .button:hover { border-color: var(--color-text-disabled); text-decoration: none; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: var(--type-weight-bold); }
button.primary:hover, .button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger { background: var(--color-status-danger); border-color: var(--color-status-danger); color: #FFFFFF; }
button.link { min-height: 0; padding: 0; border: 0; background: none; color: var(--pill-blue); }
button.link:hover { text-decoration: underline; }

/* Compact forms inside tables and toolbars */
form.inline { display: inline-flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; margin: 2px 0; }
/* Review C8: a form inside a table cell takes the cell's width and its fields wrap instead of being squeezed. */
td form.inline { display: flex; width: 100%; }
td form.inline :is(input:not([type="hidden"]), select) { flex: 1 1 12rem; min-width: 10rem; }
td form.inline button { flex: 0 0 auto; }
form.inline :is(input:not([type="hidden"]):not([type="checkbox"]), select) { min-height: var(--control-h-sm); min-width: 0; flex: 1 1 160px; font-size: 14px; }
form.inline button { min-height: var(--control-h-sm); font-size: 14px; }
td form.inline + form.inline { margin-top: var(--space-sm); }
td > p { margin-bottom: var(--space-sm); }

.toolbar { display: flex; gap: var(--space-sm); margin-bottom: var(--space-lg); }
.toolbar input { flex: 0 1 380px; min-width: 0; }
.toolbar button { min-height: var(--control-h); }

/* Tables: a white card, small-capital headings, row lines */
table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	background: var(--color-surface-panel);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-lg);
	overflow: hidden;
	margin-bottom: var(--space-xl);
	font-variant-numeric: tabular-nums;
}
th, td { text-align: left; padding: var(--space-md); border-bottom: 1px solid var(--color-border-default); vertical-align: middle; }
th {
	color: var(--color-text-secondary);
	font-size: 12px;
	font-weight: var(--type-weight-bold);
	letter-spacing: .1em;
	text-transform: uppercase;
	white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
td.actions { text-align: right; white-space: nowrap; }
td[colspan].muted { text-align: center; padding-block: var(--space-xxl); }

@media (max-width: 860px) {
	table { display: block; overflow-x: auto; }
}

/* Definition lists */
dl { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-sm) var(--space-xl); margin: 0; }
dt { color: var(--color-text-secondary); }
dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Status pills and badges */
.status, .badge, .pill {
	display: inline-flex;
	align-items: center;
	padding: 1px 9px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: var(--type-weight-bold);
	line-height: 1.6;
	white-space: nowrap;
	color: var(--color-text-secondary);
	background: var(--color-surface-subtle);
}
.pill-blue { color: var(--pill-blue); background: color-mix(in srgb, var(--pill-blue) 12%, transparent); }
.status-active, .status-trial, .status-closed, .status-approved, .status-consented { color: var(--color-status-success); background: color-mix(in srgb, var(--color-status-success) 12%, transparent); }
.status-past_due, .status-pending, .status-pending_owner, .status-pending_verification, .status-evidence_filed, .status-requested, .status-retired { color: var(--color-status-warning); background: color-mix(in srgb, var(--color-status-warning) 13%, transparent); }
.status-suspended, .status-cancelled, .status-archived, .status-open, .status-rejected { color: var(--color-status-danger); background: color-mix(in srgb, var(--color-status-danger) 11%, transparent); }
.badge-danger { background: var(--color-status-danger); color: #FFFFFF; }
.status-demo { color: var(--color-status-info); background: color-mix(in srgb, var(--color-status-info) 12%, transparent); font-weight: 600; }
/* New demo account: the fields in one wrapping row. */
.form-row { display: flex; flex-wrap: wrap; gap: var(--space-sm) var(--space-md); align-items: flex-end; margin-top: var(--space-sm); }
.form-row + .panel { margin-top: var(--space-md); }
.panel > table + table { margin-top: var(--space-md); }
.captcha-box { min-height: 65px; }
.form-row label { display: flex; flex-direction: column; gap: 4px; }
p.badge { display: flex; border-radius: var(--radius-md); padding: var(--space-sm) var(--space-md); font-size: 14px; white-space: normal; }

.notice, .form-error { padding: var(--space-md) var(--space-lg); border-radius: var(--radius-md); margin-bottom: var(--space-lg); font-weight: var(--type-weight-medium); }
.notice { color: var(--color-status-success); background: color-mix(in srgb, var(--color-status-success) 10%, transparent); }
.form-error { color: var(--color-status-danger); background: color-mix(in srgb, var(--color-status-danger) 9%, transparent); }

details { margin: var(--space-sm) 0 var(--space-lg); }
summary { cursor: pointer; color: var(--pill-blue); }
code.secret { display: inline-block; font-size: 15px; letter-spacing: .08em; padding: var(--space-sm) var(--space-md); background: var(--color-surface-subtle); border-radius: var(--radius-md); }

/* Small screens */
@media (max-width: 760px) {
	.console-header .bar { flex-wrap: wrap; gap: 0 var(--space-lg); padding-top: var(--space-sm); }
	.console-header nav { order: 3; flex-basis: 100%; min-height: 40px; }
	.who-name { display: none; }
	.console-main { padding: var(--space-xl) var(--space-lg) var(--space-xxl); }
	.auth-card { padding: var(--space-xl); }
	.filters input[type="search"] { flex: 1 1 0; min-width: 0; }
}

/* Tab pills (switch between views of one page) and segmented filters, as in MedConsole */
.tabs { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-bottom: var(--space-lg); }
.tabs a { display: inline-flex; align-items: center; gap: var(--space-sm); min-height: 36px; padding: 0 var(--space-lg); border: 1px solid var(--color-border-default); border-radius: 999px; background: var(--color-surface-panel); color: var(--color-text-primary); font-weight: var(--type-weight-medium); }
.tabs a:hover { text-decoration: none; border-color: var(--color-text-disabled); }
.tabs a[aria-current="page"] { background: var(--bar); border-color: var(--bar); color: #FFFFFF; }
.segmented { display: inline-flex; border: 1px solid var(--color-border-default); border-radius: var(--radius-md); background: var(--color-surface-panel); overflow: hidden; }
.segmented a { display: inline-flex; align-items: center; min-height: 34px; padding: 0 var(--space-md); color: var(--color-text-primary); border-left: 1px solid var(--color-border-default); }
.segmented a:first-child { border-left: 0; }
.segmented a:hover { text-decoration: none; background: var(--color-surface-subtle); }
.segmented a[aria-current="true"] { background: var(--bar); color: #FFFFFF; }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; padding: 0 7px; border-radius: 999px; font-size: 12px; font-weight: var(--type-weight-bold); line-height: 20px; color: var(--pill-blue); background: color-mix(in srgb, var(--pill-blue) 13%, transparent); }
.filters { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; margin-bottom: var(--space-lg); }
.filters input[type="search"] { flex: 0 1 360px; min-height: 36px; }

/* Summary tiles above a list */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: var(--space-md); margin-bottom: var(--space-lg); }
.stat { background: var(--color-surface-panel); border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); padding: var(--space-md) var(--space-md) var(--space-md) 14px; }
.stat b { display: block; font-size: 22px; font-weight: var(--type-weight-medium); line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat span { color: var(--color-text-secondary); font-size: 14px; }

/* Console › Updates */
.log { margin: var(--space-sm) 0; padding: var(--space-md); max-height: 360px; overflow: auto; white-space: pre-wrap; font: 12.5px/1.55 var(--font-mono); background: var(--color-surface-subtle); border-radius: var(--radius-md); }
tr.log-row td { padding-top: 0; padding-bottom: var(--space-sm); }
tr.log-row details { margin: 0; }
tbody tr:has(+ tr.log-row) td { padding-bottom: var(--space-xs); }
tbody tr:has(+ tr.log-row) td { border-bottom: 0; }
.form-error-text { color: var(--color-status-danger); }
form.rollback { flex-direction: column; align-items: flex-end; max-width: 320px; }
label.check { display: flex; gap: var(--space-sm); align-items: flex-start; margin: 0; font-size: 13px; text-align: left; white-space: normal; color: var(--color-text-secondary); }
label.check input { margin-top: 3px; }
td.actions form.inline + form.inline { margin-left: var(--space-xs); }
/* File picker: a normal field box with the browser's button drawn like the console buttons inside it */
input[type="file"] { display: flex; align-items: center; width: 100%; padding: 0 var(--space-xs) !important; color: var(--color-text-secondary); cursor: pointer; }
input[type="file"]::file-selector-button { min-height: 30px; margin: 0 var(--space-md) 0 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-disabled); }

/* Rows that keep a short form on one line instead of leaving empty space (owner rule: no empty gaps) */
.upload-row, .inline-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-md); }
.upload-row input[type="file"] { flex: 1 1 320px; width: auto; }
.upload-row button, .inline-row form button { margin: 0 !important; }
.inline-row p { margin: 0; flex: 1 1 260px; }
.inline-row form { margin: 0; }
.stats + .note, .note + .note { margin-top: calc(-1 * var(--space-sm)); }
p.note { font-size: 14px; }

/* Narrower windows: the navigation gets its own row before it would be cut off */
@media (max-width: 1180px) {
	.console-header .bar { flex-wrap: wrap; gap: 0 var(--space-lg); padding-top: var(--space-sm); }
	.console-header nav { order: 3; flex-basis: 100%; min-height: 40px; }
}.error-panel > p:last-child { margin-bottom: 0; }

/* Console › Support desk */
a.stat { color: inherit; }
a.stat:hover { text-decoration: none; border-color: var(--color-text-disabled); }
.desk-message { padding: var(--space-sm) var(--space-md); border-left: 3px solid var(--color-border-default); margin-top: var(--space-sm); }
.desk-message.desk-staff { border-left-color: var(--bar); }
.desk-message.desk-note { border-left-color: var(--pill-orange, #B54708); background: var(--color-surface-subtle); }
.desk-message p { margin: 0; }
.desk-message p + p, .desk-message p + form { margin-top: var(--space-sm); }
.desk-body { white-space: pre-wrap; }
.stack-form { display: flex; flex-direction: column; gap: var(--space-xs); align-items: flex-start; }
.stack-form textarea, .stack-form select { width: 100%; max-width: 720px; }
.stack-form .check { display: flex; flex-direction: row; gap: var(--space-xs); align-items: center; width: auto; }
.panel form.stack-form label.check input[type="checkbox"] { width: auto; flex: none; min-height: 0; margin: 0; }

/* Messages and Staff (quick wins): facts as two columns, a saved email's text as written */
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-xs) var(--space-lg); margin: var(--space-md) 0; }
dl.facts dt { color: var(--color-text-secondary); }
dl.facts dd { margin: 0; }
pre.mail-text { white-space: pre-wrap; overflow-wrap: anywhere; padding: var(--space-md); border: 1px solid var(--color-border-default); border-radius: var(--radius-md); background: var(--color-surface-panel); font-size: 14px; }
/* Invoice learning (Agreed_To_Build 3.3): a training bill beside its answer key; the fields to check first and marked. */
.badge-success { color: var(--color-status-success); background: color-mix(in srgb, var(--color-status-success) 12%, transparent); }
.learning-review { display: grid; grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr); gap: var(--space-lg); align-items: start; }
.learning-file { position: sticky; top: var(--space-md); }
.learning-file { max-height: calc(100vh - 120px); overflow: auto; display: flex; flex-direction: column; gap: var(--space-sm); }
.learning-file img { display: block; width: 100%; height: auto; border: 1px solid var(--color-border-default); border-radius: var(--radius-md); background: #FFFFFF; }
.learning-file p { margin: 0; }
.learning-fields { display: flex; flex-direction: column; gap: var(--space-sm); }
.learning-field { display: flex; flex-direction: column; gap: var(--space-sm); padding: var(--space-sm); border-radius: var(--radius-md); }
.learning-field input { width: 100%; }
.learning-field p { margin: 0; font-size: 13px; }
.learning-check { background: color-mix(in srgb, var(--color-status-warning) 10%, transparent); }
@media (max-width: 900px) { .learning-review { grid-template-columns: 1fr; } .learning-file { position: static; max-height: 50vh; } }
/* iPad with Apple Pencil (Agreed 3.4): room to write in each field (Scribble), text large enough that Safari does not
   zoom, buttons a finger can hit. */
@media (pointer: coarse) {
	.learning-field input { min-height: 56px; font-size: 20px; padding: var(--space-sm) var(--space-md); }
	.learning-fields button { min-height: 48px; padding-inline: var(--space-lg); font-size: 17px; }
	.learning-field label { font-size: 16px; }
}
.panel .learning-switch { margin-top: var(--space-md); }

/* Menu groups (29 October 2026): a few words in the bar, each opening its pages below it. */
.nav-group { position: relative; display: flex; align-items: stretch; }
/* A menu group fills the bar like a single link (owner, 30 October 2026: "can you align the menu to be all inline?"); the panels' details margin must not apply here. */
.console-header .nav-group { margin: 0; }
.nav-group > summary { display: flex; align-items: center; gap: 6px; list-style: none; cursor: pointer; color: var(--bar-text); font-weight: var(--type-weight-medium); border-top: 2px solid transparent; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); opacity: 0.7; }
.nav-group[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
.nav-group > summary:hover, .nav-group[open] > summary { color: #FFFFFF; }
.nav-group > summary[aria-current="page"] { color: #FFFFFF; border-bottom-color: var(--accent); }
.nav-menu { position: absolute; top: 100%; left: calc(-1 * var(--space-md)); z-index: 10; min-width: 200px; display: flex; flex-direction: column; padding: var(--space-xs) 0; background: var(--bar); border-radius: 0 0 var(--radius-md) var(--radius-md); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); }
.console-header .nav-menu a { padding: var(--space-sm) var(--space-md); border: 0; border-left: 3px solid transparent; }
.console-header .nav-menu a[aria-current="page"] { border-left-color: var(--accent); }
.console-header .nav-menu a:hover { background: rgba(255, 255, 255, 0.08); }
/* The batch row's actions stack and never run off a tablet's screen (owner's iPad, 29 October 2026). */
.learning-actions { min-width: 0; }
.learning-actions form { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.learning-actions input[type="file"] { max-width: 200px; }

/* Console › Website access (D78): the printed invitation card, 85 × 55 mm; printing shows the card alone. */
.inside-card { display: flex; gap: 18px; align-items: center; width: 85mm; min-height: 55mm; padding: 6mm; border: 1px solid var(--color-border-default, #D9DDE3); border-radius: 3mm; background: #fff; color: #16273F; box-sizing: border-box; }
.inside-card-text { flex: 1; font-size: 9pt; line-height: 1.35; }
.inside-card-text p { margin: 0 0 4px; }
.inside-card-brand { font-weight: 800; font-size: 12pt; }
.inside-card-brand span { color: #F6921E; }
.inside-card-name { font-weight: 700; }
.inside-card-code { font-family: ui-monospace, Menlo, monospace; font-size: 15pt; font-weight: 800; letter-spacing: 1px; margin: 6px 0; }
.inside-card-qr { width: 26mm; flex: none; }
.inside-card-qr svg { width: 100%; height: auto; display: block; }
.inside-card-link code { word-break: break-all; }
@media print {
	body * { visibility: hidden; }
	.inside-card, .inside-card * { visibility: visible; }
	.inside-card { position: absolute; left: 10mm; top: 10mm; }
}

/* The iPad review's tap to fill (owner, 30 October 2026): the words on the bill's picture are invisible targets; the
   field being filled is outlined; a word that was just used flashes. */
.learning-page { position: relative; }
.learning-page img { display: block; width: 100%; height: auto; }
.learning-word { position: absolute; padding: 0; margin: 0; border: 0; border-radius: 3px; background: transparent; cursor: pointer; touch-action: manipulation; }
.learning-word:hover, .learning-word:focus-visible { background: rgba(246, 146, 30, 0.18); outline: 1px solid rgba(246, 146, 30, 0.7); }
.learning-word-taken { background: rgba(30, 122, 70, 0.28); outline: 2px solid #1E7A46; }
.learning-active input { outline: 3px solid var(--accent, #F6921E); outline-offset: 1px; }

/* Support desk (Agreed 2.19, as on IXXO Med's desk): a side menu with the views and their counts beside the content */
.desk-wrap { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--space-xl); align-items: start; }
.desk-main { min-width: 0; }
.desk-main > :first-child, .desk-main > .panel:first-child { margin-top: 0; }
.desk-side { position: sticky; top: 68px; display: grid; gap: var(--space-sm); padding: var(--space-sm); border: 1px solid var(--color-border-default); border-radius: var(--radius-md); background: var(--color-surface-panel); }
.desk-side a { display: flex; align-items: center; gap: var(--space-sm); padding: 4px 10px; border-radius: var(--radius-sm); color: var(--color-text-primary); font-size: 14px; }
.desk-side a:hover { background: var(--color-surface-subtle); text-decoration: none; }
.desk-side a[aria-current="page"] { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: var(--type-weight-bold); }
.desk-side-group { margin: var(--space-sm) 10px 0; font-size: 11px; font-weight: var(--type-weight-bold); letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-secondary); }
.desk-side-group:first-child { margin-top: var(--space-xs); }
.desk-n { margin-left: auto; min-width: 24px; padding: 0 7px; border-radius: 999px; background: var(--color-surface-subtle); color: var(--color-text-secondary); font-size: 12px; text-align: center; }
.desk-n.hot { background: var(--accent); color: var(--on-accent); }
.desk-head { display: flex; align-items: center; gap: var(--space-md); margin-bottom: var(--space-md); }
.desk-head h2 { margin: 0; }
.desk-push { margin-left: auto; }
.desk-tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.desk-tiles .stat.desk-warn b { color: var(--color-status-warning); }
.desk-tiles .stat.desk-bad b { color: var(--color-status-danger); }
.desk-grid2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--space-lg); align-items: start; }
.desk-act { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--space-sm); padding: 0 0 var(--space-sm); border-bottom: 1px solid var(--color-border-default); margin: 0 0 var(--space-sm); }
.desk-act:last-child { border-bottom: 0; }
.desk-act .sub { flex-basis: 100%; }
.desk-kv { display: grid; grid-template-columns: auto 1fr; gap: var(--space-xs) var(--space-lg); margin: 0; }
.desk-kv dt { color: var(--color-text-secondary); }
.desk-kv dd { margin: 0; }
.desk-table .desk-pick { width: 36px; }
.desk-table tr.desk-unread td:nth-child(2) a { font-weight: var(--type-weight-bold); }
.desk-bulk { margin-top: var(--space-md); }
.desk-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; background: var(--color-text-secondary); }
.desk-red { background: var(--color-status-danger); }
.desk-orange { background: var(--color-status-warning); }
.desk-green { background: var(--color-status-success); }
.desk-blue { background: var(--pill-blue); }
.desk-purple { background: #7B5CC4; }
.desk-ticket { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-lg); align-items: start; }
.desk-details { position: sticky; top: 68px; }
.desk-details .stack-form { gap: var(--space-sm); }
.desk-details .stack-form label { display: grid; gap: 2px; width: 100%; margin: 0; font-size: 13px; color: var(--color-text-secondary); }
.desk-details .stack-form select, .desk-details .stack-form input { width: 100%; color: var(--color-text-primary); }
form.inline.desk-trash { margin-top: var(--space-md); }
.desk-ticket .stack-form { gap: var(--space-sm); }
.desk-message.desk-scheduled { border-style: dashed; opacity: .85; }
.desk-setting { padding: var(--space-md) 0; border-bottom: 1px solid var(--color-border-default); }
.desk-setting:last-child { border-bottom: 0; }
form.inline.desk-delete { margin: var(--space-sm) 0 var(--space-lg); }
@media (max-width: 1000px) {
	.desk-wrap, .desk-ticket, .desk-grid2 { grid-template-columns: minmax(0, 1fr); }
	.desk-side { position: static; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
	.desk-side-group { grid-column: 1 / -1; }
	.desk-details { position: static; }
	.desk-tiles { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}
.desk-days { display: flex; flex-wrap: wrap; gap: var(--space-sm) var(--space-md); border: 0; padding: 0; margin: 0; }
.desk-days legend { width: 100%; margin-bottom: var(--space-xs); font-weight: var(--type-weight-bold); }
.desk-rating { padding: var(--space-sm); border-radius: var(--radius-sm); background: var(--color-surface-subtle); }
form.inline.desk-check { margin-top: var(--space-md); }
.desk-merge { margin-top: var(--space-lg); padding-top: var(--space-md); border-top: 1px solid var(--color-border-default); }
.desk-details .stack-form label.check { display: flex; flex-direction: row; align-items: flex-start; gap: var(--space-xs); }
.desk-details .stack-form label.check input { width: auto; margin-top: 3px; }
.mail-body { margin-top: var(--space-md); }

/* Console › Marketing (Agreed 2.20): the posts board, copy fields and pictures */
.mk-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-md); align-items: start; }
.mk-column { display: grid; gap: var(--space-sm); padding: var(--space-sm); border-radius: var(--radius-md); background: var(--color-surface-subtle); }
.mk-column h2 { margin: var(--space-xs) var(--space-xs) 0; font-size: 14px; }
.mk-card { display: grid; gap: var(--space-xs); padding: var(--space-sm); border: 1px solid var(--color-border-default); border-radius: var(--radius-sm); background: var(--color-surface-panel); color: var(--color-text-primary); }
.mk-card:hover { text-decoration: none; border-color: var(--accent); }
.mk-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; }
.mk-copy { display: grid; gap: var(--space-sm); margin-bottom: var(--space-md); }
.mk-copy textarea { width: 100%; }
.mk-figure { margin: 0 0 var(--space-md); }
.mk-figure img { max-width: 100%; max-height: 420px; border-radius: var(--radius-sm); border: 1px solid var(--color-border-default); }
.mk-figure figcaption { margin-top: var(--space-sm); }
form.inline.mk-move, .stack-form.mk-move { margin-top: var(--space-md); }
.mk-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-md); }
.mk-image { margin: 0; padding: var(--space-sm); border: 1px solid var(--color-border-default); border-radius: var(--radius-md); background: var(--color-surface-panel); }
.mk-image img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; }
.mk-image figcaption { display: grid; gap: var(--space-sm); margin-top: var(--space-sm); }
@media (max-width: 1000px) { .mk-board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.desk-kv + form, .mk-figure + .desk-kv { margin-top: var(--space-md); }
.desk-grid2:not(:last-child) { margin-bottom: var(--space-xl); }
p.stat { margin: 0; }

/* ==================================================================================================================
   The Console in the new template (owner, 31 October 2026, O13: "here we have different buttons, not the same as in
   the rest of the pages"; "very basic design"). Its controls take the shared values in controls.css, the same as the
   admin app: one height for buttons and the boxes beside them, 4 px corners, the brand orange, Inter.
   ================================================================================================================== */

:root {
	--control-h-sm: var(--control-h);
	--accent: var(--action-bg);
	--accent-hover: var(--action-bg-hover);
	--on-accent: var(--action-text);
}

body {
	font-family: var(--font-ui);
	font-size: 14px;
}

button,
.button,
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select {
	min-height: var(--control-h);
	border-radius: var(--control-radius);
	font-size: var(--control-font-size);
}

button.link {
	min-height: 0;
}

button.primary,
.button.primary {
	color: var(--on-accent);
}

/* Short forms: the label above, the box and its button on one line, the button level with the box */
form.inline {
	align-items: flex-end;
}

form.inline:has(> label:not(.check):not(.visually-hidden)) {
	display: inline-grid;
	grid-auto-flow: column;
	grid-template-rows: auto auto;
	grid-auto-columns: max-content;
	justify-content: start;
	align-items: end;
	gap: 4px var(--space-md);
	max-width: 100%;
}

form.inline:has(> label:not(.check):not(.visually-hidden)) > label:not(.check):not(.visually-hidden) {
	grid-row: 1;
	margin: 0;
	color: var(--color-text-secondary);
	font-size: 13px;
	font-weight: var(--type-weight-medium);
}

form.inline:has(> label:not(.check):not(.visually-hidden)) > :is(input, select, textarea, button, .button) {
	grid-row: 2;
}

form.inline:has(> label:not(.check):not(.visually-hidden)) > :is(input, select) {
	min-width: 14rem;
}

@media (max-width: 720px) {
	form.inline:has(> label:not(.check):not(.visually-hidden)) {
		display: flex;
		flex-direction: column;
		align-items: stretch;
	}
}

/* Panels: the app's corners (each section of a page sits in one, its first heading the title bar) */
.panel {
	border-radius: var(--radius-md);
}


/* A box inside its label sits level with the button beside it: labels in a row carry no margin of their own */
.form-row label,
form.inline label,
.toolbar label,
.filters label {
	margin: 0;
}

/* Boxes and dropdowns exactly the control height (buttons may grow with their words) */
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select {
	height: var(--control-h);
	box-sizing: border-box;
}

/* Room between blocks and between buttons (the spacing checks) */
.panel > table + p,
.form-row + p,
.form-row + .muted,
details > summary + .form-error,
details > summary + form {
	margin-top: var(--space-md);
}

h3 + p {
	margin-top: var(--space-sm);
}

.sub {
	margin-top: var(--space-sm);
}

:not(td) > form.inline + form.inline {
	margin-left: var(--space-sm);
}

.desk-message {
	padding-bottom: var(--space-md);
}

/* Buttons exactly as tall as the boxes beside them (their words never wrap in the Console) */
button:not(.link),
.button {
	height: var(--control-h);
	box-sizing: border-box;
}

form + p.muted,
.fields + p,
.panel > table + form,
.panel > table + .inline {
	margin-top: var(--space-md);
}


/* The support desk's filter bar: labels above their dropdowns, everything level at the bottom */
.filters {
	align-items: flex-end;
}

.filters > label:not(.visually-hidden) {
	display: flex;
	flex-direction: column;
	gap: 4px;
	color: var(--color-text-secondary);
	font-size: 13px;
}

.filters input[type="search"] {
	min-height: var(--control-h);
}

/* Number tiles: the label on its own line under the figure, with room between them. */
.stat b + span { display: block; margin-top: var(--space-sm); }
/* The note under the upload row, and a table under a form in a panel, never touch what is above them. */
.upload-row + .hint { display: block; margin-top: var(--space-sm); }
.panel form + table { margin-top: var(--space-md); }

/* The texts for the single reporting platform (security reports): as they will be copied. */
.security-draft {
	margin: 8px 0 12px;
	padding: 12px;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	background: var(--color-surface-subtle);
	border-radius: var(--control-radius, 4px);
	font-size: 13px;
}

.form-stack {
	display: grid;
	gap: 12px;
}

