/*
 * Base component library (WBS-0014), consuming tokens.css only -- no
 * hard-coded colors/sizes here. Covers the subset of
 * 06-UX/02_Design_System_and_Theming.md SS4's component list needed for the
 * Phase 3 auth/error/application shells (WBS-0015/0016); the remaining
 * components (data table, chart, signature pad, etc.) are built alongside
 * the pages that first need them, per the AI Execution Protocol's
 * phase-scoped file-edit discipline -- not invented speculatively here.
 */

* { box-sizing: border-box; }

.card {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-card);
	box-shadow: var(--elevation-1);
	padding: var(--spacing-5);
}

.btn {
	font-family: inherit;
	font-size: var(--type-scale-md);
	border-radius: var(--radius-button);
	padding: var(--spacing-3) var(--spacing-5);
	min-height: 44px; /* GUC SS2 touch-target floor */
	border: 1px solid transparent;
	cursor: pointer;
	transition: background var(--motion-duration-micro) var(--motion-easing);
}
.btn-primary { background: var(--color-brand-primary); color: #fff; }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.btn-destructive { background: var(--status-danger); color: #fff; } /* GUC SS6: destructive actions use the danger token, never brand-primary */
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Status badges: icon + text label + color -- never color alone (SS5) */
.badge {
	display: inline-flex;
	align-items: center;
	gap: var(--spacing-1);
	border-radius: var(--radius-badge);
	padding: 2px var(--spacing-3);
	font-size: var(--type-scale-xs);
	font-weight: 600;
}
.badge-success { background: color-mix(in srgb, var(--status-success) 15%, transparent); color: var(--status-success); }
.badge-warning { background: color-mix(in srgb, var(--status-warning) 15%, transparent); color: var(--status-warning); }
.badge-danger { background: color-mix(in srgb, var(--status-danger) 15%, transparent); color: var(--status-danger); }
.badge-info { background: color-mix(in srgb, var(--status-info) 15%, transparent); color: var(--status-info); }
.badge-neutral { background: color-mix(in srgb, var(--status-neutral) 15%, transparent); color: var(--status-neutral); }
.badge .badge-icon { width: 12px; height: 12px; }

.alert {
	display: flex;
	gap: var(--spacing-3);
	border-radius: var(--radius-card);
	padding: var(--spacing-4);
	border: 1px solid;
}
.alert-danger { background: color-mix(in srgb, var(--status-danger) 8%, var(--color-surface)); border-color: var(--status-danger); color: var(--color-text); }
.alert-warning { background: color-mix(in srgb, var(--status-warning) 8%, var(--color-surface)); border-color: var(--status-warning); color: var(--color-text); }
.alert-info { background: color-mix(in srgb, var(--status-info) 8%, var(--color-surface)); border-color: var(--status-info); color: var(--color-text); }

.field { margin-bottom: var(--spacing-4); }
.field label { display: block; font-size: var(--type-scale-sm); margin-bottom: var(--spacing-1); }
.field .required { color: var(--status-danger); }
.field input:not([type="checkbox"]):not([type="radio"]) {
	width: 100%;
	min-height: 44px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-button);
	padding: var(--spacing-2) var(--spacing-3);
	background: var(--color-surface);
	color: var(--color-text);
	font-size: var(--type-scale-md);
}
.field input[type="checkbox"], .field input[type="radio"] {
	width: auto;
	min-height: 0;
	margin-inline-end: var(--spacing-2);
	vertical-align: middle;
}
.field.has-error input { border-color: var(--status-danger); }
.field .error-text { color: var(--status-danger); font-size: var(--type-scale-xs); margin-top: var(--spacing-1); }

/* Auth shell (WBS-0015): centered branded card, per PAG-001's Mobile/RTL note */
.auth-shell {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--color-bg);
	padding: var(--spacing-5);
}
.auth-card { width: 100%; max-width: 400px; text-align: center; }
.auth-card .logo { height: 40px; margin-bottom: var(--spacing-5); }
.auth-card h1 { font-size: var(--type-scale-xl); margin: 0 0 var(--spacing-2); }
.auth-card .subtitle { color: var(--color-text-muted); font-size: var(--type-scale-sm); margin-bottom: var(--spacing-5); }
.auth-card form { text-align: start; }
.lang-switcher { position: absolute; top: var(--spacing-4); inset-inline-end: var(--spacing-4); }

