:root{
  /* Theme tokens */
  --bg:#f5f7fb;
  --surface:#ffffff;
  --bg-elev:#ffffff;
  --muted:#f1f5f9;
  --bg-pill:#fff;
  --text:#0f172a;
  --sub:#64748b;
  --brand:#1d4ed8;
  --brand-600:#2563eb;
  --ok:#10b981;
  --warn:#f59e0b;
  --danger:#ef4444;
  --border:#e5e7eb;
  --chip:#eef2ff;
  --chipText:#3730a3;
  --shadow:0 14px 40px rgba(2,6,23,.06);

  --radius:12px;
  --anim:.24s cubic-bezier(.4,0,.2,1);
  --ease: cubic-bezier(.4,0,.2,1);
  --ease-out: cubic-bezier(.22,1,.36,1);
}

/* Dark mode variables (no gradients) */
/* :root[data-theme="dark"]{
  --bg:#0a0c10;
  --surface:#101317;
  --bg-elev:#12161b;
  --muted:#171b22;
  --bg-pill:#1a1f27;
  --text:#f2f4f8;
  --sub:#b5bac5;
  --brand:#1e4de0;
  --brand-600:#1a3796;
  --ok:#36d399;
  --warn:#fbbf24;
  --danger:#ef4444;
  --border:#313847;
  --chip:#1b2029;
  --chipText:#e5ecff;
  --shadow:0 10px 24px rgba(0,0,0,.45);
} */

/* Base */
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font:14px/1.45 Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Arial,"Noto Sans","Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);
  background:var(--bg); /* no gradients */
}
a{color:var(--brand);text-decoration:none}
a:hover{text-decoration:underline}
small, .muted{color:var(--sub)}

/* Layout */
.container{display:flex;min-height:100vh}
.content{flex:1;min-width:0;overflow-x:hidden;display:grid;grid-template-columns:1fr min(1400px,100%) 1fr;grid-template-rows:auto 1fr}
.content>.header{grid-column:1/-1}
.content>.page{grid-column:2;padding:20px}
.page h1{font-size:32px;line-height:1.1;margin:6px 0 10px}

/* Sidebar */
.sidebar{
  width:260px;
  background:var(--surface);
  border-right:1px solid var(--border);
  padding:18px 14px;
  position:sticky;top:0;align-self:flex-start;height:100vh;
}
.brand{display:flex;align-items:center;gap:10px;font-weight:800;margin-bottom:6px}
.brand .sub{color:var(--sub);font-weight:600;font-size:12px}
#sideNav{display:flex;flex-direction:column;gap:6px;margin-top:10px}
#sideNav a{
  display:flex;align-items:center;gap:10px;
  padding:10px 12px;border-radius:10px;color:#0f172a;text-decoration:none;font-weight:700;
  transition:background .18s ease,color .18s ease;
}
#sideNav a .icon{width:18px;height:18px;display:inline-flex;align-items:center;justify-content:center}
/* Sidebar-only green hover/active */
#sideNav a:hover{background:#EAF7EC}
#sideNav a.active{background:#D6F3DE;color:#14532d}

/* Header - IMHCORE-677: z-index increased from 25 to 100 so timer tooltip renders above patient table */
.header{
  position:sticky;top:0;z-index:100;
  background:var(--surface); /* flat, no gradient */
  border-bottom:1px solid var(--border);
  padding:10px 16px;
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  box-shadow:0 6px 18px rgba(2,6,23,.05);
  overflow:visible; /* Allow timer tooltip to render below header */
}
.header .left,.header .right{display:flex;align-items:center;gap:10px}

/* Segments (chips/inputs) */
.segment{
  display:flex;align-items:center;gap:8px;
  background:var(--bg-pill);
  border:1px solid var(--border);
  border-radius:10px;padding:6px 10px
}
.segment label{font-size:12px;color:var(--sub);font-weight:700}
.segment select,.segment input{
  border:1px solid var(--border);
  background:var(--surface);
  border-radius:8px;padding:6px 8px;font:inherit;
}

