/* Maneiro v8 - Premium Healthcare SaaS */
@import url('./tokens.css');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&display=swap');

:root {
  /* ── Background ── */
  --bg: #f6f8ff;            /* single canonical page background */
  --bgAccent: #eef7f5;
  --panel: #ffffff;
  --panel-gradient: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(243,246,255,0.95)); /* Doctor page card style — standard across app */
  --panel2: #f3f6f9;

  /* ── Text ── */
  --text: #111827;          /* body text — readable dark grey (not pure black) */
  --muted: #6b7280;         /* secondary text */
  --border: #e5e7eb;        /* card/input borders */

  /* ── Primary (Tiffany teal) ── */
  --primary: #0d9488;
  --primary-light: #e8f5f3; /* faded teal — matches HR initials */
  --primary-mid: #5eead4;   /* mid teal for borders */
  --accent: #0d9488;

  /* ── Semantic colours ── */
  --success: #0d9488;       /* green */
  --success-bg: #e8f5f3;
  --success-border: #e8f5f3;
  --success-text: #0d9488;

  --warning: #f2c45f;          /* Henry's gold-yellow */
  --warning-bg: #fefbec;
  --warning-border: #fde68a;
  --warning-text: #7a5c00;

  --error: #c02323;         /* faded rose-red — not harsh #ef4444 */
  --error-bg: #fdf0f0;      /* very faded rose background */
  --error-border: #e89090;  /* soft rose border */
  --error-text: #c02323;    /* dark rose text */

  --info: #2563eb;
  --info-bg: #eff6ff;
  --info-border: #bfdbfe;
  --info-text: #1d4ed8;

  /* ── Clinical value colours (Henry's system) ──
     normal/good:    teal  — same as section titles
     borderline:     muted amber — soft yellow
     abnormal/alert: muted rose-red — not harsh
  */
  --clinical-normal: #298c8c;        /* normal/good — Henry's teal */
  --clinical-normal-bg: #e6f4f4;
  --clinical-normal-border: #9dd0d0;
  --clinical-borderline: #f2c45f;    /* borderline — Henry's gold-yellow */
  --clinical-borderline-bg: #fefbec;
  --clinical-borderline-border: #f5d98a;
  --clinical-abnormal: #c02323;      /* abnormal/alert — Henry's red */
  --clinical-abnormal-bg: #fdf0f0;
  --clinical-abnormal-border: #e89090;

  --ctrlH: 36px;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; /* Lora removed — Inter everywhere except dashboard greeting */

  /* ── TYPE SYSTEM (locked — do not deviate) ──
     Font:      Inter everywhere. Lora ONLY for dashboard greeting h1.
     Title:     20-24px, weight 600, #111827
     Subtitle:  11px, weight 700, uppercase, #9cd0c5  (section labels)
     Body:      14px, weight 400/500, #374151
     Meta:      12px, weight 400, #6b7280
     Numbers:   Inter, weight 700, #0d9488
  */
  --type-title-size: 24px;
  --type-title-weight: 600;
  --type-title-color: #111827;
  --type-label-size: 11px;
  --type-label-weight: 700;
  --type-label-color: #9cd0c5;
  --type-body-size: 14px;
  --type-body-color: #374151;
  --type-meta-size: 12px;
  --type-meta-color: #6b7280;
  /* Spacing — 8px grid */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  /* Radius system — replaces the chaos of 7px/10px/12px/14px/16px/20px */
  --radius-sm: 8px;
  --radius-md: 12px;   /* cards, panels — the universal card radius */
  --radius-lg: 16px;   /* modals, banners */
  --radius-pill: 100px;
  /* Typography scale */
  --text-xs:   11px;
  --text-sm:   12px;
  --text-base: 14px;
  --text-md:   15px;
  --text-lg:   18px;
  --text-xl:   24px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-main);
  background: radial-gradient(1200px 800px at 20% 0%, var(--bgAccent) 0%, var(--bg) 60%);
  color: var(--type-body-color, #374151);
  font-size: var(--type-body-size, 14px);
  line-height: 1.6;
  min-height: 100vh;
}

/* Global page container — true full width with comfortable padding */
.page, .wrap, .page-wrap, .dash-wrap, .ops-wrap, .pt-wrap,
[class$="-wrap"], [class$="-page"] {
  max-width: 100% !important;
  width: 100%;
  padding-left: clamp(16px, 3vw, 48px);
  padding-right: clamp(16px, 3vw, 48px);
  box-sizing: border-box;
}

/* ══════════ GLOBAL TYPE ENFORCEMENT ══════════
   Inter everywhere. No serif except page H1.
   Section labels: 11px, 700, uppercase, teal.
   Body: 14px, #374151. Meta: 12px, #6b7280.
════════════════════════════════════════════════ */

