/*
 * Staff workspace: shell, components, tables, chips, drawers, toasts, calendar primitives.
 * Density: high (reception/doctor). Hairlines instead of boxed cards inside panels.
 */
*,
*::before,
*::after {
	box-sizing: border-box;
}

/*
 * WCAG AA contrast: the shared --text-3 (#6b7a90) measures 4.1:1 on the canvas, below 4.5:1.
 * The workspace uses a darker value. Doctor tones in tokens.css are all AA under white initials.
 */
:root {
	--text-3: #5d6b80;
}

[hidden] {
	display: none !important;
}

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

body {
	margin: 0;
	min-height: 100dvh;
	background: var(--canvas);
	color: var(--text);
	font-family: var(--font-body);
	font-size: 14px;
	line-height: 1.45;
	font-feature-settings: "tnum" 1, "cv11" 1;
}

h1, h2, h3, h4 {
	font-family: var(--font-display);
	margin: 0;
	letter-spacing: -0.01em;
	color: var(--navy);
}

h1 { font-size: 18px; font-weight: 500; }
h2 { font-size: 15px; font-weight: 500; }
h3 { font-size: 13px; font-weight: 500; }

/* Light typography (owner rule): emphasis is medium weight, never bold. */
strong,
b {
	font-weight: 500;
}

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

a:hover {
	text-decoration: underline;
}

.mono, .num, time {
	font-family: var(--font-mono);
	font-size: 0.94em;
	letter-spacing: -0.01em;
}

:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 2px;
	border-radius: 4px;
}

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

.skip-link {
	position: absolute;
	left: 8px;
	top: -48px;
	z-index: 100;
	padding: 8px 12px;
	border-radius: var(--r-sm);
	background: var(--panel);
	color: var(--navy);
	font-weight: 500;
	box-shadow: var(--shadow-2);
}

.skip-link:focus {
	top: 8px;
}

.main:focus {
	outline: none;
}

/* ---------- shell ---------- */
.shell {
	display: grid;
	grid-template-columns: 216px minmax(0, 1fr);
	grid-template-rows: 56px minmax(0, 1fr);
	min-height: 100dvh;
}

/* Greek module names are longer: a slightly wider side menu keeps them on one line */
@media (min-width: 861px) {
	html[lang="el"] .shell {
		grid-template-columns: 240px minmax(0, 1fr);
	}
}

.topbar {
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 0 16px;
	background: var(--navy);
	color: #fff;
	position: sticky;
	top: 0;
	z-index: 30;
}

.brand {
	display: flex;
	align-items: baseline;
	gap: 8px;
	min-width: 184px;
	font-family: var(--font-display);
	font-weight: 500;
	letter-spacing: 0.02em;
}

.brand-name {
	white-space: nowrap;
}

.brand b {
	color: var(--accent);
	font-weight: 700;
}

.brand span {
	font-weight: 400;
	opacity: 0.72;
	font-size: 12px;
}

.omnibox {
	flex: 1;
	max-width: 560px;
	position: relative;
}

.topbar .omnibox input {
	width: 100%;
	height: 36px;
	border-radius: var(--r-sm);
	border: 1px solid rgba(255, 255, 255, 0.14);
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	padding: 0 12px 0 36px;
	font: inherit;
}

.topbar .omnibox input::placeholder {
	color: rgba(255, 255, 255, 0.62);
}

.topbar .omnibox input:focus {
	background: #fff;
	color: var(--text);
	outline: none;
	border-color: var(--accent);
}

.omnibox .icon {
	position: absolute;
	left: 10px;
	top: 9px;
	color: rgba(255, 255, 255, 0.7);
}

.omnibox input:focus + .icon {
	color: var(--text-3);
}

.omnibox kbd {
	position: absolute;
	right: 8px;
	top: 8px;
}

.search-results {
	position: absolute;
	top: 42px;
	left: 0;
	right: 0;
	background: var(--panel);
	color: var(--text);
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	box-shadow: var(--shadow-2);
	max-height: 70vh;
	overflow: auto;
	z-index: 40;
}

.search-results[hidden] {
	display: none;
}

.search-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 4px 12px;
	padding: 10px 14px;
	border-bottom: 1px solid var(--line);
	cursor: pointer;
}

.search-row:last-child {
	border-bottom: 0;
}

.search-row[aria-selected="true"],
.search-row:hover {
	background: var(--canvas);
}

.search-row .meta {
	color: var(--text-3);
	font-size: 12px;
}

.topbar-right {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 12px;
	font-size: 13px;
}

.topbar-right .who {
	opacity: 0.86;
	color: inherit;
	text-decoration: none;
}

.topbar-right .who:hover {
	opacity: 1;
	text-decoration: underline;
}

.security-alarm {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 12px;
	padding: 8px 12px;
	border: 1px solid #f0c6c8;
	border-left: 4px solid var(--st-red-fg);
	border-radius: 6px;
	background: var(--st-red-bg);
	color: var(--st-red-fg);
	font-size: 13px;
}

.security-alarm strong {
	font-weight: 500;
}

.security-alarm .btn {
	margin-left: auto;
	flex-shrink: 0;
}

/* B33: payment overdue reminder, the same banner in amber */
.security-alarm.amber {
	border-color: #ecd9a8;
	border-left-color: var(--st-amber-fg);
	background: var(--st-amber-bg);
	color: var(--st-amber-fg);
}

/* B66: signed in as another user (Pilot mode): the same amber banner, kept in view while the page scrolls */
.security-alarm.impersonating {
	position: sticky;
	top: 0;
	z-index: 30;
}

.clock {
	font-family: var(--font-mono);
	opacity: 0.8;
}

.sidenav {
	background: var(--panel);
	border-right: 1px solid var(--line);
	padding: 12px 8px;
	position: sticky;
	top: 56px;
	height: calc(100dvh - 56px);
	overflow: auto;
}

.sidenav a {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border-radius: var(--r-sm);
	color: var(--text-2);
	font-weight: 500;
	text-decoration: none;
}

.sidenav a:hover {
	background: var(--canvas);
	color: var(--navy);
}

.sidenav a[aria-current="page"] {
	background: var(--accent-soft);
	color: #9a470a;
	box-shadow: inset 3px 0 0 var(--accent);
}

.sidenav .count {
	margin-left: auto;
	font-family: var(--font-mono);
	font-size: 12px;
	color: var(--text-3);
}

.sidenav .group {
	margin: 14px 10px 6px;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--text-3);
}

.main {
	padding: 20px 24px 64px;
	min-width: 0;
}

.page-head {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}

.page-head .sub {
	color: var(--text-3);
	font-size: 13px;
}

