/* Diagnostic ERP: design tokens (v3.2.1 "Medical blue-teal").
   Deep navy-teal sidebar, teal actions, cool light paper. Each kind of account keeps a small accent of its own:
   centre staff = teal, vendor = indigo, collection partner = amber, platform console = clinical blue. */
:root {
  --font: "Inter", "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --ink: #0f2a3a;
  --ink-2: #587083;
  --paper: #f2f6f9;
  --surface: #ffffff;
  --line: #d8e3ea;
  --line-soft: #eaf1f5;

  --cap-lavender: #6d6fd8;
  --cap-red: #d6545c;
  --cap-grey: #8a9aa6;
  --cap-blue: #3b8fd9;
  --cap-gold: #e3a33a;
  --cap-teal: #22b5ad;

  --accent: #0d7c86;        /* teal: buttons, links, active items */
  --accent-deep: #0b3a52;   /* sidebar and sign-in panel */
  --accent-deep-2: #0c5566;
  --accent-cap: var(--cap-teal);
  --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
  --accent-hover: color-mix(in srgb, var(--accent) 84%, #000);

  --side-text: rgba(255, 255, 255, .80);
  --side-muted: rgba(255, 255, 255, .50);
  --side-hover: rgba(255, 255, 255, .08);
  --side-active: rgba(255, 255, 255, .14);

  --shadow-sm: 0 1px 2px rgba(15, 42, 58, .06), 0 1px 1px rgba(15, 42, 58, .04);
  --shadow-md: 0 6px 18px rgba(15, 42, 58, .08);
  --radius-lg: 12px;
  --radius: 8px;
  --sb-w: 252px;
}
.portal-vendor   { --accent: #4b55c8; --accent-deep: #23285e; --accent-deep-2: #333a8a; --accent-cap: var(--cap-lavender); }
.portal-partner  { --accent: #a4640d; --accent-deep: #0b3a52; --accent-deep-2: #3d4f2e; --accent-cap: var(--cap-gold); }
.portal-platform { --accent: #1f64b4; --accent-deep: #0d2a4d; --accent-deep-2: #12407a; --accent-cap: var(--cap-blue); }

[data-bs-theme="dark"] {
  --ink: #e3edf2;
  --ink-2: #93a9b6;
  --paper: #0a161d;
  --surface: #102029;
  --line: #213845;
  --line-soft: #172b36;
  --accent-deep: #071c27;
  --accent-deep-2: #0a3240;
  --shadow-sm: none;
  --shadow-md: 0 6px 18px rgba(0, 0, 0, .35);
}
[data-bs-theme="dark"] .portal-staff, [data-bs-theme="dark"] body:not([class*="portal-"]) { --accent: #3cc8c0; }
[data-bs-theme="dark"] .portal-vendor { --accent: #9ea4f2; }
[data-bs-theme="dark"] .portal-partner { --accent: #e9b45a; }
[data-bs-theme="dark"] .portal-platform { --accent: #6fa9ec; }

/* Base */
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-border-color: var(--line);
  --bs-secondary-color: var(--ink-2);
  --bs-link-color-rgb: 13, 124, 134;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 { color: var(--ink); font-weight: 600; letter-spacing: -.01em; }
.text-muted { color: var(--ink-2) !important; }
.table, .stat-card .value, .tabular { font-variant-numeric: tabular-nums; }
a:not(.btn):not(.nav-link):not(.page-link):not(.dropdown-item) { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code { color: var(--ink); background: var(--line-soft); padding: 1px 5px; border-radius: 4px; font-size: .88em; }

/* Bootstrap, re-tinted by the portal colour */
.btn { border-radius: var(--radius); font-weight: 500; }
.btn-primary { box-shadow: 0 1px 2px rgba(13, 124, 134, .25); }
.btn-primary {
  --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent);
  --bs-btn-hover-bg: var(--accent-hover); --bs-btn-hover-border-color: var(--accent-hover);
  --bs-btn-active-bg: var(--accent-hover); --bs-btn-active-border-color: var(--accent-hover);
  --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent);
}
.btn-outline-primary {
  --bs-btn-color: var(--accent); --bs-btn-border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  --bs-btn-hover-bg: var(--accent); --bs-btn-hover-border-color: var(--accent); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--accent); --bs-btn-active-border-color: var(--accent);
}
.btn-outline-secondary { --bs-btn-color: var(--ink-2); --bs-btn-border-color: var(--line); --bs-btn-hover-bg: var(--line-soft); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--line); }
.form-control, .form-select { border-color: var(--line); border-radius: var(--radius); background-color: var(--surface); color: var(--ink); }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-label { font-weight: 500; color: var(--ink); margin-bottom: .3rem; }
.nav-tabs { border-bottom-color: var(--line); }
.nav-tabs .nav-link { color: var(--ink-2); border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.nav-tabs .nav-link:hover { color: var(--ink); border-bottom-color: var(--line); }
.nav-tabs .nav-link.active { color: var(--accent); background: transparent; border-bottom-color: var(--accent); font-weight: 600; }
.pagination { --bs-pagination-active-bg: var(--accent); --bs-pagination-active-border-color: var(--accent); --bs-pagination-color: var(--accent); }
.alert { border-radius: var(--radius); border-width: 0 0 0 3px; }
.badge { font-weight: 500; letter-spacing: 0; }
.text-bg-primary { background-color: var(--accent) !important; }

/* App shell: deep navy-teal sidebar, the active page marked in teal */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sb-w); flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--accent-deep) 0%, var(--accent-deep-2) 100%); color: var(--side-text);
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent;
}
.sidebar .brand { display: flex; gap: 11px; align-items: center; padding: 18px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand-cap { width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; position: relative;
  background: linear-gradient(135deg, var(--cap-teal), var(--cap-blue)); box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.sidebar .brand-cap::before, .sidebar .brand-cap::after { content: ""; position: absolute; background: #fff; border-radius: 2px; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.sidebar .brand-cap::before { width: 14px; height: 4px; }
.sidebar .brand-cap::after { width: 4px; height: 14px; }
.sidebar .brand-name { font-weight: 600; font-size: 15px; line-height: 1.2; color: #fff; }
.sidebar .brand-portal { font-size: 12px; color: var(--side-muted); }
.sidebar .nav { padding: 8px 12px 24px; }
.sidebar .nav-group { padding: 16px 10px 5px; font-size: 11px; font-weight: 600; color: var(--side-muted); text-transform: uppercase; letter-spacing: .06em; }
.sidebar .nav-link { color: var(--side-text); padding: 7px 10px; font-size: 13.5px; border-radius: var(--radius); display: flex; align-items: center; gap: 10px; position: relative; }
.sidebar .nav-link i { color: var(--side-muted); font-size: 15px; width: 18px; text-align: center; }
.sidebar .nav-link:hover { background: var(--side-hover); color: #fff; }
.sidebar .nav-link:hover i { color: #fff; }
.sidebar .nav-link.active { background: var(--side-active); color: #fff; font-weight: 600; }
.sidebar .nav-link.active i { color: var(--accent-cap); }
.sidebar .nav-link.active::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent-cap); }
.sidebar .nav-link:focus-visible { outline-color: #fff; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 24px; position: sticky; top: 0; z-index: 1020;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.page-title { font-size: 19px; margin: 0; font-weight: 600; }
.topbar .icon-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius); color: var(--ink-2); border: 1px solid transparent; background: transparent; }
.topbar .icon-btn:hover { background: var(--line-soft); color: var(--ink); }
.user-chip { display: flex; align-items: center; gap: 9px; padding-left: 8px; border-left: 1px solid var(--line); }
.user-chip .avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-deep-2)); color: #fff; font-weight: 600; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.user-chip .who { line-height: 1.15; }
.user-chip .who b { font-weight: 600; font-size: 13px; display: block; }
.user-chip .who span { font-size: 12px; color: var(--ink-2); }
.content { padding: 24px; max-width: 1480px; width: 100%; }

/* Surfaces */
.card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.card-header { background: transparent; border-bottom-color: var(--line-soft); padding: 12px 16px; font-weight: 600; }
.card-footer { background: transparent; border-top-color: var(--line-soft); }
.stat-card .label { font-size: 12.5px; color: var(--ink-2); }
.stat-card .value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin-top: 2px; color: var(--ink); }
.stat-card { border-top: 3px solid var(--accent); }
.stat-card .value a { color: inherit !important; text-decoration: none; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--ink); --bs-table-hover-bg: var(--line-soft); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .55rem .75rem; border-bottom-color: var(--line-soft); }
.table thead th { font-size: 11.5px; font-weight: 600; color: var(--ink-2); background: var(--line-soft); border-bottom-color: var(--line); white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
.table-light, .table-light > * > * { --bs-table-bg: var(--line-soft); }
.barcode-label { border: 1px dashed #999; padding: 6px 10px; width: 260px; display: inline-block; margin: 4px; font-size: 11px; background: #fff; color: #000; }

/* Sign-in pages: split screen, the portal's cap raised in a row of the five common tube caps */
.auth-split { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 5fr) 6fr; background: var(--surface); }
.auth-brand { background: radial-gradient(circle at 85% 12%, rgba(34,181,173,.35), transparent 42%), radial-gradient(circle at 10% 95%, rgba(59,143,217,.30), transparent 45%), linear-gradient(150deg, var(--accent-deep), var(--accent-deep-2)); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; position: relative; overflow: hidden; }
.auth-brand .org { font-weight: 600; font-size: 15px; opacity: .92; display: flex; align-items: center; gap: 10px; }
.auth-brand h1 { color: #fff; font-size: clamp(30px, 3.2vw, 42px); line-height: 1.12; font-weight: 600; letter-spacing: -.02em; margin: 0 0 14px; max-width: 14ch; }
.auth-brand p { font-size: 15.5px; line-height: 1.55; opacity: .84; max-width: 40ch; margin: 0; }
.auth-brand .foot { font-size: 12.5px; opacity: .7; }
.caps { display: flex; gap: 14px; align-items: flex-end; height: 76px; }
.caps .cap { width: 46px; height: 46px; border-radius: 50%; background: var(--c);
  box-shadow: inset 0 0 0 6px color-mix(in srgb, var(--c) 60%, #fff), inset 0 -5px 0 rgba(0,0,0,.18), 0 2px 0 rgba(0,0,0,.25); opacity: .55; }
.caps .cap.is-mine { width: 66px; height: 66px; opacity: 1; box-shadow: inset 0 0 0 8px color-mix(in srgb, var(--c) 60%, #fff), inset 0 -6px 0 rgba(0,0,0,.18), 0 0 0 4px rgba(255,255,255,.9); animation: cap-rise .6s cubic-bezier(.2,.8,.2,1) both .1s; }
@keyframes cap-rise { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .caps .cap.is-mine { animation: none; } }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 48px 24px; background: var(--paper); }
.auth-form .panel { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px 30px; box-shadow: var(--shadow-md); }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.auth-points li { display: flex; align-items: center; gap: 12px; font-size: 14.5px; opacity: .92; }
.auth-points i { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.12); color: #7fe3dc; font-size: 16px; flex-shrink: 0; }
.auth-logo { max-width: 160px; max-height: 72px; object-fit: contain; background: #fff; border-radius: 12px; padding: 8px; margin-bottom: 22px; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.auth-mark { width: 54px; height: 54px; border-radius: 14px; position: relative; background: linear-gradient(135deg, var(--cap-teal), var(--cap-blue)); box-shadow: 0 10px 30px rgba(0,0,0,.3); margin-bottom: 22px; }
.auth-mark::before, .auth-mark::after { content: ""; position: absolute; background: #fff; border-radius: 3px; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.auth-mark::before { width: 24px; height: 7px; }
.auth-mark::after { width: 7px; height: 24px; }
.auth-form h2 { font-size: 24px; margin-bottom: 6px; }
.auth-form .lead-sm { color: var(--ink-2); margin-bottom: 24px; }
.auth-form .form-control { padding: .6rem .8rem; font-size: 15px; }
.auth-form .btn-primary { padding: .65rem; font-size: 15px; }
.pw-wrap { position: relative; }
.pw-wrap .form-control { padding-right: 44px; }
.pw-wrap .pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--ink-2); width: 36px; height: 36px; border-radius: var(--radius); }
.pw-wrap .pw-toggle:hover { color: var(--ink); background: var(--line-soft); }
.portal-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px; font-size: 13px; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.portal-back:hover { color: var(--ink); text-decoration: underline; }
.other-portals { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.other-portals a { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--c); }
.centre-pill { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 16px; font-size: 13.5px; }

/* Portal chooser */
.portal-list { display: grid; gap: 12px; }
.portal-option { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink) !important; text-decoration: none; }
.portal-option:hover { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.portal-option .cap { width: 40px; height: 40px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 5px color-mix(in srgb, var(--c) 60%, #fff), inset 0 -4px 0 rgba(0,0,0,.15); }
.portal-option b { display: block; font-size: 15px; }
.portal-option span { color: var(--ink-2); font-size: 13px; }
.portal-option i { color: var(--ink-2); }

@media (max-width: 991px) {
  .sidebar { position: fixed; left: calc(-1 * var(--sb-w) - 20px); z-index: 1040; transition: left .2s; height: 100%; box-shadow: 0 0 40px rgba(0,0,0,.15); }
  .sidebar.open { left: 0; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .user-chip .who { display: none; }
  .auth-split { grid-template-columns: 1fr; }
  .auth-brand { padding: 28px 24px; gap: 20px; }
  .auth-brand h1 { font-size: 28px; max-width: none; }
  .auth-brand .foot, .auth-brand p, .auth-points { display: none; }
  .auth-form .panel { padding: 24px 20px; }
  .caps { height: 56px; }
  .caps .cap { width: 32px; height: 32px; }
  .caps .cap.is-mine { width: 46px; height: 46px; }
}
@media print {
  .sidebar, .topbar, .no-print, .alert, .toast-stack, .toast-msg { display: none !important; }
  body { background: #fff; color: #000; }
  .content { padding: 0; max-width: none; }
  .card { border: 0; }
}
.login-wrap { max-width: 420px; margin: 8vh auto; padding: 0 16px; }
.btn-primary { background-image: none; }
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #0d1520; --bs-btn-hover-color: #0d1520; --bs-btn-active-color: #0d1520; --bs-btn-disabled-color: #0d1520; }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-hover-color: #0d1520; --bs-btn-active-color: #0d1520; }
[data-bs-theme="dark"] .pagination { --bs-pagination-active-color: #0d1520; }

/* ---- Components ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 1.5; white-space: nowrap;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 11%, transparent); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-neutral  { --tone: #5b6675; }
.pill-info     { --tone: #0d7c86; }
.pill-progress { --tone: #6b4fa0; }
.pill-success  { --tone: #1d7a4b; }
.pill-warning  { --tone: #a35c00; }
.pill-danger   { --tone: #b4232f; }
.pill-muted    { --tone: #8a939e; }
[data-bs-theme="dark"] .pill-neutral { --tone: #aab4bf; } [data-bs-theme="dark"] .pill-info { --tone: #74b2ea; }
[data-bs-theme="dark"] .pill-progress { --tone: #b9a3e6; } [data-bs-theme="dark"] .pill-success { --tone: #5fc795; }
[data-bs-theme="dark"] .pill-warning { --tone: #e8a94b; } [data-bs-theme="dark"] .pill-danger { --tone: #f07a83; }

.empty-state { text-align: center; padding: 40px 16px; color: var(--ink-2); }
.empty-state i { font-size: 28px; display: block; margin-bottom: 8px; opacity: .6; }
.empty-state p { margin: 0 0 12px; }

/* Success messages pop up at the bottom right and fade; problems stay inline */
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 1090; display: grid; gap: 8px; max-width: 380px; }
.toast-msg { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--ink); color: var(--surface);
  box-shadow: 0 10px 30px rgba(15, 23, 32, .22); font-size: 13.5px; animation: toast-in .25s ease-out both; }
.toast-msg i { color: #5fc795; font-size: 16px; }
.toast-msg button { margin-left: auto; background: none; border: 0; color: inherit; opacity: .6; }
.toast-msg.hide { opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .toast-msg { animation: none; } .toast-msg.hide { transition: none; } }

/* Global search in the top bar */
.top-search { position: relative; flex: 0 1 360px; margin-left: 12px; }
.top-search input { padding-left: 34px; height: 36px; background: var(--surface); }
.top-search i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-2); }
.top-search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 11px; background: var(--line-soft); color: var(--ink-2); border: 1px solid var(--line); box-shadow: none; padding: 1px 6px; }
@media (max-width: 767px) { .top-search { display: none; } }

/* Dashboard */
.hello { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.hello h2 { font-size: 24px; margin: 0; }
.hello .when { color: var(--ink-2); margin-top: 2px; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.kpi .k-label { font-size: 12.5px; color: var(--ink-2); }
.kpi .k-value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .k-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.kpi.is-alert { border-color: color-mix(in srgb, #b4232f 45%, var(--line)); }
.kpi.is-alert .k-value { color: #b4232f; }
.meter { height: 6px; border-radius: 999px; background: var(--line-soft); margin-top: 8px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.meter span.over { background: #b4232f; }

/* Sample-to-report pipeline: one stage per step, the count on top, connected left to right */
.pipeline { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 16px 14px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.pipeline-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.pipeline-head h3 { font-size: 15px; margin: 0; }
.pipeline-head span { color: var(--ink-2); font-size: 12.5px; }
.stages { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; position: relative; }
.stage { position: relative; padding: 10px 12px 12px; text-decoration: none; color: var(--ink) !important; border-radius: var(--radius); }
.stage:hover { background: var(--line-soft); }
.stage .s-count { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stage .s-name { font-size: 12.5px; color: var(--ink-2); line-height: 1.3; }
.stage .s-track { height: 4px; border-radius: 2px; background: var(--line); margin: 8px 0 8px; position: relative; }
.stage .s-track::after { content: ""; position: absolute; right: -6px; top: -3px; border: 5px solid transparent; border-left-color: var(--line); }
.stage:last-child .s-track::after { display: none; }
.stage.has-work .s-track { background: var(--accent); }
.stage.has-work .s-track::after { border-left-color: var(--accent); }
.stage.is-zero .s-count { color: var(--ink-2); font-weight: 500; }
.stage .s-group { font-size: 11.5px; color: var(--ink-2); }
@media (max-width: 991px) { .stages { grid-template-columns: repeat(2, 1fr); } .stage .s-track { display: none; } }

.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-list li { display: flex; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
.attention-list li:last-child { border-bottom: 0; }
.attention-list .a-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--line-soft); color: var(--ink-2); }
.attention-list .a-icon.danger { background: color-mix(in srgb, #b4232f 12%, transparent); color: #b4232f; }
.attention-list .a-icon.warning { background: color-mix(in srgb, #a35c00 12%, transparent); color: #a35c00; }
.attention-list .a-text { flex: 1; min-width: 0; }
.attention-list .a-text b { font-weight: 600; }
.attention-list .a-text div { font-size: 12.5px; color: var(--ink-2); }

/* Search results */
.result-group { margin-bottom: 20px; }
.result-group h3 { font-size: 14px; color: var(--ink-2); font-weight: 600; margin: 0 0 8px; }
.result-row { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 6px; color: var(--ink) !important; text-decoration: none; }
.result-row:hover { border-color: var(--accent); }
.result-row .r-main { flex: 1; min-width: 0; }
.result-row .r-main b { font-weight: 600; }
.result-row .r-main div { font-size: 12.5px; color: var(--ink-2); }
.sidebar .brand-logo { width: 30px; height: 30px; object-fit: contain; border-radius: 6px; flex-shrink: 0; background: #fff; }

/* Phone refinements */
.table td > a:first-child { white-space: nowrap; }
@media (max-width: 575px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 12px; }
  .kpi .k-value { font-size: 20px; }
  .hello h2 { font-size: 21px; }
  .quick-actions .btn { padding: .35rem .7rem; font-size: 13px; }
  .pipeline-head { flex-direction: column; gap: 2px; }
  .table { font-size: 13px; }
}

/* Printed documents (lab report, bill): letterhead rules are in Letterhead::CSS; margins are inside the sheet */
.doc-sheet .card-body { max-width: 210mm; padding: 0; }
.doc-sheet img { max-width: 100%; }
.lh-thumb { display: block; max-width: 100%; max-height: 110px; object-fit: contain; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 4px; margin-bottom: 8px; }
.lh-preview-wrap { position: sticky; top: 76px; }
.lh-preview { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #e9ecef; }
@media print {
  /* Page margin 0 = no room for the browser's own header/footer (date, title, address, page number).
     The 10/12 mm margin is made by padding instead, repeated on every printed page. */
  @page { size: A4; margin: 0; }
  .doc-sheet .card-body { padding: 0; max-width: none; }
  .content:not(:has(.doc-sheet)) { padding: 10mm 12mm !important; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
  .doc-sheet { margin: 0 !important; border: 0 !important; box-shadow: none !important; }
  /* No empty extra sheet: the screen layout's full-height shell is not used on paper */
  .app-shell, .main { display: block !important; min-height: 0 !important; height: auto !important; }
  .content:has(.doc-sheet) { padding: 0 !important; margin: 0 !important; }
}

/* Report page break (v2.5.1): a dashed line on screen, a new sheet when printed */
.report-page-break { border-top: 2px dashed #b8c2cc; margin: 18px 0; position: relative; }
.report-page-break::after { content: "page break"; position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: #fff; padding: 0 8px; font-size: 11px; color: #8a96a3; }
@media print {
  .report-page-break { border: 0; margin: 0; height: 0; break-before: page; page-break-before: always; }
  .report-page-break::after { content: none; }
}

/* Patient form: optional extra details */
.more-details { border: 1px dashed var(--line); border-radius: var(--radius); padding: 8px 12px; background: var(--line-soft); }
.more-details > summary { cursor: pointer; color: var(--accent); list-style: none; }
.more-details > summary::-webkit-details-marker { display: none; }
.more-details[open] > summary { margin-bottom: 4px; }
