/* ============================================================
   EMR – Global Stylesheet
   3-colour system: primary (green) · accent (teal) · secondary (grey)
   ============================================================ */

:root {
  --emr-primary:        #1e7e48;
  --emr-primary-dark:   #155c35;
  --emr-primary-light:  #e8f5e9;
  --emr-accent:         #17a589;
  --emr-accent-dark:    #0e8c73;
  --emr-accent-light:   #e6f7f4;
  --emr-secondary:      #6c757d;
  --emr-secondary-light:#f0f1f3;
  --emr-alert:          #c0392b;
  --emr-bg:             #f4f6f9;
  --emr-surface:        #ffffff;
  --emr-border:         #e4e8ed;
  --emr-text:           #1e2631;
  --emr-text-muted:     #6c757d;
  --emr-navbar-height:  56px;
  --emr-sidebar-width:  240px;
  --emr-sidebar-bg:     #1a3a27;
  --emr-radius:         10px;
  --emr-radius-sm:      6px;

  /* ── Override Bootstrap's primary to match green theme ──────
     This fixes text-primary, bg-primary, bg-primary-subtle,
     btn-outline-primary, btn-primary, border-primary etc.    */
  --bs-primary:               #1e7e48;
  --bs-primary-rgb:           30, 126, 72;
  --bs-primary-text-emphasis: #155c35;
  --bs-primary-bg-subtle:     #d4edda;
  --bs-primary-border-subtle: #a8d5ba;
  --bs-link-color:            #1e7e48;
  --bs-link-color-rgb:        30, 126, 72;
  --bs-link-hover-color:      #155c35;
  --bs-link-hover-color-rgb:  21, 92, 53;
}

/* ── Accent colour helpers (Bootstrap doesn't have these) ──── */
.bg-accent          { background-color: var(--emr-accent) !important; }
.bg-accent-subtle   { background-color: var(--emr-accent-light) !important; }
.text-accent        { color: var(--emr-accent-dark) !important; }
.border-accent      { border-color: var(--emr-accent) !important; }

/* ── Base ──────────────────────────────────────────────────── */
body.emr-body {
  background-color: var(--emr-bg);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 0.9rem;
  color: var(--emr-text);
}

.emr-main { min-height: 50vh; }

/* ── Topbar (fixed header) ───────────────────────────────────── */
.emr-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--emr-navbar-height);
  z-index: 1030;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 1rem;
  background: #ffffff;
  border-bottom: 1px solid var(--emr-border);
  box-shadow: 0 1px 8px rgba(0,0,0,0.07);
}

/* ── Sidebar edge toggle (fixed circle on sidebar's top-right edge) ── */
.emr-sidebar-edge-btn {
  position: fixed;
  top: calc(var(--emr-navbar-height) + 14px);
  left: calc(var(--emr-sidebar-width) - 14px);
  z-index: 1031;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px solid var(--emr-border);
  color: var(--emr-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 700;
  transition: left 0.25s ease, box-shadow 0.15s, background 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.emr-sidebar-edge-btn:hover {
  background: var(--emr-primary-light);
  box-shadow: 0 3px 12px rgba(0,0,0,0.22);
}
body.emr-sidebar-collapsed .emr-sidebar-edge-btn {
  left: 2px;
}


.emr-topbar-brand {
  display: flex; align-items: center; gap: 0.5rem;
  text-decoration: none;
  flex-shrink: 0;
}

.emr-topbar-right {
  margin-left: auto;
  display: flex; align-items: center; gap: 0.75rem;
}

.emr-topbar-icon-btn {
  color: var(--emr-text-muted);
  padding: 0.3rem 0.4rem;
  border-radius: var(--emr-radius-sm);
  transition: color 0.15s, background 0.15s;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.emr-topbar-icon-btn:hover { color: var(--emr-primary); background: var(--emr-primary-light); }


/* ── Left sidebar ────────────────────────────────────────────── */
.emr-app-sidebar {
  position: fixed;
  top: var(--emr-navbar-height);
  left: 0;
  width: var(--emr-sidebar-width);
  height: calc(100vh - var(--emr-navbar-height));
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--emr-sidebar-bg);
  z-index: 1020;
  transition: transform 0.25s ease;
  border-right: 1px solid rgba(0,0,0,0.18);
}

.emr-sidebar-nav { padding: 0.5rem 0 2rem; }

.emr-sidebar-section-label {
  padding: 1.1rem 1rem 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255,255,255,0.3);
}

/* Section collapse toggle */
.emr-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.emr-section-toggle:hover { color: rgba(255,255,255,0.55); }
.emr-section-chevron {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.85);
  flex-shrink: 0;
  transition: transform 0.2s ease;
  -webkit-text-stroke: 0.3px rgba(255,255,255,0.9);
}
.emr-section-toggle.collapsed .emr-section-chevron { transform: rotate(-90deg); }