/* Error shell (WBS-0015): PAG-004/005/006/007 -- no upstream framework name ever rendered */
.error-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding: var(--spacing-5); }
.error-shell .code { font-size: var(--type-scale-xxxl); color: var(--color-brand-primary-on-light); font-weight: 700; } /* foreground use: -on-light variant, see DEC-IMPL-012 */
.error-shell .reference-id { font-family: monospace; color: var(--color-text-muted); direction: ltr; unicode-bidi: embed; }

/* Application shells (WBS-0016) */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
	width: var(--sidebar-width-expanded);
	background: var(--color-surface);
	border-inline-end: 1px solid var(--color-border);
	flex-shrink: 0;
}
.app-sidebar.collapsed { width: var(--sidebar-width-collapsed); }
/* Phase 20 second-pass fix: .app-sidebar itself (width/background/mobile
   drawer transform, above and below) was always styled, but the <nav><a>
   items inside it were never given any rule at all -- every staff page's
   own navigation rendered as plain browser-default blue underlined text.
   Found live re-verifying GAP-IMPL-0038's persona pages once the separate
   missing-static-assets regression was fixed and real content became
   visible underneath. */
.app-sidebar nav { display: flex; flex-direction: column; padding: var(--spacing-3) 0; }
.app-sidebar nav a {
	display: block;
	padding: var(--spacing-2) var(--spacing-5);
	color: var(--color-text);
	text-decoration: none;
	font-size: var(--type-scale-sm);
}
.app-sidebar nav a:hover { background: var(--color-border); }
.app-shell-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	/* Without this, a flex child's automatic min-width is "auto" (its
	   content's intrinsic width), so any unshrinkable descendant (a fixed-
	   width form row, an unwrapped long string) silently stretches this
	   whole column -- and the page -- wider than the viewport instead of
	   wrapping/scrolling internally. Found live on PAG-093's side-by-side
	   BP inputs at a narrow mobile width. */
	min-width: 0;
}
.app-topbar {
	min-height: 56px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: var(--spacing-2);
	padding: var(--spacing-2) var(--spacing-5);
	border-bottom: 1px solid var(--color-border);
	background: var(--color-surface);
}
.app-topbar > span:first-child { min-width: 0; }
/* GAP-IMPL-0048 closure (2026-08-08): the "Log out" link used to share
   .app-topbar-user's own overflow:hidden/max-width box with the raw
   session-email text -- at a narrow enough viewport the ellipsis could
   clip the link itself, not just the (non-essential) email text next to
   it, silently making logout unreachable rather than merely making the
   topbar look crowded. Only the email text truncates now; the logout
   link (and the language switcher, this whole group's sibling) never
   shrinks, and the topbar itself wraps onto a second line first if it
   still doesn't fit, so nothing required is ever hidden. */
.app-topbar-user-group {
	display: flex;
	align-items: center;
	min-width: 0;
}
.app-topbar-user {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
@media (max-width: 480px) {
	.app-topbar-user { max-width: 32vw; }
}
.app-main { flex: 1; padding: var(--spacing-5); max-width: var(--layout-max-width); min-width: 0; }

/* Training banner: distinct color, never reused elsewhere (SS2 token table) */
.training-banner {
	background: var(--training-banner-bg);
	color: #fff;
	text-align: center;
	padding: var(--spacing-2);
	font-size: var(--type-scale-sm);
	font-weight: 600;
}
/* Demo banner: uses status-info, visually distinct from the training banner's purple */
.demo-banner {
	background: var(--status-info);
	color: #fff;
	text-align: center;
	padding: var(--spacing-2);
	font-size: var(--type-scale-sm);
	font-weight: 600;
}

.app-nav-toggle {
	display: none;
	background: none;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm, 4px);
	font-size: var(--type-scale-lg);
	line-height: 1;
	padding: var(--spacing-1) var(--spacing-2);
	cursor: pointer;
	color: inherit;
}
.app-sidebar-scrim { display: none; }

@media (max-width: 767px) {
	.app-nav-toggle { display: inline-block; }
	.app-sidebar {
		display: block;
		position: fixed;
		inset-inline-start: 0;
		top: 0;
		bottom: 0;
		z-index: 100;
		transform: translateX(-100%);
		transition: transform 0.2s ease;
	}
	[dir="rtl"] .app-sidebar { transform: translateX(100%); }
	.app-sidebar.open { transform: translateX(0); }
	.app-sidebar-scrim.open {
		display: block;
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.4);
		z-index: 99;
	}
}