.page-head .actions {
	margin-left: auto;
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

/* ---------- icons ---------- */
.icon {
	width: 16px;
	height: 16px;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.75;
	stroke-linecap: round;
	stroke-linejoin: round;
	flex: none;
}

.icon.lg {
	width: 20px;
	height: 20px;
}

/* ---------- buttons & inputs ---------- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	height: 34px;
	padding: 0 12px;
	border-radius: var(--r-sm);
	border: 1px solid var(--line-2);
	background: var(--panel);
	color: var(--text);
	font: inherit;
	font-weight: 500;
	cursor: pointer;
	white-space: nowrap;
	transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}

.btn:hover {
	border-color: var(--text-3);
}

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

.btn[disabled] {
	opacity: 0.55;
	cursor: not-allowed;
}

/* White on --accent is 3.5:1; the darker orange keeps button text at 4.9:1 (AA). */
.btn.primary {
	background: var(--accent-2);
	border-color: var(--accent-2);
	color: #fff;
}

.btn.primary:hover {
	background: #9a470a;
	border-color: #9a470a;
}

.btn.dark {
	background: var(--navy);
	border-color: var(--navy);
	color: #fff;
}

.btn.ghost {
	border-color: transparent;
	background: transparent;
	color: var(--text-2);
}

.btn.ghost:hover {
	background: var(--canvas);
}

.btn.on-dark {
	color: #fff;
}

.btn.on-dark:hover {
	background: var(--navy-2);
}

.topbar :focus-visible {
	outline-color: #fff;
}

.btn.danger {
	color: var(--st-red-fg);
	border-color: #f0c6c8;
}

.btn.sm {
	height: 28px;
	padding: 0 9px;
	font-size: 13px;
}

.btn kbd {
	margin-left: 4px;
}

kbd {
	display: inline-block;
	min-width: 18px;
	padding: 0 5px;
	border: 1px solid var(--line-2);
	border-radius: 4px;
	background: var(--canvas);
	color: var(--text-2);
	font-family: var(--font-mono);
	font-size: 11px;
	line-height: 18px;
	text-align: center;
}

.btn.primary kbd,
.btn.dark kbd {
	background: rgba(255, 255, 255, 0.16);
	border-color: rgba(255, 255, 255, 0.3);
	color: #fff;
}

.field {
	display: grid;
	gap: 6px;
	margin-bottom: 12px;
}

.field label,
.field .label {
	font-size: 12px;
	font-weight: 500;
	color: var(--text-2);
}

.field .help {
	font-size: 12px;
	color: var(--text-3);
}

.field .error {
	font-size: 12px;
	color: var(--st-red-fg);
}

.field.invalid input,
.field.invalid select,
.field.invalid textarea {
	border-color: var(--st-red-fg);
}

input:not([type]), input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="tel"], input[type="url"],
input[type="date"], input[type="time"], input[type="number"], select, textarea {
	width: 100%;
	min-height: 36px;
	padding: 7px 10px;
	border: 1px solid var(--line-2);
	border-radius: var(--r-sm);
	background: #fff;
	color: var(--text);
	font: inherit;
}

textarea {
	min-height: 84px;
	resize: vertical;
	line-height: 1.5;
}

/* B9: one look for every drop-down list. The browser's own arrow (and in Safari the whole native button) is
	replaced by the app's chevron, so no select falls back to the browser default. Compact variants change only
	padding-right and background-position; no rule may set the background shorthand on a select. */
select {
	-webkit-appearance: none;
	appearance: none;
	padding-right: 30px;
	background-color: #fff;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%236b7a90' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 14px 14px;
	text-overflow: ellipsis;
	cursor: pointer;
}

select[multiple],
select[size]:not([size="1"]) {
	padding-right: 10px;
	background-image: none;
}

select:disabled {
	color: var(--text-3);
	background-color: var(--canvas);
	cursor: not-allowed;
	opacity: 1;
}

/* B9: Chrome pads the inside of date and time fields by 1px top and bottom, which made them 2px taller than the
	text fields and selects of the same row */
input[type="date"]::-webkit-datetime-edit-fields-wrapper,
input[type="time"]::-webkit-datetime-edit-fields-wrapper {
	padding: 0;
}

/* a short choice (On/Off) keeps its natural width instead of stretching over the column */
select.select-fit {
	width: auto;
	min-width: 110px;
	max-width: 100%;
	justify-self: start;
}

input:focus, select:focus, textarea:focus {
	outline: 2px solid rgba(47, 111, 214, 0.25);
	border-color: var(--focus);
}

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

.field {
	align-content: start;
}

.seg {
	display: inline-flex;
	border: 1px solid var(--line-2);
	border-radius: var(--r-sm);
	overflow: hidden;
	background: #fff;
}

.seg button {
	border: 0;
	background: transparent;
	padding: 0 12px;
	height: 32px;
	font: inherit;
	color: var(--text-2);
	cursor: pointer;
	border-right: 1px solid var(--line);
}

.seg button:last-child {
	border-right: 0;
}

.seg button[aria-pressed="true"] {
	background: var(--navy);
	color: #fff;
}

.check {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
}

/* ---------- panels ---------- */
.panel {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	min-width: 0;
}

.panel > header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 14px;
	border-bottom: 1px solid var(--line);
}

.panel > header .actions {
	margin-left: auto;
	display: flex;
	gap: 6px;
}

/* One inner margin for everything in a panel (14px, the header's): also when a module wraps .body in its own container. */
.panel > .body,
.panel .body {
	padding: 14px;
}

/*
 * Panels and panel grids stacked in normal (block) flow keep the page gap (16px, as .stack and the grids); they never
 * touch. Only block contexts: the page itself and plain wrappers (grids and stacks space their children with gap).
 */
.main > :is(.panel, .grid-2, .grid-3, .stack) + :is(.panel, .grid-2, .grid-3, .stack),
.main div:not([class]) > :is(.panel, .grid-2, .grid-3, .stack) + :is(.panel, .grid-2, .grid-3, .stack),
.main section:not([class]) > :is(.panel, .grid-2, .grid-3, .stack) + :is(.panel, .grid-2, .grid-3, .stack) {
	margin-top: 16px;
}

.panel > .body.flush,
.panel .body.flush {
	padding: 0;
}

/* Full-width tables and lists inside panels line up with the header text instead of the border. */
.panel .table th:first-child,
.panel .table td:first-child {
	padding-left: 14px;
}

.panel .table th:last-child,
.panel .table td:last-child {
	padding-right: 14px;
}

/* A table inside a padded body already sits on the margin: its first and last columns add no second indent. */
.panel .body:not(.flush) .table th:first-child,
.panel .body:not(.flush) .table td:first-child {
	padding-left: 0;
}

.panel .body:not(.flush) .table th:last-child,
.panel .body:not(.flush) .table td:last-child {
	padding-right: 0;
}

/* A sentence placed straight into a panel (no .body wrapper) gets the same inner margin. */
.panel > p {
	margin: 14px;
}

/* The body's padding is the margin: the first and last sentence add none of their own (no double gaps). */
.panel .body > :first-child {
	margin-top: 0;
}

.panel .body > :last-child {
	margin-bottom: 0;
}

/* Tick boxes start on the text line, not 4px inside it. */
.check > input[type="checkbox"],
.check > input[type="radio"] {
	margin: 0;
}

.panel .body > ul:not([class]),
.panel .body > ol:not([class]) {
	margin: 0;
	padding-left: 18px;
}

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

.grid-3 {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
}

.stack {
	display: grid;
	gap: 16px;
}

