/* =========================================================================
   REV.health Demo — Shared stylesheet
   - 4-theme token registry (Light, Dark, Hospital, Modern) on body class
   - Token names are IDENTICAL to docs/prd-v2/assets/shared.css for cross-site parity
   - Components MUST reference var(--color-*); never hard-code colors.
   ========================================================================= */

/* --------- Structural / typographic tokens (theme-independent) ----------- */
:root {
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-serif: 'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --font-mono:  'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;

  --header-h:    56px;
  --sidebar-w:   272px;
  --content-max: 1100px;
  --radius:      8px;
  --radius-sm:   5px;
  --radius-lg:   12px;
}

/* =========================================================================
   THEME REGISTRY — 4 themes, all using the same token names.
   Token names match docs/prd-v2/assets/shared.css EXACTLY.
   Components MUST reference var(--color-*); never hard-code colors.
   ========================================================================= */

/* ----- THEME: Light (default) — warm clinical paper ---------------------- */
:root,
body.theme-light {
  --color-bg:             #faf7f0;
  --color-surface:        #ffffff;
  --color-surface-2:      #f3ede0;
  --color-surface-3:      #ece4d2;
  --color-border:         #d9cfba;
  --color-border-strong:  #b9ad94;
  --color-text:           #1f2328;
  --color-text-dim:       #4a5360;
  --color-text-mute:      #7a8493;
  --color-accent:         #155e6e;
  --color-accent-hover:   #1c7c8e;
  --color-accent-fg:      #ffffff;
  --color-danger:         #b22222;
  --color-warn:           #8c5a2d;
  --color-success:        #2e7d32;
  --color-info:           #1a3a5c;
  --color-focus-ring:     color-mix(in srgb, var(--color-accent) 35%, transparent);
  --color-shadow-sm:      0 1px 2px rgba(31,35,40,0.07);
  --color-shadow-md:      0 4px 16px rgba(31,35,40,0.10);
  --color-shadow-lg:      0 8px 28px rgba(31,35,40,0.13);
  --color-overlay:        rgba(31,35,40,0.45);
  color-scheme: light;
}

/* ----- THEME: Dark — clinical dark, warm professional ------------------- */
body.theme-dark {
  --color-bg:             #0f1418;
  --color-surface:        #161c22;
  --color-surface-2:      #1d242c;
  --color-surface-3:      #242c36;
  --color-border:         #2a333d;
  --color-border-strong:  #3a4552;
  --color-text:           #e7ecef;
  --color-text-dim:       #a3acb6;
  --color-text-mute:      #6f7a86;
  --color-accent:         #5fb1be;
  --color-accent-hover:   #79c4cf;
  --color-accent-fg:      #07121a;
  --color-danger:         #d65a5a;
  --color-warn:           #d49050;
  --color-success:        #6cbfa6;
  --color-info:           #5fb1be;
  --color-focus-ring:     color-mix(in srgb, var(--color-accent) 45%, transparent);
  --color-shadow-sm:      0 1px 2px rgba(0,0,0,0.35);
  --color-shadow-md:      0 4px 16px rgba(0,0,0,0.45);
  --color-shadow-lg:      0 12px 32px rgba(0,0,0,0.55);
  --color-overlay:        rgba(0,0,0,0.65);
  color-scheme: dark;
}

/* ----- THEME: Hospital — sober institutional blues ---------------------- */
body.theme-hospital {
  --color-bg:             #f3f6fb;
  --color-surface:        #ffffff;
  --color-surface-2:      #e8eef7;
  --color-surface-3:      #d8e2f0;
  --color-border:         #c4d0e2;
  --color-border-strong:  #92a5c2;
  --color-text:           #0d2348;
  --color-text-dim:       #3d527a;
  --color-text-mute:      #6b7a96;
  --color-accent:         #1a4d8c;
  --color-accent-hover:   #266ab4;
  --color-accent-fg:      #ffffff;
  --color-danger:         #a82828;
  --color-warn:           #b6731f;
  --color-success:        #1f7a4d;
  --color-info:           #1a4d8c;
  --color-focus-ring:     color-mix(in srgb, var(--color-accent) 30%, transparent);
  --color-shadow-sm:      0 1px 2px rgba(13,35,72,0.07);
  --color-shadow-md:      0 4px 16px rgba(13,35,72,0.10);
  --color-shadow-lg:      0 8px 28px rgba(13,35,72,0.14);
  --color-overlay:        rgba(13,35,72,0.50);
  color-scheme: light;
}

/* ----- THEME: Modern — REV brand, warm minimal -------------------------- */
body.theme-modern {
  --color-bg:             #ffffff;
  --color-surface:        #fbfaf7;
  --color-surface-2:      #f3efe6;
  --color-surface-3:      #e8e2d3;
  --color-border:         #e3ddcd;
  --color-border-strong:  #c8bda4;
  --color-text:           #18181b;
  --color-text-dim:       #4f4f55;
  --color-text-mute:      #84848c;
  --color-accent:         #c84a2d;
  --color-accent-hover:   #e35e3e;
  --color-accent-fg:      #ffffff;
  --color-danger:         #b53d3d;
  --color-warn:           #b07020;
  --color-success:        #2e7d4d;
  --color-info:           #1f5d8a;
  --color-focus-ring:     color-mix(in srgb, var(--color-accent) 30%, transparent);
  --color-shadow-sm:      0 1px 2px rgba(24,24,27,0.05);
  --color-shadow-md:      0 4px 16px rgba(24,24,27,0.08);
  --color-shadow-lg:      0 8px 28px rgba(24,24,27,0.12);
  --color-overlay:        rgba(24,24,27,0.45);
  color-scheme: light;
}