/* Data table (WBS-0032, first needed by PAG-053 Patient List) */
.data-table-toolbar {
	display: flex;
	gap: var(--spacing-3);
	align-items: center;
	margin-bottom: var(--spacing-4);
	flex-wrap: wrap;
}
.data-table-search {
	flex: 1;
	min-width: 200px;
}
.data-table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--type-scale-sm); }
.data-table th {
	text-align: start;
	padding: var(--spacing-3);
	border-bottom: 2px solid var(--color-border);
	color: var(--color-text-muted);
	font-weight: 600;
	white-space: nowrap;
}
.data-table td {
	padding: var(--spacing-3);
	border-bottom: 1px solid var(--color-border);
	vertical-align: middle;
}
.data-table tbody tr:hover { background: color-mix(in srgb, var(--color-brand-primary) 4%, transparent); }
.data-table .alert-count {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--status-danger);
	font-weight: 600;
}
.data-table-empty {
	text-align: center;
	padding: var(--spacing-6) var(--spacing-5);
	color: var(--color-text-muted);
}
@media (max-width: 767px) {
	.data-table .col-desktop-only { display: none; }
}

/* Patient shell (PAG-055-070 shared identity strip/safety banner/tabs) */
.patient-strip {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--spacing-3);
	margin-bottom: var(--spacing-3);
}
.patient-strip-identity { display: flex; align-items: center; gap: var(--spacing-3); flex-wrap: wrap; }
.patient-strip-name { font-size: var(--type-scale-lg); font-weight: 600; }
.patient-strip-mrn { font-family: monospace; direction: ltr; unicode-bidi: embed; color: var(--color-text-muted); }
.safety-banner ul { margin: var(--spacing-2) 0 0; padding-inline-start: var(--spacing-5); }
.tab-bar {
	display: flex;
	gap: var(--spacing-2);
	overflow-x: auto;
	border-bottom: 1px solid var(--color-border);
	margin-bottom: var(--spacing-4);
	padding-bottom: 0;
}
.tab-pill {
	padding: var(--spacing-2) var(--spacing-4);
	border-radius: 999px 999px 0 0;
	color: var(--color-text-muted);
	white-space: nowrap;
	border-bottom: 2px solid transparent;
}
.tab-pill-active { color: var(--color-brand-primary); border-bottom-color: var(--color-brand-primary); font-weight: 600; }
.inline-form { display: inline-block; margin-inline-start: var(--spacing-3); }
.btn-sm { padding: var(--spacing-1) var(--spacing-3); font-size: var(--type-scale-sm); }

/* Forms (PAG-054 and every subsequent create/edit page) */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--spacing-4); }
.form-grid .field-full { grid-column: 1 / -1; }
@media (max-width: 767px) {
	.form-grid { grid-template-columns: 1fr; }
}
.field-label { display: block; font-weight: 600; margin-bottom: var(--spacing-1); font-size: var(--type-scale-sm); }
.field-input, select.field-input, textarea.field-input {
	width: 100%;
	padding: var(--spacing-2) var(--spacing-3);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-2, 6px);
	background: var(--color-surface);
	color: var(--color-text);
	font-size: var(--type-scale-base);
}
.field-error { color: var(--status-danger); font-size: var(--type-scale-sm); margin-top: var(--spacing-1); }
.field-hint { color: var(--color-text-muted); font-size: var(--type-scale-sm); margin-top: var(--spacing-1); }
.form-actions { display: flex; gap: var(--spacing-3); margin-top: var(--spacing-5); }
.duplicate-panel {
	border: 1px solid var(--status-warning);
	background: color-mix(in srgb, var(--status-warning) 8%, var(--color-surface));
	border-radius: var(--radius-2, 6px);
	padding: var(--spacing-4);
	margin-bottom: var(--spacing-4);
}
.duplicate-match { display: flex; justify-content: space-between; align-items: center; padding: var(--spacing-2) 0; border-bottom: 1px solid var(--color-border); gap: var(--spacing-3); flex-wrap: wrap; }
.duplicate-match:last-child { border-bottom: none; }