/* ---------- chips ---------- */
.chip {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	height: 22px;
	padding: 0 8px;
	border-radius: var(--r-pill);
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.02em;
	white-space: nowrap;
	background: var(--st-grey-bg);
	color: var(--st-grey-fg);
}

.chip .icon {
	width: 12px;
	height: 12px;
}

/*
 * Status chip (with icon), funding chip, doctor dot and access flags share one line at the same height: an icon-first
 * inline-flex box would otherwise take its baseline from the icon and ride higher than a text-only chip.
 */
.chip,
.doc-dot,
.flag {
	vertical-align: middle;
}

/* A row of chips (appointment pop-up, visit header): centred on one line with one gap. */
.chip-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}

.chip.blue { background: var(--st-blue-bg); color: var(--st-blue-fg); }
.chip.green { background: var(--st-green-bg); color: var(--st-green-fg); }
.chip.amber { background: var(--st-amber-bg); color: var(--st-amber-fg); }
.chip.red { background: var(--st-red-bg); color: var(--st-red-fg); }
.chip.grey { background: var(--st-grey-bg); color: var(--st-grey-fg); }
.chip.violet { background: var(--st-violet-bg); color: var(--st-violet-fg); }
.chip.outline { background: transparent; border: 1px solid var(--line-2); color: var(--text-2); }

/*
 * Doctor tones: .doc-1 .. .doc-12 (aliases .doc-a/.doc-b) set --doc and --doc-soft on any element;
 * .doc-dot paints the initials dot, other components use var(--doc) for a thin accent.
 */
.doc-1, .doc-a { --doc: var(--doc-1); --doc-soft: var(--doc-1-soft); }
.doc-2, .doc-b { --doc: var(--doc-2); --doc-soft: var(--doc-2-soft); }
.doc-3 { --doc: var(--doc-3); --doc-soft: var(--doc-3-soft); }
.doc-4 { --doc: var(--doc-4); --doc-soft: var(--doc-4-soft); }
.doc-5 { --doc: var(--doc-5); --doc-soft: var(--doc-5-soft); }
.doc-6 { --doc: var(--doc-6); --doc-soft: var(--doc-6-soft); }
.doc-7 { --doc: var(--doc-7); --doc-soft: var(--doc-7-soft); }
.doc-8 { --doc: var(--doc-8); --doc-soft: var(--doc-8-soft); }
.doc-9 { --doc: var(--doc-9); --doc-soft: var(--doc-9-soft); }
.doc-10 { --doc: var(--doc-10); --doc-soft: var(--doc-10-soft); }
.doc-11 { --doc: var(--doc-11); --doc-soft: var(--doc-11-soft); }
.doc-12 { --doc: var(--doc-12); --doc-soft: var(--doc-12-soft); }

.doc-dot {
	display: inline-grid;
	place-items: center;
	flex: none;
	/* demo QA 1.16.4: a three letter code (ACH) widens the circle into a pill instead of spilling out of it */
	box-sizing: border-box;
	min-width: 22px;
	padding: 0 2px;
	height: 22px;
	border-radius: 11px;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: #fff;
	background: var(--doc, var(--doc-1));
}

.flag {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	font-size: 11px;
	color: var(--text-2);
}

/* ---------- tables ---------- */
.table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.table th {
	text-align: left;
	font-size: 11px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--text-3);
	padding: 8px 12px;
	border-bottom: 1px solid var(--line);
	background: #fbfcfe;
	position: sticky;
	top: 0;
}

.table td {
	padding: 9px 12px;
	border-bottom: 1px solid var(--line);
	vertical-align: middle;
	font-weight: 400;
}

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

.table tbody tr:hover,
.table tbody tr:focus-within {
	background: #fafbfd;
}

.table tbody tr.is-selected {
	background: var(--accent-soft);
}

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

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

.table-wrap {
	overflow: auto;
	max-width: 100%;
}

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

.strong {
	font-weight: 500;
}

/* ---------- states ---------- */
.empty {
	padding: 28px 16px;
	text-align: center;
	color: var(--text-3);
}

.empty strong {
	display: block;
	color: var(--text-2);
	margin-bottom: 4px;
}

.skeleton {
	display: block;
	height: 14px;
	border-radius: 4px;
	background: linear-gradient(90deg, #eef2f7 25%, #f6f8fb 37%, #eef2f7 63%);
	background-size: 400% 100%;
	animation: shimmer 1.4s ease infinite;
	margin: 10px 0;
}

@keyframes shimmer {
	0% { background-position: 100% 50%; }
	100% { background-position: 0 50%; }
}

.error-box {
	border: 1px solid #f0c6c8;
	background: var(--st-red-bg);
	color: var(--st-red-fg);
	padding: 10px 12px;
	border-radius: var(--r-sm);
	font-size: 13px;
}

.note-box {
	border: 1px solid var(--line);
	background: #fbfcfe;
	color: var(--text-2);
	padding: 10px 12px;
	border-radius: var(--r-sm);
	font-size: 12px;
}

/* demo QA 1.16.4: the hint above the visit summary form keeps the form's field spacing (the title label touched it) */
.vs-form > .note-box {
	margin-bottom: 12px;
}

.warn-box {
	border: 1px solid #f1dfb0;
	background: var(--st-amber-bg);
	color: var(--st-amber-fg);
	padding: 10px 12px;
	border-radius: var(--r-sm);
	font-size: 13px;
}

/* ---------- drawer, dialog, toast ---------- */
.drawer-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(22, 39, 63, 0.28);
	z-index: 50;
	opacity: 0;
	transition: opacity var(--t-med) var(--ease);
}

.drawer-backdrop.open {
	opacity: 1;
}

.drawer {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(560px, 100vw);
	background: var(--panel);
	z-index: 51;
	display: flex;
	flex-direction: column;
	box-shadow: var(--shadow-2);
	transform: translateX(24px);
	opacity: 0;
	transition: transform var(--t-med) var(--ease), opacity var(--t-med) var(--ease);
}

.drawer.wide {
	width: min(820px, 100vw);
}

.drawer.open {
	transform: none;
	opacity: 1;
}

/* Centred pop-up variant (calendar): same content and behaviour as the side panel. */
.drawer.modal {
	top: 50%;
	left: 50%;
	right: auto;
	bottom: auto;
	width: min(640px, calc(100vw - 32px));
	max-height: min(88vh, 900px);
	border-radius: 12px;
	transform: translate(-50%, -48%) scale(0.98);
}

.drawer.modal.wide {
	width: min(860px, calc(100vw - 32px));
}

.drawer.modal.open {
	transform: translate(-50%, -50%);
}

.drawer.modal > footer {
	border-radius: 0 0 12px 12px;
}

/* Pop-up look shared with the calendar's move dialog: accent edge, deeper shadow, calm header, large buttons. */
.drawer.modal {
	border-top: 3px solid var(--accent);
	box-shadow: 0 18px 50px rgba(15, 23, 42, 0.25);
}

.drawer.modal > header {
	padding: 16px 20px 12px;
	border-bottom: 0;
}

