:root {
  --navy-900: #0f2540;
  --navy-800: #15335a;
  --navy-700: #1c3d63;
  --blue-600: #2f6690;
  --blue-500: #3b7ba8;
  --blue-100: #eaf1f7;
  --slate-50: #f5f7fa;
  --slate-100: #eef1f5;
  --slate-200: #e2e6ea;
  --slate-400: #9aa5b1;
  /* Darkened from the original #5a6472 (a visibly grey mid-tone) to a
     near-black - every "muted"/secondary/label text in the app (hints,
     table headers, disclaimers, panel-header meta) uses this token for
     `color:` only (confirmed - no border/background call site references
     var(--slate-600), the one border that shares its RGB uses a literal
     rgba(), untouched by this), so this one change reads as "black instead
     of grey" everywhere at once rather than reading every template. Kept
     very slightly softer than --ink-900 (not identical) so secondary text
     still recedes a hair behind primary content - true equality would
     erase that hierarchy entirely, which readability needs even when the
     goal is "less grey." */
  --slate-600: #263140;
  /* Formalizes what was previously only ever referenced as a fallback
     (`var(--slate-700, #33404f)`, 4 call sites - never actually defined
     here, so always fell through to that literal) - defined now, and
     darkened along with --slate-600 above for the same reason. */
  --slate-700: #1a2531;
  --ink-900: #16202b;
  --green-600: #2e7d32;
  --green-100: #e6f4ea;
  --amber-700: #9c6500;
  --amber-100: #fdf2df;
  --orange-700: #c9791a;
  --orange-100: #fbe8d2;
  --red-700: #b3261e;
  --red-100: #fbe9e8;
  /* Colorful reskin rollout (2026-09-09) - page-identity accent colors for
     .panel-header-* variants and .kpi-card's --tile-color, extending the
     bold palette the RCM KPI Dashboard introduced to the rest of the app.
     --purple-600 matches that page's own inline #7b4fa0 exactly (formalized
     as a token now that it's used in more than one place); --teal-600,
     --indigo-600, --maroon-600 are new. --maroon-600 is deliberately its
     own color, not --red-700 - Denials needing "a red" would otherwise make
     that page read as an error/danger banner rather than a page identity. */
  --purple-600: #7b4fa0;
  --teal-600: #0f766e;
  --indigo-600: #4338ca;
  --maroon-600: #7a2431;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-sm: 7px;
  /* A slightly larger, softer, more color-tinted shadow scale (navy-tinted
     rather than pure black) - closer to the shadcn/21st.dev "soft card"
     look than the original single flat --shadow value, without changing
     any call site (every existing var(--shadow) reference gets this for
     free). --shadow-md/--shadow-lg are new, opt-in, for elements that
     want more lift (hover states, modals). */
  --shadow: 0 1px 2px rgba(15, 37, 64, 0.05), 0 2px 8px rgba(15, 37, 64, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 37, 64, 0.10), 0 1px 3px rgba(15, 37, 64, 0.08);
  --shadow-lg: 0 12px 36px rgba(15, 37, 64, 0.18), 0 2px 8px rgba(15, 37, 64, 0.08);
  --ring: 0 0 0 3px rgba(59, 123, 168, 0.28);
  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--ink-900);
  background: var(--slate-50);
  font-size: 14px;
  line-height: 1.5;
}

/* Browsers do not inherit font-family into form controls by default -
   without this, inputs/selects/textareas/buttons silently fall back to
   the OS's native UI font instead of the site font, which is what causes
   visibly mismatched text in fields even though every other element
   correctly uses var(--font). This one rule covers every current and
   future form control site-wide, rather than patching font-family onto
   each individual input/select/button selector. */
input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Small inline-code pill for identifiers (tenant slugs, etc.) - was plain
   browser-default monospace text outside of .modal-body's own local
   `code` rule; this is that same treatment, just available everywhere. */
code {
  background: var(--slate-100);
  color: var(--navy-800);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.92em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Modern, accessible focus ring - shadcn/21st.dev style: a soft colored
   halo via box-shadow, not the browser's default (often clipped, always
   inconsistent-looking) outline. :focus-visible (not bare :focus) so a
   mouse click doesn't show it, only keyboard/AT navigation does - the
   ring communicates "you tabbed here," not "you clicked here." */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-sm);
}

/* One shared base for every plain text-ish input and select across the
   whole app (search boxes, date pickers, filter dropdowns, admin forms) -
   previously each page/form styled its own inputs ad hoc (or, for a bare
   <select>, not at all - just raw browser chrome). This is what makes the
   "restyle in place" approach cascade to every page's filter bar/form
   without touching 27 templates: change the shared rule once, it shows up
   everywhere the element already exists. Deliberately excludes
   type=checkbox/radio/range/file (native controls that don't want this
   treatment) and type=hidden. Individual pages' own more specific
   selectors (.login-card input, .table-search-bar input) still win over
   this by specificity where they intentionally differ. */
select,
input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="number"], input[type="date"],
input[type="tel"], input[type="url"], textarea {
  padding: 8px 12px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--ink-900);
  transition: border-color var(--transition), box-shadow var(--transition);
}

select:hover, input:hover, textarea:hover {
  border-color: var(--slate-400);
}

select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--blue-500);
}

select {
  cursor: pointer;
  /* A custom chevron (native <select> arrows look dated/inconsistent
     across browsers) - a plain inline SVG data-URI, no icon font/library
     needed. Slate-600 to match the rest of the app's muted-icon color. */
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a6472' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px;
  padding-right: 32px;
}

/* ---------- App shell ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy-900), var(--navy-800));
  color: #dce6f1;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  transition: width 0.18s ease;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 12px;
}

.sidebar-brand {
  min-width: 0;
  overflow: hidden;
}

.sidebar-toggle-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.06);
  border: none;
  border-radius: 6px;
  color: #dce6f1;
  cursor: pointer;
}

.sidebar-toggle-btn:hover { background: rgba(255,255,255,0.16); }

/* #topbarMenuBtn reuses .sidebar-toggle-btn's styling (base.html) but is
   only relevant once the sidebar becomes an off-canvas drawer - see the
   max-width:768px override in the responsiveness pass section below,
   which switches this to display:flex. Hidden here (not via the inline
   HTML) specifically so the media-query override further down the
   cascade can win without needing !important. */
#topbarMenuBtn { display: none; }

.sidebar-toggle-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-brand .name {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.2px;
}

.sidebar-brand .subtitle {
  font-size: 11px;
  color: #9db3c9;
  margin-top: 2px;
}

.nav-section {
  padding: 6px 12px;
}

.nav-section-label {
  padding: 14px 12px 6px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7f93aa;
}

.nav-section:first-of-type .nav-section-label {
  padding-top: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: #c6d5e5;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  text-decoration: none;
  transform: translateX(2px);
}

.nav-link.active {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(47, 102, 144, 0.45);
}

.nav-link.active:hover { transform: none; }

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.9;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 20px 0 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: #93a7bd;
}

.sidebar-footer a { color: #cfe0f0; }

/* Collapsed sidebar state - toggled on #appShell by the hamburger button in
   base.html, persisted in localStorage so it survives full page loads
   (this app navigates page-to-page, not a SPA, so the class alone
   wouldn't survive a reload without that). Only the icon rail stays
   visible; every text label collapses away rather than wrapping/clipping,
   and each nav-link keeps its `title` attribute so the label is still
   reachable as a native tooltip on hover. */
.app-shell.sidebar-collapsed .sidebar { width: 64px; }

.app-shell.sidebar-collapsed .sidebar-brand,
.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .nav-section-label,
.app-shell.sidebar-collapsed .sidebar-footer {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding: 0 0 20px 0;
}

.app-shell.sidebar-collapsed .nav-section {
  padding: 6px 8px;
}

.app-shell.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 10px;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  /* Same gradient as .sidebar, so the top bar and left rail read as one
     continuous shell instead of a white bar sitting above a navy one. */
  background: linear-gradient(180deg, var(--navy-900), var(--navy-800));
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.topbar h1 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  /* White, not the dark navy this used against the old white bar - that
     color is invisible against the navy background it now sits on. */
  color: #ffffff;
}