/* Cards/summary tiles (PAG-055 Overview, PAG-085 Daily Closing, etc.) */
.tile-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--spacing-4); margin-bottom: var(--spacing-5); }
.tile { border: 1px solid var(--color-border); border-radius: var(--radius-2, 6px); padding: var(--spacing-4); background: var(--color-surface); }
.tile-value { font-size: var(--type-scale-xl, 1.5rem); font-weight: 700; }
.tile-label { color: var(--color-text-muted); font-size: var(--type-scale-sm); }
.tile-locked { color: var(--color-text-muted); font-style: italic; }

/* Kanban (PAG-081 Queue Board) */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--spacing-4); align-items: start; }
@media (max-width: 900px) {
	.kanban { grid-template-columns: 1fr; }
}
.kanban-column { background: var(--color-surface-alt, var(--color-surface)); border-radius: var(--radius-2, 6px); padding: var(--spacing-3); min-height: 120px; }
.kanban-column h3 { margin: 0 0 var(--spacing-3); font-size: var(--type-scale-sm); text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); }
.kanban-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-2, 6px); padding: var(--spacing-3); margin-bottom: var(--spacing-3); }
.kanban-card-priority-urgent { border-inline-start: 4px solid var(--status-danger); }
.kanban-card-priority-high { border-inline-start: 4px solid var(--status-warning); }
.kanban-card-actions { display: flex; gap: var(--spacing-2); margin-top: var(--spacing-2); flex-wrap: wrap; }