/* =========================================================================
   RESET / BASE
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .2s ease, color .2s ease;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { max-width: 100%; }

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

/* Skip-link — first focusable element on every page */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--color-accent); color: var(--color-accent-fg);
  padding: 0.55rem 1rem; border-radius: var(--radius-sm);
  font-weight: 600; z-index: 1000;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* Main landmark focus indicator — visible when skip-link activates focus */
main#main:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
  border-radius: 3px;
}

/* =========================================================================
   TYPOGRAPHY
   ========================================================================= */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.005em;
  color: var(--color-text);
  margin: 0;
}
h1 { font-size: 2rem;    margin: 0 0 0.75rem; letter-spacing: -0.015em; }
h2 { font-size: 1.45rem; margin: 2rem 0 0.85rem;
     padding-bottom: 0.4rem;
     border-bottom: 1px solid color-mix(in srgb, var(--color-accent) 25%, var(--color-border));
     color: var(--color-accent); }
h3 { font-size: 1.18rem; margin: 1.5rem 0 0.55rem; color: var(--color-text); }
h4 { font-size: 1.02rem; margin: 1.1rem  0 0.4rem;  color: var(--color-text-dim); }
h5 { font-size: 0.92rem; margin: 0.9rem  0 0.3rem; }
h6 { font-family: var(--font-sans); font-size: 0.78rem;
     color: var(--color-text-mute); text-transform: uppercase;
     letter-spacing: 0.08em; font-weight: 700; margin: 0.85rem 0 0.3rem; }

p  { margin: 0 0 0.85rem; }
ul, ol { margin: 0 0 1rem 1.4rem; }
li { margin-bottom: 0.3rem; }

code {
  font-family: var(--font-mono); font-size: 0.86em;
  background: var(--color-surface-2);
  padding: 0.12em 0.38em; border-radius: 4px;
  color: var(--color-text);
}
pre {
  font-family: var(--font-mono); font-size: 0.85rem;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.95rem 1rem; overflow-x: auto;
  line-height: 1.55; margin: 0 0 1rem;
}
hr { border: 0; border-top: 1px solid var(--color-border); margin: 2rem 0; }

/* =========================================================================
   BUTTONS — .btn variants: primary, ghost, danger
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9rem; font-weight: 600;
  cursor: pointer; user-select: none;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.btn:hover {
  background: var(--color-surface-2);
  border-color: var(--color-border-strong);
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-accent-fg);
}
.btn.primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}
.btn.ghost {
  background: transparent;
  border-color: var(--color-border);
}
.btn.ghost:hover { background: var(--color-surface-2); }
.btn.danger {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: var(--color-accent-fg);
}
.btn.sm { padding: 0.35rem 0.65rem; font-size: 0.82rem; }
.btn.lg { padding: 0.75rem 1.25rem; font-size: 1rem; }

/* =========================================================================
   PILLS / BADGES
   ========================================================================= */
.pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.72rem; font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--color-surface-2);
  color: var(--color-text-dim);
  border: 1px solid var(--color-border);
  letter-spacing: 0.04em; text-transform: uppercase;
  line-height: 1.2; white-space: nowrap;
}
.pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.pill.success { color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 12%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-success) 35%, var(--color-border)); }
.pill.warn    { color: var(--color-warn);
  background: color-mix(in srgb, var(--color-warn) 12%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-warn) 35%, var(--color-border)); }
.pill.danger  { color: var(--color-danger);
  background: color-mix(in srgb, var(--color-danger) 12%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-danger) 35%, var(--color-border)); }
.pill.info    { color: var(--color-info);
  background: color-mix(in srgb, var(--color-info) 12%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-info) 35%, var(--color-border)); }
.pill.accent  { color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 12%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-accent) 35%, var(--color-border)); }

/* =========================================================================
   CARDS
   ========================================================================= */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--color-shadow-sm);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--color-shadow-md);
}
.card .card-title {
  margin: 0 0 0.4rem;
  font-family: var(--font-serif);
  font-size: 1.08rem;
  color: var(--color-text);
}
.card .card-desc {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-dim);
}
.card-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* =========================================================================
   CALLOUTS — info / warn / danger / success
   ========================================================================= */
.callout {
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  background: var(--color-surface);
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1rem 0;
  font-size: 0.92rem;
  color: var(--color-text);
}
.callout strong {
  display: block; margin-bottom: 0.2rem;
  color: var(--color-text);
  font-family: var(--font-serif); font-size: 1rem;
}
.callout.info    { border-left-color: var(--color-info); }
.callout.warn    { border-left-color: var(--color-warn); }
.callout.danger  { border-left-color: var(--color-danger); }
.callout.success { border-left-color: var(--color-success); }