.topbar .meta {
  font-size: 13px;
  /* Lighter slate (matches .sidebar-brand .subtitle) so the subtitle stays
     legible on navy instead of the dark slate meant for a white bar. */
  color: #b7c7da;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #cfe0f0;
}

.user-chip strong {
  color: #ffffff;
}

.user-chip a {
  color: #9fd4ff;
}

.content {
  padding: 24px 28px 40px 28px;
}

.site-footer {
  padding: 16px 28px 20px;
  text-align: center;
  font-size: 12px;
  color: var(--slate-600);
  border-top: 1px solid var(--slate-200);
}

/* ---------- Disclaimer banner ---------- */

.disclaimer {
  background: var(--amber-100);
  border: 1px solid #f0d9a6;
  color: var(--amber-700);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 20px;
}

/* Success-message variant of the same box - was a per-call-site inline
   style="background:var(--green-100,...); border-color:...; color:...;"
   override repeated at every "message" banner (admin_tenants.html,
   admin_tenant_admins.html) - one shared modifier class instead. */
.disclaimer-success {
  background: var(--green-100);
  border-color: rgba(46, 125, 50, 0.35);
  color: var(--green-600);
}

/* ---------- KPI cards ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  /* Colorful reskin rollout (2026-09-09) - a colored top border, same
     --tile-color mechanism rcm_kpi_dashboard.html's .rcm-kpi-tile uses,
     falling back to blue when a card doesn't set the var (so this is a
     safe, additive default - no template needs to change just to avoid a
     broken border). Set inline per-card via style="--tile-color:...". */
  border-top: 4px solid var(--tile-color, var(--blue-600));
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.kpi-card--maskable:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--blue-100);
  transform: translateY(-1px);
}

/* Opt-in modifier - NOT plain .kpi-card - so pages that haven't adopted the
   click-to-reveal pattern yet keep showing their values as before. Only
   cards carrying this class (currently Executive Summary) get the masked/
   revealed behavior and the pointer/focus affordances that go with it. */
.kpi-card--maskable {
  cursor: pointer;
}

.kpi-card--maskable:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 2px;
}

.kpi-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.kpi-card-head .kpi-label { margin-bottom: 0; }

/* Colorful reskin rollout (2026-09-09) - the icon badge inserted by the
   new kpi_icon() macro (_widget_macros.html), first child of
   .kpi-card-head. Purely additive - a .kpi-card-head with no badge (a
   template that hasn't been swept yet) lays out exactly as before, since
   this class only styles an element that wouldn't otherwise exist. */
.kpi-icon-badge {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--tile-color, var(--blue-600));
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.kpi-icon-badge svg { width: 15px; height: 15px; }

/* Maskable KPI cards always show the headline .kpi-value - only their extra
   .kpi-sub breakdown lines hide behind a "click for details" state, shown
   once the card carries .revealed (toggled by toggleKpiReveal() in
   base.html). The info-icon-btn inside the head stops click propagation so
   it can open its modal without also toggling the reveal state. A card with
   no .kpi-sub content (e.g. Total Charges) skips --maskable entirely and
   stays a plain, non-clickable card. */
.kpi-masked-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--slate-400);
  margin-top: 4px;
}

.kpi-masked-hint svg { width: 14px; height: 14px; flex-shrink: 0; }

.kpi-card--maskable .kpi-sub {
  display: none;
}

.kpi-card--maskable.revealed .kpi-masked-hint {
  display: none;
}

.kpi-card--maskable.revealed .kpi-sub {
  display: block;
}

.kpi-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--slate-600);
  font-weight: 600;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy-900);
}

.kpi-sub {
  font-size: 12px;
  color: var(--slate-600);
  margin-top: 4px;
}

/* ---------- Cards / panels ---------- */

.panel {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 22px;
  overflow: hidden; /* keeps .panel-header's gradient band clipped to the
                        rounded corners even though its own radius is set
                        separately below */
  transition: box-shadow var(--transition);
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--blue-200, #cfe1ee);
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Responsiveness pass (2026-09-10) - a long title + a hint/subtitle +
     header-action icons all sharing one row had no wrap fallback, so a
     narrow panel (a 2-column .chart-grid pair on a tablet, or any panel
     on a phone) could force the row to overflow instead of stacking.
     row-gap only matters once flex-wrap actually produces a second line;
     harmless no-op otherwise. */
  flex-wrap: wrap;
  row-gap: 6px;
  /* Soft blue gradient band (was a flat fill) on every widget header -
     still visually separates each panel's title/actions row from its
     white body and the page background, just with a touch more depth. */
  background: linear-gradient(135deg, #e3eff8, #d3e6f2);
}

.panel-header h2 {
  font-size: 15px;
  margin: 0;
  font-weight: 700;
  color: var(--navy-900);
}

.panel-header .hint {
  font-size: 12px;
  color: var(--slate-600);
}

.panel-header .header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Colorful reskin rollout (2026-09-09) - one solid accent color per PAGE
   (not per panel - see rcm_kpi_dashboard.html's own per-panel treatment,
   which is deliberately different since that page's panels are each a
   distinct KPI category; every other page's panels share one page identity
   color instead). Replaces the soft gradient band above with a solid fill
   plus white text - .info-icon-btn keeps its own white circular background
   (style.css:557) so it stays legible regardless of the header color
   behind it, no override needed there. */
.panel-header-blue, .panel-header-green, .panel-header-red, .panel-header-amber,
.panel-header-purple, .panel-header-navy, .panel-header-teal, .panel-header-indigo,
.panel-header-maroon {
  border-bottom: none;
  color: #fff;
}
.panel-header-blue h2, .panel-header-green h2, .panel-header-red h2, .panel-header-amber h2,
.panel-header-purple h2, .panel-header-navy h2, .panel-header-teal h2, .panel-header-indigo h2,
.panel-header-maroon h2 { color: #fff; }
.panel-header-blue .hint, .panel-header-green .hint, .panel-header-red .hint, .panel-header-amber .hint,
.panel-header-purple .hint, .panel-header-navy .hint, .panel-header-teal .hint, .panel-header-indigo .hint,
.panel-header-maroon .hint { color: rgba(255,255,255,0.75); }
/* A link in a coloured header's action area (Evidence Gaps' "View all findings in Top
   Opportunities") had no colour rule, so it fell back to the default link blue - unreadable on the
   solid fill. White like the title; underlined on hover as links are elsewhere. */
.panel-header-blue .header-actions a, .panel-header-green .header-actions a, .panel-header-red .header-actions a,
.panel-header-amber .header-actions a, .panel-header-purple .header-actions a, .panel-header-navy .header-actions a,
.panel-header-teal .header-actions a, .panel-header-indigo .header-actions a, .panel-header-maroon .header-actions a {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.panel-header-blue { background: var(--blue-600); }
.panel-header-green { background: var(--green-600); }
.panel-header-red { background: var(--red-700); }
.panel-header-amber { background: var(--amber-700); }
.panel-header-purple { background: var(--purple-600); }
.panel-header-navy { background: var(--navy-800); }
.panel-header-teal { background: var(--teal-600); }
.panel-header-indigo { background: var(--indigo-600); }
.panel-header-maroon { background: var(--maroon-600); }

.info-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--slate-200);
  background: #fff;
  color: var(--slate-600);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.info-icon-btn:hover,
.info-icon-btn:focus-visible {
  color: var(--blue-600, #2f6690);
  border-color: var(--blue-600, #2f6690);
  background: #eef4f9;
  outline: none;
}

.info-icon-btn svg {
  width: 14px;
  height: 14px;
}

.panel-body {
  padding: 18px 20px;
  /* Responsiveness pass (2026-09-10) - every <table class="data-table">
     in this app sits directly inside a .panel-body with no scroll wrapper
     of its own (confirmed - no template wraps it separately). A wide
     table (many columns) on a narrow viewport would otherwise force the
     whole PAGE to scroll horizontally instead of just the table; this
     lets the table scroll within its own panel and leaves the rest of
     the page (nav, KPI tiles, other panels) unaffected. */
  overflow-x: auto;
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: modalOverlayIn 160ms ease;
}

.modal-overlay.open {
  display: flex;
}

@keyframes modalOverlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalBoxIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalBoxIn 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--slate-200);
  position: sticky;
  top: 0;
  background: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--navy-900);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--slate-600);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}