/* Calendar grid (PAG-074) */
.calendar-grid { display: grid; border: 1px solid var(--color-border); border-radius: var(--radius-2, 6px); overflow: auto; }
.calendar-header-row, .calendar-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.calendar-header-cell { padding: var(--spacing-2); font-weight: 600; text-align: center; border-bottom: 1px solid var(--color-border); border-inline-start: 1px solid var(--color-border); background: var(--color-surface-alt, var(--color-surface)); }
.calendar-cell { min-height: 48px; border-bottom: 1px solid var(--color-border); border-inline-start: 1px solid var(--color-border); padding: 2px; position: relative; }
.calendar-block { border-radius: 4px; padding: 2px 6px; font-size: var(--type-scale-sm); cursor: grab; color: #fff; }
.calendar-block[draggable="true"]:active { cursor: grabbing; }
.calendar-block-blocked { background: repeating-linear-gradient(45deg, #ccc, #ccc 4px, #ddd 4px, #ddd 8px); cursor: not-allowed; }
.slot-grid { display: flex; flex-wrap: wrap; gap: var(--spacing-2); }
.slot-chip { padding: var(--spacing-2) var(--spacing-3); border: 1px solid var(--color-border); border-radius: 999px; cursor: pointer; background: var(--color-surface); }
.slot-chip:hover, .slot-chip.selected { background: var(--color-brand-primary); color: #fff; border-color: var(--color-brand-primary); }
.board-row { display: flex; align-items: center; gap: var(--spacing-3); padding: var(--spacing-3); border-bottom: 1px solid var(--color-border); flex-wrap: wrap; }
.board-row-actions { display: flex; gap: var(--spacing-2); margin-inline-start: auto; flex-wrap: wrap; }
.conflict-banner { position: sticky; top: 0; z-index: 5; }

/* Report Center gallery (PAG-175, WBS-0068) */
.report-category { margin-bottom: var(--spacing-6); }
.report-category-title { font-size: var(--type-scale-lg); margin: 0 0 var(--spacing-3); }
.report-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--spacing-4); }
.report-card { display: flex; flex-direction: column; gap: var(--spacing-2); cursor: pointer; transition: box-shadow var(--motion-duration-micro) var(--motion-easing); }
.report-card:hover { box-shadow: var(--elevation-2, 0 4px 12px rgba(0,0,0,0.08)); }
.report-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--spacing-2); }
.report-card-title { font-weight: 600; }
.report-card-formats { display: flex; gap: var(--spacing-1); color: var(--color-text-muted); font-size: var(--type-scale-xs); }
.favorite-toggle { background: none; border: none; cursor: pointer; font-size: var(--type-scale-lg); color: var(--color-text-muted); padding: 0; line-height: 1; }
.favorite-toggle.is-favorite { color: var(--status-warning); }
.category-chip { padding: var(--spacing-2) var(--spacing-3); border: 1px solid var(--color-border); border-radius: 999px; cursor: pointer; background: var(--color-surface); font-size: var(--type-scale-sm); }
.category-chip:hover, .category-chip.selected { background: var(--color-brand-primary); color: #fff; border-color: var(--color-brand-primary); }
.category-chip-row { display: flex; flex-wrap: wrap; gap: var(--spacing-2); }
@media (max-width: 768px) {
	.report-category-title { cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
	.report-category.collapsed .report-card-grid { display: none; }
}

/* Guided demo tour (clinic_platform/public/js/tour.js) -- gated strictly to
   an active Demo Session server-side (see app_shell_base.html/
   portal_shell_base.html), so this CSS renders inert on a real production
   site: no matching elements are ever injected into the DOM. The spotlight
   is a small fixed-position box whose own oversized box-shadow doubles as
   the dimmed backdrop -- one element, no SVG mask, no clip-path, works
   identically under dir="ltr" and dir="rtl" since it is positioned purely
   from the real target's getBoundingClientRect() in tour.js. */
.cp-tour-backdrop { position: fixed; inset: 0; z-index: 9997; background: transparent; }
.cp-tour-spotlight {
	position: fixed;
	z-index: 9998;
	pointer-events: none;
	border-radius: var(--radius-card);
	border: 2px solid var(--color-brand-primary);
	box-shadow: 0 0 0 9999px rgba(15, 20, 24, 0.6);
	transition: left var(--motion-duration-panel) var(--motion-easing), top var(--motion-duration-panel) var(--motion-easing),
		width var(--motion-duration-panel) var(--motion-easing), height var(--motion-duration-panel) var(--motion-easing);
}
.cp-tour-card {
	position: fixed;
	z-index: 9999;
	width: min(320px, calc(100vw - 24px));
	background: var(--color-surface);
	color: var(--color-text);
	border-radius: var(--radius-modal);
	box-shadow: var(--elevation-2);
	padding: var(--spacing-4) var(--spacing-5);
	text-align: start;
}
.cp-tour-card:focus { outline: none; }
.cp-tour-progress { font-size: var(--type-scale-xs); color: var(--color-text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: var(--spacing-2); }
.cp-tour-title { margin: 0 0 var(--spacing-2); font-size: var(--type-scale-lg); }
.cp-tour-body { margin: 0 0 var(--spacing-4); color: var(--color-text-muted); font-size: var(--type-scale-sm); line-height: 1.5; }
.cp-tour-dots { display: flex; gap: 6px; margin-bottom: var(--spacing-4); }
.cp-tour-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--color-border); }
.cp-tour-dot.active { background: var(--color-brand-primary); }
.cp-tour-actions { display: flex; align-items: center; justify-content: space-between; gap: var(--spacing-3); flex-wrap: wrap; }
.cp-tour-actions-end { display: flex; gap: var(--spacing-2); }

/* Persistent replay control, topbar-adjacent (SS "always show ... so the
   visitor can replay it anytime"). */
.cp-tour-replay-btn {
	width: 28px;
	height: 28px;
	flex-shrink: 0;
	border-radius: 50%;
	border: 1px solid var(--color-border);
	background: var(--color-surface);
	color: var(--color-brand-primary-on-light);
	font-weight: 700;
	font-size: var(--type-scale-sm);
	line-height: 1;
	padding: 0;
	cursor: pointer;
}
.cp-tour-replay-btn:hover { background: var(--color-border); }

/* REM-017 "Personalise This Demo" entry point. Sits beside the tour replay
   control in the app/portal topbar and, like it, renders only inside an
   active Demo Session. Deliberately quiet -- a text pill, not a call to
   action competing with the product being demonstrated. */
.cp-demo-personalize-link {
	flex-shrink: 0;
	white-space: nowrap;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-badge);
	background: var(--color-surface);
	color: var(--color-brand-primary-on-light);
	font-size: var(--type-scale-xs);
	font-weight: 600;
	line-height: 1;
	padding: var(--spacing-2) var(--spacing-3);
	text-decoration: none;
}
.cp-demo-personalize-link:hover { background: var(--color-border); }
@media (max-width: 640px) {
	/* The topbar is already tight on a phone; the tour button and the
	   language switcher take priority there. */
	.cp-demo-personalize-link { display: none; }
}