/* =========================================================================
   TABLES
   ========================================================================= */
.table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.85rem 0 1.25rem;
  font-size: 0.88rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table th, .table td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
  color: var(--color-text);
}
.table th {
  background: var(--color-surface-2);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-dim);
}
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: color-mix(in srgb, var(--color-accent) 6%, var(--color-surface)); }

/* =========================================================================
   INPUTS
   ========================================================================= */
.input,
input[type="text"].input,
input[type="search"].input,
input[type="email"].input,
input[type="number"].input,
textarea.input,
select.input {
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.8rem;
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--color-text-mute); }
.input:focus,
input[type="text"].input:focus,
input[type="search"].input:focus,
textarea.input:focus,
select.input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}
.label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-dim);
  margin-bottom: 0.3rem;
  font-family: var(--font-sans);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* =========================================================================
   KPI TILE
   ========================================================================= */
.kpi {
  display: flex; flex-direction: column; gap: 0.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  box-shadow: var(--color-shadow-sm);
  min-width: 0;
}
.kpi .kpi-label {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-mute);
}
.kpi .kpi-value {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.05;
  color: var(--color-text);
  letter-spacing: -0.01em;
}
.kpi .kpi-delta {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-dim);
}
.kpi .kpi-delta.up      { color: var(--color-success); }
.kpi .kpi-delta.down    { color: var(--color-danger); }
.kpi-grid {
  display: grid; gap: 0.85rem;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

/* =========================================================================
   THEME PICKER
   ========================================================================= */
.theme-picker {
  display: inline-flex; gap: 0.3rem; flex-wrap: wrap;
  padding: 0.3rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}
.theme-picker .tp-btn {
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  color: var(--color-text-dim);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background .15s, color .15s, border-color .15s;
}
.theme-picker .tp-btn:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}
.theme-picker .tp-btn.active {
  background: var(--color-surface-2);
  border-color: color-mix(in srgb, var(--color-accent) 50%, var(--color-border));
  color: var(--color-text);
}
.theme-picker .tp-swatch {
  width: 14px; height: 14px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18);
}
.theme-picker .tp-swatch.tp-light    { background: linear-gradient(135deg, #faf7f0 0%, #155e6e 100%); }
.theme-picker .tp-swatch.tp-dark     { background: linear-gradient(135deg, #0f1418 0%, #5fb1be 100%); }
.theme-picker .tp-swatch.tp-hospital { background: linear-gradient(135deg, #f3f6fb 0%, #1a4d8c 100%); }
.theme-picker .tp-swatch.tp-modern   { background: linear-gradient(135deg, #ffffff 0%, #c84a2d 100%); }

/* =========================================================================
   DEMO SHELL — header / sidebar / main / footer
   ========================================================================= */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

body.has-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: var(--header-h) 1fr auto;
  grid-template-areas:
    "header header"
    "sidebar main"
    "footer footer";
  min-height: 100vh;
}
body.has-shell > .skip-link { grid-column: 1 / -1; }
body.has-shell > .demo-header  { grid-area: header; }
body.has-shell > .demo-sidebar { grid-area: sidebar; }
body.has-shell > .demo-main    { grid-area: main; padding: 1.25rem 2rem 3rem; min-width: 0; }
body.has-shell > .demo-footer  { grid-area: footer; }

/* Desktop nav collapse — reclaim the sidebar column */
body.has-shell.nav-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
body.has-shell.nav-collapsed > .demo-sidebar { display: none; }
.nav-collapse-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; padding: 0.35rem;
  color: var(--color-text-dim); border-radius: var(--radius-sm);
}
.nav-collapse-btn:hover { background: var(--color-surface-2); color: var(--color-text); }
.nav-collapse-btn[aria-pressed="true"] { color: var(--color-accent); }

/* ---------- Header --------------------------------------------------------- */
.demo-header {
  position: sticky; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: color-mix(in srgb, var(--color-bg) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0 1rem;
  z-index: 100;
}
@supports not (backdrop-filter: blur(10px)) {
  .demo-header { background: var(--color-bg); }
}

.hamburger {
  display: none;
  align-items: center; justify-content: center;
  width: 38px; height: 38px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 1.05rem; line-height: 1;
  cursor: pointer; flex-shrink: 0;
}
.hamburger:hover { background: var(--color-surface-2); }
.hamburger[aria-expanded="true"] {
  background: var(--color-surface-2);
  border-color: var(--color-border-strong);
}

.brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.01em;
  flex-shrink: 0;
  padding: 0.25rem 0.35rem;
  border-radius: var(--radius-sm);
}
.brand:hover { color: var(--color-accent); text-decoration: none; }
.brand .brand-mark {
  display: inline-flex;
  width: 26px; height: 26px;
  color: var(--color-accent);
  flex-shrink: 0;
}
.brand .brand-mark > svg { width: 100%; height: 100%; }
.brand .brand-text {
  font-weight: 700;
  white-space: nowrap;
}

/* ---------- Persona switcher dropdown -------------------------------------- */
.persona-switcher {
  position: relative;
  flex-shrink: 0;
}
.persona-switcher-btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.88rem; font-weight: 600;
  cursor: pointer; user-select: none;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  transition: background .15s, border-color .15s, color .15s;
}
.persona-switcher-btn:hover {
  background: var(--color-surface-2);
  border-color: var(--color-border-strong);
}
.persona-switcher-btn .ps-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-accent-fg);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 700;
  flex-shrink: 0;
}
.persona-switcher-btn .ps-name {
  white-space: nowrap;
}
.persona-switcher-btn .ps-caret {
  font-size: 0.65rem;
  color: var(--color-text-mute);
  margin-left: 0.15rem;
}
.persona-switcher-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--color-shadow-lg);
  z-index: 200;
  display: none;
}
.persona-switcher-dropdown.open {
  display: block;
}
.persona-switcher-dropdown .ps-option {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  color: var(--color-text);
  cursor: pointer;
  transition: background .1s;
  border: none; background: transparent; width: 100%;
  text-align: left; font-family: inherit;
}
.persona-switcher-dropdown .ps-option:hover {
  background: var(--color-surface-2);
}
.persona-switcher-dropdown .ps-option.active {
  background: color-mix(in srgb, var(--color-accent) 12%, var(--color-surface));
  color: var(--color-accent);
  font-weight: 600;
}
.persona-switcher-dropdown .ps-option .ps-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-accent-fg);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700;
  flex-shrink: 0;
}