/* All headings: Inter, not Lora */
.page-header h1,
.page-header-left h1,
.ops-title,
.pt-title,
.dash-greeting,
.accountTitle,
h1, h2, h3, h4 {
  font-family: var(--font-main);
  font-weight: 600;
  color: var(--type-title-color, #111827);
}

/* Page-level H1 size */
.page-header h1,
.page-header-left h1,
.ops-title,
.pt-title,
h1 {
  font-size: 24px;
}

/* Section card labels — same system everywhere */
.dash-card-title,
.ops-card-title,
.pt-card-title {
  font-family: var(--font-main);
  font-size: 11px;
  font-weight: 700;
  color: var(--type-label-color, #9cd0c5);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Stat numbers: Inter bold teal */
.stat-num,
.value-metric-num,
.kpi-num {
  font-family: var(--font-main);
  font-weight: 700;
  color: var(--primary, #0d9488);
}

/* ========== TOP BAR ========== */
.topBar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 100;
  height: 57px;
  box-sizing: border-box;
}

.topBarLeft {
  display: flex;
  align-items: center;
  gap: 16px;
  /* Breathing room before nav cluster on the right — prevents orgName/orgLogo
     from butting against the Home button at narrower desktop widths. */
  padding-right: 16px;
}

.brandLogo {
  height: 32px;
  width: auto;
}

.topBarLeft .orgDivider {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
}

.topBarLeft .orgName {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  /* Fixed-width slot — never wrap onto the next line and push Home down */
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

/* Clinic logo slot — fixed dimensions, ensures consistent header height */
.topBarLeft .orgLogo {
  height: 28px;
  max-width: 140px;
  width: auto;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

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

.topDivider {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 8px;
}

.topBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
}

.topBtn:hover {
  background: var(--panel2);
  color: var(--text);
}

.topBtnActive {
  background: #e8f5f3;
  border-color: #b2d8d1;
  color: #0d9488;
}
.topBtnActive:hover {
  background: #d8eee9;
  color: #0d9488;
}

.topBtn.viewToggle {
  background: rgba(156,208,197,0.15);
  border: 1px solid rgba(156,208,197,0.3);
  color: #0d9488;
  padding: 8px;
  border-radius: 8px;
}

.topBtn.viewToggle:hover {
  background: rgba(156,208,197,0.25);
  border-color: rgba(156,208,197,0.5);
}

/* Maya button — uses app logo + label */
.mayaBtn {
  background: linear-gradient(180deg, rgba(156,208,197,.18), rgba(118,185,173,.18));
  border: 1px solid rgba(13,148,136,.2);
  border-radius: 8px;
  gap: 6px;
  padding: 7px 12px;
}
.mayaBtn:hover {
  background: linear-gradient(180deg, rgba(156,208,197,.32), rgba(118,185,173,.32));
  border-color: rgba(13,148,136,.35);
  color: #0d9488;
}

.topBtnIcon {
  padding: 8px;
}

.topBtn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.userMenuBtn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  border-radius: 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s;
}

.userMenuBtn:hover {
  background: var(--panel2);
}

.userInitials {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #e8f5f3;
  color: #0d9488;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
}

.userMenuBtn svg {
  width: 18px;
  height: 18px;
  stroke: var(--muted);
  stroke-width: 2;
  fill: none;
  transition: transform 0.15s;
}

.userMenuBtn[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

/* ========== DROPDOWN ========== */
.dropdown { position: relative; }

.dropdownMenu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
  padding: 8px;
  display: none;
  z-index: 200;
}

.dropdown.open .dropdownMenu {
  display: block;
}

.dropdownItem {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.1s;
}

.dropdownItem:hover {
  background: var(--panel2);
}

.dropdownItem svg {
  width: 20px;
  height: 20px;
  stroke: var(--muted);
  stroke-width: 2;
  fill: none;
}

.dropdownDivider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* ========== LAYOUT ========== */
.appGrid {
  display: block;
  min-height: calc(100vh - 57px);
}

/* ========== SIDEBAR ========== */
.sideBar {
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  padding: 16px;
  position: sticky;
  top: 57px;
  align-self: start;
  height: calc(100vh - 57px);
  overflow: auto;
}

.sideHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.sideTitle {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}

.sideHint {
  font-size: 13px;
  color: var(--muted);
  margin-top: 16px;
  line-height: 1.5;
}

.caseList {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.caseCard {
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.5);
  position: relative;
}

.caseCard:hover {
  background: rgba(255,255,255,0.9);
  border-color: var(--border);
}

.caseCard.processing {
  border-left: 3px solid var(--primary);
  background: rgba(156,208,197,0.08);
}

.caseCard.queued {
  border-left: 3px solid var(--muted);
  background: rgba(200,200,200,0.08);
}

.caseCard.error {
  border-left: 3px solid var(--error);
  background: rgba(239,68,68,0.05);
}

.caseTitle {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.caseStatusBadge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 4px;
}

.caseStatusBadge.processing {
  background: rgba(156,208,197,0.2);
  color: #4a9085;
}

.caseStatusBadge.queued {
  background: rgba(150,150,150,0.15);
  color: var(--muted);
}

.caseStatusBadge.error {
  background: rgba(239,68,68,0.1);
  color: var(--error);
}

.caseProgressBar {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.caseProgressFill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.miniSpinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid transparent;
  border-top-color: var(--primary);
  border-right-color: rgba(13,148,136,0.35);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

.caseItem {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.caseItem:hover {
  background: rgba(255,255,255,0.7);
}

.caseItem.active {
  background: rgba(156, 208, 197, 0.15);
  border-color: var(--primary);
}

.caseIcon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, rgba(156,208,197,0.25), rgba(156,208,197,0.1));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 800;
  color: #0d9488;
}

.caseIcon svg {
  width: 22px;
  height: 22px;
  stroke: #0d9488;
  stroke-width: 2;
  fill: none;
}

.caseInfo {
  flex: 1;
  min-width: 0;
}

.caseName {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.caseMeta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.sideBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  margin-top: 8px;
}

.sideBtn:hover {
  background: rgba(255,255,255,0.7);
  border-color: #c0c8d8;
}

.sideBtnClear {
  color: var(--muted);
  border-color: transparent;
  font-size: 12px;
}

.sideBtnClear:hover {
  color: var(--error);
  background: transparent;
  border-color: transparent;
}

/* ========== MAIN AREA ========== */
.mainArea {
  padding: 20px 28px;
}

/* ========== STEP BAR ========== */
.stepBar {
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(243,246,255,0.95));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.stepHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.stepTitle {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #0d9488;
}

.stepTitle b { color: inherit; }

.stepControls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stepHint {
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
}

.stepStatus {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 100px;
  background: var(--panel2);
  color: var(--muted);
}

/* ========== BUTTONS ========== */
.btnPrimary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(180deg, rgba(156,208,197,1), rgba(118,185,173,1));
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 10px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
  box-shadow: 0 6px 18px rgba(156,208,197,0.3);
}

.btnPrimary:hover {
  background: linear-gradient(180deg, rgba(156,208,197,1), rgba(118,185,173,1));
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(156,208,197,0.35);
}

.btnPrimary:active {
  background: #0d9488;
}

.btnPrimary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btnPrimary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btnPrimary svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.btnSecondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.btnSecondary:hover {
  background: var(--panel2);
  border-color: #c0c8d8;
}

.btnSecondary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btnSecondary svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.btn {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
}

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

/* ========== PROGRESS BAR ========== */
.analyzeProgress {
  margin-top: 20px;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(156,208,197,0.15), rgba(156,208,197,0.05));
  border-radius: 16px;
  border: 1px solid rgba(156,208,197,0.25);
}

.analyzeProgress.hidden { display: none; }

.progressContainer {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.progressLabel {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.progressBar {
  width: 100%;
  height: 10px;
  background: rgba(156,208,197,0.2);
  border-radius: 100px;
  overflow: hidden;
}

.progressFill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #0d9488, var(--primary));
  background-size: 200% 100%;
  border-radius: 100px;
  transition: width 0.4s ease;
  animation: progressShimmer 2s ease-in-out infinite;
}

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

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2.5px solid transparent;
  border-top-color: rgba(13,148,136,0.95);
  border-right-color: rgba(13,148,136,0.35);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: -2px;
  margin-left: 8px;
}

@keyframes spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.statusProcessing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #0d9488;
  font-weight: 700;
}