.emr-sidebar-nav-link {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.5rem 0.75rem;
  margin: 2px 10px;
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 400;
  border-radius: 8px;
  transition: background 0.13s, color 0.13s;
  white-space: nowrap;
}
.emr-sidebar-nav-link i {
  width: 18px; text-align: center; font-size: 1rem;
  flex-shrink: 0; opacity: 0.8;
}
.emr-sidebar-nav-link:hover {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.95);
}
.emr-sidebar-nav-link.active {
  background: #ffffff;
  color: var(--emr-primary);
  font-weight: 600;
}
.emr-sidebar-nav-link.active i { opacity: 1; color: var(--emr-primary); }

/* Bottom sidebar nav (Help & Settings) */
.emr-sidebar-bottom-nav {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 0.5rem 0;
  margin-top: auto;
}

/* ── Sidebar mobile overlay ──────────────────────────────────── */
.emr-sidebar-overlay {
  display: none;
  position: fixed;
  inset: var(--emr-navbar-height) 0 0 0;
  background: rgba(0,0,0,0.42);
  z-index: 1019;
}
.emr-sidebar-overlay.show { display: block; }

/* ── App content wrapper ─────────────────────────────────────── */
.emr-app-content {
  margin-left: var(--emr-sidebar-width);
  margin-top: var(--emr-navbar-height);
  min-height: calc(100vh - var(--emr-navbar-height));
  transition: margin-left 0.25s ease;
}
.emr-app-content--noauth { margin-left: 0; margin-top: 0; }

/* Desktop collapsed: sidebar slides out, content fills */
body.emr-sidebar-collapsed .emr-app-sidebar {
  transform: translateX(calc(-1 * var(--emr-sidebar-width)));
}
body.emr-sidebar-collapsed .emr-app-content {
  margin-left: 0;
}

/* Mobile (<992px): sidebar hidden by default */
@media (max-width: 991.98px) {
  .emr-app-sidebar                   { transform: translateX(calc(-1 * var(--emr-sidebar-width))); }
  .emr-app-sidebar.show              { transform: translateX(0); }
  .emr-app-content                   { margin-left: 0; }
}

/* ── Keep old .emr-navbar alias for any lingering templates ─── */
.emr-navbar {
  background: linear-gradient(90deg, var(--emr-primary-dark) 0%, var(--emr-primary) 100%);
  border-bottom: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 2px 10px rgba(21,92,53,0.2);
}
.emr-navbar .navbar-toggler      { border: none; padding: 0.4rem 0.6rem; }
.emr-navbar .navbar-toggler-icon { filter: invert(1); }