/* Buttons */
.btn{border:0;background:var(--brand-600);color:#fff;border-radius:10px;padding:8px 12px;cursor:pointer;box-shadow:var(--shadow);font-weight:800;letter-spacing:.2px}
.btn.secondary{background:#eaf0f7;color:#0f172a;border:1px solid var(--border);box-shadow:none}
.btn.ghost{background:transparent;color:var(--brand)}
.btn.outline-green{background:transparent;color:#059669;border:1.5px solid #059669;box-shadow:none}
.btn.outline-green:hover{background:#ecfdf5;color:#047857}
/* Subtle text-link style button for Next navigation */
.btn.subtle-next{background:transparent !important;color:#6b7280 !important;border:none !important;box-shadow:none !important;font-weight:500 !important;padding:8px 4px !important}
.btn.subtle-next:hover{color:#374151 !important;text-decoration:none !important;background:transparent !important;transform:none !important;box-shadow:none !important}
.btn.subtle-next::after{content:' →';font-size:1.1em}
.btn.small{height:28px;padding:0 12px}
.btn.big{height:40px;padding:0 16px}
.btn:disabled{opacity:.6;cursor:not-allowed}
/* Non-sidebar subtle hover */
.btn:hover{filter:brightness(0.98)}

/* Pills / badges */
.badge{
  display:inline-flex;align-items:center;gap:6px;
  background:#f8fafc;color:#334155;
  padding:4px 10px;border:1px solid var(--border);
  border-radius:999px;font-size:12px;font-weight:800
}
.badge.ok{background:#EAF7EC;color:#157B3E;border-color:#CDEED6}
.badge.warn{background:#FFF2DF;color:#9B5B00;border-color:#FAD9B0}
.badge.info{background:#E7F0FF;color:#1E4BB8;border-color:#CFE0FF}
.badge.pending{background:#FFF6CC;color:#8B6A00;border-color:#F5E6A1}
/* IMH-121: Loading skeleton for status badges during progressive load */
.badge.loading{
  background:linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size:200% 100%;
  animation:badge-shimmer 1.5s infinite;
  color:transparent;
  border-color:#e5e5e5;
  min-width:100px
}
@keyframes badge-shimmer{
  0%{background-position:200% 0}
  100%{background-position:-200% 0}
}
/* Status updating transition */
.badge.updating{
  opacity:0.7;
  transition:opacity 0.3s ease
}

/* Cards */
.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:14px;
  padding:16px;
  box-shadow:var(--shadow)
}
.card:hover{transform:none;box-shadow:var(--shadow)}
.cards{display:grid;gap:16px}
.cards.cols-2{grid-template-columns:1fr 1fr}
.cards.cols-3{grid-template-columns:repeat(3,1fr)}

/* Tables */
.table{
  width:100%;border-collapse:separate;border-spacing:0;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:12px;overflow:hidden
}
.table th,.table td{padding:12px 14px;border-bottom:1px solid var(--border);text-align:left}
.table th{background:#fbfcfe;color:var(--text);font-weight:600}
.table tbody tr:last-child td{border-bottom:0}
/* Neutral hover (no green) */
.table tbody tr:hover{background:#f8fafc}

/* “Details” small chip in tables */
.table .btn.secondary.small{
  background:#f0f4fa;color:#0f172a;border:1px solid var(--border);
  border-radius:999px;padding:4px 10px
}
.table .btn.secondary.small::before{
  content:'› ';color:#64748b;font-weight:900;margin-right:4px
}

/* Avatar bubble & chevron */
.avatar{
  width:28px;height:28px;min-width:28px;border-radius:999px;background:#e5e7eb;color:#111827;
  display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:800;
  box-shadow:inset 0 0 0 1px #d1d5db
}
.chev-btn{
  appearance:none;border:0;background:transparent;cursor:pointer;
  font-size:16px;line-height:1;color:#64748b;padding:0 6px
}
.chev-btn:hover{color:#334155}

/* Patient name as black text (not link) */
.pt-name{color:var(--text);font-weight:700}

/* Chips row for search/filters */
.search-row{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:10px 0 14px}
.search-row .search-chip{
  display:flex;align-items:center;gap:8px;height:48px;padding:0 14px;
  border:1px solid var(--border);border-radius:10px;background:#fff;flex:1 1 640px
}
.search-row input[type="search"]{border:0;outline:0;height:44px;min-width:0;width:100%;font-size:15px}
.filter-chip{
  height:38px;display:inline-flex;align-items:center;gap:8px;padding:0 12px;
  border:1px solid var(--border);border-radius:10px;background:#fff;cursor:pointer
}
.filter-chip select{border:0;outline:0;height:30px;background:transparent}

/* Gray dropdown details panel */
.dropdown-anim{
  overflow:hidden;max-height:0;opacity:0;transform:translateY(-6px) scale(.98);
  transition:max-height .55s var(--ease-out),opacity .35s var(--ease),transform .45s var(--ease-out)
}
.dropdown-anim.open{
  opacity:1;transform:translateY(0) scale(1);
  background:#f7f8fa;border:1px solid var(--border);border-radius:12px;
  box-shadow:var(--shadow);padding:8px 10px
}

/* Chips, notes, helpers */
.chips{display:flex;gap:8px;flex-wrap:wrap}
.chip{background:var(--chip);color:var(--chipText);border-radius:999px;padding:4px 8px;font-size:12px}
.note{background:var(--bg-elev);border:1px dashed var(--border);padding:10px;border-radius:12px}
.footer-note{opacity:.6;font-size:12px;text-align:center;padding:18px}

/* Pre/code blocks */
pre{
  white-space:pre-wrap;word-wrap:break-word;overflow-x:auto;max-width:100%;
  padding:1em;background-color:#f4f7fb;border:1px solid #e5e7eb;border-radius:10px;
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace;
  color:inherit
}
/* :root[data-theme="dark"] pre{background-color:#0f1217;border-color:#2f3746} */

/* Inputs */
.input{
  border:1px solid var(--border);background:var(--surface);border-radius:10px;padding:10px 12px;
  font:inherit;outline:none;color:var(--text);
  transition:box-shadow var(--anim),border-color var(--anim),transform var(--anim),background var(--anim)
}
.input::placeholder{color:color-mix(in oklab,var(--text) 70%,transparent)}
/* :root[data-theme="dark"] .input{background:#0f1217;color:var(--text);border:1px solid var(--border)}
:root[data-theme="dark"] .input::placeholder{color:color-mix(in oklab,var(--text) 70%,transparent)}

/* Improve icons in dark mode on native pickers */
/* :root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
:root[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator,
:root[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator{
  filter:invert(1) brightness(1.25) contrast(1.05);opacity:.95
} */
/* :root[data-theme="dark"] input[type="date"],
:root[data-theme="dark"] input[type="datetime-local"],
:root[data-theme="dark"] input[type="time"]{color-scheme:dark} */
input[type="date"],input[type="datetime-local"],input[type="time"]{
  background:var(--bg-pill);color:var(--text);border:1px solid var(--border);border-radius:8px
}

/* Auth screens (no gradients) */
.auth-container{
  min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;
  background:var(--bg)
}
.auth-card{
  width:800px;max-width:200vw;background:var(--surface);border:1px solid var(--border);border-radius:16px;
  padding:40px;box-shadow:var(--shadow)
}
.auth-card .brand{justify-content:center;margin-bottom:14px}
.auth-card h1,.auth-card h2{margin:6px 0 14px 0;text-align:center}
.auth-card label{color:var(--text);font-weight:700;font-size:14px;margin-bottom:6px;display:inline-block}

/* Summary/Generic tabstrip */
.tabstrip {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--sub);
  padding: 8px 12px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-weight: 700;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--text);
  border-bottom-color: color-mix(in oklab, var(--brand) 60%, var(--border));
}

/* Utilities */
.mt-0{margin-top:0}.mt-8{margin-top:8px}.mt-12{margin-top:12px}.mt-16{margin-top:16px}
.mb-0{margin-bottom:0}.mb-8{margin-bottom:8px}.mb-12{margin-bottom:12px}.mb-16{margin-bottom:16px}

/* Reduced motion */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{transition:none !important;animation:none !important}
}

/* Smooth page fade-in/out */
body:not(.page-ready) .page{opacity:0;transform:translateY(6px)}
.page{opacity:1;transition:opacity .28s var(--ease), transform .28s var(--ease)}
body.page-leave .page{opacity:0;transform:translateY(8px)}

/* Pre-apply sidebar collapsed state to prevent layout shift */
html.sidebar-pre-collapsed .sidebar { width: 60px; padding: 18px 8px; }
html.sidebar-pre-collapsed .sidebar .brand .sub { display: none; }
html.sidebar-pre-collapsed .sidebar .brand .title { display: none; }
html.sidebar-pre-collapsed .sidebar #sideNav a .label { display: none; }
html.sidebar-pre-collapsed .sidebar #sideNav a { justify-content: center; }

/* Empty state */
.empty-state{
  display:flex;align-items:center;justify-content:center;
  background:color-mix(in oklab,var(--bg-elev) 98%,transparent);
  border:1px dashed var(--border);border-radius:16px;padding:36px
}

/* Patient Picker Modal */
.patient-picker-overlay{
  position:fixed;inset:0;background:rgba(10,14,18,.58);
  -webkit-backdrop-filter:saturate(120%) blur(4px);
  backdrop-filter:saturate(120%) blur(4px);
  z-index:10050;opacity:0;pointer-events:none;transition:opacity var(--anim)
}
.patient-picker-overlay.show{opacity:1;pointer-events:auto}
.patient-picker-card{
  width:min(760px,92vw);max-height:85vh;border-radius:18px;margin:8vh auto 0;padding:16px;
  border:1px solid var(--border);background:var(--surface);color:var(--text);box-shadow:0 20px 60px rgba(0,0,0,.35);
  transform:translateY(10px) scale(.98);transition:transform var(--anim),opacity var(--anim)
}
.patient-picker-overlay.show .patient-picker-card{transform:translateY(0) scale(1)}
.pp-header{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}
.pp-header h2{margin:0;font-size:20px}
.patient-picker-input{
  width:100%;height:48px;font-size:16px;padding:0 14px;border-radius:12px;border:1px solid var(--border);
  background:var(--bg-pill);color:var(--text);outline:none;transition:box-shadow var(--anim),border-color var(--anim),transform var(--anim)
}
.patient-picker-list{
  list-style:none;margin:12px 0 0;padding:0;max-height:56vh;overflow:auto;border:1px solid var(--border);border-radius:12px;background:color-mix(in oklab,var(--surface) 96%,transparent)
}
.pp-item{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 14px;cursor:pointer;transition:background var(--anim),transform var(--anim)}
.pp-item:hover,.pp-item:focus{background:#f1f5f9;outline:none}
.pp-item .sub{color:var(--sub);font-size:12px}
.pp-item.empty,.pp-item.more{color:var(--sub);cursor:default}

/* Search/filters helper classes (used by dashboard) */
.time-cell{white-space:nowrap}
.time-cell::before{content:"⏱ ";color:#64748b;margin-right:2px}

/* --- Avatar + Patient typography --- */
.avatar{
  width:28px; height:28px; min-width:28px;
  border-radius:999px; background:#e5e7eb; color:#111827;
  display:inline-flex; align-items:center; justify-content:center;
  font-size:12px; font-weight:500; /* slimmer initials */
  box-shadow: inset 0 0 0 1px #d1d5db;
}
.pt-name{
  color: var(--text);
  font-weight: 400;           /* not bold */
  text-decoration: none;      /* ensure no underline */
}
.table .pt-sub{ font-size:12px; color: var(--sub); }

/* --- Filter selects styled like the screenshot --- */
.filter-chip{
  position: relative;
  height:44px;
  display:inline-flex; align-items:center; gap:8px; padding:0 14px 0 14px;
  border:1px solid var(--border); border-radius:10px; background:#fff; cursor:pointer;
  transition: box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.filter-chip:hover{ border-color: color-mix(in oklab, var(--brand-600) 18%, var(--border)); }
.filter-chip:focus-within{
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--brand-600) 30%, transparent);
  border-color: color-mix(in oklab, var(--brand-600) 38%, var(--border));
}
.filter-chip select{
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  border: 0; outline: 0; height:30px; background: transparent;
  padding-right: 18px; font: inherit; color: var(--text);
}
.filter-chip::after{
  content: "▾";
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: #64748b; pointer-events: none; font-size: 12px;
}

/* --- Table & dropdown remain neutral, stronger panel separation already present --- */
.page .card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(2,6,23,.06);
}
.table tbody tr:hover{ background:#f8fafc; }
.dropdown-anim.open{
  background:#f7f8fa; border:1px solid var(--border); border-radius:12px;
  box-shadow: var(--shadow); padding:8px 10px;
}
/* Layout row so avatar sits left of the name */
.row{ display:flex; align-items:center; gap:10px; }

/* Slim initials + typography */
.avatar{
  width:28px; height:28px; min-width:28px;
  border-radius:999px; background:#e5e7eb; color:#111827;
  display:inline-flex; align-items:center; justify-content:center;
  font-size:12px; font-weight:500; /* slim */
  box-shadow: inset 0 0 0 1px #d1d5db;
}
.table .pt-name{ color: var(--text); font-weight: 400; text-decoration: none; }
.table .pt-sub{ font-size:12px; color: var(--sub); }

/* Custom pill dropdowns (slide + green selected check) */
.filter-chip.dd{
  position: relative;
  height:44px;
  display:inline-flex; align-items:center; gap:8px; padding:0 14px 0 10px;
  border:1px solid var(--border); border-radius:10px; background:#fff; cursor:pointer;
  transition: box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.filter-chip.dd:hover{ border-color: color-mix(in oklab, var(--brand-600) 18%, var(--border)); }
.filter-chip.dd:focus-within{
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--brand-600) 30%, transparent);
  border-color: color-mix(in oklab, var(--brand-600) 38%, var(--border));
}
.filter-chip .dd-btn{
  all: unset; display:inline-flex; align-items:center; gap:6px; cursor:pointer;
  height:30px; padding:0 18px 0 4px; border-radius:8px;
}
.filter-chip .dd-value{ color: var(--text); }
.filter-chip .dd-caret{ color:#64748b; font-size:12px; }

/* Popover menu: slide + clip to edges so hover doesn't bleed */
.filter-chip .dd-menu{
  position: absolute; left:0; top: calc(100% + 6px); min-width: 180px;
  background:#fff; border:1px solid var(--border); border-radius:12px;
  box-shadow: var(--shadow); padding:6px;
  max-height:0; opacity:0; overflow:hidden;
  pointer-events:none; visibility:hidden;
  transition: max-height .22s var(--ease-out), opacity .18s var(--ease);
  z-index:1000;
}
.filter-chip.open .dd-menu{
  max-height:260px; opacity:1; pointer-events:auto; visibility:visible;
}
.filter-chip .dd-menu button{
  all:unset; display:flex; align-items:center; justify-content:space-between;
  width:100%; padding:8px 10px; border-radius:8px; cursor:pointer;
  color: var(--text); font-size:14px; box-sizing:border-box;
}
.filter-chip .dd-menu button:hover{
  background:#f1f5f9; /* subtle gray hover inside rounded corners */
}
.filter-chip .dd-menu button.selected{
  background:#cfeee4; /* green-ish selection */
}
.filter-chip .dd-menu button.selected::after{
  content:"✓"; color:#15803d; font-weight:700; margin-left:10px;
}
/* Remove the base ::after caret when using the custom dropdown (dd) variant */
.filter-chip.dd::after { content: none !important; }  /* prevents double arrows */
/* 1) Page background: closer to the screenshot */
:root{
  /* … keep your existing tokens … */
  --bg:#f8fcff;              /* was #f5f7fb; now lighter neutral */
  --surface:#ffffff;
  --bg-elev:#ffffff;
  /* leave the rest of your variables as-is */
}

/* 2) Make the dashboard list not look like a separate box */
.card.flat{
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* 3) Table uses same background for header and rows */
.table{
  background: var(--surface);          /* white rows */
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.table th{
  background: var(--surface) !important;  /* remove the distinct header tint */
}

/* Optional: keep hover subtle; you can keep your existing hover rule or this */
.table tbody tr:hover{ background: #f8fafc; }

/* Transparent surfaces for dashboard controls — place at end of style.css */

/* Table uses page background (transparent surface), keep borders */
.table{
  background: transparent !important;
  border: 1px solid var(--border);
}
.table th,
.table td{
  background: transparent !important;
}
.table tbody tr:hover{
  /* very subtle hover that still respects the page bg */
  background: color-mix(in oklab, var(--bg) 96%, transparent);
}

/* Search bar chip blends into page background */
.search-row .search-chip{
  background: transparent !important;
  border: 1px solid var(--border);
}
.search-row input[type="search"]{
  background: transparent !important;
  border: 0; /* the chip wraps it; keep chip’s border only */
  color: var(--text);
}

/* Filter chips blend into page background */
.filter-chip,
.filter-chip.dd{
  background: transparent !important;
  border: 1px solid var(--border);
}

/* Dropdown menu uses same bg; keep border + shadow for depth (optional) */
.filter-chip .dd-menu{
  background: transparent !important;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* Inline “segment” groups (small form pills) also transparent */
.segment{
  background: transparent !important;
  border: 1px solid var(--border);
}
.segment select,
.segment input{
  background: transparent !important;
}

/* Generic inputs transparent so they inherit the page bg */
.input{
  background: transparent !important;
  border: 1px solid var(--border);
  color: var(--text);
}

/* Expanded “details” rows under the table not in a separate panel */
.dropdown-anim.open{
  background: transparent !important;
  border: 1px solid var(--border);
  /* keep your existing padding/transition from earlier rule */
}

/* If you created a flattened container for the table, keep it flat */
.card.flat{
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* Match header (top bar) and sidebar to page background */
.header{
  background: var(--bg) !important;
  backdrop-filter: none !important;   /* remove blur so it looks flat */
  box-shadow: none !important;        /* optional: remove drop shadow */
  border-bottom: 1px solid var(--border); /* keep a subtle divider */
}

.sidebar{
  background: var(--bg) !important;
  border-right: 1px solid var(--border); /* subtle divider like screenshot */
}

/* All badges */
.badge {
  font-weight: 500; /* or 400 for normal */
}

/* Filters: match page background color and stay opaque */
.search-row .filter-chip,
.search-row .filter-chip.dd{
  background: var(--bg) !important;    /* same color as page */
  border: 1px solid var(--border);
}

/* Dropdown menu: same bg, not transparent (won’t show content underneath) */
.search-row .filter-chip .dd-menu{
  background: var(--bg) !important;    /* same color as page */
  border: 1px solid var(--border);
  box-shadow: var(--shadow);           /* optional subtle separation */
  backdrop-filter: none !important;    /* ensure no translucency blur */
  opacity: 1 !important;               /* ensure fully opaque during open */
}

/* Keep menu items readable with subtle hover/selected states */
.search-row .filter-chip .dd-menu button{ background: transparent; }
.search-row .filter-chip .dd-menu button:hover{ background: #f1f5f9; }
.search-row .filter-chip .dd-menu button.selected{
  background: #cfeee4;
}

/* Sidebar: expanded width + smooth collapse to icon-only */
.sidebar{
  width: 320px !important;              /* expanded width */
  position: sticky; top:0; height:100vh;
  overflow: visible;                     /* let the toggle pill render outside the edge */
  transition: width var(--anim);
}

/* Icon-only collapsed state (panel is still visible, no text) */
.sidebar[data-collapsed="1"]{
  width: 72px !important;               /* compact width for icons only */
}

/* Hide label and small subtitle when collapsed */
.sidebar[data-collapsed="1"] .brand .sub{ display:none; }
.sidebar[data-collapsed="1"] #sideNav a .label{ display:none; }

/* Keep nav items aligned and icons visible */
#sideNav a{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px; border-radius:10px;
  min-width:0;                 /* prevent unwanted text/phantom shrinking */
  white-space:nowrap;          /* keep labels on one line when expanded */
}
#sideNav a .icon{
  width:18px; height:18px;
  display:inline-flex; align-items:center; justify-content:center;
}

/* Center icons when labels are hidden */
.sidebar[data-collapsed="1"] #sideNav a{ justify-content:center; }

/* Chevron toggle handle that sits on the sidebar's edge */
.sidebar-toggle{
  position:absolute; right:-12px; top:72px;
  width:24px; height:24px; border-radius:999px;
  background: var(--bg);
  color: var(--text);
  border:1px solid var(--border);
  display:inline-flex; align-items:center; justify-content:center;
  cursor:pointer;
  box-shadow:0 6px 18px rgba(2,6,23,.08);
  transition: transform .18s ease, box-shadow .18s ease;
  z-index:100;
  font-size:0; /* hide any inline text/icon; chevron provided via ::before */
}
.sidebar-toggle:hover{ transform: translateY(-1px); box-shadow:0 10px 26px rgba(2,6,23,.12); }

/* --- Patient page: hero header + section title + gray panels --- */

/* Top green "hero" with patient identity */
.pt-hero{
  display:grid; grid-template-columns:auto 1fr; gap:16px; align-items:center;
  padding:18px;
  border-radius:16px;
  background: color-mix(in oklab, var(--ok) 10%, var(--bg));
  border:1px solid color-mix(in oklab, var(--ok) 38%, var(--border));
  box-shadow: var(--shadow);
  margin-bottom:18px;
}
.pt-hero .avatar-lg{
  width:56px; height:56px; min-width:56px; border-radius:999px;
  display:inline-flex; align-items:center; justify-content:center;
  background:#e5f7ee; color:#065f46; /* minty chip */
  font-weight:700; font-size:18px; box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--ok) 30%, #ffffff);
}
/* :root[data-theme="dark"] .pt-hero .avatar-lg{
  background: color-mix(in oklab, var(--ok) 22%, var(--surface));
  color: var(--text);
} */
.pt-hero .name{
  margin:0; font-size:24px; line-height:1.2; font-weight:800;
}
.pt-hero .subline{
  color: var(--text);
  opacity:.9;
}
.pt-hero .info-grid{
  margin-top:6px;
  display:grid; gap:10px;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}
.pt-hero .kv label{
  display:block; font-size:12px; color: var(--sub); margin-bottom:2px; font-weight:600;
}
.pt-hero .kv .value{ font-weight:700; }

/* Title row: "Patient Information" on the left, History button on the right */
.pt-section-title{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  margin:18px 0 10px 0;
}
.pt-section-title h2{ margin:0; font-size:20px; }

/* Gray content panels for each section */
.pt-panel{
  background: color-mix(in oklab, var(--muted) 85%, #fff);
  border:1px solid var(--border);
  border-radius:14px;
  padding:16px;
}
/* :root[data-theme="dark"] .pt-panel{
  background: color-mix(in oklab, var(--muted) 28%, var(--surface));
} */

/* Panel header actions (Edit / Save / Cancel) */
.pt-panel .section-head{
  display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px;
}
.pt-panel .section-head h3{ margin:0; font-size:16px; }

/* Markdown/content spacing inside panels */
.pt-panel .markdown{ white-space:pre-wrap; }

/* Markdown content formatting for tabs and drawers */
.markdown p { margin: 0 0 1em 0; line-height: 1.6; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4, .markdown h5, .markdown h6 { margin: 1.2em 0 0.6em 0; font-weight: 700; line-height: 1.3; }
.markdown h1 { font-size: 1.5em; }
.markdown h2 { font-size: 1.3em; }
.markdown h3 { font-size: 1.15em; }
.markdown h4 { font-size: 1em; }
.markdown ul, .markdown ol { margin: 0 0 1em 0; padding-left: 1.5em; display: block; }
.markdown ul { list-style-type: disc; }
.markdown ol { list-style-type: decimal; }
.markdown li { margin: 0.3em 0; line-height: 1.5; display: list-item; }
.markdown ul ul { list-style-type: circle; margin-top: 0.3em; margin-bottom: 0.3em; }
.markdown ul ul ul { list-style-type: square; }
.markdown ol ol { list-style-type: lower-alpha; margin-top: 0.3em; margin-bottom: 0.3em; }
.markdown strong, .markdown b { font-weight: 700; }
.markdown em, .markdown i { font-style: italic; }
.markdown blockquote { margin: 1em 0; padding: 0.5em 1em; border-left: 3px solid var(--border); background: var(--muted); border-radius: 4px; }
.markdown code { background: var(--muted); padding: 2px 6px; border-radius: 4px; font-family: ui-monospace, monospace; font-size: 0.9em; }
.markdown pre { background: var(--muted); padding: 12px; border-radius: 8px; overflow-x: auto; margin: 1em 0; }
.markdown pre code { background: transparent; padding: 0; }
.markdown a { color: var(--brand); text-decoration: underline; }
.markdown hr { border: none; border-top: 1px solid var(--border); margin: 1.5em 0; }
.markdown table { border-collapse: collapse; width: 100%; margin: 1em 0; }
.markdown th, .markdown td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.markdown th { background: var(--muted); font-weight: 600; }

/* Optional: make the History button look like a secondary ghost on white bg rows */
.pt-history-btn.btn.secondary{
  background:#eaf0f7;
  color:var(--text);
  border:1px solid var(--border);
}

/* Make patient name on dashboard hover to requested color (kept here for consistency) */
.pt-name:hover{ color:#4292ca; }

/* === Billing page additions === */

/* Transparent table (keeps borders), matching dashboard look */
.card.flat { background: transparent; border: 0; box-shadow: none; padding: 0; }
.table {
  background: transparent !important;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.table th,
.table td { background: transparent !important; }
.table tbody tr:hover{
  background: color-mix(in oklab, var(--bg) 96%, transparent);
}
/* === Billing page: UI fixes & additions === */

/* 1) Better search chip styling (matches dashboard) */
.billing-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0 14px;
}
.billing-toolbar .search-chip{
  flex: 1 1 520px;
  background: var(--bg) !important;
  border: 1px solid var(--border);
  border-radius: 10px;
  height: 38px;
  display: flex;
  align-items: center;
  padding: 0 12px;
}
.billing-toolbar .search-chip input[type="search"]{
  border: 0;
  outline: 0;
  height: 32px;
  width: 100%;
  background: transparent;
  color: var(--text);
  font: inherit;
}

/* 2) Filter chips (same look as dashboard) */
.billing-toolbar .filter-chip,
.billing-toolbar .filter-chip.dd{
  background: var(--bg) !important;
  border: 1px solid var(--border);
}
.billing-toolbar .filter-chip .dd-menu{
  background: var(--bg) !important;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  /* Show many patients/providers (scrollable) */
  max-height: 60vh !important;
  overflow: auto !important;
}

/* 3) Transparent table to match dashboard */
.card.flat { background: transparent; border: 0; box-shadow: none; padding: 0; }
.table {
  background: transparent !important;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.table th, .table td { background: transparent !important; }
.table tbody tr:hover{
  background: color-mix(in oklab, var(--bg) 96%, transparent);
}

/* 4) Chevron + pills + small text styles */
.chev-btn{
  appearance:none; border:0; background:transparent; cursor:pointer;
  font-size:16px; line-height:1; color:#64748b; padding:0 6px
}
.chev-btn:hover{ color:#334155 }
.pt-cell { display:flex; align-items:center; gap:10px; }
.pt-cell .col { display:flex; flex-direction:column; }
.pt-name { text-decoration:none; font-weight:600; }
.pt-name:hover { color:#4292ca; text-decoration:underline; }
.assessment-link { color:#2563eb; text-decoration:none; font-weight:600; }
.assessment-link:hover { text-decoration:underline; }
.activity-title { color:#6d28d9; font-weight:700; text-decoration:none; }
.activity-title:hover { text-decoration:underline; }
.activity-bundle {
  display:block; color: var(--sub); font-size:12px; letter-spacing:.2px; text-transform:uppercase;
}
.cpt-pill{
  display:inline-flex; align-items:center;
  padding:3px 10px; border-radius:999px;
  border:1px solid var(--border);
  background: color-mix(in oklab, var(--muted) 88%, #fff);
  color: var(--text);
  font-weight:700; font-size:12px;
}
.provider-line { font-weight:600; }
.provider-sub { color: var(--sub); font-size:12px; }
.text-nowrap{ white-space:nowrap; }

/* 5) Smooth details dropdown content spacing */
.dropdown-anim { transition: max-height .55s cubic-bezier(.22,1,.36,1), opacity .35s var(--ease), transform .45s var(--ease-out); }
.log-details-footer{ display:flex; gap:8px; margin-top:10px; align-items:center; }

/* 6) Pager (rows + prev/next) */
.pager-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.pager-row .spacer { flex: 1; }
.pager-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pager-controls select {
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0 10px;
}

/* 7) "Add Custom Time" modal (matches dashboard add-patient modal) */
.time-modal-overlay{
  position: fixed; inset: 0;
  background: rgba(2,6,23,.45);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  backdrop-filter: blur(6px) saturate(120%);
  display: none; align-items: center; justify-content: center;
  z-index: 10000;
}
.time-modal-overlay[data-open="1"] { display: flex; }
.time-modal {
  width: min(760px, 92vw);
  background: var(--bg-elev, #fff);
  color: var(--text, #111827);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px;
  box-shadow: 0 30px 70px rgba(2,6,23,.35);
  overflow: hidden;
  transform: translateY(8px) scale(.98);
  opacity: 0;
  transition: transform .22s cubic-bezier(.22,1,.36,1), opacity .18s ease;
}
.billing-toolbar .filter-chip .dd-menu{
  background: var(--bg) !important;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  /* Show many patients/providers (scrollable) */
  max-height: 60vh !important;
  overflow: auto !important;
}

/* 3) Transparent table to match dashboard */
.card.flat { background: transparent; border: 0; box-shadow: none; padding: 0; }
.table {
  background: transparent !important;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.table th, .table td { background: transparent !important; }
.table tbody tr:hover{
  background: color-mix(in oklab, var(--bg) 96%, transparent);
}

/* 4) Chevron + pills + small text styles */
.chev-btn{
  appearance:none; border:0; background:transparent; cursor:pointer;
  font-size:16px; line-height:1; color:#64748b; padding:0 6px
}
.chev-btn:hover{ color:#334155 }
.pt-cell { display:flex; align-items:center; gap:10px; }
.pt-cell .col { display:flex; flex-direction:column; }
.pt-name { text-decoration:none; font-weight:600; }
.pt-name:hover { color:#4292ca; text-decoration:underline; }
.assessment-link { color:#2563eb; text-decoration:none; font-weight:600; }
.assessment-link:hover { text-decoration:underline; }
.activity-title { color:#6d28d9; font-weight:700; text-decoration:none; }
.activity-title:hover { text-decoration:underline; }
.activity-bundle {
  display:block; color: var(--sub); font-size:12px; letter-spacing:.2px; text-transform:uppercase;
}
.cpt-pill{
  display:inline-flex; align-items:center;
  padding:3px 10px; border-radius:999px;
  border:1px solid var(--border);
  background: color-mix(in oklab, var(--muted) 88%, #fff);
  color: var(--text);
  font-weight:700; font-size:12px;
}
.provider-line { font-weight:600; }
.provider-sub { color: var(--sub); font-size:12px; }
.text-nowrap{ white-space:nowrap; }

/* 5) Smooth details dropdown content spacing */
.dropdown-anim { transition: max-height .55s cubic-bezier(.22,1,.36,1), opacity .35s var(--ease), transform .45s var(--ease-out); }
.log-details-footer{ display:flex; gap:8px; margin-top:10px; align-items:center; }

/* 6) Pager (rows + prev/next) */
.pager-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.pager-row .spacer { flex: 1; }
.pager-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pager-controls select {
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0 10px;
}

/* 7) "Add Custom Time" modal (matches dashboard add-patient modal) */
.time-modal-overlay{
  position: fixed; inset: 0;
  background: rgba(2,6,23,.45);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  backdrop-filter: blur(6px) saturate(120%);
  display: none; align-items: center; justify-content: center;
  z-index: 10000;
}
.time-modal-overlay[data-open="1"] { display: flex; }
.time-modal{
  width: min(760px, 92vw);
  background: var(--bg-elev, #fff);
  color: var(--text, #111827);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px;
  box-shadow: 0 30px 70px rgba(2,6,23,.35);
  overflow: hidden;
  transform: translateY(8px) scale(.98);
  opacity: 0;
  transition: transform .22s cubic-bezier(.22,1,.36,1), opacity .18s ease;
}
.time-modal-overlay[data-open="1"] .time-modal{
  transform: translateY(0) scale(1);
  opacity: 1;
}
.time-modal-header{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:14px 16px; border-bottom:1px solid var(--border, #e5e7eb);
  background: color-mix(in oklab, var(--bg-elev, #fff) 98%, transparent);
}
.time-modal-overlay[data-open="1"] .time-modal{
  transform: translateY(0) scale(1);
  opacity: 1;
}
.time-modal-header{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:14px 16px; border-bottom:1px solid var(--border, #e5e7eb);
  background: color-mix(in oklab, var(--bg-elev, #fff) 98%, transparent);
}
.time-modal-header h3{ margin:0; font-size:16px; }
.time-modal-body{ padding:16px; display:grid; gap:12px; }
.time-grid{ display:grid; grid-template-columns: 1fr 1fr; gap:12px; }
.time-field{ display:grid; gap:6px; }
.time-field label{ font-size:12px; color: var(--sub,#6b7280); }
.time-field input, .time-field select{
  height: 36px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border, #e5e7eb); background: var(--surface, #fff); color: var(--text, #111827);
}
.time-modal-footer{
  padding:12px 16px; display:flex; gap:8px; justify-content:flex-end;
  border-top:1px solid var(--border, #e5e7eb);
  background: color-mix(in oklab, var(--bg-elev, #fff) 98%, transparent);
}

/* --- Brand override: all blue buttons use #2579bf --- */
:root{
  --brand: #2579bf !important;
  --brand-600: #2579bf !important;
}

/* Ensure any gradient big button also uses the same solid color */
.btn,
.btn.big {
  background: #2579bf !important;
  color: #fff;
}

/* Ghost button link color to match */
.btn.ghost { color: #2579bf !important; }
.time-modal-header h3{ margin:0; font-size:16px; }
.time-modal-body{ padding:16px; display:grid; gap:12px; }
.time-grid{ display:grid; grid-template-columns: 1fr 1fr; gap:12px; }
.time-field{ display:grid; gap:6px; }
.time-field label{ font-size:12px; color: var(--sub,#6b7280); }
.time-field input, .time-field select{
  height: 36px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border, #e5e7eb); background: var(--surface, #fff); color: var(--text, #111827);
}
.time-modal-footer{
  padding:12px 16px; display:flex; gap:8px; justify-content:flex-end;
  border-top:1px solid var(--border, #e5e7eb);
  background: color-mix(in oklab, var(--bg-elev, #fff) 98%, transparent);
}

/* --- Brand override: all blue buttons use #2579bf --- */
:root{
  --brand: #2579bf !important;
  --brand-600: #2579bf !important;
}

/* Ensure any gradient big button also uses the same solid color */
.btn,
.btn.big {
  background: #2579bf !important;
  color: #fff;
}

/* Ghost button link color to match */
.btn.ghost { color: #2579bf !important; }

/* ===== Global brand + button + typography overrides ===== */

/* 1) Brand tokens → all UI elements that reference --brand/--brand-600 will resolve to #009966 */
:root{
  --brand: #009966 !important;
  --brand-600: #009966 !important;
}

/* 2) All buttons: green background + white text (including secondary/ghost variants) */
.btn,
.btn.secondary,
.btn.ghost {
  background: #009966 !important;
  color: #ffffff !important;
  border: 1px solid #008a60 !important;  /* subtle border to match */
  box-shadow: 0 8px 20px rgba(0,0,0,.06); /* light lift */
}

/* Hover/active feel without changing color */
.btn:hover,
.btn.secondary:hover,
.btn.ghost:hover {
  filter: brightness(0.98);
  transform: translateY(-1px);
}
.btn:active,
.btn.secondary:active,
.btn.ghost:active {
  transform: translateY(0);
  filter: none;
}

/* 3) Remove bold everywhere (site-wide) */
*, *::before, *::after {
  font-weight: 400 !important; /* normalize to non-bold */
}

/* If you want headings just slightly heavier but not bold, uncomment below:
h1, h2, h3 { font-weight: 500 !important; }
*/

/* 4) Ensure badges/pills/labels also use non-bold text and remain readable */
.badge,
.chip,
.status-pill,
.risk-pill,
.pt-name,
.assess-title {
  font-weight: 400 !important;
  color: inherit; /* keep existing color schemes */
}

/* 5) Inputs in .segment/.filter chips keep their look with the new brand */
.filter-chip .dd-btn .dd-caret { color: #ffffff !important; } /* caret remains visible on green if you ever style these as buttons */

/* --- Auth/branding polish --- */
.brand-hero { display:flex; align-items:center; justify-content:center; gap:12px; margin: 24px auto 8px; padding: 8px 0; }
.brand-title { font-weight: 800; letter-spacing: .2px; }
.brand-sub { color: var(--sub); font-weight: 600; font-size: 12px; text-align:center; }
.brand-logo {
  width: 44px; height: 44px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  display:inline-flex; align-items:center; justify-content:center;
}
.brand-logo.fallback{
  background: #e6f5ef; border-color: #d5ede4; color: #009966;
  font-weight:900; font-size: 18px;
}

.auth-container { display:flex; align-items:center; justify-content:center; min-height: calc(100vh - 100px); padding:24px; background: var(--bg); }
.auth-card {
  width: min(720px, 96vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 24px 22px;
}
.auth-form .field { display:grid; gap:6px; }
.auth-form .field label { font-size: 13px; color: var(--sub); }
.auth-form .field input, .auth-form .field select {
  height:40px; padding:0 12px; border-radius:10px;
  border:1px solid var(--border); background:var(--surface); color:var(--text);
  outline:none;
}
.auth-actions { display:flex; gap:10px; justify-content:flex-end; margin-top:14px; }

/* Subtle focus feedback */
.auth-form .field input:focus,
.auth-form .field select:focus {
  border-color: color-mix(in oklab, var(--brand-600) 42%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand-600) 16%, transparent);
}

/* Error block (shared) */
.form-error {
  padding: 10px 12px; border-radius: 10px;
  border:1px solid color-mix(in oklab, var(--danger) 35%, var(--border));
  background: color-mix(in oklab, var(--danger) 6%, var(--surface));
  color:#7f1d1d; font-size:13px;
}

.filter-chip.dd::after { content: none !important; } /* prevent double caret when using dd-caret span */
.filter-chip.dd .dd-btn .dd-caret {
  color: var(--sub) !important;  /* visible on neutral bg */
  font-size: 12px;
  margin-left: 6px;
}

/* Search input - sized to fit with filters on one line */
.search-row .search-chip { flex: 0 1 240px !important; }
.search-row input[type="search"] {
  min-width: 0 !important;
  width: 100% !important;
  font-size: 14px;
}

/* Continue Work button - prevent link hover styles */
.continue-btn:hover { text-decoration: none !important; color: #fff !important; }

/* Hide brand title when sidebar is collapsed */
.sidebar[data-collapsed="1"] .brand .title { display: none !important; }

/* ===== Sidebar — Professional polish (restored) ===== */

/* Subtle elevation + edge; keeps your width/collapse behavior intact */
.sidebar{
  background: linear-gradient(
    180deg,
    color-mix(in oklab, var(--surface) 98%, transparent) 0%,
    var(--surface) 100%
  ) !important;
  box-shadow: 0 20px 50px rgba(2,6,23,.06);
  border-right: 1px solid var(--border);
  z-index: 60; /* ensure toggle/tooltip appear above content */
}

/* Brand block container */
.sidebar .brand{
  padding: 10px 10px;
  border-radius: 12px;
  background: color-mix(in oklab, var(--muted) 90%, #fff);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.sidebar[data-collapsed="1"] .brand{
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  padding: 6px 0;
  justify-content: center;
}

/* Tighter nav spacing */
#sideNav{ gap: 6px; }

/* Nav items: refined hover/active/focus with left accent bar */
#sideNav a{
  position: relative;
  border: 1px solid transparent;
  transition:
    background .18s var(--ease),
    color .18s var(--ease),
    transform .16s var(--ease),
    border-color .18s var(--ease),
    box-shadow .18s var(--ease);
}
/* Removed vertical line indicator - user requested no left bar on active/hover */
#sideNav a:hover{
  background: color-mix(in oklab, var(--brand-600) 10%, var(--surface));
  border-color: color-mix(in oklab, var(--brand-600) 22%, var(--border));
  box-shadow: 0 10px 24px rgba(2,6,23,.06);
  transform: translateY(-1px);
}
/* Removed hover left bar */
#sideNav a.active{
  background: color-mix(in oklab, var(--brand-600) 14%, var(--surface));
  color: var(--text);
  border-color: color-mix(in oklab, var(--brand-600) 30%, var(--border));
  box-shadow: 0 12px 30px rgba(2,6,23,.08);
}
/* Removed active left bar */
#sideNav a:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand-600) 28%, transparent);
  border-color: color-mix(in oklab, var(--brand-600) 38%, var(--border));
}

/* Icon tint transitions (works with inline SVGs) */
.sidebar .icon svg path,
.sidebar .icon svg rect,
.sidebar .icon svg circle{
  transition: stroke .18s var(--ease), fill .18s var(--ease);
  stroke: #334155;
}
.sidebar .icon svg circle{ fill: #334155; }
#sideNav a:hover .icon svg path,
#sideNav a.active .icon svg path,
#sideNav a:hover .icon svg rect,
#sideNav a.active .icon svg rect{
  stroke: var(--brand-600);
}
#sideNav a:hover .icon svg circle,
#sideNav a.active .icon svg circle{
  fill: var(--brand-600);
}

/* Collapsed: center icons and show a clean tooltip using aria-label */
.sidebar[data-collapsed="1"]{ overflow: visible; } /* allow tooltip to escape */
.sidebar[data-collapsed="1"] #sideNav a{
  justify-content: center;
  position: relative;
}
.sidebar[data-collapsed="1"] #sideNav a::after{
  content: attr(aria-label);
  position: absolute;
  top: 50%;
  left: calc(100% + 10px);
  transform: translateY(-50%) translateX(4px);
  background: var(--text);
  color: var(--surface);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 14px 40px rgba(2,6,23,.18);
  transition: opacity .18s var(--ease), transform .18s var(--ease);
  z-index: 2000;
}
.sidebar[data-collapsed="1"] #sideNav a:hover::after,
.sidebar[data-collapsed="1"] #sideNav a:focus-visible::after{
  opacity: 1;
  transform: translateY(-50%) translateX(6px);
}

/* Toggle pill polish */
.sidebar-toggle{
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(2,6,23,.08);
}
.sidebar-toggle:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(2,6,23,.12);
}

/* Robust chevron rendering for the sidebar toggle (no JS/HTML changes) */
.sidebar-toggle::before{
  content: "‹";                 /* show left-pointing chevron when expanded */
  font-size: 14px;
  line-height: 1;
  font-weight: 800;
  color: var(--text);
  display: inline-block;
}
.sidebar[data-collapsed="1"] .sidebar-toggle::before{
  content: "›";                 /* show right-pointing chevron when collapsed */
}
/* Hide any existing icon/text inside the toggle to avoid double-render or misalignment */
.sidebar-toggle > svg,
.sidebar-toggle > i,
.sidebar-toggle > span{
  display: none !important;
}

/* ===== Dashboard visual polish (non‑breaking) ===== */

/* Heading: solid color per feedback */
.page h1{
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: var(--text);
  letter-spacing: .2px;
}

/* Count badge in the header line e.g. “• 6 patients” */
#ptCount{
  display:inline-flex; align-items:center; justify-content:center;
  min-width: 20px; height: 20px; padding: 0 8px; margin: 0 2px;
  font-size: 12px; border-radius: 999px;
  background: color-mix(in oklab, var(--ok) 20%, var(--bg));
  color: #065f46; border: 1px solid color-mix(in oklab, var(--ok) 38%, var(--border));
}

/* Filter bar container: lightly framed “chip tray” */
.search-row{
  padding: 10px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in oklab, var(--bg) 96%, transparent);
  box-shadow: 0 8px 24px rgba(2,6,23,.04);
}

/* Search chip with icon (no markup changes) */
.search-row .search-chip{
  position: relative;
  overflow: hidden;
}
.search-row .search-chip::before{
  content: "🔍";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  opacity: .65;
  pointer-events: none;
}
.search-row .search-chip input[type="search"]{
  padding-left: 28px !important;
}

/* Filter chips: consistent hover/focus and elevation */
.search-row .filter-chip,
.search-row .filter-chip.dd{
  transition: box-shadow .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease);
}
.search-row .filter-chip:hover,
.search-row .filter-chip.dd:hover{
  border-color: color-mix(in oklab, var(--brand-600) 26%, var(--border));
  box-shadow: 0 8px 18px rgba(2,6,23,.06);
  transform: translateY(-1px);
}
.search-row .filter-chip:focus-within,
.search-row .filter-chip.dd:focus-within{
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand-600) 20%, transparent), 0 10px 24px rgba(2,6,23,.06);
  border-color: color-mix(in oklab, var(--brand-600) 40%, var(--border));
}

/* Dropdown panel polish */
.search-row .filter-chip .dd-menu{
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(2,6,23,.10);
  backdrop-filter: none;
}

/* “New Patient” primary button: modern gradient (keeps existing brand color semantics) */
.btn.primary{
  background: linear-gradient(135deg, color-mix(in oklab, var(--ok) 70%, #16a34a) 0%, color-mix(in oklab, var(--brand-600) 30%, var(--ok)) 100%) !important;
  border: 1px solid color-mix(in oklab, var(--ok) 45%, var(--border)) !important;
  color: #fff !important;
  box-shadow: 0 10px 24px rgba(16,185,129,.25);
}
.btn.primary:hover{
  filter: brightness(1.02);
  transform: translateY(-1px);
}
.btn.primary:active{
  transform: translateY(0);
}

/* Table hover and details panel: a touch more separation without changing structure */
.table tbody tr:hover{
  background: color-mix(in oklab, var(--bg) 94%, transparent) !important;
}
.dropdown-anim.open{
  border-radius: 12px;
  background: color-mix(in oklab, var(--bg-elev) 98%, transparent) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 14px 36px rgba(2,6,23,.10) !important;
}

/* Responsive tweaks for narrow screens */
@media (max-width: 720px){
  .search-row{
    padding: 8px;
  }
  .search-row .search-chip{ flex: 1 1 100%; }
  .search-row .filter-chip,
  .search-row .filter-chip.dd{ flex: 1 1 calc(50% - 8px); }
}


/* Subtle zebra striping with brand-tinted hover */

/* Left accent on hover without shifting layout */

/* Patient cell refinements */

/* Time column alignment */

/* Dashboard layout tweaks per feedback */
.search-row{ width: 100%; }
.search-row > .btn,
.search-row > button.btn{ margin-left: auto; } /* push New Patient to the far right */
.search-row .filter-chip,
.search-row .filter-chip.dd{ flex: 0 0 auto; } /* chips do not stretch; search consumes remaining space */

/* Larger selects inside chips to match 44px height */
.filter-chip select{ height: 36px; }

/* ===== Pager polish (Dashboard/Billing) ===== */
.pager-row{
  display:flex;
  align-items:center;
  gap:12px;
  margin-top:12px;
  flex-wrap:wrap;
  padding:8px 10px;
  background: color-mix(in oklab, var(--bg) 98%, transparent);
  border:1px solid var(--border);
  border-radius:12px;
  box-shadow:0 6px 18px rgba(2,6,23,.04);
}
.pager-row .spacer{ flex:1; }
.pager-row #pagerText{
  color: var(--sub);
  font-size:13px;
}

/* Compact capsule around Rows select */
.pager-controls{
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:8px;
  /* extra right padding to host caret icon, like the All Genders chip */
  padding:6px 30px 6px 10px;
  border:1px solid var(--border);
  border-radius:999px;
  background: var(--surface);
  transition: box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.pager-controls label{
  color: var(--sub);
  font-size:12px;
  font-weight:600;
}
.pager-controls select{
  appearance:none; -webkit-appearance:none; -moz-appearance:none;
  height:30px;
  min-width:64px;
  padding:0 16px 0 10px; /* room before caret */
  border:0; /* match All Genders chip look (single outer border) */
  border-radius:999px;
  background: transparent;
  color: var(--text);
  outline: none;
  font: inherit;
}
/* Focus ring and border color like filter chips */
.pager-controls:focus-within{
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand-600) 20%, transparent);
  border-color: color-mix(in oklab, var(--brand-600) 35%, var(--border));
}
/* Caret similar to filter chips */
.pager-controls::after{
  content: "▾";
  position:absolute;
  right:10px;
  top:50%;
  transform: translateY(-50%);
  color:#64748b;
  pointer-events:none;
  font-size:12px;
}

/* Prev/Next green pills (professional, matches spec) */
.pager-row #prevPage,
.pager-row #nextPage{
  background: linear-gradient(135deg, #36c69a 0%, #16a36e 100%) !important;
  border: 1px solid color-mix(in oklab, var(--ok) 50%, var(--border)) !important;
  color: #fff !important;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(16,185,129,.22);
}
.pager-row #prevPage:hover,
.pager-row #nextPage:hover{
  filter: brightness(1.02);
  transform: translateY(-1px);
}
.pager-row #prevPage:active,
.pager-row #nextPage:active{
  transform: translateY(0);
  filter: none;
}
/* Ensure Rows custom chip feels clickable and hovers like the top filters */
.pager-row .filter-chip.dd,
.pager-row .filter-chip.dd .dd-btn{
  cursor: pointer;
}

/* Prev/Next as sleek pills without changing button markup */
.pager-row .btn.small{
  height:28px;
  padding:0 14px;
  border-radius:999px;
  font-weight:600;
  box-shadow:0 8px 16px rgba(2,6,23,.06);
  transition: transform .12s var(--ease), filter .12s var(--ease);
}
.pager-row .btn.small:hover{
  transform: translateY(-1px);
  filter: brightness(1.02);
}
.pager-row .btn.small:disabled{
  opacity: .6;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

/* Direction chevrons via pseudo elements (no text changes) */
.pager-row #prevPage::before{
  content:"‹";
  margin-right:6px;
  margin-bottom: 2px;
  font-size:12px;
  opacity:.9;
}
.pager-row #nextPage::after{
  content:"›";
  margin-left:6px;
  margin-bottom: 2px;
  font-size:12px;
  opacity:.9;
}

/* Mobile: center items and drop spacer */
@media (max-width: 640px){
  .pager-row{ justify-content: center; gap: 10px; }
  .pager-row .spacer{ display:none; }
}

/* Rows control styled capsule dropdown (enhanced) */
.pager-row .rows-dd {
  display: inline-flex;
  align-items: center;
  position: relative;         /* create stacking context above cards */
  z-index: 20000;             /* ensure the whole control sits above underlying card */
}
.pager-row .rows-dd .filter-chip.dd {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;  /* less rounded */
  padding: 0 !important;
  box-shadow: 0 8px 18px rgba(2,6,23,.06);
}
.pager-row .rows-dd .dd-btn {
  all: unset;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  line-height: 1.2;
  padding: 6px 12px;
}
.pager-row .rows-dd .dd-value { font-weight: 700; }
.pager-row .rows-dd .dd-caret { opacity: .7; font-size: 12px; }
.pager-row .rows-dd .dd-menu {
  min-width: 120px;
  border-radius: 8px !important;   /* less rounded */
  z-index: 20050 !important;       /* force above card/table/drop shadows */
}

/* Remove outer capsule: when pager-controls is enhanced (rows-dd), make it visually neutral */
.pager-row .pager-controls.rows-dd {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.pager-row .pager-controls.rows-dd::after { content: none !important; }
.pager-row .pager-controls.rows-dd:focus-within {
  box-shadow: none !important;
  border-color: transparent !important;
}

/* ===== Dashboard header micro‑polish (visual-only, non-breaking) ===== */
.search-row .search-chip{ height:40px; }
.search-row .search-chip input[type="search"]{ height:36px; }
.filter-chip, .filter-chip.dd{ height:40px; }
.filter-chip .dd-btn{ height:32px; }

/* Subtle focus/hover ring consistency across search and filter chips */
.search-row .search-chip:focus-within,
.search-row .filter-chip:focus-within,
.search-row .filter-chip.dd:focus-within{
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand-600) 18%, transparent), 0 10px 24px rgba(2,6,23,.06);
  border-color: color-mix(in oklab, var(--brand-600) 36%, var(--border));
}

/* Ensure the top header stays visually flat and consistent with page */
.header{
  background: color-mix(in oklab, var(--bg) 98%, transparent);
  border-bottom: 1px solid var(--border);
}

/* Fix: remove inner "card" border on the dashboard search input (browser default styling) */
.search-row .search-chip input[type="search"]{
  appearance: none;
  -webkit-appearance: none;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none;
}
.search-row .search-chip input[type="search"]::-webkit-search-decoration,
.search-row .search-chip input[type="search"]::-webkit-search-cancel-button{
  -webkit-appearance: none;
}

/* ---- Utilities for non-CTA muted buttons and slight vertical nudge ---- */
.btn.muted { background:#f1f5f9 !important; color: var(--sub) !important; border:1px solid var(--border) !important; box-shadow:none !important; }
.btn.raise-5 { transform: translateY(-5px); }

/* Billing table full-width fix */
.page .card.flat { width: 100%; }
.page .card.flat .table { width: 100% !important; }
.table { width: 100% !important; }

/* Temporary hide per request */
#pf4SubmitBtn,
#finalApproveBtn,
#pf4RetryBtn,
#charmToggle {
  display: none !important;
}

/* Hide MyJourney History (patient page) */
#histCard,
#historyOverlay {
  display: none !important;
}

/* ===== IMHCORE-675: UI Quick Wins - Enhanced Visual Polish ===== */
/* Safe additive improvements - does not change layouts */

/* 1) Enhanced Shadow System - More visible depth for modern SaaS look */
:root {
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.08), 0 8px 10px -6px rgba(0,0,0,.04);
  --shadow-hover: 0 14px 28px rgba(0,0,0,.10), 0 6px 10px rgba(0,0,0,.06);
}

/* 2) Card depth improvements */
.card {
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover {
  box-shadow: var(--shadow-lg);
}

/* 3) Button refinements - Better states and transitions */
.btn {
  transition: all 0.18s ease;
  position: relative;
  overflow: hidden;
}
.btn:not(:disabled):hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.btn:not(:disabled):active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand-600) 25%, transparent), var(--shadow-md);
}
/* Secondary button distinction */
.btn.secondary {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}
.btn.secondary:not(:disabled):hover {
  background: var(--muted) !important;
  border-color: color-mix(in oklab, var(--brand-600) 20%, var(--border)) !important;
}

/* 4) Table row improvements - Better hover feedback */
.table {
  box-shadow: var(--shadow-sm);
}
.table tbody tr {
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.table tbody tr:hover {
  background: linear-gradient(90deg, color-mix(in oklab, var(--brand-600) 4%, var(--bg)) 0%, var(--bg) 100%) !important;
  box-shadow: inset 3px 0 0 var(--brand-600);
}
/* Sortable header indication */
.table th {
  transition: background 0.15s ease;
  cursor: default;
}
.table th[data-sort]:hover {
  background: var(--muted) !important;
  cursor: pointer;
}

/* 5) Sidebar refinements - Enhanced visual hierarchy */
.sidebar {
  box-shadow: var(--shadow-lg);
}
#sideNav a {
  transition: all 0.18s ease;
}
#sideNav a:hover {
  background: color-mix(in oklab, var(--brand-600) 8%, var(--surface));
  box-shadow: var(--shadow-sm);
}
#sideNav a.active {
  background: color-mix(in oklab, var(--brand-600) 12%, var(--surface));
  box-shadow: var(--shadow-md);
}

/* 6) Input focus improvements - Better accessibility */
.input:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: color-mix(in oklab, var(--brand-600) 50%, var(--border)) !important;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand-600) 15%, transparent) !important;
  outline: none;
}

/* 7) Badge/pill polish - Subtle depth */
.badge {
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.badge:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* 8) Filter chip polish */
.filter-chip,
.filter-chip.dd {
  transition: all 0.18s ease;
}
.filter-chip:hover,
.filter-chip.dd:hover {
  box-shadow: var(--shadow-md);
  border-color: color-mix(in oklab, var(--brand-600) 30%, var(--border));
}

/* 9) Modal/overlay backdrop enhancement */
.patient-picker-overlay,
.time-modal-overlay {
  backdrop-filter: blur(8px) saturate(150%);
}
.patient-picker-card,
.time-modal {
  box-shadow: var(--shadow-xl);
}

/* 10) Header bar subtle depth */
.header {
  box-shadow: var(--shadow-sm);
}

/* 11) Dropdown menu polish */
.filter-chip .dd-menu,
.dropdown-anim.open {
  box-shadow: var(--shadow-lg) !important;
}
.filter-chip .dd-menu button:hover {
  background: color-mix(in oklab, var(--brand-600) 8%, var(--surface));
}

/* 12) Avatar hover effect */
.avatar {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.avatar:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

/* 13) Link hover polish */
a:not(.btn):not(#sideNav a):hover {
  color: color-mix(in oklab, var(--brand-600) 80%, var(--text));
}

/* 14) Search chip focus enhancement */
.search-row .search-chip:focus-within {
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand-600) 15%, transparent), var(--shadow-md) !important;
  border-color: color-mix(in oklab, var(--brand-600) 40%, var(--border)) !important;
}

/* 15) Pager button polish */
.pager-row .btn {
  box-shadow: var(--shadow-sm);
}
.pager-row .btn:not(:disabled):hover {
  box-shadow: var(--shadow-md);
}

/* ===== End IMHCORE-675 UI Quick Wins ===== */

/* ===== User Menu in Top Bar ===== */
.user-menu-wrapper {
  position: relative;
  display: inline-block;
}
.user-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.18s ease;
}
.user-menu-btn:hover {
  border-color: color-mix(in oklab, var(--brand-600) 40%, var(--border));
  box-shadow: var(--shadow-md);
}
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #009966 0%, #16a34a 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-menu-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  z-index: 1000;
}
.user-menu-wrapper.open .user-menu-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.user-menu-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.user-role {
  font-size: 12px;
  color: var(--sub);
}
.user-clinic {
  font-size: 11px;
  color: var(--brand-600);
  font-weight: 500;
  padding: 2px 8px;
  background: color-mix(in oklab, var(--brand-600) 10%, transparent);
  border-radius: 4px;
  margin-top: 4px;
  display: inline-block;
}
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s ease;
}
.user-menu-item:hover {
  background: var(--muted);
  text-decoration: none;
}
.user-menu-item.logout-item {
  color: #dc2626;
}
.user-menu-item.logout-item:hover {
  background: #fef2f2;
}
/* ===== End User Menu ===== */