/* ---------- Search box in header ------------------------------------------- */
.demo-search {
  flex: 1 1 220px;
  min-width: 0; max-width: 480px;
  display: flex; align-items: center;
  margin: 0;
}
.demo-search > .input {
  height: 36px;
  padding-top: 0.4rem; padding-bottom: 0.4rem;
}

/* ---------- Demo badge (unobtrusive marker that this is a demo) ---------- */
.demo-badge {
  display: inline-flex; align-items: center;
  font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.18rem 0.45rem;
  margin-left: 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-warn) 18%, transparent);
  color: var(--color-warn);
  border: 1px solid color-mix(in srgb, var(--color-warn) 45%, transparent);
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ---------- Header actions (theme picker, reset, logout) ------------------- */
.header-actions {
  display: flex; align-items: center; gap: 0.4rem;
  flex-shrink: 0;
  margin-left: auto;
}

.header-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.88rem; font-weight: 600;
  padding: 0.4rem 0.7rem;
  color: var(--color-text-dim);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  text-decoration: none;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, border-color .15s, color .15s;
}
.header-btn:hover {
  background: var(--color-surface-2);
  border-color: var(--color-border-strong);
  color: var(--color-text);
  text-decoration: none;
}
.header-btn.danger-btn {
  color: var(--color-danger);
  border-color: color-mix(in srgb, var(--color-danger) 35%, var(--color-border));
}
.header-btn.danger-btn:hover {
  background: color-mix(in srgb, var(--color-danger) 10%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-danger) 55%, var(--color-border));
}
.header-btn.warn-btn {
  color: var(--color-warn);
  border-color: color-mix(in srgb, var(--color-warn) 35%, var(--color-border));
}
.header-btn.warn-btn:hover {
  background: color-mix(in srgb, var(--color-warn) 10%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-warn) 55%, var(--color-border));
}

/* ---------- Sidebar -------------------------------------------------------- */
.demo-sidebar {
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: 1.1rem 0.75rem 2rem;
  overflow-y: auto;
  position: sticky;
  top: var(--header-h);
  align-self: start;
  height: calc(100vh - var(--header-h));
}
.sidebar-title {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-mute);
  padding: 0 0.55rem 0.5rem;
  margin: 0;
}
.sidebar-nav { list-style: none; padding: 0; margin: 0; }
.sidebar-nav > li { margin: 0; }
.sidebar-nav .sb-item {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--color-text-dim);
  text-decoration: none;
  position: relative;
  min-width: 0;
}
.sidebar-nav .sb-item:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
  text-decoration: none;
}
.sidebar-nav [aria-current="page"] {
  background: color-mix(in srgb, var(--color-accent) 12%, var(--color-surface));
  color: var(--color-text);
  font-weight: 700;
}
.sidebar-nav [aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -0.05rem; top: 0.4rem; bottom: 0.4rem;
  width: 3px;
  background: var(--color-accent);
  border-radius: 2px;
}
.sidebar-nav .sb-icon {
  font-size: 1rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  color: var(--color-text-mute);
}
.sidebar-nav [aria-current="page"] .sb-icon {
  color: var(--color-accent);
}

/* ---------- Sidebar mobile/backdrop --------------------------------------- */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: var(--header-h) 0 0 0;
  background: var(--color-overlay);
  z-index: 90;
}

/* ---------- Footer --------------------------------------------------------- */
.demo-footer {
  border-top: 1px solid var(--color-border);
  padding: 1.1rem 1.5rem;
  font-size: 0.8rem;
  color: var(--color-text-dim);
  background: var(--color-surface);
  display: flex;
  gap: 1rem; flex-wrap: wrap;
  justify-content: space-between; align-items: center;
}
.demo-footer .footer-version,
.demo-footer .footer-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}
.demo-footer .footer-meta {
  display: inline-flex; gap: 0.85rem; flex-wrap: wrap;
  align-items: center;
}