.statusComplete {
  color: var(--success);
  font-weight: 700;
}

/* ========== SUMMARY ========== */
.summary {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(243,246,255,0.95));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
  overflow: hidden;
}

.sectionHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.sectionTitle {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sectionTitle::before {
  content: '';
  width: 4px;
  height: 16px;
  background: linear-gradient(180deg, var(--primary), #0d9488);
  border-radius: 2px;
}

.sectionTitle b {
  color: inherit;
  font-weight: 700;
}

.panel {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(243,246,255,0.95));
}

#summaryBox {
  min-height: 40px;
  max-height: 500px;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  box-sizing: border-box;
}

#summaryBox ul {
  margin: 8px 0;
  padding-left: 24px;
}

#summaryBox li {
  margin-bottom: 4px;
  line-height: 1.5;
}

#summaryBox p {
  margin-bottom: 4px;
}

#summaryBox b {
  color: var(--text);
}

#summaryBox::-webkit-scrollbar {
  width: 5px;
}

#summaryBox::-webkit-scrollbar-track {
  background: var(--panel2);
  border-radius: 3px;
}

#summaryBox::-webkit-scrollbar-thumb {
  background: #c0c8d8;
  border-radius: 3px;
}

#summaryBox:empty::before {
  content: 'Upload exam notes to begin.';
  color: var(--muted);
  font-style: italic;
}