.modal-close:hover {
  color: var(--navy-900);
  background: var(--slate-100);
}

.modal-body {
  padding: 18px 20px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--slate-700, #33404f);
}

.modal-body p {
  margin: 0 0 10px;
}

.modal-body p:last-child {
  margin-bottom: 0;
}

.modal-body ul {
  margin: 4px 0 12px 20px;
  padding: 0;
}

.modal-body li {
  margin-bottom: 4px;
}

.modal-body code {
  background: var(--slate-100, #f1f4f8);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 13px;
}

/* Fullscreen chart/table viewer - reuses .modal-overlay/.modal-box (see
   above) but sized much larger, since its whole purpose is "show me this
   bigger" rather than a short info blurb. */
.fullscreen-modal-box {
  max-width: 92vw;
  width: 92vw;
  max-height: 92vh;
}

.fullscreen-modal-body {
  padding: 18px 20px 22px;
}

.fullscreen-chart-wrap {
  position: relative;
  width: 100%;
  height: 72vh;
}

.fullscreen-table-note {
  font-size: 13px;
  color: var(--slate-600);
  margin-bottom: 10px;
}

.fullscreen-modal-body table {
  width: 100%;
  font-size: 14px;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 22px;
}

/* Grid's own default align-items:stretch already makes both direct grid
   items (a .panel, OR the .widget wrapper that _widget_macros.html's
   wm.widget() puts around most chart panels - see that file for why) equal
   height within one row. What stretch does NOT do on its own is make a
   *nested* .panel fill that stretched height - a block box's height is
   normally content-driven, not parent-driven. So the rest of this chain
   passes a real (not just "auto") height down from whichever element grid
   actually stretched, through .widget-content, to .panel, so the panel's
   white card - not just its invisible outer wrapper - visibly fills the row.
   Only `height`, never `display`, is set on .widget/.widget-content here:
   static/js/widgets.js sets .widget-content's `style.display` directly via
   JS (block while loaded, none while loading), and an inline style always
   wins over an external stylesheet for the property it sets - but ONLY that
   property. `height` isn't inline-styled anywhere, so it cascades normally
   regardless of which display value JS has set. */
.chart-grid > .widget,
.chart-grid > .panel {
  height: 100%;
}

.chart-grid > .widget > .widget-content {
  height: 100%;
}

.chart-grid .panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin-bottom: 0; /* chart-grid's own gap replaces .panel's default margin-bottom here */
}

.chart-grid .panel .panel-body {
  flex: 1;
  min-width: 0;  /* lets a wide canvas/table shrink instead of overflowing its grid column */
  min-height: 0; /* lets panel-body shrink below content size, so .chart-canvas-box's own fixed height governs instead of being pushed taller by overflowing content */
}

@media (max-width: 980px) {
  .chart-grid { grid-template-columns: 1fr; }
}

canvas { max-width: 100%; }

/* Every chart canvas across the dashboard sits inside one of these boxes so
   its rendered height is controlled by ONE place (this fixed height), not by
   each canvas's own `height="..."` attribute - which had drifted to a
   different value per page/chart (80/90/100/120/220/260px) over time,
   producing visibly mismatched chart sizes even within the same 2-per-row
   grid. Chart.js is told `maintainAspectRatio: false` on every chart
   instantiation so it fills this box exactly instead of computing its own
   aspect-ratio-based height. position:relative + the absolutely-positioned
   canvas below is Chart.js's own documented pattern for a responsive chart
   in a fixed-size parent (https://www.chartjs.org/docs/latest/configuration/responsive.html). */
.chart-canvas-box {
  position: relative;
  height: 300px;
}

.chart-canvas-box canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

/* ---------- Tables ---------- */

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--slate-600);
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid var(--slate-200);
  background: var(--slate-50);
  white-space: nowrap;
}

.data-table th a {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--transition);
}

.data-table th a:hover { color: var(--blue-600); }

.data-table th .sort-arrow { color: var(--blue-600); font-size: 9px; }

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--slate-100);
  color: var(--ink-900);
}

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:hover { background: var(--blue-100); }
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Wide grids (8+ columns, 2026-09-21): tighter cells and headers that wrap, so the last column is not cut off at the
   default window width. Add class="data-table data-table-wide". */
.data-table.data-table-wide th { white-space: normal; vertical-align: bottom; padding: 10px 8px; letter-spacing: 0.3px; }
.data-table.data-table-wide td { padding: 10px 8px; }

/* When a table still overflows its panel, make the scrollbar easy to see instead of a hairline. */
.panel-body { scrollbar-width: auto; scrollbar-color: var(--slate-400, #94a3b8) var(--slate-100, #f1f5f9); }
.panel-body::-webkit-scrollbar { height: 12px; }
.panel-body::-webkit-scrollbar-track { background: var(--slate-100, #f1f5f9); border-radius: 6px; }
.panel-body::-webkit-scrollbar-thumb { background: var(--slate-400, #94a3b8); border-radius: 6px; }

.text-muted { color: var(--slate-600); }

.composite-score-banner:not(:empty) { margin-bottom: 12px; }

/* Was only ever styled as a nested .panel-header .hint - every OTHER
   `class="hint"` usage across the app (admin_tenants.html's "Unmanaged"/
   "No Tenant Management Admin accounts exist yet." notes, and others)
   rendered as plain unstyled black text with no visual distinction from
   a heading, despite clearly being muted helper copy. One base rule
   covers all of them. */
.hint {
  font-size: 13px;
  color: var(--slate-600);
}

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2.5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  border: 1px solid transparent;
}

/* A matching-but-darker border on top of each fill (was a flat, borderless
   pill) - the shadcn "soft/outline badge" look, gives each pill a touch of
   definition against a white panel background without needing a heavier
   solid-fill treatment. */
.badge-green { background: var(--green-100); color: var(--green-600); border-color: rgba(46, 125, 50, 0.22); }
.badge-amber { background: var(--amber-100); color: var(--amber-700); border-color: rgba(156, 101, 0, 0.2); }
.badge-orange { background: var(--orange-100); color: var(--orange-700); border-color: rgba(201, 121, 26, 0.2); }
.badge-red { background: var(--red-100); color: var(--red-700); border-color: rgba(179, 38, 30, 0.2); }
.badge-slate { background: var(--slate-100); color: var(--slate-600); border-color: rgba(90, 100, 114, 0.16); }

/* ---------- Expand/collapse tree table (AR Risk / Denial Risk pivot -
   webapp/static/js/tree-table.js) - a hierarchical drill-down table: the
   leading column holds the dimension tree (Risk Category -> Payer ->
   Claim Number), the trailing columns are fixed metrics (Count, Balance,
   Avg Risk) that recompute for whatever level is currently showing. ---- */

.tree-table .tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  border: 1px solid var(--slate-300);
  border-radius: 4px;
  background: var(--slate-50);
  color: var(--slate-600);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  flex: none;
  transition: background var(--transition), border-color var(--transition);
}

.tree-table .tree-toggle:hover { background: var(--blue-100); border-color: var(--blue-500); }

.tree-table .tree-leaf-spacer { display: inline-block; width: 22px; flex: none; }

.tree-table .tree-label-cell { display: flex; align-items: center; }

.tree-table tr.tree-row-hidden { display: none; }

.tree-table tr[data-tree-level="0"] td { font-weight: 700; }
.tree-table tr[data-tree-level="1"] td { font-weight: 600; }

.tree-table .tree-control-row td { padding: 6px 12px; background: var(--slate-50); border-bottom: 1px solid var(--slate-100); }

.tree-table .tree-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tree-table .tree-page-info { font-size: 12px; color: var(--slate-600); white-space: nowrap; }

.tree-table .tree-page-prev, .tree-table .tree-page-next {
  font-size: 12px;
  color: var(--blue-600);
  text-decoration: none;
  white-space: nowrap;
}

.tree-table .tree-page-prev:hover, .tree-table .tree-page-next:hover { text-decoration: underline; }

.tree-table .tree-page-prev.disabled, .tree-table .tree-page-next.disabled {
  color: var(--slate-400);
  pointer-events: none;
}

.tree-table .tree-breadcrumb-sep { color: var(--slate-400); margin: 0 6px; }

.tree-table .tree-empty-note { text-align: center; color: var(--slate-600); padding: 24px 12px; }

/* ---------- Tree table global search bar (typeahead + preset chips) -
   webapp/static/js/tree-table.js's buildSearchBar(). One search bar and
   one results pager per tree, sitting above it; committing a search or
   picking a chip swaps the hierarchy for a flat, paginated result list
   drawn from the WHOLE dataset, not just what's currently expanded. ---- */

.tree-global-search-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.tree-global-search-input-wrap {
  position: relative;
  flex: 1 1 320px;
  min-width: 240px;
  max-width: 460px;
}

.tree-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--slate-400);
  pointer-events: none;
}

.tree-global-search-input {
  width: 100%;
  padding: 10px 34px 10px 36px;
  border: 1px solid var(--slate-200);
  border-radius: 999px;
  font-size: 14px;
  font-family: var(--font);
  background: #ffffff;
  color: var(--ink-900);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.tree-global-search-input:hover { border-color: var(--slate-400); }

.tree-global-search-input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: var(--ring);
}

.tree-global-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 999px;
  background: var(--slate-100);
  color: var(--slate-600);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition);
}