/* ---------- Tablet (≤900px) — header collapse, search hidden -------------- */
@media (max-width: 900px) {
  .demo-search { display: none; }
  .demo-badge { display: none; }
  .persona-switcher-btn .ps-name { display: none; }
  .header-btn .btn-label { display: none; }
  .header-actions { gap: 0.25rem; }
  .theme-picker .tp-label { display: none; }
  .theme-picker { padding: 0.2rem; gap: 0.2rem; }
  .theme-picker .tp-btn { padding: 0.3rem 0.4rem; }
}

/* ---------- Mobile (≤720px) ----------------------------------------------- */
@media (max-width: 720px) {
  body.has-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main"
      "footer";
  }
  body.has-shell > .demo-main { padding: 1rem 1rem 2rem; }
  .hamburger { display: inline-flex; }
  .nav-collapse-btn { display: none; }  /* mobile uses the hamburger slide-in */
  .demo-sidebar {
    position: fixed;
    top: var(--header-h); left: 0; bottom: 0;
    width: 280px; max-width: 82vw;
    height: calc(100vh - var(--header-h));
    z-index: 95;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--color-shadow-lg);
  }
  body.sidebar-open .demo-sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .brand .brand-text { display: none; }
}
@media (max-width: 480px) {
  .demo-header { padding: 0 0.5rem; gap: 0.35rem; }
  .brand { padding: 0.25rem 0.2rem; gap: 0.4rem; }
  .header-btn { padding: 0.35rem 0.45rem; font-size: 0.78rem; }
  .theme-picker { padding: 0.15rem; gap: 0.15rem; }
  .theme-picker .tp-btn { padding: 0.25rem 0.3rem; }
  .header-actions { gap: 0.2rem; }
}

/* Micro screens (≤360px, e.g. iPhone SE 1st gen): the theme switcher + Reset +
   Logout don't fit the fixed-height header. Drop the inline theme picker here
   (theme still persists via localStorage); modern phones (375px+) keep it. */
@media (max-width: 360px) {
  .header-actions .theme-picker { display: none; }
}

/* ---------- Print ---------------------------------------------------------- */
@media print {
  .skip-link,
  .demo-header,
  .demo-sidebar,
  .sidebar-backdrop,
  .hamburger { display: none !important; }
  body.has-shell {
    display: block;
    grid-template: none;
  }
  body.has-shell > .demo-main { padding: 0; }
  .demo-footer {
    border-top: 1px solid #888;
    background: transparent;
  }
}

/* =========================================================================
   LOGIN / PERSONA PICKER PAGE
   ========================================================================= */

body.login-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--color-bg);
}

.login-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  flex-shrink: 0;
}

.login-header .brand {
  font-size: 1.15rem;
}

.login-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem 3rem;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

.login-main h1 {
  text-align: center;
  margin-bottom: 0.3rem;
}

.login-main .login-subtitle {
  color: var(--color-text-dim);
  text-align: center;
  margin-bottom: 2rem;
  font-size: 1.05rem;
}

.persona-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
  max-width: 720px;
}

.persona-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  padding: 1.5rem 1rem 1.25rem;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-family: inherit;
  color: var(--color-text);
  text-align: center;
  transition: border-color .15s, transform .12s, box-shadow .15s, background .15s;
  outline: none;
}

.persona-card:hover {
  border-color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 5%, var(--color-surface));
  transform: translateY(-2px);
  box-shadow: var(--color-shadow-md);
}

.persona-card:focus-visible {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-focus-ring), var(--color-shadow-md);
  transform: translateY(-2px);
}

.persona-card:active {
  transform: translateY(0);
  box-shadow: var(--color-shadow-sm);
}

.persona-card .pc-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-accent-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  font-family: var(--font-sans);
  flex-shrink: 0;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--color-accent) 30%, transparent);
}

.persona-card .pc-name {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text);
}

.persona-card .pc-role {
  font-size: 0.82rem;
  color: var(--color-text-dim);
  font-weight: 500;
}

.login-footer {
  border-top: 1px solid var(--color-border);
  padding: 1rem 1.5rem;
  font-size: 0.8rem;
  color: var(--color-text-dim);
  background: var(--color-surface);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
}

.login-footer .footer-version,
.login-footer .footer-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.login-footer .footer-meta {
  display: inline-flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  align-items: center;
}

@media (max-width: 640px) {
  .persona-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .login-main {
    padding: 1.5rem 1rem 2rem;
  }
}

@media (max-width: 400px) {
  .persona-grid {
    grid-template-columns: 1fr;
    max-width: 280px;
  }
}

/* =========================================================================
   RESET MODAL — accessible confirmation dialog (VAL-DEMO-RESET-001–007)
   ========================================================================= */

.reset-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

@supports not (backdrop-filter: blur(4px)) {
  .reset-modal-overlay {
    background: rgba(0, 0, 0, 0.55);
  }
}

.reset-modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--color-shadow-lg);
  max-width: 420px;
  width: calc(100% - 2rem);
  padding: 1.75rem 1.5rem 1.5rem;
  outline: none;
}

.reset-modal-title {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-danger);
}