/* ========== THREE COLUMNS ========== */
.triCols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.col {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(243,246,255,0.95));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  overflow: hidden;
  min-width: 0;
}

.col .panel {
  min-height: 40px;
  max-height: 500px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  width: 100%;
  box-sizing: border-box;
}

.col .panel::-webkit-scrollbar {
  width: 5px;
}

.col .panel::-webkit-scrollbar-track {
  background: var(--panel2);
  border-radius: 3px;
}

.col .panel::-webkit-scrollbar-thumb {
  background: #c0c8d8;
  border-radius: 3px;
}

.col .panel::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

#dxBox, #planBox, #refBox {
  font-size: 13px;
  line-height: 1.7;
  max-width: 100%;
}

#dxBox > div, #planBox > div, #refBox > div {
  max-width: 600px;
}

#dxBox:empty::before, #planBox:empty::before, #refBox:empty::before {
  content: 'No data yet.';
  color: var(--muted);
  font-style: italic;
}

.itemTitle {
  font-weight: 700;
  margin-top: 12px;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--text);
}

.itemTitle:first-child { margin-top: 0; }

.itemMeta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.refLink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.refLink:hover {
  filter: brightness(1.15);
  text-decoration: underline;
}

.citeRef {
  cursor: pointer;
  color: var(--accent);
  font-weight: 800;
}

.citeRef:hover { filter: brightness(1.15); }

/* ========== STEP 2: COMMUNICATE ========== */
.step2 {
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(243,246,255,0.95));
  border: 1px solid var(--border);
  border-radius: 14px 14px 0 0;
  margin-bottom: 0;
}

.step2 .stepTitle {
  padding: 10px 0 0 0;
}

.commGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  align-items: end;
  padding: 10px 0 4px 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fieldLabel {
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
}

.actionRow {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
}

.stepStatus.inline {
  font-size: 12px;
  padding: 2px 0;
  background: transparent;
  text-align: center;
  color: var(--muted);
  min-height: 16px;
  line-height: 1.2;
}

.ctrl {
  height: var(--ctrlH);
  padding: 0 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.15s;
}

.ctrl:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(156,208,197,0.2);
}

.ctrl::placeholder { color: var(--muted); }

select.ctrl {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2351565b' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.commGrid .btnPrimary {
  width: 100%;
  height: var(--ctrlH);
  padding: 8px 14px;
}

/* ========== OUTPUT / LETTER ========== */
.output {
  background: var(--panel);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 14px 14px;
  padding: 14px;
  margin-bottom: 16px;
}

.letterToolbar {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.toolBtn {
  height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel2);
  cursor: pointer;
  font-weight: 800;
  font-size: 14px;
  color: var(--text);
  transition: all 0.15s;
}

.toolBtn:hover {
  background: var(--border);
}

.letterRich {
  width: 100%;
  max-width: 100%;
  min-height: 60px;
  max-height: 500px;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 0;
  font-size: 14px;
  line-height: 1.7;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  box-sizing: border-box;
}

.letterRich:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  font-style: italic;
}

.letterRich:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(156,208,197,0.25);
  border-color: rgba(156,208,197,0.75);
}

.letter { display: none; }

.outputActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-top: 14px;
}

.outputActions .btn {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 10px;
  height: auto;
}

.outputActions .btn svg {
  width: 14px;
  height: 14px;
  margin-right: 5px;
}

/* ========== FILE QUEUE ========== */
.fileQueue {
  margin-top: 14px;
  padding: 14px;
  background: var(--panel2);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.fileQueue.hidden { display: none; }

.fileQueueTitle {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fileQueueList {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fileQueueItem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
}

.fileQueueItem.processing {
  border-color: var(--primary);
  background: rgba(156, 208, 197, 0.08);
}

.fileQueueItem.complete {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.08);
}

.fileQueueItem.error {
  border-color: var(--error);
  background: rgba(239, 68, 68, 0.08);
}

.fileQueueIcon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.fileQueueIcon svg {
  width: 16px;
  height: 16px;
  stroke: var(--muted);
  stroke-width: 2;
  fill: none;
}

.fileQueueItem.complete .fileQueueIcon svg {
  stroke: var(--success);
}

.fileQueueName {
  flex: 1;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fileQueueStatus {
  font-size: 12px;
  color: var(--muted);
}

.fileQueueItem.processing .fileQueueStatus {
  color: var(--primary);
}

.fileQueueItem.complete .fileQueueStatus {
  color: var(--success);
}

/* Floating Batch Queue Panel */
.batchQueuePanel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 320px;
  max-height: 400px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  z-index: 1000;
  overflow: hidden;
  display: none;
}

.batchQueuePanel.visible {
  display: block;
}

.batchQueueHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--primary), #14b8a6);
  color: white;
}