.tree-global-search-clear:hover { background: var(--slate-200); }

.tree-search-suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 340px;
  overflow-y: auto;
  padding: 6px;
  animation: modalBoxIn 140ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tree-suggestion-item {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.tree-suggestion-item:hover { background: var(--blue-100); }

.tree-suggestion-main { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-900); }

.tree-suggestion-sub { font-size: 12px; color: var(--slate-600); margin-top: 2px; }

.tree-suggestion-empty { padding: 10px; font-size: 13px; color: var(--slate-600); text-align: center; }

.tree-preset-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.tree-preset-chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--slate-200);
  background: #ffffff;
  color: var(--ink-900);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.tree-preset-chip:hover { box-shadow: var(--shadow); border-color: var(--slate-400); }
.tree-preset-chip:active { transform: scale(0.97); }

.tree-preset-chip.badge-green.active { background: var(--green-100); border-color: var(--green-600); color: var(--green-600); }
.tree-preset-chip.badge-amber.active { background: var(--amber-100); border-color: var(--amber-700); color: var(--amber-700); }
.tree-preset-chip.badge-orange.active { background: var(--orange-100); border-color: var(--orange-700); color: var(--orange-700); }
.tree-preset-chip.badge-red.active { background: var(--red-100); border-color: var(--red-700); color: var(--red-700); }

/* ---------- Per-table search bar (payer summary / AR by payer / denial
   detail / executive payer detail - see _table_macros.html) ---------- */

.table-search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.table-search-bar input[type="text"] {
  padding: 6px 10px;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font);
  background: #ffffff;
  color: var(--ink-900);
}

/* ---------- Forms / filters ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  align-items: center;
}

.filter-bar input[type="text"],
.filter-bar input[type="date"],
.filter-bar input[type="number"],
.filter-bar select {
  padding: 8px 10px;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font);
  background: #ffffff;
  color: var(--ink-900);
}

.filter-bar .date-range-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-bar .date-range-group label {
  font-size: 13px;
  color: var(--slate-600);
  white-space: nowrap;
}

.active-range-note {
  font-size: 13px;
  color: var(--slate-600);
  margin-bottom: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  /* Sensible default look for a BARE .btn with no .btn-primary/-secondary
     modifier (many small inline admin-table actions - Revoke/Disable/
     Suspend/Assign - are exactly this, `class="btn"` alone with an inline
     padding/font-size override) - was unstyled native button chrome
     before (grey face, square corners) clashing with the rounded/shadowed
     look every other .btn now has. Either modifier class still overrides
     this by specificity/source order below. */
  border: 1px solid var(--slate-200);
  background: #ffffff;
  color: var(--ink-900);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: background var(--transition), border-color var(--transition),
              box-shadow var(--transition), transform var(--transition);
}

.btn:hover { background: var(--slate-50); border-color: var(--slate-400); text-decoration: none; }

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 37, 64, 0.12), 0 1px 3px rgba(47, 102, 144, 0.28);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--navy-700), var(--blue-600));
  box-shadow: 0 4px 12px rgba(47, 102, 144, 0.38);
  transform: translateY(-1px);
  text-decoration: none;
}
.btn-primary:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(15, 37, 64, 0.2); }

.btn-secondary { background: #ffffff; border-color: var(--slate-200); color: var(--ink-900); }
.btn-secondary:hover {
  background: var(--slate-50);
  border-color: var(--slate-400);
  text-decoration: none;
}

/* ---------- Pagination ---------- */

.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 14px;
  font-size: 13px;
  color: var(--slate-600);
}

.pagination a, .pagination span {
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-200);
  color: var(--ink-900);
  transition: background var(--transition), border-color var(--transition);
}

.pagination a:hover { background: var(--slate-50); border-color: var(--slate-400); text-decoration: none; }
.pagination .disabled { color: var(--slate-400); }

/* ---------- Login ---------- */

.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  /* CSS fallback/first-paint background - shows instantly (a raster
     gradient needs zero JS/WebGL) and stays visible underneath if
     shader-bg.js can't run at all (no WebGL support). Once the canvas
     starts drawing, this is fully covered - never removed, just layered
     under, so there's no failure mode where the page shows nothing. */
  background: radial-gradient(circle at 30% 20%, var(--navy-800), var(--navy-900) 60%);
}

/* Animated shader canvas (static/js/shader-bg.js) - fills the whole
   viewport behind the card. pointer-events:none so it never intercepts
   clicks meant for the form on top of it. */
.shader-bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 380px;
  /* Frosted glass panel over the animated shader - translucent white with
     a backdrop blur, the "glassmorphism" treatment 21st.dev's own sign-in
     block gallery favors for a card sitting on top of motion/gradient
     art, rather than a fully opaque card that would visually disconnect
     from the background entirely. */
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  animation: loginCardIn 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .login-card { animation: none; }
}

.login-brand-mark {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  background: linear-gradient(135deg, var(--blue-600), var(--navy-800));
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(47, 102, 144, 0.4);
}

.login-brand-mark svg { width: 22px; height: 22px; }

.login-card h1 {
  font-size: 18px;
  margin: 0 0 4px 0;
  color: var(--navy-900);
  letter-spacing: -0.2px;
}

.login-card .subtitle {
  font-size: 13px;
  color: var(--slate-600);
  margin-bottom: 24px;
}

.login-card label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-600);
  margin-bottom: 5px;
  margin-top: 14px;
}

.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  background: #ffffff;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.login-card input:hover { border-color: var(--slate-400); }
.login-card input:focus { outline: none; border-color: var(--blue-500); box-shadow: var(--ring); }

.login-card .btn {
  width: 100%;
  margin-top: 22px;
  padding: 11px;
  font-size: 14px;
}

/* Reusable stacked label/input form (2026-09-23) - the same block-layout
   .login-card label/input already have, extracted into its own class so a
   form INSIDE an ordinary .panel (not the pre-login .login-card shell) can
   opt in too. Without this, a plain <label>/<input> pair has no display
   rule anywhere in this file outside .login-card, so a narrow panel
   (change_password.html's account settings form was the first case that
   hit this) lets a short label + short input fit on one line and the
   NEXT label crowd onto the tail of that same line instead of starting
   its own row - confirmed live, a visibly skewed/misaligned form. */
.stacked-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-600);
  margin-bottom: 5px;
  margin-top: 14px;
}