.reset-modal-desc {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--color-text-dim);
}

.reset-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.reset-modal-btn {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1.25rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.reset-confirm-btn {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}

.reset-confirm-btn:hover,
.reset-confirm-btn:focus-visible {
  background: var(--color-danger-hover, #991b1b);
  border-color: var(--color-danger-hover, #991b1b);
}

.reset-cancel-btn {
  background: var(--color-surface);
  color: var(--color-text);
}

.reset-cancel-btn:hover,
.reset-cancel-btn:focus-visible {
  background: var(--color-surface-2);
}

.reset-modal-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* =========================================================================
   DASHBOARD — persona landing pages
   ========================================================================= */

.dashboard-greeting {
  margin-bottom: 0.25rem;
}

.dashboard-subtitle {
  color: var(--color-text-dim);
  font-size: 1rem;
  font-weight: 500;
  margin: 0 0 1.5rem;
  letter-spacing: 0.01em;
}

/* --- Task List --- */
.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--color-shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}

.task-item:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--color-shadow-md);
}

.task-priority {
  flex-shrink: 0;
}

.task-title {
  flex: 1 1 auto;
  font-size: 0.92rem;
  color: var(--color-text);
  min-width: 0;
}

.task-kind {
  flex-shrink: 0;
}

.empty-tasks {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 1rem 1.15rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text-dim);
  font-size: 0.92rem;
}

/* --- Recently Viewed Shortcuts --- */
.shortcut-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.shortcut-item {
  /* each shortcut is a chip */
}

.shortcut-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-text-dim);
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  box-shadow: var(--color-shadow-sm);
}

.shortcut-link:hover {
  background: var(--color-surface-2);
  border-color: var(--color-border-strong);
  color: var(--color-text);
  text-decoration: none;
  box-shadow: var(--color-shadow-md);
}

.shortcut-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.shortcut-label {
  white-space: nowrap;
}

/* --- Empty State --- */
.empty-state {
  padding: 2.5rem 1.5rem;
  text-align: center;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  margin-top: 1rem;
}

.empty-state.hidden {
  display: none;
}

.empty-state-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.empty-state-icon {
  font-size: 2rem;
}

.empty-state-message {
  color: var(--color-text-dim);
  font-size: 1rem;
  font-style: italic;
  margin: 0;
}

/* --- Dashboard Section Spacing (generous whitespace) --- */
.dashboard-section {
  margin-top: 2rem;
}

.dashboard-section:first-of-type {
  margin-top: 0;
}

.dashboard-section h2 {
  margin-bottom: 0.85rem;
}

/* =========================================================================
   DASHBOARD COMPONENTS — greeting, KPI strip, tasks, recently-viewed, empty
   ========================================================================= */

/* --- Greeting & Subtitle --- */
.dash-greeting {
  margin: 0 0 0.15rem;
  letter-spacing: -0.015em;
}
.dash-subtitle {
  color: var(--color-text-dim);
  font-size: 0.95rem;
  margin: 0 0 1.5rem;
  font-weight: 500;
}

/* --- Dashboard Section --- */
.dash-section {
  margin-top: 2rem;
}
.dash-section:first-of-type {
  margin-top: 0;
}
.dash-section-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.75rem;
  border-bottom: 1px solid color-mix(in srgb, var(--color-accent) 25%, var(--color-border));
  padding-bottom: 0.4rem;
  color: var(--color-accent);
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
}
.dash-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: var(--color-accent);
  color: var(--color-accent-fg);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
}

/* --- Task List --- */
.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.task-row {
  display: grid;
  grid-template-columns: 130px 1fr auto auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: border-color .15s, box-shadow .15s;
}
.task-row:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--color-shadow-sm);
}
.task-patient {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.task-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-accent-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.task-patient-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-title {
  color: var(--color-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-time {
  color: var(--color-text-mute);
  font-size: 0.8rem;
  white-space: nowrap;
  font-family: var(--font-sans);
}

/* --- Recently Viewed --- */
.rv-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}
.rv-card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.85rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.rv-card:hover {
  border-color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 6%, var(--color-surface));
  box-shadow: var(--color-shadow-sm);
}
.rv-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--color-surface-2);
  color: var(--color-text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
}
.rv-name {
  font-weight: 600;
  white-space: nowrap;
}
.rv-type {
  color: var(--color-text-mute);
  font-size: 0.76rem;
}

/* --- Empty State (dashboard) --- */
.dash-empty .empty-state {
  padding: 3rem 1.5rem;
}
.empty-icon {
  display: block;
  font-size: 2.8rem;
  margin-bottom: 0.75rem;
}
.empty-heading {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 0.45rem;
}
.empty-body {
  color: var(--color-text-dim);
  font-size: 0.95rem;
  margin: 0 0 1rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}
.dash-empty .btn {
  margin-top: 0.25rem;
}