.batchQueueHeader h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.batchQueueBadge {
  background: white;
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}

.batchQueueBody {
  max-height: 280px;
  overflow-y: auto;
  padding: 8px;
}

.batchQueueEmpty {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 13px;
}

.batchItem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--panel2);
  border-radius: 10px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.batchItem:last-child {
  margin-bottom: 0;
}

.batchItem:hover {
  background: rgba(156,208,197,0.1);
}

.batchItem.processing {
  border-left: 3px solid var(--primary);
}

.batchItem.complete {
  border-left: 3px solid var(--success);
}

.batchItem.error {
  border-left: 3px solid var(--error);
}

.batchItemIcon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.batchItemInfo {
  flex: 1;
  min-width: 0;
}

.batchItemName {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.batchItemStatus {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.batchItemProgress {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.batchItemProgressBar {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.batchQueueFooter {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--panel2);
}

.batchQueueBtn {
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.batchQueueBtn.primary {
  flex: 1;
  background: var(--primary);
  color: white;
}

.batchQueueBtn.primary:hover {
  background: #14b8a6;
}

.batchQueueBtn.secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
}

.batchQueueBtn.secondary:hover {
  background: var(--panel2);
}

.batchQueueBtn.small {
  width: 32px;
  height: 32px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Multi-file upload hint */
.uploadMultiHint {
  font-size: 11px;
  color: var(--primary);
  margin-top: 6px;
  font-weight: 600;
}

/* ========== FOOTER ========== */
.footer {
  border-top: 1px solid var(--border);
  padding: 20px 28px;
  background: var(--panel);
}

.footerRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.footerBrand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.footerLogo {
  height: 28px;
  opacity: 0.5;
}

.footerVersion {
  font-size: 13px;
  color: var(--muted);
}

.footerDisclaimer {
  font-size: 13px;
  color: var(--muted);
  max-width: 560px;
  text-align: center;
  line-height: 1.5;
}

.footerLinks {
  display: flex;
  align-items: center;
  gap: 18px;
}

.footerLink {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.footerLink:hover { color: var(--primary); }

.footerDot { color: var(--muted); }
.footerCopyright { font-size: 13px; color: var(--muted); }

/* ========== MODALS ========== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.modal.hidden { display: none; }

.modalBackdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 18, 38, 0.5);
  backdrop-filter: blur(6px);
}

.modalCard {
  position: relative;
  background: var(--panel);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  max-width: 520px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  z-index: 1;
}

.modalCard.modalWide {
  max-width: 680px;
}

.modalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
}

.modalTitle {
  font-size: 18px;
  font-weight: 900;
}

.modalClose, .iconBtn {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}

.modalClose:hover, .iconBtn:hover {
  background: var(--border);
  color: var(--text);
}

.modalBody {
  padding: 24px;
}

/* Record Modal Specific */
.recordTop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.recordStatus {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

.recordTimer {
  font-size: 28px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.recordLang {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recordLang .fieldLabel {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.recordLang .ctrl {
  height: 36px;
  font-size: 14px;
  min-width: 130px;
}

.recBtn {
  padding: 10px 20px;
  font-size: 14px;
}

.recordGrid {
  margin-top: 16px;
}

.transcriptBox {
  width: 100%;
  min-height: 120px;
  padding: 14px;
  font-family: inherit;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  resize: vertical;
  margin-top: 8px;
}

.transcriptBox:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(156,208,197,0.25);
}

.recordNote {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

.liveIndicator {
  font-size: 11px;
  font-weight: 700;
  color: var(--error, #c02323);
  letter-spacing: 0.05em;
  animation: livePulse 1.2s ease-in-out infinite;
  margin-left: 8px;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.liveTranscriptPanel {
  background: #f0fdf9;
  border: 1.5px solid var(--primary);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 8px;
  min-height: 80px;
  max-height: 200px;
  overflow-y: auto;
}

.liveTranscriptText {
  font-size: 15px;
  color: #1f2937;
  line-height: 1.6;
  white-space: pre-wrap;
}

.liveInterim {
  font-size: 15px;
  color: #6b7280;
  font-style: italic;
  line-height: 1.6;
  margin-top: 2px;
}

/* Settings Modal */
.settingsField {
  margin-bottom: 20px;
}

.settingsField label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.settingsField .ctrl {
  width: 100%;
}

.settingsField .hint {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.settingsActions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* FAQ Modal */
.faqContent {
  max-height: 60vh;
  overflow-y: auto;
}

.faqItem {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.faqItem:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.faqQ, .faqQuestion {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  font-size: 15px;
}

.faqA, .faqAnswer {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

/* ========== TOAST ========== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.95);
  border: 1px solid var(--border);
  padding: 14px 20px;
  border-radius: 14px;
  display: none;
  color: var(--text);
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  max-width: 92vw;
  z-index: 2000;
  font-size: 15px;
  font-weight: 600;
}

/* ========== OCR PROMPT ========== */
.ocrPrompt {
  margin-top: 20px;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,0.6);
  border-left: 4px solid var(--warning);
}

.ocrPrompt.hidden { display: none; }

.ocrText {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 14px;
}

.ocrControls {
  display: flex;
  align-items: center;
  gap: 18px;
}

.ocrLabel {
  font-size: 14px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

/* ========== SETTINGS & RECORD ========== */
.settingsGrid {
  display: grid;
  gap: 20px;
}

.smallHint {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

.recordTimerDisplay {
  font-size: 3.5rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-align: center;
  padding: 32px 0;
}

.recordState {
  text-align: center;
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 14px;
}

.recordControls {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.recordTranscript {
  width: 100%;
  min-height: 140px;
  margin-top: 20px;
  padding: 16px;
  font-family: inherit;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  resize: vertical;
}

.recordActions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 20px;
}

/* FAQ */
.faqSection { margin-bottom: 24px; }
.faqQuestion {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.faqAnswer {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
}

/* ========== EDITABLE SECTIONS ========== */
.panel.editable {
  transition: all 0.2s ease;
  cursor: text;
  border-radius: 12px;
  padding: 8px;
  margin: -8px;
}

.panel.editable:focus {
  outline: none;
  background: rgba(156, 208, 197, 0.06);
  box-shadow: inset 0 0 0 2px rgba(156,208,197,0.3);
}

.panel.editable[contenteditable="true"] {
  background: var(--panel);
}

.editedBadge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 100px;
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.editedBadge.hidden { display: none; }

/* ========== FORMATTING TOOLBAR ========== */
.formatToolbar {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  margin-bottom: 8px;
  width: 100%;
  box-sizing: border-box;
}

.formatToolbar.visible {
  display: flex;
}

.formatBtn {
  width: 28px;
  height: 28px;
  padding: 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-size: 14px;
  font-weight: 700;
}

.formatBtn:hover {
  background: rgba(156,208,197,0.15);
  color: var(--primary);
}

.formatBtn.active {
  background: var(--primary);
  color: white;
}

.formatBtn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.formatDivider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.formatSelect {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.formatSelect:hover {
  border-color: var(--primary);
}

/* ========== FINALIZE BAR ========== */
.finalizeBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px;
  background: linear-gradient(135deg, rgba(156,208,197,0.15), rgba(156,208,197,0.05));
  border: 1px solid rgba(156,208,197,0.3);
  border-radius: 20px;
  margin-bottom: 24px;
}

.finalizeBar.hidden { display: none; }

.finalizeInfo {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.finalizedBanner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 24px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 16px;
  color: #0d9488;
  font-size: 15px;
  font-weight: 700;
}

.finalizedBanner svg {
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}

.finalizedBanner.hidden { display: none; }

/* ========== UTILITIES ========== */
.hidden { display: none !important; }
.fileInput { display: none; }
.muted { color: var(--muted); }

/* ========== RESPONSIVE ========== */
@media (max-width: 1100px) {
  .appGrid { grid-template-columns: 1fr; }
  .sideBar {
    position: relative;
    top: 0;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .triCols { grid-template-columns: 1fr; }
  .commGrid { grid-template-columns: 1fr; }
}

/* ── navIcon: margin on desktop, none on mobile ── */
.navIcon { margin-right: 4px; flex-shrink: 0; }

@media (max-width: 640px) {
  .mainArea { padding: 20px; }
  .topBar { padding: 10px 12px; gap: 4px; }
  .topBarLeft .brand { width: auto; }
  .footerRow { flex-direction: column; text-align: center; gap: 16px; }

  /* ── Mobile nav: icon-only, hide text labels ── */
  .navLabel { display: none; }
  .navIcon { margin-right: 0 !important; }
  .topBtn { padding: 8px; gap: 0; min-width: 36px; justify-content: center; }
  .topBarRight { gap: 4px; }
  .topDivider { margin: 0 4px; }

  /* ── Hide org name + logo on small screens ── */
  .orgName { display: none; }
  .orgDivider { display: none; }
  .orgLogo { display: none; }
}

/* ========== EHR FIELDS SECTION (P1 Feature) ========== */
.ehrFields {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.ehrFields.hidden { display: none; }

.ehrFieldsHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ehrFieldsTitle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.btnEHR {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--mn-radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btnEHR:hover { background: var(--mn-primary-hover); }
.btnEHR:active { background: var(--mn-primary-active); }
.btnEHR svg { flex-shrink: 0; }

.ehrFieldsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.ehrField {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.ehrFieldLabel {
  font-size: 11px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.ehrFieldValue {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

@media (max-width: 640px) {
  .ehrFieldsGrid { grid-template-columns: repeat(2, 1fr); }
}

/* Patient Context Bar — Doctor page (v8.0.197) */
/* Extension patient banner (v8.0.231) */
.extensionPatientBanner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 16px 0;
  padding: 8px 12px;
  background: #e8f5f3;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  color: #0d9488;
  max-width: 520px;
}
.extensionPatientBanner.hidden { display: none; }
.extensionPatientBanner svg { flex-shrink: 0; color: #0d9488; }
.extensionPatientBanner span { flex: 1; }
.extensionPatientBannerClose {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #6b7280;
  padding: 0 2px;
  line-height: 1;
}
.extensionPatientBannerClose:hover { color: #111827; }

.patientContextBar {
  position: relative;
  padding: 0 0 12px 0;
  width: 100%;
  /* Match stepBar exactly */
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(243,246,255,0.95));
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: visible;
  margin-bottom: 14px;
}

.patientContextHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px 8px;
}

.patientContextSearch {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 6px 18px 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  transition: border-color .15s, box-shadow .15s;
}

.patientContextBar:focus-within {
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13,148,136,.1);
}

.patientContextInput {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  font-weight: 500;
  color: #111827;
  background: transparent;
  min-width: 0;
  font-family: var(--font-main);
}

.patientContextInput::placeholder { color: #9ca3af; font-weight: 400; }

.patientContextClearBtn {
  border: none; background: none; cursor: pointer;
  color: #9ca3af; font-size: 16px; padding: 0 2px; line-height: 1;
}
.patientContextClearBtn:hover { color: #374151; }

.patientContextDropdown {
  position: absolute;
  left: 16px; right: 16px;
  top: calc(100% - 2px);
  background: #fff;
  border: 1px solid #e8f5f3;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,.10);
  z-index: 200;
  max-height: 220px;
  overflow-y: auto;
}

.patientContextDropdown.hidden { display: none; }

.patientContextOption {
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #f3f4f6;
  transition: background .1s;
}
.patientContextOption:last-child { border-bottom: none; }
.patientContextOption:hover { background: #f0fdf9; }
.patientContextOption .pco-name { font-weight: 600; color: #134e4a; }
.patientContextOption .pco-meta { font-size: 11px; color: #6b7280; margin-left: auto; }

.patientContextChip {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e8f5f3;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  padding: 4px 10px 4px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #0d9488;
}
.patientContextChip.hidden { display: none; }
.patientContextChip svg { color: #0d9488; }
.patientContextChip a {
  color: #0d9488;
  text-decoration: none;
  font-weight: 700;
}
.patientContextChip a:hover { text-decoration: underline; }

/* ========== PATIENT LETTERS SECTION (v8.0.204) ========== */
.patientLettersSection {
  margin: 0 0 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.patientLettersSection.hidden { display: none; }
.patientLettersHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel2, #f8f9fb);
}
.patientLettersHeader span {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.patientLettersViewAll {
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.patientLettersViewAll:hover { text-decoration: underline; }
.patientLettersList {
  padding: 8px 0;
}
.patientLettersEmpty {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--muted);
}
.patientLetterRow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background .1s;
  border-bottom: 1px solid var(--border);
}
.patientLetterRow:last-child { border-bottom: none; }
.patientLetterRow:hover { background: var(--primary-light, #e8f5f3); }
.patientLetterType {
  font-size: 11px;
  font-weight: 700;
  background: #e8f5f3;
  color: #0d9488;
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
}
.patientLetterMeta {
  flex: 1;
  min-width: 0;
}
.patientLetterMeta strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.patientLetterMeta span {
  font-size: 11px;
  color: var(--muted);
}
.patientLetterCopy {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  padding: 3px 8px;
  border: 1px solid var(--primary);
  border-radius: 5px;
  background: none;
  cursor: pointer;
  white-space: nowrap;
}
.patientLetterCopy:hover { background: var(--primary-light); }

/* ═══════════════════════════════════════════════════════════════
   GLOBAL TYPOGRAPHY CONSISTENCY
   Inter everywhere. Lora ONLY for dashboard greeting.
   ═══════════════════════════════════════════════════════════════ */

/* Page-level hero heading — Inter, all pages */
.page-hero {
  font-family: var(--font-main);
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 600;
  color: #111827;
  line-height: 1.25;
}

/* Page-level headings — Inter everywhere */
.page-header h1,
.page-header-left h1,
h1.page-title {
  font-family: var(--font-main);
  font-weight: 600;
}

/* Card section headings stay Inter — clinical UI should be crisp */
.card-header h2,
.dash-card-title {
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted, #6b7280);
}

/* Value metric numbers — Inter bold */
.value-metric-num {
  font-family: var(--font-main);
}

/* Consistent button system — canonical definitions are below (unified alias section) */

/* Dashboard card padding — consistent 20px */
.dash-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(243,246,255,0.95));
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}
.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 12px;
  border-bottom: 1px solid #f3f4f6;
}
.dash-card-body {
  padding: 12px 20px 16px;
}
.dash-card-link {
  font-size: 12px;
  color: var(--primary, #0d9488);
  font-weight: 600;
  text-decoration: none;
}
.dash-card-link:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════
   UNIFIED BUTTON ALIASES — maps all button classes to 
   the Doctor page gold standard (btnPrimary/btnSecondary)
   ═══════════════════════════════════════════════════════ */

/* .btn-primary = exact match for Doctor page .btnPrimary — gradient */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(180deg, rgba(156,208,197,1), rgba(118,185,173,1));
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 10px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
  box-shadow: 0 6px 18px rgba(156,208,197,0.3);
  text-decoration: none;
}
.btn-primary:hover { background: linear-gradient(180deg, rgba(156,208,197,1), rgba(118,185,173,1)); transform: translateY(-1px); box-shadow: 0 10px 22px rgba(156,208,197,0.35); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary svg { flex-shrink: 0; }

/* .btn-secondary = Doctor page .btnSecondary — grey border, dark text */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #111827);
  background: var(--panel, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-secondary:hover { background: var(--panel2, #f3f6f9); border-color: #c0c8d8; }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

/* .btn-sm variants */
.btn-primary.btn-sm, .btn-secondary.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-primary.btn-xs, .btn-secondary.btn-xs { padding: 5px 10px; font-size: 12px; border-radius: 8px; }

/* Typography scale lives in tokens.css */

/* Page hero headings — Inter, all pages */
.page-hero h1,
.page-header h1,
h1.page-title {
  font-family: var(--font-main);
  font-weight: 600;
  color: #111827;
}

/* Section labels — consistent across all cards */
.section-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
}

/* ==========================================================================
   UNIFIED BUTTON STATES — drop-in completion of existing .btn* classes.
   Adds hover / active / disabled / focus-visible / loading to every variant.
   ========================================================================== */

/* Focus ring applies to every interactive control */
.btnPrimary:focus-visible,
.btnSecondary:focus-visible,
.btnEHR:focus-visible,
.btn:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-xs:focus-visible,
.btn-sm:focus-visible,
.btn-lg:focus-visible {
  outline: var(--mn-focus-outline);
  outline-offset: 2px;
  box-shadow: var(--mn-focus-ring);
}

/* Disabled - parity across all variants */
.btnSecondary:disabled,
.btnEHR:disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Loading state - set aria-busy="true" or add class .is-loading */
.btnPrimary.is-loading,
.btnSecondary.is-loading,
.btnEHR.is-loading,
.btn.is-loading,
.btn-primary.is-loading,
.btn-secondary.is-loading,
[aria-busy="true"].btnPrimary,
[aria-busy="true"].btn-primary {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btnPrimary.is-loading::after,
.btnSecondary.is-loading::after,
.btnEHR.is-loading::after,
.btn.is-loading::after,
.btn-primary.is-loading::after,
.btn-secondary.is-loading::after,
[aria-busy="true"].btnPrimary::after,
[aria-busy="true"].btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  color: #fff;
}
/* Dark spinner for secondary/ghost */
.btnSecondary.is-loading::after,
.btn.is-loading::after,
.btn-secondary.is-loading::after {
  color: var(--mn-primary);
}

/* Normalize .btnEHR radius to token */
.btnEHR { border-radius: var(--mn-radius-sm); padding: var(--mn-space-sm) var(--mn-space-md); }
.btnEHR:hover  { background: var(--mn-primary-hover); }
.btnEHR:active { background: var(--mn-primary-active); }