/* Demo Session control panel (Section 38): a quiet dropdown, matching the
   Personalise pill's own restraint -- this is operator tooling for
   evaluating the product, not part of the product itself. */
.cp-demo-panel-wrap { position: relative; flex-shrink: 0; }
.cp-demo-panel {
	position: absolute;
	inset-inline-end: 0;
	top: calc(100% + var(--spacing-2));
	z-index: 40;
	min-width: 240px;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-card);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
	padding: var(--spacing-3);
	display: flex;
	flex-direction: column;
	gap: var(--spacing-2);
	font-size: var(--type-scale-sm);
}
.cp-demo-panel-row { display: flex; flex-direction: column; gap: var(--spacing-1); }
.cp-demo-panel-row label { font-size: var(--type-scale-xs); color: var(--color-text-muted); }
.cp-demo-panel-actions { display: flex; gap: var(--spacing-2); flex-wrap: wrap; border-top: 1px solid var(--color-border); padding-top: var(--spacing-2); }
.cp-demo-panel-actions button {
	flex: 1 1 auto;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-badge);
	background: var(--color-surface);
	padding: var(--spacing-1) var(--spacing-2);
	font-size: var(--type-scale-xs);
	cursor: pointer;
}
.cp-demo-panel-actions button:hover { background: var(--color-border); }
#cp-demo-exit { color: var(--color-danger, #b23b2f); }
@media (max-width: 640px) {
	.cp-demo-panel-wrap { display: none; }
}

/* /demo-personalize preview pane (www/demo-personalize.html). */
.cp-personalize-preview-bar {
	border-radius: var(--radius-card);
	padding: var(--spacing-3);
	display: flex;
	align-items: center;
	gap: var(--spacing-2);
	color: #fff;
	background: var(--color-brand-primary);
}
.cp-personalize-swatch {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	display: inline-block;
	border: 1px solid var(--color-border);
}

/* ---------------------------------------------------------------------
 * Print (REM-020, 2026-08-11 demo-upgrade audit section M).
 *
 * Before this block the app had exactly one @media print rule in the
 * whole codebase -- a local `.no-print { display:none }` inside
 * www/verify/invoice.html -- so every "Print" button in every staff page
 * printed the entire application shell: sidebar navigation, topbar,
 * session e-mail, Log out link, language picker, tour replay button and
 * the page's own action buttons (Post Invoice / Reverse / Request
 * Refund), all on top of the actual document.
 *
 * `.no-print` is promoted here from that one page's private rule to a
 * real app-wide utility: put it on anything that is a control rather
 * than content. Document pages additionally offer a dedicated branded
 * print view (?print=1, see utils/branded_documents.py) which renders no
 * shell at all; these rules are the safety net for that view's own
 * toolbar AND the correct behaviour for every other page whose Print
 * action still prints the shell page in place.
 * ------------------------------------------------------------------ */
@media print {
	.no-print,
	.app-sidebar,
	.app-sidebar-scrim,
	.app-nav-toggle,
	.app-topbar-user-group,
	#app-lang-switch,
	#cp-tour-replay-btn,
	.cp-demo-personalize-link,
	.cp-tour-backdrop,
	.cp-tour-spotlight,
	.cp-tour-card {
		display: none !important;
	}

	/* The topbar itself stays, reduced to the clinic's own logo/name --
	   it is the only branding an in-place shell print carries. Everything
	   interactive inside it is hidden above. */
	.app-topbar {
		position: static;
		border-bottom: 1px solid #000;
		background: transparent;
		padding-inline: 0;
	}

	/* Undo the screen layout: no flex columns, no viewport heights, no
	   internal scroll containers (an overflow:auto wrapper prints only
	   its visible slice and silently truncates wide tables). */
	.app-shell { display: block; min-height: 0; }
	.app-shell-content { display: block; }
	.app-main { padding: 0; max-width: none; }
	.data-table-wrap { overflow: visible !important; }

	body { background: #fff; color: #000; }
	.card { box-shadow: none; border-color: #999; break-inside: avoid; page-break-inside: avoid; }
	.data-table tr { break-inside: avoid; page-break-inside: avoid; }
	.data-table thead { display: table-header-group; }
	.badge { border: 1px solid #999; }
	a[href] { color: inherit; text-decoration: none; }
	h1, h2, h3 { break-after: avoid; page-break-after: avoid; }
}