/* --- Dashboard responsive tweaks --- */
@media (max-width: 720px) {
  .task-row {
    grid-template-columns: 110px 1fr auto;
    gap: 0.45rem;
    padding: 0.6rem 0.75rem;
  }
  .task-time { display: none; }
  .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
@media (max-width: 480px) {
  .task-row {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }
  .task-patient { order: 2; }
  .task-title { order: 1; font-weight: 600; color: var(--color-text); }
  .rv-list { flex-direction: column; }
}

/* =========================================================================
   DASHBOARD v2 — "Everything is a task" layout
   Header, hero strip (3 cards), 2-column grid: Right Now + Up Next.
   ========================================================================= */

.dash-wrap {
  max-width: 1100px;
  margin: 0 auto;
}

/* --- Header --- */
.dash-header {
  margin: 0 0 1.5rem;
}
.dash-greeting {
  margin: 0 0 0.2rem;
  font-size: 1.85rem;
  letter-spacing: -0.018em;
  line-height: 1.15;
}
.dash-subtitle {
  margin: 0;
  color: var(--color-text-dim);
  font-size: 0.92rem;
  font-weight: 500;
}

/* --- Hero strip: 3 cards side-by-side --- */
.dash-hero {
  margin: 0 0 1.5rem;
}
.hero-cards {
  display: grid;
  grid-template-columns: 1fr 1fr 1.15fr;
  gap: 0.85rem;
}
.hero-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1rem 1.15rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--color-shadow-sm);
}
.hero-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.hero-num {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--color-text);
  letter-spacing: -0.02em;
}
.hero-label {
  font-size: 0.85rem;
  color: var(--color-text-dim);
  font-weight: 500;
  text-transform: lowercase;
}
.hero-meta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--color-accent);
  font-weight: 600;
  background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface));
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.hero-meta-muted {
  color: var(--color-text-mute);
  background: var(--color-surface-2);
}
.hero-card-total {
  border-left: 3px solid var(--color-accent);
}
.hero-progress {
  height: 5px;
  background: var(--color-surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.15rem;
}
.hero-progress-fill {
  height: 100%;
  background: var(--color-accent);
  transition: width .3s ease;
}

/* --- Two-column main grid: Right Now (left) + Up Next (right) --- */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

/* --- Right Now focus block --- */
.dash-next {
  padding: 1.4rem 1.5rem 1.5rem;
  background: color-mix(in srgb, var(--color-accent) 8%, var(--color-surface));
  border: 1px solid color-mix(in srgb, var(--color-accent) 45%, var(--color-border));
  border-radius: var(--radius-lg);
  box-shadow: var(--color-shadow-md);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  position: relative;
  overflow: hidden;
}
.dash-next::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--color-accent);
}
.dash-next.prio-urgent::before { background: var(--color-danger); }
.dash-next.prio-high::before   { background: var(--color-warn); }
.next-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.next-eyebrow-label {
  color: var(--color-accent);
}
.next-time {
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--color-surface);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}
.next-duration {
  color: var(--color-text-mute);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}
.next-title {
  margin: 0.2rem 0 0;
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.next-note {
  margin: 0;
  color: var(--color-text-dim);
  font-size: 0.92rem;
}
.dash-next .btn.primary {
  margin-top: 0.6rem;
  align-self: flex-start;
  font-size: 0.95rem;
  padding: 0.65rem 1.25rem;
}

/* --- Up Next list --- */
.dash-priority {
  padding: 0.25rem 0 0;
}
.dash-section-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.75rem;
  padding-bottom: 0.35rem;
  color: var(--color-text);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  border-bottom: 1px solid var(--color-border);
}
.dash-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: var(--color-surface-2);
  color: var(--color-text-dim);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
}
.prio-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.prio-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.85rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
  min-height: 38px;
}
.prio-row:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--color-shadow-sm);
}
.prio-row .task-avatar { display: none; }
.prio-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-mute);
  flex-shrink: 0;
}
.prio-dot.prio-urgent { background: var(--color-danger); }
.prio-dot.prio-high   { background: var(--color-warn); }
.prio-dot.prio-normal { background: var(--color-accent); }
.prio-dot.prio-low    { background: var(--color-text-mute); }
.prio-time {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-surface-2);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  min-width: 60px;
  text-align: center;
}
.prio-time-kind {
  color: var(--color-text-dim);
  background: transparent;
  border: 1px solid var(--color-border);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.74rem;
}
.prio-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.prio-meta {
  color: var(--color-text-mute);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  white-space: nowrap;
}
.prio-row .btn.sm {
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
}
.prio-more {
  margin-top: 0.85rem;
  text-align: center;
  font-size: 0.88rem;
}
.prio-more a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 600;
}
.prio-more a:hover { text-decoration: underline; }

/* --- Responsive --- */
@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
  .hero-cards { grid-template-columns: 1fr 1fr; }
  .hero-card-total { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .dash-greeting { font-size: 1.5rem; }
  .hero-cards { grid-template-columns: 1fr; }
  .hero-card-total { grid-column: auto; }
  .hero-num { font-size: 2rem; }
  .next-title { font-size: 1.25rem; }
  .dash-next { padding: 1.15rem 1.15rem 1.25rem; }
  .dash-next .btn.primary { align-self: stretch; text-align: center; }
  .prio-row { grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 0.5rem; }
  .prio-row .prio-meta { display: none; }
}