.stacked-form label:first-of-type { margin-top: 0; }

.stacked-form input {
  display: block;
  width: 100%;
  box-sizing: border-box;
}

.stacked-form .btn {
  width: 100%;
  margin-top: 18px;
}

.login-error {
  background: var(--red-100);
  color: var(--red-700);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: 16px;
  border: 1px solid rgba(179, 38, 30, 0.18);
}

.login-links {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
}

.password-strength-meter {
  margin-top: 8px;
}

.password-strength-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--slate-200);
  overflow: hidden;
}

.password-strength-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: var(--slate-300, #cbd5e1);
  transition: width 0.15s ease, background 0.15s ease;
}

.password-strength-fill.weak { background: var(--red-700); }
.password-strength-fill.fair { background: var(--amber-700); }
.password-strength-fill.good { background: var(--blue-500); }
.password-strength-fill.strong { background: var(--green-600); }

.password-strength-label {
  font-size: 12px;
  color: var(--slate-600);
  margin-top: 4px;
  min-height: 14px;
}

/* ---------- Waterfall ---------- */

/* The AR Waterfall panel stacks two independent panel-body blocks (the bar
   rows, then a short exclusions note) inside one panel - every other chart
   panel on the dashboard has exactly one panel-body. The generic
   `.chart-grid .panel .panel-body { flex:1; min-height:0 }` rule above was
   written for that single-panel-body case: with two flex:1 siblings it
   splits the panel's height equally between them regardless of how much
   content each actually has, and min-height:0 lets each shrink below its
   real content height to enforce that even split - so the 5 bar rows get
   squeezed into roughly half the available space, overflow past their own
   box, and visually land on top of the exclusions note text below. These
   two need to size to their own content instead of splitting the panel's
   height 50/50. */
#waterfallBars,
#waterfallExclusionsNote {
  flex: none;
  min-height: auto;
}

.waterfall-bar-row {
  display: grid;
  grid-template-columns: 320px 1fr 130px;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--slate-100);
}

/* Visual affordance for the rows that navigate/drill down on click (see
   renderStageRow in waterfall.html) - without this a clickable row looked
   identical to a plain one, which is why "click a stage to drill down" was
   easy to miss. */
.waterfall-bar-row.clickable,
.waterfall-bar-row.drilldown-clickable {
  margin: 0 -10px;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.waterfall-bar-row.clickable:hover,
.waterfall-bar-row.drilldown-clickable:hover {
  background: var(--blue-100);
}

.waterfall-bar-track {
  background: var(--slate-100);
  border-radius: 4px;
  height: 22px;
  overflow: hidden;
}

.waterfall-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-600), var(--blue-500));
  border-radius: 4px;
}

.waterfall-bar-fill.zero { background: var(--slate-200); }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--slate-600);
}

/* ---------- Tabs ---------- */
/* Was a one-off <style> block local to opportunity_evidence_gaps.html
   (the only page using tabs today) - globalized so any future page can
   reuse the same `.tab-strip` / `.tab-btn` pair instead of redefining it,
   and refined into a segmented-control pill look (was a plain underline
   tab) to match the rest of this pass's rounded, softly-elevated style. */
.tab-strip {
  display: flex;
  gap: 4px;
  background: var(--slate-100);
  padding: 4px;
  border-radius: var(--radius-sm);
  border-bottom: none !important; /* overrides the inline style="border-bottom:1px solid ..." some call sites still set */
}

.tab-btn {
  background: none;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  padding: 7px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-600);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.tab-btn:hover { color: var(--navy-900); }

.tab-btn.active {
  color: var(--navy-900);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.breadcrumb {
  font-size: 13px;
  color: var(--slate-600);
  margin-bottom: 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.detail-field .label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--slate-600);
  font-weight: 600;
  letter-spacing: 0.3px;
}

.detail-field .value {
  font-size: 14px;
  color: var(--ink-900);
  margin-top: 2px;
}

/* Opportunity Finding Detail's field labels (Payer, Confidence level,
   etc. - opportunity_finding_detail.html's fieldRow()). The value text
   below each label is unstyled .detail-grid content, inheriting the 14px
   body base - these need to read as sub-headings ABOVE that value, so
   bold and a size step up from it, not .hint's smaller/lighter treatment
   used for muted helper copy elsewhere in the app. */
.finding-field-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--slate-700, #33404f);
  margin-bottom: 2px;
}

/* ---------- Revenue-opportunity gauges ---------- */

.gauge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.gauge-card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  /* Colorful reskin rollout (2026-09-09) - same --tile-color mechanism as
     .kpi-card, same fallback so a gauge without one set still gets a
     border rather than none. */
  border-top: 4px solid var(--tile-color, var(--blue-600));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 10px 16px;
  text-align: center;
  transition: box-shadow var(--transition), transform var(--transition);
}

.gauge-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.gauge-card .gauge-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy-900);
  margin-bottom: 4px;
}

.gauge-card canvas {
  max-height: 130px;
}

.gauge-card .gauge-readout {
  margin-top: -6px;
}

.gauge-card .gauge-actual {
  font-size: 21px;
  font-weight: 700;
  color: var(--navy-900);
}

.gauge-card .gauge-target {
  font-size: 12px;
  color: var(--slate-600);
}

.gauge-card .gauge-status {
  display: inline-block;
  margin-top: 4px;
  padding: 2.5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}

.gauge-status.met { background: var(--green-100); color: var(--green-600); border-color: rgba(46, 125, 50, 0.22); }
.gauge-status.gap { background: var(--amber-100); color: var(--amber-700); border-color: rgba(156, 101, 0, 0.2); }

.targets-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.targets-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-600);
  margin-bottom: 5px;
}

.targets-form input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font);
}

.targets-note {
  font-size: 12px;
  color: var(--slate-600);
  margin-bottom: 14px;
}

/* ---------- Widget-wise async loading ---------- */
/* Every chart, KPI card, gauge, and table on every page is fetched
   independently (see static/js/widgets.js + static/js/datagrid.js), so one
   slow query never blocks the rest of the page and no grid interaction
   (sort/search/page) triggers a full navigation. Each async unit renders
   .widget-loading immediately in markup and swaps to .widget-content once
   its own fetch resolves - see WIDGET_LOADING_HTML in _widget_macros.html. */

.widget-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 110px;
  color: var(--slate-400);
  font-size: 13px;
}

.widget-loading.compact { min-height: 54px; }

.widget-spinner {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: 3px solid var(--slate-200);
  border-top-color: var(--blue-600);
  border-radius: 50%;
  animation: widget-spin 0.75s linear infinite;
}

@keyframes widget-spin {
  to { transform: rotate(360deg); }
}

.widget-content { display: none; }

.widget-error {
  color: var(--red-700);
  background: var(--red-100);
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 13px;
}

.widget-error a { color: var(--red-700); font-weight: 600; text-decoration: underline; }

/* KPI cards render their skeleton in place of the value/sub lines only, so
   the card grid doesn't jump around as each card's own fetch resolves. */
.kpi-card .kpi-value.skeleton,
.kpi-card .kpi-sub.skeleton {
  display: inline-block;
  background: var(--slate-100);
  color: transparent;
  border-radius: 4px;
  animation: widget-skeleton-pulse 1.1s ease-in-out infinite;
}

.kpi-card .kpi-value.skeleton { width: 90px; height: 24px; }
.kpi-card .kpi-sub.skeleton { width: 130px; height: 12px; margin-top: 6px; }

@keyframes widget-skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ---------- Chat assistant ---------- */

.chat-toggle-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--blue-600), var(--navy-800));
  color: #fff;
  box-shadow: 0 6px 20px rgba(15, 37, 64, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 900;
  transition: transform var(--transition), box-shadow var(--transition);
}
.chat-toggle-btn:hover { transform: scale(1.06) translateY(-1px); box-shadow: 0 10px 28px rgba(15, 37, 64, 0.4); }
.chat-toggle-btn:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 2px; }
.chat-toggle-btn svg { width: 24px; height: 24px; }
.chat-toggle-btn .chat-close-icon { display: none; }
.chat-widget.open .chat-toggle-btn .chat-chat-icon { display: none; }
.chat-widget.open .chat-toggle-btn .chat-close-icon { display: block; }