.drawer.modal > header h2 {
	font-size: 16px;
	font-weight: 500;
}

.drawer.modal > .content {
	padding: 4px 20px 18px;
}

.drawer.modal > footer {
	padding: 12px 20px 16px;
	border-top: 1px solid var(--line);
	background: var(--panel);
}

.drawer.modal > footer .btn {
	height: 40px;
	min-width: 112px;
	justify-content: center;
	font-size: 14px;
}

/* Confirmation pop-up: small, content-sized. */
.drawer.modal.compact {
	width: min(460px, calc(100vw - 32px));
}

.drawer.modal.compact > .content {
	flex: none;
	padding: 16px 18px 8px;
}

.drawer.modal.compact > .content p {
	margin-top: 0;
	line-height: 1.55;
}

.drawer > header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 18px;
	border-bottom: 1px solid var(--line);
}

.drawer > header .close {
	margin-left: auto;
}

.drawer > .content {
	flex: 1;
	overflow: auto;
	padding: 18px;
}

.drawer > footer {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	padding: 12px 18px;
	border-top: 1px solid var(--line);
	background: #fbfcfe;
}

/* UI.ask: a question above an open pop-up (restore unsaved changes, changed by someone else) */
.ask-backdrop {
	z-index: 55;
}

.drawer.ask {
	z-index: 56;
}

/* Autosave status (UI.saveStatus): light and muted beside a form's title; the error says why, with Retry. */
.save-status {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	min-height: 20px;
	font-size: 12px;
	font-weight: 400;
	color: var(--text-3);
	letter-spacing: 0;
	text-transform: none;
	white-space: normal;
}

.save-status .save-status-icon {
	width: 13px;
	height: 13px;
	display: none;
}

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

.save-status[data-state="error"],
.save-status[data-state="stopped"] {
	color: var(--st-red-fg);
}

.save-status[data-state="offline"] {
	color: var(--st-amber-fg);
}

.save-status .save-status-retry {
	font-size: 12px;
}

/* long lists of small forms (policies, custom fields): no "Saves automatically" on every row */
.policy-status .save-status[data-state="idle"],
.cf-status .save-status[data-state="idle"] {
	visibility: hidden;
}

/* a Save button with nothing to save: quiet "Saved", same size (no layout jump) */
.btn.is-saved,
.btn.is-saved[disabled] {
	background: var(--panel);
	color: var(--text-3);
	border-color: var(--line-2);
	box-shadow: none;
	opacity: 1;
	cursor: default;
}

.btn.is-saved .icon {
	color: var(--success);
}

.toasts {
	position: fixed;
	bottom: 16px;
	left: 50%;
	transform: translateX(-50%);
	display: grid;
	gap: 8px;
	z-index: 70;
	width: min(520px, calc(100vw - 32px));
}

.toast {
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--navy);
	color: #fff;
	padding: 10px 14px;
	border-radius: var(--r-md);
	box-shadow: var(--shadow-2);
	font-size: 13px;
	animation: toast-in var(--t-med) var(--ease);
}

.toast.error {
	background: #7d2422;
}

.toast .btn {
	margin-left: auto;
	height: 26px;
	background: rgba(255, 255, 255, 0.14);
	border-color: rgba(255, 255, 255, 0.24);
	color: #fff;
}

@keyframes toast-in {
	from { transform: translateY(8px); opacity: 0; }
	to { transform: none; opacity: 1; }
}

/* ---------- tiles ---------- */
.tiles {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
	gap: 10px;
	margin-bottom: 18px;
}

.tile {
	display: grid;
	grid-template-columns: auto 1fr;
	grid-template-rows: auto auto;
	gap: 2px 10px;
	align-items: center;
	text-align: left;
	padding: 12px 14px;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	cursor: pointer;
	font: inherit;
	color: var(--text);
	position: relative;
	transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.tile:hover {
	border-color: var(--line-2);
	box-shadow: var(--shadow-1);
}

.tile[aria-pressed="true"] {
	border-color: var(--navy);
	box-shadow: inset 0 0 0 1px var(--navy);
}

.tile .icon-wrap {
	grid-row: 1 / span 2;
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	border-radius: 8px;
	background: var(--st-grey-bg);
	color: var(--st-grey-fg);
}

.tile .count {
	font-family: var(--font-mono);
	font-size: 19px;
	font-weight: 500;
	line-height: 1;
	color: var(--navy);
}

.tile .label {
	font-size: 12px;
	color: var(--text-2);
	line-height: 1.25;
}

.tile.tone-blue .icon-wrap { background: var(--st-blue-bg); color: var(--st-blue-fg); }
.tile.tone-green .icon-wrap { background: var(--st-green-bg); color: var(--st-green-fg); }
.tile.tone-amber .icon-wrap { background: var(--st-amber-bg); color: var(--st-amber-fg); }
.tile.tone-red .icon-wrap { background: var(--st-red-bg); color: var(--st-red-fg); }
.tile.tone-violet .icon-wrap { background: var(--st-violet-bg); color: var(--st-violet-fg); }

div.tile {
	cursor: default;
}

.tile .hint {
	grid-column: 1 / -1;
	margin-top: 6px;
	font-size: 12px;
	color: var(--text-3);
	line-height: 1.3;
}

.tile.is-zero .count {
	color: var(--text-3);
	font-weight: 400;
}

.tile.hot::after {
	content: "";
	position: absolute;
	top: 10px;
	right: 10px;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--st-red-fg);
}

/* ---------- command palette ---------- */
.palette {
	position: fixed;
	top: 12vh;
	left: 50%;
	transform: translateX(-50%);
	width: min(620px, calc(100vw - 32px));
	background: var(--panel);
	border-radius: var(--r-md);
	box-shadow: var(--shadow-2);
	z-index: 80;
	overflow: hidden;
}

.palette input {
	border: 0;
	border-bottom: 1px solid var(--line);
	border-radius: 0;
	height: 48px;
	font-size: 15px;
	padding: 0 16px;
}

.palette ul {
	list-style: none;
	margin: 0;
	padding: 6px;
	max-height: 50vh;
	overflow: auto;
}

.palette li {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 10px;
	border-radius: var(--r-sm);
	cursor: pointer;
}

.palette li[aria-selected="true"] {
	background: var(--accent-soft);
}

.palette li kbd {
	margin-left: auto;
}

/* ---------- login ---------- */
.auth-page {
	min-height: 100dvh;
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
	background: var(--canvas);
}

.auth-aside {
	background: var(--navy);
	color: #fff;
	padding: 48px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
}

.auth-aside .auth-title {
	color: #fff;
	font-family: var(--font-display);
	font-size: 24px;
	font-weight: 500;
	max-width: 440px;
	line-height: 1.25;
	opacity: 1;
}

.auth-aside p {
	opacity: 0.78;
	max-width: 440px;
}

.auth-form {
	padding: 48px 40px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	background: var(--panel);
}

.auth-form h1 {
	font-size: 20px;
	margin-bottom: 6px;
}

.auth-form .btn {
	width: 100%;
	height: 40px;
	margin-top: 6px;
}