.emr-nav-logo {
  height: 36px; width: 36px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  padding: 2px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.emr-nav-brand-text         { color: var(--emr-text); font-size: 1rem; font-weight: 400; }
.emr-nav-brand-text strong  { font-weight: 700; color: var(--emr-primary); }

.emr-nav-link {
  color: rgba(255,255,255,0.8) !important;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.8rem !important;
  border-radius: var(--emr-radius-sm);
  transition: background 0.15s, color 0.15s;
}

.emr-nav-link:hover,
.emr-nav-link.active { color: #fff !important; background: rgba(255,255,255,0.12); }

.emr-nav-avatar {
  display: flex; align-items: center; gap: 0.4rem;
  background: var(--emr-secondary-light);
  border: 1px solid var(--emr-border);
  border-radius: 999px;
  color: var(--emr-text);
  padding: 0.28rem 0.75rem 0.28rem 0.3rem;
  font-size: 0.875rem;
  transition: background 0.15s;
}

.emr-nav-avatar:hover,
.emr-nav-avatar.show { background: var(--emr-primary-light); color: var(--emr-primary); }
.emr-nav-avatar::after { margin-left: 0.15rem; }

.emr-avatar-sm {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--emr-accent);
  color: #fff;
  font-size: 0.72rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.emr-nav-username { font-size: 0.875rem; font-weight: 500; }

.emr-nav-dropdown {
  border-radius: var(--emr-radius);
  min-width: 220px;
  border: 1px solid var(--emr-border) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.emr-nav-dropdown .dropdown-item {
  font-size: 0.875rem;
  padding: 0.55rem 1rem;
  color: var(--emr-text);
}

.emr-nav-dropdown .dropdown-item:hover { background: var(--emr-primary-light); }

/* ── Role badge ─────────────────────────────────────────────── */
.emr-role-badge {
  background: var(--emr-accent);
  color: #fff;
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.28em 0.75em;
  border-radius: 999px;
  text-transform: uppercase;
}

/* ── Buttons ────────────────────────────────────────────────── */
.emr-btn-primary {
  background: var(--emr-primary);
  border-color: var(--emr-primary);
  color: #fff; border-radius: var(--emr-radius-sm);
  font-size: 0.875rem;
  transition: background 0.18s, box-shadow 0.18s;
}

.emr-btn-primary:hover,
.emr-btn-primary:focus {
  background: var(--emr-primary-dark);
  border-color: var(--emr-primary-dark);
  color: #fff;
  box-shadow: 0 3px 12px rgba(30,126,72,0.3);
}

.emr-btn-primary:disabled { opacity: 0.7; }

.emr-btn-accent {
  background: var(--emr-accent); border-color: var(--emr-accent); color: #fff;
  border-radius: var(--emr-radius-sm); font-size: 0.875rem;
}

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

/* ── Cards & surfaces ───────────────────────────────────────── */
.card            { border-radius: var(--emr-radius); border-color: var(--emr-border); }
.card-header     { border-radius: var(--emr-radius) var(--emr-radius) 0 0 !important; }
.card-header.bg-white { border-bottom: 1px solid var(--emr-border) !important; }

/* ── 3-colour badge system ──────────────────────────────────── */
.emr-badge { display: inline-flex; align-items: center; font-size: 0.72rem; font-weight: 600;
             padding: 0.3em 0.7em; border-radius: 999px; }

.emr-badge-primary   { background: var(--emr-primary-light);   color: var(--emr-primary); }
.emr-badge-accent    { background: var(--emr-accent-light);     color: var(--emr-accent-dark); }
.emr-badge-secondary { background: var(--emr-secondary-light);  color: var(--emr-secondary); }
.emr-badge-alert     { background: rgba(192,57,43,0.1);         color: var(--emr-alert); }
.emr-badge-dark      { background: #e9ecef; color: #343a40; }

/* ── Appointment & encounter status → 3 colours ─────────────── */
/* Map Bootstrap colour names used in templates to our 3-colour system */
.emr-status        { font-size: 0.72rem; font-weight: 600; padding: 0.3em 0.7em; border-radius: 999px; }
.emr-status-scheduled   { background: var(--emr-secondary-light); color: var(--emr-secondary); }
.emr-status-confirmed   { background: var(--emr-primary-light);   color: var(--emr-primary); }
.emr-status-checked_in  { background: var(--emr-accent-light);    color: var(--emr-accent-dark); }
.emr-status-in_progress { background: var(--emr-primary-light);   color: var(--emr-primary); }
.emr-status-completed   { background: var(--emr-accent-light);    color: var(--emr-accent-dark); }
.emr-status-cancelled   { background: #f0f1f3; color: #6c757d; }
.emr-status-no_show     { background: #f0f1f3; color: #6c757d; }

/* Encounter states */
.emr-state { font-size: 0.72rem; font-weight: 600; padding: 0.3em 0.75em; border-radius: 999px; }
.emr-state-created          { background: var(--emr-secondary-light); color: var(--emr-secondary); }
.emr-state-checked_in       { background: var(--emr-primary-light);   color: var(--emr-primary); }
.emr-state-triage_done      { background: var(--emr-primary-light);   color: var(--emr-primary); }
.emr-state-in_consultation  { background: var(--emr-primary-light);   color: var(--emr-primary-dark); font-weight:700; }
.emr-state-orders_placed    { background: var(--emr-accent-light);    color: var(--emr-accent-dark); }
.emr-state-awaiting_results { background: var(--emr-accent-light);    color: var(--emr-accent-dark); }
.emr-state-plan_finalized   { background: var(--emr-accent-light);    color: var(--emr-accent-dark); }
.emr-state-billing_pending  { background: var(--emr-secondary-light); color: var(--emr-secondary); }
.emr-state-closed           { background: #e9ecef; color: #495057; }

/* ── Input groups ───────────────────────────────────────────── */
.emr-input-group .input-group-text {
  background: var(--emr-primary-light);
  border-color: var(--emr-border);
  color: var(--emr-primary);
  font-size: 0.875rem;
}

.emr-input-group .form-control,
.emr-input-group .form-select {
  border-color: var(--emr-border);
  font-size: 0.875rem;
}

.emr-input-group .form-control:focus,
.emr-input-group .form-select:focus {
  border-color: var(--emr-primary);
  box-shadow: 0 0 0 3px rgba(30,126,72,0.12);
}

.emr-toggle-pw {
  border: 1px solid var(--emr-border); border-left: none;
  background: #fff; color: var(--emr-secondary);
  padding: 0 0.75rem;
}

.emr-toggle-pw:hover { background: var(--emr-primary-light); color: var(--emr-primary); }

/* ── Link ──────────────────────────────────────────────────── */
.emr-link { color: var(--emr-primary); text-decoration: none; }
.emr-link:hover { color: var(--emr-primary-dark); text-decoration: underline; }

/* ── Breadcrumb ─────────────────────────────────────────────── */
.emr-breadcrumb {
  background: var(--emr-surface);
  border-bottom: 1px solid var(--emr-border);
  padding: 0.6rem 0;
}

.emr-breadcrumb .breadcrumb { margin-bottom: 0; font-size: 0.8rem; }
.emr-breadcrumb .breadcrumb-item a { color: var(--emr-primary); text-decoration: none; }
.emr-breadcrumb .breadcrumb-item a:hover { text-decoration: underline; }
.emr-breadcrumb .breadcrumb-item.active { color: var(--emr-text-muted); }

/* ── Page header ─────────────────────────────────────────────── */
.emr-page-header {
  background: var(--emr-surface);
  border-bottom: 1px solid var(--emr-border);
  padding: 1rem 0;
}

/* ── Next-step guide strip ──────────────────────────────────── */
.emr-next-step {
  background: var(--emr-primary-light);
  border: 1px solid rgba(30,126,72,0.15);
  border-radius: var(--emr-radius);
  padding: 0.85rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  flex-wrap: wrap;
}

.emr-next-step-label {
  font-size: 0.78rem; font-weight: 700;
  color: var(--emr-primary-dark);
  text-transform: uppercase; letter-spacing: 0.06em;
  white-space: nowrap;
}

/* ── Avatar ─────────────────────────────────────────────────── */
.emr-avatar-lg {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--emr-primary); color: #fff;
  font-size: 2rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ── Tables ─────────────────────────────────────────────────── */
.emr-table thead th {
  background: #f8f9fb;
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--emr-text-muted);
  border-bottom: 1px solid var(--emr-border);
  white-space: nowrap; padding: 0.75rem 1rem;
}

.emr-table tbody td { font-size: 0.875rem; padding: 0.7rem 1rem; border-color: var(--emr-border); }
.emr-table tbody tr:hover td { background: var(--emr-primary-light); }

.emr-uhid {
  font-family: 'Courier New', monospace; font-size: 0.75rem;
  background: var(--emr-primary-light); color: var(--emr-primary);
  padding: 2px 6px; border-radius: 4px;
}

.emr-queue-token {
  font-family: 'Courier New', monospace; font-weight: 700; font-size: 0.9rem;
  background: var(--emr-accent); color: #fff;
  padding: 3px 8px; border-radius: var(--emr-radius-sm);
}

/* ── Tabs ───────────────────────────────────────────────────── */
.emr-tabs { border-bottom: 2px solid var(--emr-border); }

.emr-tabs .nav-link {
  color: var(--emr-text-muted); font-size: 0.875rem; font-weight: 500;
  border: none; border-bottom: 2px solid transparent;
  margin-bottom: -2px; padding: 0.65rem 1.1rem; border-radius: 0;
  transition: color 0.15s, border-color 0.15s;
}

.emr-tabs .nav-link:hover  { color: var(--emr-primary); }
.emr-tabs .nav-link.active { color: var(--emr-primary); border-bottom-color: var(--emr-primary); font-weight: 600; background: transparent; }

/* ── Sticky patient banner ──────────────────────────────────── */
.emr-patient-banner {
  position: sticky; top: var(--emr-navbar-height); z-index: 1010;
  background: var(--emr-surface);
  border-bottom: 2px solid var(--emr-primary-light);
  box-shadow: 0 2px 8px rgba(30,126,72,0.06);
  padding: 0.5rem 0;
}

.emr-patient-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--emr-primary); color: #fff;
  font-size: 0.85rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ── Empty state ─────────────────────────────────────────────── */
.emr-empty-state { max-width: 260px; }

.emr-empty-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--emr-primary-light);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto; font-size: 1.8rem; color: var(--emr-primary);
}

/* ── Vitals display ─────────────────────────────────────────── */
.emr-vital-val   { font-size: 1.25rem; font-weight: 700; color: var(--emr-text); }
.emr-vital-label { font-size: 0.68rem; color: var(--emr-text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── State/status badge (generic) ───────────────────────────── */
.emr-state-badge { font-size: 0.75rem; font-weight: 600; }

/* ════════════════════════════════════════════════════════════
   LOGIN PAGE
   ════════════════════════════════════════════════════════════ */

body.emr-login-page { background: #fff; overflow: hidden; }

.emr-login-wrap { display: flex; height: 100vh; width: 100vw; }

.emr-login-left {
  position: relative; flex: 0 0 42%; max-width: 42%;
  background: linear-gradient(145deg, var(--emr-sidebar-bg) 0%, var(--emr-primary) 55%, var(--emr-accent) 100%);
  display: flex; flex-direction: column; overflow: hidden; padding: 3rem;
}

.emr-blob { position: absolute; border-radius: 50%; opacity: 0.1; pointer-events: none; }
.emr-blob-1 { width: 400px; height: 400px; background: #fff; top: -150px; left: -130px; }
.emr-blob-2 { width: 260px; height: 260px; background: var(--emr-accent); bottom: -80px; right: -80px; opacity: 0.2; }
.emr-blob-3 { width: 150px; height: 150px; background: #fff; bottom: 150px; left: -40px; opacity: 0.07; }

.emr-left-content { position: relative; z-index: 1; display: flex; flex-direction: column; height: 100%; color: #fff; }

.emr-left-pill {
  display: inline-flex; align-items: center;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px; padding: 0.35em 1em;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.03em;
}

.emr-left-title { font-size: 2.4rem; font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; }
.emr-left-sub   { font-size: 0.95rem; opacity: 0.82; max-width: 340px; line-height: 1.65; }

.emr-feature-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1.4rem; }

.emr-feature-list li { display: flex; align-items: flex-start; gap: 1rem; }

.emr-feature-icon {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px;
  background: rgba(255,255,255,0.13); border: 1px solid rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}

.emr-feature-list strong { display: block; font-size: 0.88rem; font-weight: 700; }
.emr-feature-list p      { margin: 0; font-size: 0.78rem; opacity: 0.72; line-height: 1.4; }
.emr-left-footer         { font-size: 0.73rem; opacity: 0.5; margin-top: auto; padding-top: 2rem; }

.emr-login-right {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: #fff; overflow-y: auto; padding: 2rem;
}

.emr-login-form-wrap { width: 100%; max-width: 400px; }

.emr-login-logo-img {
  width: 96px; height: 96px; object-fit: contain;
  border-radius: 20px;
  box-shadow: 0 6px 28px rgba(30,126,72,0.15), 0 2px 8px rgba(0,0,0,0.07);
}

.emr-link-primary { color: var(--emr-primary); }
.emr-link-primary:hover { color: var(--emr-primary-dark); }

@media (max-width: 991.98px) {
  body.emr-login-page { overflow: auto; }
  .emr-login-wrap  { flex-direction: column; height: auto; min-height: 100vh; }
  .emr-login-right { padding: 2.5rem 1.25rem 3rem; }
}

/* ════════════════════════════════════════════════════════════
   DASHBOARD
   ════════════════════════════════════════════════════════════ */

.emr-hero {
  position: relative;
  background: linear-gradient(135deg, #e8f5e9 0%, #f4faf6 60%, #eaf6f0 100%);
  overflow: hidden; padding-bottom: 2rem;
  border-bottom: 1px solid #d4edda;
}

.emr-hero-blob   { position: absolute; border-radius: 50%; pointer-events: none; }
.emr-hero-blob-1 { width: 480px; height: 480px; background: var(--emr-primary); opacity: 0.05; top: -220px; right: -100px; }
.emr-hero-blob-2 { width: 240px; height: 240px; background: var(--emr-accent); opacity: 0.08; bottom: -100px; left: 38%; }

.emr-hero-greeting { color: var(--emr-text-muted); font-size: 0.9rem; }
.emr-hero-greeting strong { color: var(--emr-primary); }
.emr-hero-title    { color: var(--emr-text); font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; }
.emr-hero-meta     { color: var(--emr-text-muted); font-size: 0.8rem; }

.emr-hero-logo {
  height: 88px; width: 88px; object-fit: contain;
  border-radius: 16px; background: rgba(255,255,255,0.8);
  padding: 6px;
  border: 1px solid var(--emr-border);
  box-shadow: 0 2px 12px rgba(30,126,72,0.1);
}

/* Stats */
.emr-stat-card {
  border-radius: var(--emr-radius); position: relative; overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}

.emr-stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.08) !important; }
.emr-stat-card-link  { cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; }

/* Quick-link icon cards (admin panel) */
.emr-quick-link {
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
.emr-quick-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.1) !important;
}

/* Bootstrap doesn't ship btn-outline-accent — add it */
.btn-outline-accent {
  color: var(--emr-accent-dark);
  border-color: var(--emr-accent);
}
.btn-outline-accent:hover {
  background-color: var(--emr-accent);
  color: #fff;
}

.emr-stat-label {
  font-size: 0.72rem; font-weight: 700; color: var(--emr-text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}

.emr-stat-icon-wrap {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}

.emr-stat-value { font-size: 1.9rem; font-weight: 800; color: var(--emr-text); line-height: 1.1; }
.emr-stat-sub   { font-size: 0.7rem; margin-top: 2px; }
.emr-stat-accent { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; border-radius: var(--emr-radius) 0 0 var(--emr-radius); }

/* Action cards */
.emr-action-card {
  border-radius: var(--emr-radius); overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid var(--emr-border) !important;
}

.emr-action-link:hover .emr-action-card {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.09) !important;
}

.emr-action-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; color: #fff; flex-shrink: 0;
}

.emr-action-title { font-weight: 600; font-size: 0.875rem; color: var(--emr-text); line-height: 1.3; }
.emr-action-desc  { font-size: 0.775rem; color: var(--emr-text-muted); margin-top: 3px; line-height: 1.4; }

.emr-action-footer {
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--emr-border);
  background: var(--emr-bg) !important;
}

/* Profile mini card */
.emr-profile-mini { border-radius: var(--emr-radius); overflow: hidden; }

.emr-profile-mini-header {
  height: 60px;
  background: linear-gradient(90deg, var(--emr-primary-dark), var(--emr-primary));
}

.emr-profile-mini-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--emr-primary); color: #fff;
  font-size: 1.4rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid #fff; margin-top: -28px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.14);
}

/* Stat overlap over hero */
.mt-n3 { margin-top: -1rem !important; }

/* ── Profile avatar large ────────────────────────────────────── */
.emr-avatar-lg {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--emr-primary); color: #fff;
  font-size: 2rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ── Patient record two-column workspace ─────────────────────── */
.emr-patient-workspace {
  display: flex;
  align-items: flex-start;          /* required for sticky children */
}

.emr-patient-sidebar {
  width: 220px;
  min-width: 220px;
  flex-shrink: 0;
  align-self: flex-start;           /* REQUIRED: lets position:sticky work in flex */
  position: sticky;
  /* topbar (56) + patient-banner (~66); breadcrumb scrolls away */
  top: calc(var(--emr-navbar-height) + 66px);
  max-height: calc(100vh - var(--emr-navbar-height) - 66px);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--emr-surface);
  border-right: 1px solid var(--emr-border);
}

.emr-patient-main {
  flex: 1;
  min-width: 0;
  /* No height/overflow — the PAGE scrolls, sidebar sticks via CSS */
}

/* Sidebar links */
.emr-sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.55rem 1.1rem;
  color: var(--emr-text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.emr-sidebar-link i {
  font-size: 0.95rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.emr-sidebar-link span { flex: 1; }

.emr-sidebar-link:hover {
  background: var(--emr-primary-light);
  color: var(--emr-primary);
}

.emr-sidebar-link.active {
  background: var(--emr-primary-light);
  color: var(--emr-primary);
  border-left-color: var(--emr-primary);
  font-weight: 600;
}

.emr-sidebar-count {
  background: var(--emr-primary-light);
  color: var(--emr-primary);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.emr-sidebar-link.active .emr-sidebar-count {
  background: var(--emr-primary);
  color: #fff;
}

/* Section headings */
.emr-section {
  padding: 1.25rem 1.5rem;
  scroll-margin-top: calc(var(--emr-navbar-height) + 70px);
}

.emr-section + .emr-section {
  border-top: 1px solid var(--emr-border);
}

.emr-section-header {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--emr-text);
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
}