@keyframes chatPanelIn { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }

.chat-panel {
  position: fixed;
  right: 24px;
  bottom: 90px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 900;
  animation: chatPanelIn 200ms cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
}
.chat-widget.open .chat-panel { display: flex; }

.chat-panel-header {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-800));
  color: #fff;
  padding: 14px 18px;
  flex-shrink: 0;
}
.chat-panel-header .title { font-weight: 700; font-size: 15px; }
.chat-panel-header .subtitle { font-size: 12px; color: rgba(255,255,255,0.65); margin-top: 2px; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--slate-50);
}

.chat-empty-state {
  color: var(--slate-400);
  font-size: 13px;
  text-align: center;
  margin: auto 0;
  padding: 0 12px;
  line-height: 1.6;
}

.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg.assistant { justify-content: flex-start; }

.chat-bubble {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.chat-msg.user .chat-bubble {
  background: var(--blue-600);
  color: #fff;
  border-bottom-right-radius: 3px;
}
.chat-msg.assistant .chat-bubble {
  background: #fff;
  color: var(--ink-900);
  border: 1px solid var(--slate-200);
  border-bottom-left-radius: 3px;
}
.chat-msg.error .chat-bubble {
  background: var(--red-100);
  color: var(--red-700);
  border: 1px solid var(--red-100);
}

.chat-msg-block { display: flex; flex-direction: column; gap: 6px; max-width: 86%; }
.chat-msg.assistant .chat-msg-block { align-items: flex-start; }

.chat-mode-note {
  font-size: 11px;
  color: var(--slate-400);
  font-style: italic;
}

.chat-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chat-source-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--blue-600);
  background: var(--blue-100);
  border-radius: 999px;
  padding: 3px 10px;
  text-decoration: none;
  white-space: nowrap;
}
.chat-source-chip:hover { background: #dce9f2; }

.chat-input-bar {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--slate-200);
  background: #fff;
}
.chat-input-bar input[type="text"] {
  flex: 1;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 14px;
  font-family: var(--font);
  min-width: 0;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.chat-input-bar input[type="text"]:focus { outline: none; border-color: var(--blue-500); box-shadow: var(--ring); }
.chat-input-bar button {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.chat-input-bar button:hover:not(:disabled) { background: linear-gradient(135deg, var(--navy-700), var(--blue-600)); transform: translateY(-1px); }
.chat-input-bar button:disabled { background: var(--slate-400); cursor: not-allowed; }
.chat-input-bar button svg { width: 17px; height: 17px; }

.chat-loading { display: flex; align-items: center; gap: 8px; color: var(--slate-400); font-size: 13px; }
.chat-loading .widget-spinner { width: 16px; height: 16px; border-width: 2px; flex: none; }
.chat-loading-text { flex: 1 1 auto; }
.chat-loading-elapsed {
  flex: none;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--slate-400);
  background: var(--slate-100);
  border-radius: 999px;
  padding: 1px 8px;
}

@media (max-width: 480px) {
  .chat-panel { right: 12px; left: 12px; width: auto; bottom: 80px; }
  .chat-toggle-btn { right: 16px; bottom: 16px; }
}

/* Phase 2 Part A - Global Analysis Context bar, shown on every page just
   below the topbar (base.html fetches /api/analysis-context once per page
   load and populates this). Deliberately understated - context, not a KPI -
   so it doesn't compete visually with each page's own headline numbers. */
.analysis-context-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  padding: 8px 28px;
  background: var(--slate-50);
  border-bottom: 1px solid var(--slate-200);
  font-size: 12px;
  color: var(--slate-600);
}
.analysis-context-bar .ctx-item { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.analysis-context-bar .ctx-label { font-weight: 600; color: var(--slate-600); }
.analysis-context-bar .ctx-value { color: var(--slate-700, #33404f); }
.analysis-context-bar .ctx-sep { color: var(--slate-400); }
.analysis-context-bar .ctx-toggle {
  margin-left: auto;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--blue-600, #2b6cb0);
  cursor: pointer;
  font-size: 12px;
  padding: 3px 8px;
  text-decoration: underline;
  transition: background var(--transition);
}

.analysis-context-bar .ctx-toggle:hover { background: var(--blue-100); }
.ctx-unavailable { color: var(--slate-400); font-style: italic; }

.excluded-populations-detail {
  display: none;
  padding: 10px 28px 12px;
  background: var(--slate-50);
  border-bottom: 1px solid var(--slate-200);
  font-size: 13px;
}
.excluded-populations-detail.open { display: block; }
.excluded-populations-detail table { width: 100%; border-collapse: collapse; }
.excluded-populations-detail th, .excluded-populations-detail td {
  text-align: left; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--slate-100);
}
.excluded-populations-detail th { color: var(--slate-600); font-weight: 600; }
.excluded-populations-detail .num { text-align: right; }

/* ---------- Evidence Gaps: master-detail layout ---------- */
/* Left: the 8 governed rules, one click target each. Right: the selected
   rule's own gaps + a live sample of its findings. A plain 2-column grid,
   not .chart-grid (that class's stretch/height rules are built for a
   chart+table pair of equal, bounded height - this layout wants the left
   list free to be shorter than the right detail panel, not stretched to
   match it). */
.evidence-gaps-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .evidence-gaps-layout { grid-template-columns: 1fr; }
}
.evidence-gaps-rule-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.evidence-gaps-rule-item {
  display: block;
  text-align: left;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.evidence-gaps-rule-item:hover { border-color: var(--blue-300, #9cc3e0); box-shadow: var(--shadow); }
.evidence-gaps-rule-item.active {
  border-color: var(--blue-600);
  border-width: 2px;
  background: var(--blue-50, #eef5fb);
  box-shadow: var(--shadow-md);
}
.evidence-gaps-rule-item .rule-name { font-weight: 700; font-size: 14px; color: var(--navy-900); }
.evidence-gaps-rule-item .rule-category { font-size: 12px; color: var(--slate-600); margin-top: 2px; }
.evidence-gaps-rule-item .rule-count { float: right; font-weight: 700; color: var(--blue-600); font-size: 14px; }
.evidence-gap-item {
  padding: 12px 14px;
  border: 1px solid var(--amber-200, #f2dcae);
  background: var(--amber-50, #fdf6e8);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.evidence-gap-item .gap-title-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
}
.evidence-gap-item .gap-label { font-weight: 700; font-size: 13px; color: var(--amber-800, #7a4d00); }
.evidence-gap-item .gap-blocks { font-size: 12px; color: var(--slate-600); white-space: nowrap; }
.evidence-gap-item .gap-would-unlock { margin-top: 6px; font-size: 14px; }

/* =====================================================================
   Responsiveness pass (2026-09-10)
   =====================================================================
   Found live (Browser tool, mobile preset 375x812): the sidebar
   (.sidebar, style.css:171) has exactly one collapse mode - a 64px icon
   rail, toggled manually, defaulting to fully expanded (232px) on first
   visit (base.html's init script: `collapsed = false` unless localStorage
   already has a saved preference). On a phone that meant the nav ate
   roughly two-thirds of the screen on every first visit, since 232px (or
   even the "collapsed" 64px rail) is a large fraction of a ~375px
   viewport - not a scaled-down desktop layout, an actually broken one.
   Fixed below by giving the SAME .sidebar-collapsed class a different
   meaning under this breakpoint (fully off-canvas via transform, not an
   icon rail) - reuses the existing toggle button/JS/localStorage
   mechanism entirely; only base.html's default-state logic and this CSS
   changed, see that file's own comment for the default-collapsed-on-
   mobile-only-when-no-saved-preference change. */

@media (max-width: 900px) {
  /* Trimmed from 24px/28px so a narrow viewport isn't spending ~15% of
     its width on padding alone. */
  .content { padding: 16px 16px 32px 16px; }
  .topbar { flex-wrap: wrap; gap: 10px 16px; padding: 14px 16px; }
  .user-chip { flex-wrap: wrap; row-gap: 6px; }
  .kpi-grid, .rcm-kpi-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

/* Phone-only (not iPad/tablet - confirmed via live testing that the
   original always-visible 232px sidebar + remaining content still fits
   comfortably at iPad-portrait's 768px, so the full-overlay drawer would
   be overkill there; 640px comfortably excludes every common tablet
   width in portrait while still covering phones, including larger ones
   like a Pro Max in portrait at ~430px). */
@media (max-width: 640px) {
  #topbarMenuBtn { display: inline-flex; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    z-index: 1000;
    /* Overrides the desktop rule's `transition: width` (style.css:179) -
       on mobile the sidebar's width never changes, only its on/off-screen
       position does. */
    transition: transform 0.2s ease;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  /* Default state (no .sidebar-collapsed class present) is "expanded" on
     desktop - reused as-is here to mean "drawer open." */
  .app-shell:not(.sidebar-collapsed) .sidebar { transform: translateX(0); }
  .app-shell.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
    /* Desktop's icon-rail width (style.css:298) doesn't apply here - a
       hidden (off-canvas) drawer should still be full-width for the
       instant it's mid-transition/reopened, not squeezed to 64px. */
    width: 260px;
  }
  /* Desktop's collapsed state hides these to show icon-only (style.css:
     300-305) - that reading doesn't apply on mobile, where "collapsed"
     means fully off-canvas; whenever the drawer IS open here, it should
     always show full labels, never an icon-only rail. */
  .app-shell.sidebar-collapsed .sidebar-brand,
  .app-shell.sidebar-collapsed .nav-label,
  .app-shell.sidebar-collapsed .nav-section-label,
  .app-shell.sidebar-collapsed .sidebar-footer {
    display: block;
  }
  .app-shell.sidebar-collapsed .sidebar-header { justify-content: space-between; padding: 0 12px 20px 20px; }
  .app-shell.sidebar-collapsed .nav-section { padding: 6px 12px; }
  .app-shell.sidebar-collapsed .nav-link { justify-content: flex-start; padding: 10px 12px; }

  /* .sidebar is `position:fixed` now, so it no longer occupies space in
     .app-shell's flex layout - .main already gets the full width for
     free, this just makes that explicit rather than relying on the flex
     leftover-space default. */
  .main { width: 100%; }

  .chart-grid { grid-template-columns: 1fr; }
  .evidence-gaps-layout { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .topbar h1 { font-size: 16px; }
  .kpi-grid, .rcm-kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .gauge-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Shared "meter" visual - Payment Prediction accuracy meter, Action Plan's
   Estimated Recovery meter. A colored gradient track + marker rather than
   a canvas/Chart.js gauge (executive.html's renderGauge) - simpler for a
   single 0-100 score, no extra JS dependency. */
.accuracy-meter-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: center; }
.accuracy-meter-score { text-align: center; }
.accuracy-meter-number { font-size: 2.6rem; font-weight: 700; line-height: 1; }
.accuracy-meter-label { margin-top: 4px; font-weight: 600; }
.accuracy-meter-caption { margin-top: 6px; font-size: 0.85rem; color: var(--text-muted, #5a6472); }
.accuracy-meter-track {
  margin-top: 12px; height: 10px; border-radius: 6px; position: relative;
  background: linear-gradient(90deg, var(--red-600, #b3261e) 0%, var(--orange-700, #c9791a) 34%,
              var(--amber-700, #9c6500) 67%, var(--green-600, #2e7d32) 100%);
}
.accuracy-meter-marker {
  position: absolute; top: -4px; width: 4px; height: 18px; background: #16202b; border-radius: 2px;
  transform: translateX(-2px);
}
@media (max-width: 720px) { .accuracy-meter-layout { grid-template-columns: 1fr; } }


/* ═════════════════════════════════════════════════════════════════════════
   KrisnnAI brand layer (2026-11-24). Same look as the KrisnnAI RCM Analytics
   demo: Deep Teal / Teal Blue chrome, Off White canvas, Teal buttons, the
   4-stop brand gradient as an accent line, palette-only colours (no
   per-widget colour variety). Appended last so it overrides the earlier
   navy/blue theme through the existing tokens; to roll back, delete from
   here to the end of the file.
   Palette: Deep Teal #004D56, Teal #00C6B8, Teal Blue #0898A8, Aqua #4DE6D6,
   Mint #B2F5E8, Ice #E6FFFB, Charcoal #0F172A, Slate #475569, Silver #CBD5E1,
   Off White #F8FAFC.
   ═════════════════════════════════════════════════════════════════════════ */
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --navy-900: #004D56;
  --navy-800: #0B6470;
  --navy-700: #0F7480;
  --blue-600: #0898A8;
  --blue-500: #00C6B8;
  --blue-100: #E6FFFB;
  --blue-200: #B2F5E8;
  --slate-50: #F8FAFC;
  --slate-100: #F1F5F9;
  --slate-200: #E2E8F0;
  --slate-400: #94A3B8;
  --slate-600: #475569;
  --slate-700: #334155;
  --ink-900: #0F172A;
  /* page-identity accents collapse into the palette */
  --purple-600: #0898A8;
  --teal-600: #0898A8;
  --indigo-600: #0B6470;
  --maroon-600: #004D56;
  --ring: 0 0 0 3px rgba(0, 198, 184, 0.35);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 36px rgba(15, 23, 42, 0.20), 0 2px 8px rgba(15, 23, 42, 0.08);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --brand-grad: linear-gradient(90deg, #004D56, #0898A8, #00C6B8, #4DE6D6);
  --brand-grad-soft: linear-gradient(135deg, #0898A8, #00C6B8 55%, #4DE6D6);
}
html, body { background: #F8FAFC; font-size: 13.5px; letter-spacing: -0.003em; }
a { color: #0898A8; }

/* sidebar: Deep Teal into Charcoal, white logo block on top */
.sidebar {
  background: radial-gradient(260px 200px at 0% 0%, rgba(77, 230, 214, .16), transparent 70%),
              linear-gradient(185deg, #004D56 0%, #004D56 55%, #0F172A 100%);
  color: #D5EDEE;
}
.sidebar-header { padding: 0 12px 14px 0; align-items: flex-start; }
.sidebar-brand .name, .sidebar-brand .subtitle { display: none; }
.sidebar-brand { flex: 1; }
.sidebar-brand .brand-logo {
  box-sizing: border-box; height: 72px; margin: -20px 0 0 0; padding: 0 14px;
  display: flex; align-items: center; justify-content: center; background: #fff;
  border-bottom: 3px solid transparent; border-image: var(--brand-grad) 1;
}
.sidebar-brand .brand-logo img { height: 52px; width: auto; max-width: 100%; mix-blend-mode: multiply; }
.sidebar-toggle-btn { margin-top: 14px; background: rgba(255,255,255,.10); }
.nav-section-label { color: #7FC8CC; font-size: 10.5px; }
.nav-link { color: #D5EDEE; font-size: 13px; }
.nav-link:hover { background: rgba(77, 230, 214, .12); color: #fff; }
.nav-link.active {
  background: var(--brand-grad-soft); color: #0F172A; font-weight: 700;
  box-shadow: 0 2px 10px rgba(0, 198, 184, .35);
}
.sidebar-footer { color: #8DC7CB; border-top-color: rgba(255,255,255,.10); }
.sidebar-footer a { color: #B2F5E8; }

/* top bar: Deep Teal into Teal Blue with the brand gradient line */
.topbar {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,0) 55%),
              linear-gradient(100deg, #004D56 0%, #004D56 58%, #0898A8 100%);
  border-bottom: none; padding: 14px 28px;
}
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--brand-grad); }
.topbar h1 { font-size: 17px; letter-spacing: -0.01em; }
.topbar .meta, .user-chip { color: #C5E9EA; }
.user-chip a { color: #4DE6D6; }

/* KPI cards: one colour, no per-card variety */
.kpi-card {
  border-top: 3px solid #0898A8 !important;
  background: linear-gradient(180deg, #fff, #F8FAFC);
  border-radius: 12px;
}
.kpi-icon-badge { background: var(--brand-grad-soft) !important; color: #0F172A !important; }
.kpi-label { font-size: 11px; letter-spacing: .06em; color: #475569; }
.kpi-value { color: #004D56; font-size: 23px; font-weight: 700; letter-spacing: -0.02em; }
.kpi-sub { color: #475569; }

/* panels: Deep Teal to Teal Blue headers, every variant identical */
.panel { border-radius: 12px; border-color: #E2E8F0; }
.panel-header,
.panel-header-blue, .panel-header-green, .panel-header-red, .panel-header-amber,
.panel-header-purple, .panel-header-navy, .panel-header-teal, .panel-header-indigo,
.panel-header-maroon {
  background: linear-gradient(180deg, rgba(255,255,255,.13), rgba(255,255,255,0) 60%),
              linear-gradient(95deg, #004D56, #0898A8);
  border-bottom: none; padding: 12px 18px;
}
.panel-header h2, .panel-header-blue h2, .panel-header-green h2, .panel-header-red h2,
.panel-header-amber h2, .panel-header-purple h2, .panel-header-navy h2, .panel-header-teal h2,
.panel-header-indigo h2, .panel-header-maroon h2 { color: #fff; font-size: 14px; letter-spacing: -0.005em; }
.panel-header .hint, .panel-header-blue .hint, .panel-header-green .hint, .panel-header-red .hint,
.panel-header-amber .hint, .panel-header-purple .hint, .panel-header-navy .hint, .panel-header-teal .hint,
.panel-header-indigo .hint, .panel-header-maroon .hint { color: rgba(255,255,255,.80); }
.panel-header .header-actions a { color: #B2F5E8; }

/* tables: light header, subtle zebra */
.data-table th { background: #E6FFFB; color: #004D56; border-bottom: 1px solid #B2F5E8; }
.data-table th a:hover, .data-table th .sort-arrow { color: #0898A8; }
.data-table tbody tr:nth-child(even) td { background: #F8FAFC; }
.data-table tbody tr:hover, .data-table tbody tr:hover td { background: #E6FFFB; }

/* buttons: Teal with Charcoal text */
.btn-primary, button.btn-primary {
  background: #00C6B8; border-color: #00C6B8; color: #0F172A; font-weight: 700;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .10);
}
.btn-primary:hover { background: #4DE6D6; border-color: #4DE6D6; box-shadow: 0 4px 12px -4px rgba(0, 198, 184, .6); }
.btn-secondary { color: #004D56; border-color: #CBD5E1; }
.btn-secondary:hover { background: #E6FFFB; border-color: #00C6B8; }
.tab-btn:hover { color: #004D56; }
.tab-btn.active, .tab-btn[aria-selected="true"] { color: #004D56; border-bottom-color: #00C6B8; }

/* sign-in and MFA pages */
.login-wrap {
  background: radial-gradient(700px 420px at 20% 10%, rgba(0, 198, 184, .25), transparent 60%),
              linear-gradient(135deg, #004D56 0%, #0F172A 100%);
}
.login-card { border-radius: 16px; background: rgba(255,255,255,.97); }
.login-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--brand-grad); border-radius: 16px 16px 0 0; }
.login-brand-mark {
  width: 150px; height: 72px; border-radius: 0; box-shadow: none; margin-bottom: 14px;
  background: url("/static/img/krisnnai-logo.png") left center / contain no-repeat;
}
.login-brand-mark svg { display: none; }
.login-card h1 { color: #004D56; font-size: 19px; letter-spacing: -0.01em; }
.login-card input:focus { border-color: #00C6B8; box-shadow: var(--ring); }
.login-card .btn { background: #00C6B8; border-color: #00C6B8; color: #0F172A; font-weight: 700; }
.login-card .btn:hover { background: #4DE6D6; border-color: #4DE6D6; }
/* brand layer fixes */
.login-card { overflow: hidden; }
.sidebar { padding-top: 0; }
.sidebar-header { padding: 0 10px 12px 0; align-items: flex-start; }
.sidebar-brand .brand-logo { margin: 0; height: 72px; }
.sidebar-toggle-btn { margin-top: 22px; }

/* Hierarchy drill dialog: existing pages/charts retain their approved layout. */
.hierarchy-drill { width:min(900px,92vw); max-height:85vh; overflow:auto; border:1px solid #CBD5E1; border-radius:8px; background:white; color:#0F172A; }
.hierarchy-drill::backdrop { background:rgba(15,23,42,.45); }
.hierarchy-drill > p,.hierarchy-drill > div:not(.panel-header) { margin:14px; }
.hierarchy-drill-nav { display:flex; gap:8px; flex-wrap:wrap; margin:12px 0; }
.hierarchy-drill table { width:100%; }

/* chart-level filters (funnel in a chart header + dropdown) */
.chart-filter-btn.active { background: #00C6B8; color: #0F172A; box-shadow: 0 0 0 2px rgba(0, 198, 184, .35); }
.chart-filter-pop { position: fixed; z-index: 9000; background: #FFFFFF; border: 1px solid #CBD5E1; border-radius: 12px; padding: 12px 14px;
  box-shadow: 0 12px 36px rgba(15, 23, 42, .22); overflow-y: auto; }
.chart-filter-pop[hidden] { display: none; }
.chart-filter-title { font-weight: 700; font-size: 13px; color: #004D56; margin-bottom: 8px; }
.chart-filter-row { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; font-size: 11px; color: #475569; font-weight: 600; letter-spacing: .02em; }
.chart-filter-row select { width: 100%; font-size: 12.5px; padding: 6px 8px; border: 1px solid #CBD5E1; border-radius: 8px; background: #fff; color: #0F172A; }
.chart-filter-row select:focus { outline: none; border-color: #00C6B8; box-shadow: 0 0 0 3px rgba(0, 198, 184, .3); }
.chart-filter-note { margin: 0 0 8px; font-size: 11px; color: #475569; }
.chart-filter-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* top bar right-hand cluster, arranged like the RCM header */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.topbar .user-chip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.topbar .tenant-context-selector { margin: 0; }
.topbar .tenant-context-selector select, .topbar-pill {
  display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .10); border: 1px solid rgba(255, 255, 255, .30); color: #fff;
  font-weight: 600; font-size: 13px; border-radius: 999px; padding: 7px 14px; max-width: 300px; line-height: 1.2; text-decoration: none; }
.topbar .tenant-context-selector select { padding-right: 10px; cursor: pointer; }
.topbar .tenant-context-selector select option { color: #0F172A; }
.topbar-pill-link { cursor: pointer; transition: background var(--transition), border-color var(--transition); }
.topbar-pill-link:hover { background: rgba(255, 255, 255, .20); border-color: #4DE6D6; text-decoration: none; color: #fff; }
.topbar .user-menu { position: relative; }
.topbar .user-btn { display: inline-flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, .10); border: 1px solid rgba(255, 255, 255, .30); color: #fff;
  font-weight: 600; font-size: 13px; border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; }
.topbar .user-btn:hover { background: rgba(255, 255, 255, .18); }
.topbar .avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand-grad-soft); color: #0F172A; font-size: 11.5px; font-weight: 800; }
.topbar .user-caret { font-size: 10px; opacity: .8; }
.topbar .user-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .user-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: #FFFFFF; border: 1px solid #CBD5E1; border-radius: 12px;
  padding: 12px 14px; box-shadow: 0 12px 36px rgba(15, 23, 42, .22); z-index: 60; display: flex; flex-direction: column; gap: 8px; color: #0F172A; }
.topbar .user-pop[hidden] { display: none; }
.topbar .user-pop-name { font-size: 12px; color: #475569; word-break: break-all; }
.topbar .user-pop .badge { align-self: flex-start; }
.topbar .user-pop a { color: #004D56; font-weight: 600; font-size: 13px; padding: 7px 8px; border-radius: 8px; text-decoration: none; }
.topbar .user-pop a:hover { background: #E6FFFB; text-decoration: none; }