.auth-form .code-input {
	font-size: 16px;
	letter-spacing: 0.15em;
}

.auth-form {
	position: relative;
}

.auth-form .auth-lang {
	position: absolute;
	top: 16px;
	right: 16px;
}

.auth-form .lang-switch .btn {
	width: auto;
	height: 26px;
	margin-top: 0;
}

.auth-form #use-recovery,
.auth-form .auth-link {
	font-size: 12px;
	height: 32px;
}

.auth-form .auth-check {
	margin: 2px 0 6px;
	font-size: 13px;
}

.recovery-list {
	columns: 2;
	margin: 8px 0 16px;
	padding-left: 22px;
	font-size: 14px;
	line-height: 1.9;
}

.dev-hint {
	margin-top: 20px;
	font-size: 12px;
}

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

/* Short viewports (200% zoom on a laptop): the sticky bars would cover most of the page. */
@media (max-height: 560px) {
	.topbar,
	.sidenav {
		position: static;
		height: auto;
	}
}

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

	/* demo QA 1.16.4: panel header buttons wrap on a phone instead of pushing the page sideways */
	.panel > header,
	.panel > header .actions {
		flex-wrap: wrap;
	}

	.topbar {
		position: static;
		flex-wrap: wrap;
		gap: 8px 12px;
		padding: 8px 12px;
	}

	.omnibox {
		order: 3;
		flex-basis: 100%;
		max-width: none;
	}

	.omnibox kbd,
	.topbar-right kbd {
		display: none;
	}

	/* the top bar buttons wrap instead of running off a phone screen */
	.topbar-right {
		flex-wrap: wrap;
	}

	.page-head .actions {
		margin-left: 0;
	}

	.drawer > footer {
		flex-wrap: wrap;
	}

	.sidenav {
		position: static;
		height: auto;
		display: flex;
		overflow-x: auto;
		gap: 4px;
		padding: 6px 8px;
		border-right: 0;
		border-bottom: 1px solid var(--line);
	}

	.sidenav .group {
		display: none;
	}

	.brand span,
	.topbar-right .who,
	.topbar-right .clock {
		display: none;
	}

	.brand {
		min-width: 0;
	}

	.main {
		padding: 16px;
	}

	.grid-2,
	.grid-3 {
		grid-template-columns: minmax(0, 1fr);
	}

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

	.auth-aside {
		display: none;
	}
}

@media print {
	.topbar, .sidenav, .no-print, .toasts {
		display: none !important;
	}

	.shell {
		display: block;
	}

	body {
		background: #fff;
	}

	.panel {
		border: 0;
	}
}

/* ---------- shared booking drawer + slot finder ---------- */
.small {
	font-size: 12px;
}

.booking .step {
	padding: 4px 0 16px;
	border-bottom: 1px solid var(--line);
	margin-bottom: 16px;
}

.booking .step:last-child {
	border-bottom: 0;
}

.booking h3 {
	margin-bottom: 10px;
}

/* update 2: where the pre-selected doctor and service came from (always editable) */
.booking .booking-suggested {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0 0 10px;
}

.booking .booking-suggested .icon {
	width: 13px;
	height: 13px;
	flex: none;
}

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

.inline input[type="search"] {
	flex: 1;
	min-width: 220px;
}

.picked {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	background: var(--canvas);
	border-radius: var(--r-sm);
}

.picked .btn {
	margin-left: auto;
}

/* Services of one visit (booking pop-up and visit pop-up): main service, "+" rows, total */
.svc-picker,
.svc-list {
	display: grid;
	gap: 6px;
}

.svc-extra {
	display: flex;
	align-items: center;
	gap: 6px;
}

.svc-extra select {
	flex: 1;
	min-width: 0;
}

.svc-plus {
	color: var(--text-3);
	font-weight: 300;
	width: 10px;
}

.svc-item {
	display: flex;
	align-items: baseline;
	gap: 4px;
}

.svc-remove {
	border: 0;
	background: none;
	padding: 0 6px;
	font: inherit;
	font-size: 16px;
	line-height: 1;
	color: var(--text-3);
	cursor: pointer;
	border-radius: var(--r-sm);
}

.svc-remove:hover,
.svc-remove:focus-visible {
	color: var(--st-red-fg);
	background: var(--canvas);
}

.svc-foot {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	font-size: 12px;
}

.svc-total {
	color: var(--text-3);
	font-variant-numeric: tabular-nums;
	margin-left: auto;
}

.mini-results {
	display: grid;
	gap: 4px;
	margin-top: 8px;
}

.mini-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto auto;
	gap: 12px;
	align-items: center;
	text-align: left;
	padding: 8px 10px;
	border: 1px solid var(--line);
	border-radius: var(--r-sm);
	background: #fff;
	font: inherit;
	cursor: pointer;
}

.mini-row:hover,
.mini-row:focus-visible {
	border-color: var(--focus);
}

.new-patient {
	margin-top: 12px;
	padding: 14px;
	border: 1px dashed var(--line-2);
	border-radius: var(--r-md);
}

.dupe-row {
	display: flex;
	gap: 8px;
	align-items: center;
	justify-content: space-between;
	margin: 6px 0;
}

.slot-head {
	display: flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
	margin-bottom: 10px;
}

.slot-head .seg {
	margin-left: auto;
}

.slot-days {
	display: grid;
	gap: 10px;
	max-height: 360px;
	overflow: auto;
	padding-right: 4px;
}

.slot-day {
	display: grid;
	grid-template-columns: 110px minmax(0, 1fr);
	gap: 10px;
	align-items: start;
}

.slot-day-label {
	font-size: 12px;
	font-weight: 500;
	color: var(--text-2);
	padding-top: 6px;
}