/* =========================================================================
   TABLE-SCROLL — horizontal scroll wrapper for narrow viewports
   Fix for claims/denials/appeals overflow defect (defect-report-2026-06-02).
   ========================================================================= */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  border-radius: var(--radius);
}
.table-scroll > .table {
  margin-top: 0;
  margin-bottom: 0;
}
.table.sticky-first th:first-child,
.table.sticky-first td:first-child {
  position: sticky;
  left: 0;
  background: var(--color-surface);
  z-index: 2;
  box-shadow: 1px 0 0 var(--color-border);
}
.table.sticky-first thead th:first-child {
  background: var(--color-surface-2);
  z-index: 3;
}
.table.sticky-first tr:hover td:first-child {
  background: color-mix(in srgb, var(--color-accent) 6%, var(--color-surface));
}

/* =========================================================================
   CLAIM TIMELINE — headline pill (compact, used in list rows)
   ========================================================================= */
.claim-timeline-headline {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  min-height: 32px;
  gap: 0;
}
.claim-timeline-headline .ct-node {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ct-tone, var(--color-text-mute)) 10%, var(--color-surface));
  color: var(--ct-tone, var(--color-text-mute));
  border: 1px solid color-mix(in srgb, var(--ct-tone, var(--color-text-mute)) 25%, var(--color-border));
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.1;
  font-family: var(--font-sans);
}
.claim-timeline-headline .ct-node-done {
  opacity: 0.85;
}
.claim-timeline-headline .ct-node-current {
  background: color-mix(in srgb, var(--ct-tone, var(--color-accent)) 18%, var(--color-surface));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ct-tone, var(--color-accent)) 25%, transparent);
  font-weight: 700;
}
.claim-timeline-headline .ct-icon {
  font-size: 0.85rem;
  line-height: 1;
}
.claim-timeline-headline .ct-label {
  letter-spacing: 0.02em;
}
.claim-timeline-headline .ct-connector {
  display: inline-block;
  width: 14px;
  height: 2px;
  background: var(--color-border);
  flex-shrink: 0;
  margin: 0 -1px;
}
.claim-timeline-empty {
  font-size: 0.78rem;
  color: var(--color-text-mute);
  font-style: italic;
}

/* Minimum column width so the headline pill never squishes below readability */
.col-timeline { min-width: 320px; }

/* Cursor hint for row click-to-open-drawer */
.table tbody tr.row-clickable {
  cursor: pointer;
}
.table tbody tr.row-clickable:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

/* =========================================================================
   CLAIM TIMELINE — full (vertical) mode, used inside the claim drawer
   ========================================================================= */
.claim-timeline-full {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.claim-timeline-full::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 13px;
  width: 2px;
  background: var(--color-border);
}
.claim-timeline-event {
  position: relative;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 0.6rem;
  padding: 0.55rem 0;
}
.claim-timeline-event .ct-event-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--ct-tone, var(--color-text-mute));
  color: var(--ct-tone, var(--color-text-mute));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  z-index: 1;
}
.claim-timeline-event-current .ct-event-marker {
  background: color-mix(in srgb, var(--ct-tone, var(--color-accent)) 18%, var(--color-surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ct-tone, var(--color-accent)) 22%, transparent);
}
.ct-event-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.ct-event-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.ct-event-status {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--color-text);
}
.ct-event-time {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--color-text-mute);
}
.ct-event-meta {
  font-size: 0.78rem;
  color: var(--color-text-dim);
  font-weight: 600;
}
.ct-event-note {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--color-text-dim);
  line-height: 1.45;
}
.ct-mini-icon {
  display: inline-block;
  font-size: 0.85rem;
  margin-right: 0.25rem;
}
.claim-history-scroll {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.claim-history-table {
  margin: 0;
  border-radius: 0;
  border: 0;
}
.claim-history-table thead th {
  position: sticky;
  top: 0;
  background: var(--color-surface-2);
  z-index: 1;
}

/* =========================================================================
   CLAIM DRAWER — right-side panel for claim detail + timeline + actions
   ========================================================================= */
.claim-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.claim-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.claim-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(560px, 100vw);
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--color-shadow-lg);
  z-index: 1110;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.claim-drawer.open {
  transform: translateX(0);
}
.claim-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-2);
}
.claim-drawer-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.25;
}
.claim-drawer-subtitle {
  font-size: 0.82rem;
  color: var(--color-text-dim);
  margin: 0.15rem 0 0;
}
.claim-drawer-close {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--color-text-dim);
  flex-shrink: 0;
}
.claim-drawer-close:hover {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}
.claim-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.1rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.claim-drawer-section h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-mute);
  border-bottom: 0;
  padding-bottom: 0;
}
.claim-drawer-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1rem;
  font-size: 0.88rem;
}
.claim-drawer-facts dt {
  color: var(--color-text-mute);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.claim-drawer-facts dd {
  margin: 0;
  color: var(--color-text);
}
.claim-drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.claim-drawer-actions .btn { font-size: 0.82rem; }

@media (max-width: 560px) {
  .claim-drawer { width: 100vw; border-left: 0; }
  .claim-timeline-headline .ct-label { display: none; }
  .claim-timeline-headline .ct-node { padding: 0.22rem 0.4rem; }
  .col-timeline { min-width: 220px; }
}