.slot-times {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.slot {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	height: 30px;
	padding: 0 9px;
	border: 1px solid var(--line-2);
	border-radius: var(--r-sm);
	background: #fff;
	cursor: pointer;
	font: inherit;
	font-size: 13px;
}

.slot .doc-dot {
	width: 18px;
	height: 18px;
	font-size: 9px;
}

.slot:hover {
	border-color: var(--navy);
}

.slot[aria-pressed="true"] {
	background: var(--navy);
	border-color: var(--navy);
	color: #fff;
}

.kv {
	display: grid;
	grid-template-columns: 130px minmax(0, 1fr);
	gap: 6px 12px;
	margin: 14px 0;
}

.kv dt {
	color: var(--text-3);
	font-size: 12px;
	padding-top: 2px;
}

.kv dd {
	margin: 0;
}

.events {
	list-style: none;
	padding: 0;
	margin: 8px 0 0;
	display: grid;
	gap: 6px;
	font-size: 12px;
}

.reasons {
	display: flex;
	gap: 4px;
	flex-wrap: wrap;
	margin-top: 4px;
}

.print-only {
	display: none;
}

@media print {
	.print-only {
		display: block;
	}

	.main > *:not(.print-only) {
		display: none !important;
	}

	body.printing-form .drawer,
	body.printing-form .drawer-backdrop,
	body.printing-form .print-only:not(#form-print-area) {
		display: none !important;
	}
}

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

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

.nowrap {
	white-space: nowrap;
}

.link-btn {
	border: 0;
	background: none;
	padding: 0;
	font: inherit;
	font-size: 12px;
	color: var(--accent, #b4501a);
	cursor: pointer;
	text-decoration: underline;
}

.link-btn[disabled] {
	opacity: 0.6;
	cursor: default;
}

/* ---------- screen language (ΕΛ | EN in the header and on the sign-in page) ---------- */
.lang-switch {
	display: inline-flex;
	align-items: center;
	border: 1px solid rgba(255, 255, 255, 0.22);
	border-radius: var(--r-sm);
	overflow: hidden;
}

.lang-switch .btn {
	height: 26px;
	padding: 0 8px;
	border: 0;
	border-radius: 0;
	font-weight: 400;
	font-size: 12px;
	letter-spacing: 0.04em;
	opacity: 0.7;
}

.lang-switch .btn[aria-pressed="true"] {
	background: rgba(255, 255, 255, 0.16);
	opacity: 1;
}

.lang-switch.on-light {
	border-color: var(--line-2);
}

.lang-switch.on-light .btn {
	color: var(--text-2);
}

.lang-switch.on-light .btn[aria-pressed="true"] {
	background: var(--navy);
	color: #fff;
}

/* ---------- page help ---------- */
.help-lang {
	margin-left: 12px;
}

.help-body {
	font-size: 14px;
	line-height: 1.6;
}

.help-intro {
	margin-top: 0;
	color: var(--text-2);
}

.help-clips {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	gap: 14px;
	margin: 12px 0 18px;
}

.help-clip {
	margin: 0;
}

.help-clip video {
	width: 100%;
	aspect-ratio: 16 / 10;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: #0f1b2d;
}

.help-clip figcaption {
	margin-top: 4px;
	font-size: 13px;
	color: var(--text-2);
}

.help-clip-missing {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 16 / 10;
	border: 1px dashed var(--line);
	border-radius: 8px;
}

.help-section h3 {
	margin: 18px 0 6px;
	font-size: 14px;
	font-weight: 500;
}

.help-section ol {
	margin: 0;
	padding-left: 20px;
}

.help-tips {
	margin: 6px 0 0;
	padding-left: 20px;
	color: var(--text-2);
}

.help-keys {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 4px 12px;
	margin: 0;
}

.help-keys dd {
	margin: 0;
}

/* ---------- alerts bell ---------- */
.bell {
	position: relative;
}

.bell-count {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 17px;
	height: 17px;
	padding: 0 4px;
	border-radius: 9px;
	background: var(--accent);
	color: #fff;
	font-size: 11px;
	line-height: 17px;
	text-align: center;
}

.bell-count[hidden] {
	display: none;
}

.bell.has-urgent .bell-count {
	background: var(--st-red-fg);
	animation: bell-pulse 1.2s ease-in-out 3;
}

@keyframes bell-pulse {
	50% {
		transform: scale(1.25);
	}
}

.bell-pop {
	position: fixed;
	z-index: 60;
	width: min(380px, calc(100vw - 16px));
	max-height: min(560px, calc(100vh - 80px));
	display: flex;
	flex-direction: column;
	background: var(--panel);
	color: var(--text);
	border: 1px solid var(--line-2);
	border-radius: 10px;
	box-shadow: var(--shadow-2);
	font-size: 13px;
}

.bell-pop header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 12px;
	border-bottom: 1px solid var(--line);
	color: var(--text-2);
}

.bell-list {
	overflow: auto;
	flex: 1;
}

.bell-empty {
	padding: 18px 14px;
}

.bell-item {
	display: grid;
	grid-template-columns: 18px minmax(0, 1fr) auto;
	gap: 10px;
	align-items: start;
	width: 100%;
	padding: 9px 12px;
	border: 0;
	border-bottom: 1px solid var(--line);
	background: none;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.bell-item:hover,
.bell-item:focus-visible {
	background: var(--canvas);
}

.bell-item .icon {
	margin-top: 2px;
	color: var(--text-3);
}

.bell-item.unread {
	background: var(--accent-soft);
}

.bell-item.unread .bell-title::before {
	content: "";
	display: inline-block;
	width: 7px;
	height: 7px;
	margin-right: 6px;
	border-radius: 50%;
	background: var(--accent);
	vertical-align: 1px;
}

.bell-item.urgent .icon {
	color: var(--st-red-fg);
}

.bell-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

/* Up to two lines so a heart alert ("SpO2 below 92 %: 12 readings, lowest 88 %, last 27/09 13:19") reads in full. */
.bell-body {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
	color: var(--text-2);
}

.bell-when {
	color: var(--text-3);
	font-size: 12px;
	white-space: nowrap;
}

.bell-settings {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	align-items: center;
	padding: 8px 12px;
	border-top: 1px solid var(--line);
	color: var(--text-2);
}

.bell-push {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 10px;
	flex-basis: 100%;
}

.bell-push-extra {
	display: inline-flex;
	gap: 6px;
	align-items: center;
}

.bell-push-extra select {
	width: auto;
	min-height: 28px;
	padding: 3px 26px 3px 8px;
	background-position: right 8px center;
	background-size: 12px 12px;
	font-size: 12px;
}

.bell-push:empty {
	display: none;
}

.alert-toast {
	display: inline-flex;
	gap: 8px;
	align-items: flex-start;
}

.alert-toast strong {
	font-weight: 500;
}

/* ---------- patient reminders (reminders.js): chart tab, settings, patient page ---------- */
.rem-visits,
.rem-sent {
	list-style: none;
	margin: 0;
	padding: 0;
}

.rem-visits li,
.rem-sent li {
	padding: 4px 0;
}

.rem-flags-box {
	margin-top: 12px;
}

.rem-sms-off {
	display: grid;
	gap: 6px;
	margin-bottom: 16px;
	font-size: 13px;
}

.rem-sms-off-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
}

.rem-flags-box summary {
	cursor: pointer;
}

.rem-flags {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 8px 16px;
	align-items: end;
	margin-top: 8px;
}

.rem-recommend {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	margin-bottom: 12px;
}

.rem-group h3 {
	font-weight: 400;
	margin: 12px 0 6px;
}

.rem-bring-row {
	display: grid;
	grid-template-columns: 1fr 1fr auto auto;
	gap: 6px;
	align-items: center;
	margin-bottom: 6px;
}

@media (max-width: 640px) {
	.rem-bring-row {
		grid-template-columns: 1fr;
	}
}

/* GeSY co-payment button (copay.js), on Today rows and in the visit pop-up. */
.copay {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 4px;
	align-items: center;
	margin: 4px 0 0;
}

.copay .copay-method {
	min-width: 46px;
}

.copay .copay-done .icon {
	color: var(--success);
}

/* B4: at the practice's co-payment moment, one split button (cash in one click, the narrow ▾ for card or other) */
.copay.is-split {
	gap: 0;
	flex-wrap: nowrap;
}

.copay.is-split .copay-issue {
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
}

.copay.is-split .copay-caret {
	min-width: 30px;
	padding: 0 8px;
	border-top-left-radius: 0;
	border-bottom-left-radius: 0;
	border-left: 1px solid rgba(255, 255, 255, 0.45);
}

.copay-quick {
	display: flex;
	gap: 10px;
	margin-top: 12px;
}

.copay-quick .btn {
	flex: 1;
}

.copay-row {
	margin: 8px 0 12px;
}

/* ---------- tabs, action rows and key figures (shared by every module; were only in admin.css) ---------- */
.inline-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	align-items: center;
}

.form-actions {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	margin-top: 6px;
}

.tabs {
	display: flex;
	gap: 2px;
	border-bottom: 1px solid var(--line);
	margin-bottom: 16px;
	overflow-x: auto;
}

/* Greek tab names are longer: wrap to a second row instead of hiding the last tabs */
html[lang="el"] .tabs {
	flex-wrap: wrap;
	overflow-x: visible;
}

.tabs button {
	border: 0;
	background: transparent;
	font: inherit;
	font-weight: 500;
	color: var(--text-2);
	padding: 10px 14px;
	border-bottom: 2px solid transparent;
	cursor: pointer;
	white-space: nowrap;
}

.tabs button:hover {
	color: var(--navy);
}

.tabs button[aria-selected="true"] {
	color: var(--navy);
	border-bottom-color: var(--accent);
	font-weight: 500;
}

.kpis {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
	gap: 10px;
	margin-bottom: 16px;
}

.kpi {
	padding: 12px 14px;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	min-width: 0;
}

.kpi .value {
	font-family: var(--font-mono);
	font-size: 22px;
	font-weight: 500;
	color: var(--navy);
	line-height: 1.1;
}

.kpi .value.muted {
	color: var(--text-3);
	font-weight: 400;
}

.kpi .label {
	font-size: 12px;
	color: var(--text-2);
	margin-top: 4px;
}

.kpi .sub {
	font-size: 11px;
	color: var(--text-3);
	margin-top: 2px;
	font-family: var(--font-mono);
}

.kpi.warn {
	border-color: #f1dfb0;
	background: var(--st-amber-bg);
}

.kpi.alert {
	border-color: #f0c6c8;
	background: var(--st-red-bg);
}

.kpi.alert .value {
	color: var(--st-red-fg);
}

/* 1.11/1.12 port on the 1.10 look: the existing identity chip opens the check (identity.js attach); nothing else changes */
.id-attach {
	cursor: pointer;
}

.id-methods {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4px 16px;
}

/* 1.11 "Connect iPhone app" pop-up (heartconnect.js): the QR code large enough to scan from the screen */
.hc {
	text-align: center;
}

.drawer.modal.compact > .content .hc p {
	margin: 0 0 8px;
}

.hc .hc-name {
	font-size: 16px;
	color: var(--navy);
}

.hc-qr {
	display: block;
	width: 248px;
	height: 248px;
	margin: 4px auto 10px;
	image-rendering: pixelated;
}

.hc .hc-hint {
	color: var(--text-2);
}

.hc .hc-status {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 4px 12px;
	border-radius: var(--r-pill);
	background: var(--canvas);
	color: var(--text-2);
	font-size: 13px;
}

.hc .hc-status.ok {
	background: var(--st-green-bg);
	color: var(--st-green-fg);
}

.hc-wait {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--accent);
	animation: hc-pulse 1.4s ease-in-out infinite;
}

@keyframes hc-pulse {
	50% {
		opacity: 0.25;
	}
}

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

.hc-devices {
	text-align: left;
	margin-top: 10px;
}

.hc-dev {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 0;
	border-top: 1px solid var(--line);
}

.hc-dev .btn {
	margin-left: auto;
}

.hc-popup > footer {
	display: flex;
	justify-content: center;
	gap: 8px;
}

/* 1.11 demo mode (not production, simulated SMS): a one-time code shown on the page, clearly marked */
.demo-code {
	border: 1px dashed var(--st-amber-fg);
	background: var(--st-amber-bg);
	color: var(--st-amber-fg);
	border-radius: 8px;
	padding: 8px 12px;
	font-variant-numeric: tabular-nums;
}

/* B30 official medicine information: the (i) beside a medicine and its pop-up (medinfo.js), above any open pop-up */
.medinfo-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	/* negative vertical margins: the button never makes a label or table row taller */
	margin: -4px 2px -4px 4px;
	padding: 0;
	border: 1px solid var(--line-2);
	border-radius: 50%;
	background: #fff;
	color: var(--text-2);
	font: italic 600 11px/1 Georgia, 'Times New Roman', serif;
	vertical-align: middle;
	cursor: pointer;
}

.medinfo-btn:hover,
.medinfo-btn:focus-visible {
	border-color: var(--accent);
	color: var(--accent);
}

.medinfo-backdrop {
	z-index: 62;
}

.drawer.modal.compact.medinfo {
	z-index: 63;
	width: min(680px, calc(100vw - 32px));
	max-height: 92vh;
}

.medinfo-head {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.medinfo-sub {
	color: var(--text-3);
	font-size: 13px;
	font-weight: 300;
}

.medinfo-lang {
	display: inline-block;
	margin-left: 4px;
	padding: 0 7px;
	border: 1px solid var(--line);
	border-radius: var(--r-pill);
	color: var(--text-2);
	font-size: 12px;
	font-weight: 300;
	line-height: 18px;
	white-space: nowrap;
}

.drawer.modal.compact.medinfo > .content {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
	overflow: hidden;
}

.medinfo-tabs {
	flex: none;
	max-width: 100%;
	overflow-x: auto;
	align-self: flex-start;
}

.medinfo-tabs button {
	flex: none;
	padding: 0 10px;
	font-size: 13px;
	font-weight: 300;
}

.medinfo-text {
	max-height: 70vh;
	overflow: auto;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	font-size: 14px;
	font-weight: 300;
	line-height: 1.55;
}

.medinfo-missing,
.medinfo-none {
	margin: 4px 0;
	color: var(--text-2);
	font-weight: 300;
}

/* B61: no SmPC installed, links to the official registers */
.medinfo-register a {
	color: var(--focus);
}

.drawer.modal.compact.medinfo > footer {
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
}

.medinfo-source {
	flex: 1 1 260px;
	color: var(--text-3);
	font-size: 12px;
	font-weight: 300;
	line-height: 1.45;
}

.drawer.modal.compact.medinfo > footer .btn {
	min-width: 0;
	margin-left: auto;
}

.mc-info {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin: 10px 2px;
}

/* 1.12 port on the 1.10 look (B1): Heart alerts filters (Patients, Severity, Status) side by side on one row, wrapping on narrow screens */
.toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: flex-end;
}

.toolbar > .field {
	flex: 0 1 220px;
	min-width: 160px;
	margin: 0;
}

/* 1.12 port (B1): the heart alerts table's Acknowledge and Close buttons never touch (a gap, wrapping with a gap when narrow) */
.table td > .row-actions {
	display: inline-flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 6px;
	margin: 2px 0;
}

/* C6: "Show in the patient's app with reminders" switch (prescription pop-up, prescription view, chart medicines) */
.app-switch {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	vertical-align: middle;
	cursor: pointer;
	font-size: 13px;
	font-weight: 400;
	color: var(--text);
}

.app-switch-input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
}

.app-switch-track {
	position: relative;
	flex: none;
	width: 30px;
	height: 17px;
	border-radius: 9px;
	background: var(--navy);
	transition: background 0.15s;
}

.app-switch-track::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 15px;
	width: 13px;
	height: 13px;
	border-radius: 50%;
	background: #fff;
	transition: transform 0.15s;
}

.app-switch.off .app-switch-track {
	background: var(--line-2);
}

.app-switch.off .app-switch-track::after {
	transform: translateX(-13px);
}

.app-switch-input:focus-visible + .app-switch-track {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.app-switch-input:disabled + .app-switch-track {
	opacity: 0.6;
}

.app-switch.off .app-switch-label {
	color: var(--text-3);
}

.rx-item .app-line {
	grid-column: 1 / -1;
	margin: 2px 0 8px;
}

.rx-item .app-line .app-hint {
	margin: 2px 0 0 38px;
	font-size: 12px;
	font-weight: 300;
	color: var(--text-3);
}

.rx-item[data-app="0"] .app-hint {
	text-decoration: line-through;
}

/* the switch column takes only the room it needs, so the row actions beside it stay on one line */
.table th.app-col {
	width: 1%;
}

.app-cell .muted.small {
	margin-top: 2px;
	white-space: nowrap;
}

.app-rx-lines > h3 {
	margin: 0;
	padding: 12px 14px 6px;
	font-size: 12px;
	font-weight: 500;
	color: var(--navy);
}

@media (prefers-reduced-motion: reduce) {
	.app-switch-track,
	.app-switch-track::after {
		transition: none;
	}
}

/* ---------- B73 lab values from documents (docvalues.js) ---------- */

.dv-box {
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	margin: 12px 0;
	background: var(--panel);
}

.dv-box > header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	padding: 9px 12px;
	border-bottom: 1px solid var(--line);
}

.dv-box > header h4 {
	margin: 0;
	flex: 1;
	min-width: 160px;
	font-size: 13.5px;
	font-weight: 400;
}

.dv-body {
	display: grid;
	gap: 10px;
	padding: 10px 12px;
	justify-items: start;
}

.dv-body > .table-wrap,
.dv-body > .dv-foot,
.dv-body > .dv-manual {
	justify-self: stretch;
}

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

.dv-valcell {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

.dv-table input.dv-val {
	width: 78px;
	min-width: 0;
	padding: 3px 6px;
}

.dv-valcell {
	flex-wrap: nowrap;
}

.dv-foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	justify-content: flex-end;
}

.dv-foot > .muted {
	flex: 1;
	min-width: 180px;
}

.dv-pagewrap {
	justify-self: stretch;
	max-height: 340px;
	overflow: auto;
	border: 1px solid var(--line-2);
	border-radius: var(--r-sm);
	background: var(--canvas);
}

.dv-canvas {
	display: block;
	max-width: 100%;
	border: 1px solid var(--line-2);
	border-radius: var(--r-sm);
}

.dv-scan {
	max-width: 100%;
	max-height: 520px;
	border: 1px solid var(--line-2);
	border-radius: var(--r-sm);
}

.dv-manual {
	display: grid;
	gap: 6px;
}

.dv-mrow {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 96px 90px;
	gap: 6px;
	align-items: center;
}

.dv-date {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

/* ---------- B73 AI summary with sources (ai-assist.js) ---------- */

.ai-sourced {
	display: grid;
	gap: 6px;
}

.ai-src-head {
	margin-top: 6px;
	color: var(--text-2);
	font-size: 12px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.ai-src-line {
	line-height: 1.6;
}

.ai-src-line.is-unsourced > span:first-child {
	color: var(--text-2);
}

.ai-src {
	display: inline-block;
	margin: 0 4px 0 0;
	padding: 0 7px;
	border-radius: var(--r-pill);
	background: var(--st-blue-bg);
	color: var(--st-blue-fg);
	font-size: 11.5px;
	text-decoration: none;
	white-space: nowrap;
}

.ai-src:hover,
.ai-src:focus-visible {
	text-decoration: underline;
}

/* ---------- B73 visit briefing (decision.js) ---------- */

.vb-panel.is-warning {
	border-color: var(--st-red-fg);
}

.vb-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 12px;
	margin-top: 10px;
}

.vb-blk {
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	padding: 10px 12px;
	display: grid;
	gap: 6px;
	align-content: start;
	min-width: 0;
}

.vb-blk h4 {
	margin: 0;
	font-size: 11.5px;
	font-weight: 400;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--text-3);
}

.vb-blk ol {
	margin: 0;
	padding-left: 18px;
}

.vb-row {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px 8px;
}

.vb-flag {
	border-left: 3px solid var(--st-red-fg);
	padding-left: 8px;
}

.vb-glance {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 12px;
	margin-top: 10px;
}

.vb-trends {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.vb-trends td {
	padding: 3px 6px 3px 0;
	border-bottom: 1px solid var(--line);
}

.vb-trends tr:last-child td {
	border-bottom: 0;
}

/* ---------- B74 dose check on prescription lines (clinical.js) ---------- */

.rx-dose {
	grid-column: 1 / -1;
}

.rx-dose:empty {
	display: none;
}

.rx-dose-flag {
	border-radius: var(--r-md);
	padding: 8px 10px;
	display: grid;
	gap: 6px;
	font-size: 13px;
}

.rx-dose-flag.red {
	background: var(--st-red-bg);
	color: var(--st-red-fg);
	border: 1px solid var(--st-red-fg);
}

.rx-dose-flag.amber {
	background: var(--st-amber-bg);
	color: var(--st-amber-fg);
}

.rx-dose-flag .row-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

/* B73 item 8 Medication review card (medreview.js) */
.mr-card > header h2 {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}

.mr-chips {
	display: inline-flex;
	gap: 6px;
}

.mr-card > header .actions {
	display: flex;
	align-items: center;
	gap: 10px;
}

.mr-body {
	display: grid;
	gap: 10px;
}

.mr-group {
	display: grid;
	gap: 6px;
}

.mr-h {
	font-size: 11.5px;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--text-3);
}

.mr-find {
	border-radius: var(--r-md);
	padding: 9px 12px;
	display: grid;
	gap: 5px;
	font-size: 13px;
	border: 1px solid var(--line);
	background: var(--st-grey-bg);
}

.mr-find.red {
	background: var(--st-red-bg);
	color: var(--st-red-fg);
	border-color: var(--st-red-fg);
}

.mr-find.amber {
	background: var(--st-amber-bg);
	color: var(--st-amber-fg);
	border-color: transparent;
}

.mr-find.is-seen {
	opacity: .75;
}

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

.mr-title {
	font-weight: 500;
}

.mr-quote {
	font-size: 12px;
	border-left: 3px solid var(--line-2, var(--line));
	padding-left: 8px;
}

.mr-note {
	font-size: 12px;
}

.mr-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}
