/* ═══════════════════════════════════════════════════════════════════════════
   Jarvis Prime — Google Material theme (hybrid action palette)
   ---------------------------------------------------------------------------
   Loads AFTER each dashboard's inline <style> block; wins on tie-break by
   source order. Plain solid colours (no gradients), Google Sans / Roboto
   typography, pill-shaped controls, Material 3 elevation. Prime's red/green
   buy-sell semantics preserved.
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&family=Google+Sans+Text:wght@400;500;700&family=Roboto:wght@400;500;700&family=Roboto+Mono:wght@400;500&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ─── Design tokens (Google Material palette) ──────────────────────────── */
:root {
  /* Google Blue scale */
  --g-blue-50:  #e8f0fe;
  --g-blue-100: #d2e3fc;
  --g-blue-200: #aecbfa;
  --g-blue-500: #1a73e8;   /* primary */
  --g-blue-600: #1765cc;   /* primary hover */
  --g-blue-700: #185abc;
  --g-blue-900: #174ea6;

  /* Neutrals (Google grey scale) */
  --g-white:  #ffffff;
  --g-bg:     #ffffff;     /* page bg — pure white */
  --g-bg2:    #f8f9fa;     /* very subtle surface (toolbars, tfoot) */
  --g-hover:  #f6f8fc;     /* row hover */
  --g-border: #dadce0;     /* dividers */
  --g-border-strong: #bdc1c6;

  /* Text scale */
  --g-text:   #202124;
  --g-text2:  #3c4043;
  --g-muted:  #5f6368;
  --g-muted2: #80868b;
  --g-disabled: #9aa0a6;

  /* Semantic (Google) */
  --g-green: #1e8e3e;
  --g-green-bg: #e6f4ea;
  --g-red:   #d93025;
  --g-red-bg: #fce8e6;
  --g-amber: #f9ab00;
  --g-amber-bg: #feefc3;

  /* Material 3 elevation shadows */
  --el1: 0 1px 2px rgba(60,64,67,.10), 0 1px 3px 1px rgba(60,64,67,.06);
  --el2: 0 1px 2px rgba(60,64,67,.12), 0 2px 6px 2px rgba(60,64,67,.08);
  --el3: 0 4px 8px rgba(60,64,67,.10), 0 8px 24px 4px rgba(60,64,67,.10);

  /* Radii (Material 3 shapes) */
  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-xl:   16px;
  --r-pill: 999px;

  /* Fonts */
  --font-body:    'Google Sans Text','Roboto',-apple-system,'Segoe UI',sans-serif;
  --font-display: 'Google Sans','Google Sans Text','Roboto',sans-serif;
  --font-mono:    'Roboto Mono','SF Mono','Courier New',monospace;
  /* Geometric secondary display face — used for brand/wordmark contexts
     (e.g. the "Prime Portfolio" label next to the logo) so it reads as
     distinct from the humanist Google Sans body/heading stack. */
  --font-brand:   'Space Grotesk','Google Sans','DM Sans',sans-serif;

  /* ── Override Prime tokens so *every* existing rule inherits the new look ── */
  --jblue:   var(--g-blue-500);
  --jnavy:   var(--g-blue-700);
  --jnavym:  var(--g-text);
  --jteal:   var(--g-blue-500);
  --jpurple: #9334e6;
  --jamber:  var(--g-amber);
  /* Buy/sell semantics deliberately unchanged from Prime */
  --jgreen:  #1e8e3e;
  --jred:    #d93025;

  --canvas:  var(--g-bg);
  --card:    var(--g-white);
  --border:  var(--g-border);
  --lt:      var(--g-bg2);

  --text:    var(--g-text);
  --sub:     var(--g-text2);
  --muted:   var(--g-muted);

  --font:    var(--font-body);
}

/* ─── Base ─────────────────────────────────────────────────────────────── */
body {
  font-family: var(--font-body);
  background: var(--g-bg);
  color: var(--g-text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--g-border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--g-border-strong); }

/* ─── Icons (Lucide sprite consumers) ──────────────────────────────────── */
.ic {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.15em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: inherit;
}
.ic-lg { width: 1.25em; height: 1.25em; }
.ic-xl { width: 1.5em;  height: 1.5em; }
.ic-2x { width: 2em;    height: 2em;    stroke-width: 1.75; }
.ic-3x { width: 2.5em;  height: 2.5em;  stroke-width: 1.5; }

/* ─── Top nav (Google app-bar) ─────────────────────────────────────────── */
.topnav {
  height: 64px;
  background: var(--g-white);
  padding: 0 24px;
  border-bottom: 1px solid var(--g-border);
  box-shadow: none;
  gap: 20px;                /* space between left / tabs / right zones */
}
.logo-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.2px;
  background: none;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: initial;
  color: var(--g-text);
}
.logo-tag {
  font-size: 11px;
  font-style: normal;
  color: var(--g-muted);
  letter-spacing: 0;
  font-weight: 400;
}
.nav-right { gap: 16px; }
.nav-clock {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  line-height: 1.15;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--g-muted);
}
.nav-clock-date {
  font-size: 12px;
  color: var(--g-text);
  letter-spacing: 0.1px;
}
.nav-clock-time {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--g-muted);
  letter-spacing: 0.2px;
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}
.nav-pill {
  background: var(--g-blue-50);
  border: none;
  color: var(--g-blue-700);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.3px;
  padding: 4px 12px;
  border-radius: var(--r-pill);
}
#auth-bar {
  font-size: 13px !important;
  color: var(--g-muted) !important;
  font-weight: 400;
}

/* ─── Top-nav user chip ─────────────────────────────────────────────────
   Compact identity block: avatar → name + role → icon-only logout.
   Replaces the previous "Signed in as X  [Logout]" string. */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px 3px 3px;
  border-radius: var(--r-pill);
  background: var(--g-bg2);
  border: 1px solid var(--g-border);
  line-height: 1;
}
.user-chip .user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--g-blue-500);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-transform: uppercase;
}
.user-chip .user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.user-chip .user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  gap: 1px;
}
.user-chip .user-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--g-text);
  white-space: nowrap;
}
.user-chip .user-role {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--g-blue-600);
}
.user-chip .user-role[data-role="analyst"] { color: var(--g-green); }

/* Icon-only ghost button — used by the top-nav logout so we don't waste
   width on a text label next to the identity chip. */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--r-pill);
  background: transparent;
  border: none;
  color: var(--g-muted);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.icon-btn:hover  { background: var(--g-hover); color: var(--g-text); }
.icon-btn:active { background: var(--g-bg2);  color: var(--g-text); }
.icon-btn .ic    { width: 18px; height: 18px; }

/* ─── Hero (dashboard header) — flat, no gradient ──────────────────────── */
.hero {
  background: var(--g-white);
  padding: 20px 24px 18px;
  border-bottom: 1px solid var(--g-border);
}
.hero-badge {
  background: var(--g-blue-50);
  border: none;
  color: var(--g-blue-700);
  font-weight: 500;
  letter-spacing: 0.3px;
  font-size: 11px;
  text-transform: none;
  padding: 3px 10px;
  border-radius: var(--r-pill);
}
.hero-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--g-text);
  letter-spacing: -0.3px;
}
.hero-sub { color: var(--g-muted); font-size: 13px; margin-top: 4px; }

/* ─── Tab bar → Google-style pill chips ────────────────────────────────── */
.tabbar {
  background: var(--g-white);
  border-bottom: 1px solid var(--g-border);
  padding: 6px 16px;
  gap: 4px;
  box-shadow: none;
}
.tabbar::before { display: none; }

/* When the tab strip lives *inside* the top nav (see admin.html /
   analyst.html), strip the standalone-bar chrome — no double border,
   no double padding — and let it fill the middle zone. Overflows
   horizontally on narrow viewports rather than wrapping. */
.topnav .tabbar {
  background: transparent;
  border-bottom: none;
  padding: 0;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;                /* Firefox */
}
.topnav .tabbar::-webkit-scrollbar { display: none; }
.tabbtn {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: var(--r-sm);   /* rectangle, not pill */
  background: transparent;
  color: var(--g-text2);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.2px;
  text-transform: none;
  border: none;
  border-bottom: none;
  transition: background-color 0.15s ease, color 0.15s ease;
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tabbtn:hover:not(.active) {
  color: var(--g-text);
  background: var(--g-hover);
}
.tabbtn.active {
  color: var(--g-blue-700);
  background: var(--g-blue-50);
  box-shadow: none;
  border-bottom: none;
  border-radius: var(--r-sm);   /* rectangle, not pill */
  font-weight: 500;
}
.tabbtn.active:hover { background: var(--g-blue-100); }
.tabbtn .ic { width: 18px; height: 18px; stroke-width: 2; }

/* ─── Sub-tabs (Stock Detail / MCP / Approvals / Risk Signal) ───────────
   Not pills — flat rectangles with a light-blue active fill (Google Admin
   secondary-nav pattern). Overrides Prime's underline style. */
.sd-tabbtn,
.mcp-tabbtn,
.risk-tabbtn,
.appr-tabbtn,
.rs-tabbtn,
.mc-tabbtn,
.mc-inner-tabbtn,
.pb-tabbtn {
  padding: 8px 14px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--g-text2);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.1px;
  text-transform: none;
  cursor: pointer;
  border-bottom: none;
  transition: background-color 0.12s ease, color 0.12s ease;
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 2px;
  white-space: nowrap;
}
.sd-tabbtn:hover:not(.active),
.mcp-tabbtn:hover:not(.active),
.risk-tabbtn:hover:not(.active),
.appr-tabbtn:hover:not(.active),
.rs-tabbtn:hover:not(.active),
.mc-tabbtn:hover:not(.active),
.mc-inner-tabbtn:hover:not(.active),
.pb-tabbtn:hover:not(.active) {
  color: var(--g-text);
  background: var(--g-hover);
  border-bottom: none;
}
.sd-tabbtn.active,
.mcp-tabbtn.active,
.risk-tabbtn.active,
.appr-tabbtn.active,
.rs-tabbtn.active,
.mc-tabbtn.active,
.mc-inner-tabbtn.active,
.pb-tabbtn.active {
  background: var(--g-blue-50);
  color: var(--g-blue-700);
  border-bottom: none;
  font-weight: 500;
}
.sd-tabbtn .ic,
.mcp-tabbtn .ic,
.risk-tabbtn .ic,
.appr-tabbtn .ic,
.rs-tabbtn .ic,
.mc-tabbtn .ic,
.mc-inner-tabbtn .ic,
.pb-tabbtn .ic { width: 16px; height: 16px; }

.pb-tabbtn .pb-tabbtn-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  background: var(--g-bg2);
  color: var(--g-muted);
  margin-left: 4px;
  letter-spacing: 0.1px;
}
.pb-tabbtn.active .pb-tabbtn-badge {
  background: var(--g-blue-100);
  color: var(--g-blue-700);
}

/* Sub-tab bars: replace bottom-border underline layout with padding gap. */
.sd-tabbar,
.mcp-tabbar,
.risk-tabbar,
.appr-tabbar,
.rs-tabbar,
.mc-tabbar,
.pb-tabbar {
  display: flex;
  padding: 6px 8px;
  gap: 2px;
  background: var(--g-white);
  border-bottom: 1px solid var(--g-border);
}

/* Small filter buttons (Analytics Nifty50/Nifty500, Top-5/10/15). Not pills. */
.top-filter-btn {
  padding: 6px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--g-border);
  background: var(--g-white);
  color: var(--g-text2);
  font-size: 12px;
  font-weight: 500;
  height: 30px;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.top-filter-btn:hover:not(.active) {
  background: var(--g-hover);
  color: var(--g-text);
  border-color: var(--g-border-strong);
}
.top-filter-btn.active {
  background: var(--g-blue-50);
  color: var(--g-blue-700);
  border-color: var(--g-blue-100);
}

/* ─── Content wrap ─────────────────────────────────────────────────────── */
.wrap { padding: 24px; }

/* ─── Cards ────────────────────────────────────────────────────────────── */
.card {
  background: var(--g-white);
  border: 1px solid var(--g-border);
  border-radius: var(--r-md);
  box-shadow: none;
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.card:hover {
  box-shadow: var(--el1);
  border-color: var(--g-border-strong);
}

/* ─── KPI cards ────────────────────────────────────────────────────────── */
.kpi {
  background: var(--g-white);
  border: 1px solid var(--g-border);
  border-radius: var(--r-md);
  border-top: 1px solid var(--g-border);
  padding: 16px 18px;
  box-shadow: none;
  transition: box-shadow 0.15s ease;
  position: relative;
}
.kpi::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: var(--g-blue-500);
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.kpi:hover {
  box-shadow: var(--el1);
  transform: none;
}
.kpi-lbl {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--g-muted);
  margin-bottom: 6px;
}
.kpi-val {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  line-height: 1.15;
  color: var(--g-text);
  letter-spacing: -0.3px;
}
.kpi-sub { font-size: 12px; color: var(--g-muted); margin-top: 4px; font-weight: 400; }

/* ─── Toolbar ──────────────────────────────────────────────────────────── */
.toolbar {
  padding: 12px 16px;
  background: var(--g-white);
  border-bottom: 1px solid var(--g-border);
}
.sec-lbl {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2px;
  color: var(--g-text2);
  text-transform: none;
}
.sec-lbl::before { display: none; }
.row-ct { color: var(--g-muted); font-weight: 400; font-size: 12px; }

/* ─── Form controls (Google-style outlined) ────────────────────────────── */
input.fc, select.fc, textarea.fc {
  background: var(--g-white);
  border: 1px solid var(--g-border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--g-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  height: 36px;
}
textarea.fc { height: auto; min-height: 60px; }
input.fc:hover, select.fc:hover, textarea.fc:hover { border-color: var(--g-border-strong); }
input.fc:focus, select.fc:focus, textarea.fc:focus {
  outline: none;
  border-color: var(--g-blue-500);
  box-shadow: 0 0 0 1px var(--g-blue-500);
}
input.fc::placeholder { color: var(--g-muted2); }

/* ─── Buttons (Google Material 3 pill/rounded) ─────────────────────────── */
.btn {
  border-radius: var(--r-pill);
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-body);
  transition: background-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
  gap: 8px;
  height: 36px;
  letter-spacing: 0.1px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.btn-blue {
  background: var(--g-blue-500);
  color: #fff;
  box-shadow: none;
}
.btn-blue:hover {
  background: var(--g-blue-600);
  opacity: 1;
  transform: none;
  box-shadow: var(--el1);
}
.btn-blue:active { background: var(--g-blue-700); }
.btn-out {
  background: transparent;
  color: var(--g-blue-500);
  border: 1px solid var(--g-border);
}
.btn-out:hover {
  background: var(--g-blue-50);
  color: var(--g-blue-700);
  border-color: var(--g-blue-500);
}
.btn-teal {
  background: transparent;
  color: var(--g-blue-500);
  border: 1px solid var(--g-border);
}
.btn-teal:hover { background: var(--g-blue-50); color: var(--g-blue-700); }
.btn-ghost {
  background: transparent;
  color: var(--g-text2);
  border: 1px solid var(--g-border);
}
.btn-ghost:hover {
  background: var(--g-hover);
  color: var(--g-text);
  border-color: var(--g-border-strong);
}

/* Prime action colours (hybrid) — flat solids, no gradients */
.btn-red   { background: var(--g-red);   color: #fff; box-shadow: none; }
.btn-red:hover   { background: #b3261e; opacity: 1; transform: none; box-shadow: var(--el1); }
.btn-green { background: var(--g-green); color: #fff; box-shadow: none; }
.btn-green:hover { background: #187a30; opacity: 1; transform: none; box-shadow: var(--el1); }

/* ─── Tables ───────────────────────────────────────────────────────────── */
table { font-size: 13px; }
thead tr { background: transparent; border-bottom: 1px solid var(--g-border); }
th {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1px;
  text-transform: none;
  color: var(--g-muted);
  padding: 12px 16px;
  text-align: left;
}
th.sort:hover { color: var(--g-text); }
th.asc::after, th.desc::after { color: var(--g-blue-500); }
td { padding: 12px 16px; border-bottom: 1px solid var(--g-border); color: var(--g-text); }
tbody tr { transition: background-color 0.1s ease; }
tbody tr:hover td { background: var(--g-hover); }
tfoot td {
  background: var(--g-bg2);
  border-top: 1px solid var(--g-border);
  color: var(--g-text);
  font-weight: 500;
}

/* ─── Badges / chips (Google Material 3) ───────────────────────────────── */
.badge {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
}
.b-blue   { background: var(--g-blue-50);  color: var(--g-blue-700); }
.b-green  { background: var(--g-green-bg); color: #137333; }
.b-red    { background: var(--g-red-bg);   color: #a50e0e; }
.b-amber  { background: var(--g-amber-bg); color: #b06000; }
.b-active { background: var(--g-green-bg); color: #137333; }

/* ─── Numeric values ────────────────────────────────────────────────────
   All numbers in tables share the same font as dates (Google Sans Text /
   DM Sans body font). Tabular numerals keep columns aligned without
   switching to a monospace face — Google's standard treatment.
   !important overrides Prime's many inline `style="font-family:monospace"`
   attributes on individual <td>/<span> nodes without touching each one. */
.mono,
td.mono,
th.mono,
td.tr,
td.num,
.num,
.kpi-val,
.nav-clock,
.univ-cell,                                /* MCP → Universe symbol grid  */
[style*="font-family:monospace"],
[style*="font-family: monospace"],
[style*="font-family:'SF Mono'"],
[style*='font-family:"SF Mono"'],
[style*="font-family:'Courier"],
[style*='font-family:"Courier'],
[style*="font-family:Consolas"] {
  font-family: var(--font-body) !important;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  letter-spacing: 0;
}
/* KPI values keep the display face — larger numeric display style. */
.kpi-val { font-family: var(--font-display) !important; }

/* Accent colours for numerical values — Google Material palette.
   Positive gain, negative loss, and neutral currency accents. */
.pos { color: var(--g-green) !important; font-weight: 500; font-variant-numeric: tabular-nums; }
.neg { color: var(--g-red)   !important; font-weight: 500; font-variant-numeric: tabular-nums; }

/* Prime scatters inline `style="color:var(--jblue|--jteal|--jgreen|--jred|--jpurple)"` on
   numeric <td> cells (invested = blue, cash = teal, etc.). Force those to the
   Google equivalents so accented numbers read as Material tones, not the
   pre-Meridian brand colours. */
td[style*="color:var(--jblue)"],
td[style*="color: var(--jblue)"]  { color: var(--g-blue-600) !important; }
td[style*="color:var(--jteal)"],
td[style*="color: var(--jteal)"]  { color: var(--g-blue-500) !important; }
td[style*="color:var(--jgreen)"],
td[style*="color: var(--jgreen)"] { color: var(--g-green) !important; }
td[style*="color:var(--jred)"],
td[style*="color: var(--jred)"]   { color: var(--g-red) !important; }
td[style*="color:var(--jpurple)"],
td[style*="color: var(--jpurple)"]{ color: #9334e6 !important; }

/* ─── Status bar ───────────────────────────────────────────────────────── */
.statusbar {
  background: var(--g-white);
  border-top: 1px solid var(--g-border);
  border-bottom: 1px solid var(--g-border);
  color: var(--g-muted);
  padding: 8px 24px;
  font-size: 12px;
}
.status-dot { width: 8px; height: 8px; }
.status-dot.ok      { background: var(--g-green); box-shadow: none; }
.status-dot.err     { background: var(--g-red);   box-shadow: none; }
.status-dot.loading { background: var(--g-blue-500); box-shadow: none; }

/* ─── States (empty / loading) ─────────────────────────────────────────── */
/* Centred flex column — was previously a bare block so the icon + title
   floated to the left edge of the container. */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 72px 24px;
  gap: 16px;
}
.state-icon { color: var(--g-muted2); }
.state-icon .ic { width: 40px; height: 40px; stroke-width: 1.5; }
.state-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--g-text);
}
.state-sub   { font-size: 13px; color: var(--g-muted); max-width: 380px; line-height: 1.6; }
.spinner {
  border-color: var(--g-border);
  border-top-color: var(--g-blue-500);
  border-width: 3px;
}

/* ─── Error banner ─────────────────────────────────────────────────────── */
.err-banner {
  background: var(--g-red-bg);
  border: 1px solid #f4c7c3;
  color: #a50e0e;
  border-radius: var(--r-md);
  padding: 10px 16px;
  font-size: 13px;
  box-shadow: none;
}

/* ─── Modal / overlay polish ───────────────────────────────────────────── */
[id$="-overlay"] > div,
[id$="Modal"] > div {
  border-radius: var(--r-xl) !important;
  box-shadow: var(--el3) !important;
  border: 1px solid var(--g-border) !important;
}

/* Capital-source picker cards in the Portfolio Building wizard — smooth
   transitions + a subtle hover for the inactive cards. The active card's
   fill (blue tint + solid border) is set inline by selectCapSource(). */
.cs-card { transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; }
.cs-card:hover { background: var(--g-hover) !important; }

/* ─── Login page ────────────────────────────────────────────────────────
   Body background comes from the login.html inline stylesheet (deep-blue
   gradient); meridian.css intentionally does NOT override it here. The
   card itself stays clean white so it reads against the dark backdrop. */
.login-card {
  border-radius: var(--r-xl);
  box-shadow: 0 24px 64px rgba(2,6,23,.45);
  border: 1px solid rgba(255,255,255,.35);
}

/* ─── Utility ──────────────────────────────────────────────────────────── */
.fw7 { font-weight: 500; }

/* ─── Pagination bar (rendered by static/js/pagination.js) ─────────────── */
.pg-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--g-border);
  background: var(--g-white);
  font-family: var(--font-body);
  flex-wrap: wrap;
}
.pg-left, .pg-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pg-lbl {
  font-size: 12px;
  color: var(--g-muted);
}
.pg-select {
  height: 30px;
  padding: 3px 8px;
  border: 1px solid var(--g-border);
  border-radius: var(--r-sm);
  background: var(--g-white);
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--g-text);
  cursor: pointer;
  min-width: 80px;
}
.pg-select:hover  { border-color: var(--g-border-strong); }
.pg-select:focus  { outline: none; border-color: var(--g-blue-500); box-shadow: 0 0 0 1px var(--g-blue-500); }
.pg-range {
  font-size: 12px;
  color: var(--g-muted);
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}
.pg-nav {
  height: 30px;
  min-width: 30px;
  padding: 0 8px;
  border: 1px solid var(--g-border);
  border-radius: var(--r-sm);
  background: var(--g-white);
  color: var(--g-text2);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.pg-nav:hover:not([disabled]) {
  background: var(--g-hover);
  color: var(--g-text);
  border-color: var(--g-border-strong);
}
.pg-nav[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
.pg-page {
  font-size: 12.5px;
  color: var(--g-text);
  font-weight: 500;
  padding: 0 6px;
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Analytics sub-tab (Overview → per-customer drill-down → Analytics)
   ---------------------------------------------------------------------------
   Scoped `.an-*` primitives — kept separate from generic `.kpi` / `.card` so
   the Analytics view can evolve independently without touching the rest of
   the dashboard. Mirrored across admin.html and analyst.html markup.
   ═══════════════════════════════════════════════════════════════════════════ */

/* KPI row */
.an-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 1200px) { .an-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px)  { .an-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.an-kpi {
  position: relative;
  background: var(--g-white);
  border: 1px solid var(--g-border);
  border-radius: var(--r-md);
  padding: 14px 16px 12px 18px;
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.an-kpi::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--an-accent, var(--g-blue-500));
}
.an-kpi:hover {
  box-shadow: var(--el1);
  border-color: var(--g-border-strong);
}
.an-kpi[data-accent="blue"]   { --an-accent: var(--g-blue-500); }
.an-kpi[data-accent="amber"]  { --an-accent: var(--g-amber);    }
.an-kpi[data-accent="green"]  { --an-accent: var(--g-green);    }
.an-kpi[data-accent="red"]    { --an-accent: var(--g-red);      }
.an-kpi[data-accent="purple"] { --an-accent: #9334e6;           }
.an-kpi[data-accent="grey"]   { --an-accent: #5f6368;           }

.an-kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.an-kpi-lbl {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--g-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.an-kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-pill);
  flex-shrink: 0;
  color: var(--g-blue-700);
  background: var(--g-blue-50);
}
.an-kpi-icon .ic { width: 14px; height: 14px; stroke-width: 2; }
.an-kpi[data-accent="blue"]   .an-kpi-icon { color: var(--g-blue-700); background: var(--g-blue-50); }
.an-kpi[data-accent="amber"]  .an-kpi-icon { color: #8a5a00;           background: var(--g-amber-bg); }
.an-kpi[data-accent="green"]  .an-kpi-icon { color: var(--g-green);    background: var(--g-green-bg); }
.an-kpi[data-accent="red"]    .an-kpi-icon { color: var(--g-red);      background: var(--g-red-bg); }
.an-kpi[data-accent="purple"] .an-kpi-icon { color: #7b1fa2;           background: #f3e8fd; }
.an-kpi[data-accent="grey"]   .an-kpi-icon { color: #5f6368;           background: var(--g-bg2); }

.an-kpi-val {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.15;
  color: var(--g-text);
  letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums;
}
.an-kpi-sub {
  font-size: 11.5px;
  color: var(--g-muted);
  margin-top: 6px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chart cards */
.an-card {
  background: var(--g-white);
  border: 1px solid var(--g-border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.an-card:hover { box-shadow: var(--el1); border-color: var(--g-border-strong); }

.an-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--g-border);
  background: var(--g-white);
  flex-wrap: wrap;
}
.an-card-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.an-card-title-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  flex-shrink: 0;
}
.an-card-title-ic .ic { width: 16px; height: 16px; }
.an-card-title-ic[data-accent="blue"]   { background: var(--g-blue-50);   color: var(--g-blue-700); }
.an-card-title-ic[data-accent="purple"] { background: #f3e8fd;            color: #7b1fa2; }
.an-card-title-ic[data-accent="green"]  { background: var(--g-green-bg);  color: var(--g-green); }
.an-card-title-ic[data-accent="amber"]  { background: var(--g-amber-bg);  color: #8a5a00; }

.an-card-title-txt {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--g-text);
  letter-spacing: 0.1px;
  line-height: 1.2;
}
.an-card-title-sub {
  font-size: 11.5px;
  color: var(--g-muted);
  margin-top: 2px;
  line-height: 1.2;
}
.an-card-body { padding: 18px 20px 20px; }
.an-chart-wrap { position: relative; width: 100%; }

.an-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 900px) { .an-grid-2 { grid-template-columns: 1fr; } }

/* Segmented control (benchmark switch + bar chart filter) */
.an-seg {
  display: inline-flex;
  background: var(--g-bg2);
  border: 1px solid var(--g-border);
  border-radius: var(--r-pill);
  padding: 3px;
  gap: 2px;
}
/* Piggyback on `.top-filter-btn` so existing JS reset code keeps matching. */
.an-seg .top-filter-btn {
  border: none;
  background: transparent;
  color: var(--g-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 14px;
  height: 26px;
  border-radius: var(--r-pill);
  letter-spacing: 0.1px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.an-seg .top-filter-btn:hover:not(.active) {
  background: var(--g-hover);
  color: var(--g-text);
  border-color: transparent;
}
.an-seg .top-filter-btn.active {
  background: var(--g-white);
  color: var(--g-blue-700);
  box-shadow: var(--el1);
  border-color: transparent;
}

/* Chart legend (donuts) */
.an-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 14px;
  justify-content: center;
  padding: 0 4px;
}
.an-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 11.5px;
}
.an-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.an-legend-lbl { color: var(--g-text2); }
.an-legend-val { font-weight: 500; color: var(--g-text); font-variant-numeric: tabular-nums; }

/* ═══════════════════════════════════════════════════════════════════════════
   Rolling Beta sub-tab (MCP → Rolling Beta)
   ---------------------------------------------------------------------------
   Two-card Google Material layout — a controls card (title, inputs, risk-band
   legend on a tinted strip) sitting above a results card (result summary +
   data-driven table + pagination). Every text run uses --font-body /
   --font-display / --font-mono so Google Sans / Roboto Mono is authoritative.
   ═══════════════════════════════════════════════════════════════════════════ */

.rb-card {
  background: var(--g-white);
  border: 1px solid var(--g-border);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 20px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
  font-family: var(--font-body);
}
.rb-card:hover { box-shadow: var(--el1); border-color: var(--g-border-strong); }
.rb-card:last-child { margin-bottom: 0; }

.rb-card-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--g-border);
  background: var(--g-white);
  flex-wrap: wrap;
}
.rb-card-head-meta { margin-left: auto; }

/* Inline head variant: title/sub on the left, inputs + button + Current pill
   flowing right after — NOT pinned to the far right — so the two blocks read
   as a single row with a consistent gap instead of being split by an empty
   middle gutter. Used by MCP → Stop Loss / Supertrend. */
.rb-card-head-inline {
  align-items: center;
  padding: 14px 24px;
  gap: 24px;
  border-bottom: none;   /* only re-added by the status banner if it shows */
}
/* Title block shouldn't grab all remaining space in the inline variant —
   let it shrink to content so the actions sit right next to it. */
.rb-card-head-inline .rb-card-title-block {
  flex: 0 1 auto;
  min-width: 0;
}
.rb-card-head-actions {
  display: inline-flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}
.rb-field-inline { gap: 4px; }
.rb-field-inline .rb-field-label {
  font-size: 10.5px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.rb-status-stripe {
  margin: 0;
  border-radius: 0;
  border: none;
  border-top: 1px solid var(--g-border);
  padding: 12px 24px;
}
.rb-card-title-block { min-width: 0; flex: 1; }
.rb-card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: var(--g-text);
  letter-spacing: 0.1px;
  line-height: 1.3;
}
.rb-card-sub {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--g-muted);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.rb-card-head-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  background: var(--g-blue-50);
  color: var(--g-blue-700);
  flex-shrink: 0;
  margin-right: 4px;
}
.rb-card-head-ic .ic { width: 18px; height: 18px; }
.rb-card-head-meta {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--g-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rb-card-body {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Input row — align-items:flex-end pairs Submit / Calculate button bottoms
   with the input bottoms. Hint labels use `position: absolute` (see
   .rb-field-hint) so they don't drag the flex-end anchor down. The 24 px
   margin-bottom reserves visual space for those absolutely-positioned hints
   before whatever section follows this row. */
.rb-controls-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.rb-controls-row + .rb-status { margin-top: 14px; }
.rb-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-body);
  position: relative;
}
.rb-field-label {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--g-muted);
  letter-spacing: 0.1px;
}
.rb-field .fc {
  min-width: 140px;
  height: 40px;
  font-family: var(--font-body);
  font-size: 14px;
}
.rb-field select.fc { min-width: 200px; }
.rb-field input.fc[type="number"] { text-align: right; }
.rb-field-hint {
  /* Sits below the input without contributing to the field's flex height —
     keeps `align-items: flex-end` on .rb-controls-row aligning the Submit /
     Calculate button to the input's bottom edge, not the hint's. */
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  font-family: var(--font-body);
  font-size: 11.5px;
  color: var(--g-muted);
  letter-spacing: 0.1px;
  pointer-events: none;
  white-space: nowrap;
}
.rb-formula {
  display: inline-block;
  padding: 2px 8px;
  background: var(--g-bg2);
  border: 1px solid var(--g-border);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--g-text2);
  letter-spacing: 0.1px;
}
/* "Current: ..." pill that sits in the card head on the right */
.rb-current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--g-bg2);
  border: 1px solid var(--g-border);
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--g-muted);
  white-space: nowrap;
}
.rb-current-val {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--g-text);
  font-variant-numeric: tabular-nums;
}
.rb-calc-btn {
  height: 40px;
  padding: 0 22px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  gap: 8px;
}
.rb-calc-btn .ic { width: 16px; height: 16px; }

/* Risk-band legend — its own tinted strip below the input row */
.rb-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--g-bg2);
  border: 1px solid var(--g-border);
  border-radius: var(--r-md);
}
.rb-legend-lbl {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--g-muted);
  padding-right: 6px;
  white-space: nowrap;
}
.rb-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: var(--r-pill);
  background: var(--g-white);
  border: 1px solid var(--g-border);
  cursor: default;
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
  font-family: var(--font-body);
}
.rb-legend-chip:hover {
  box-shadow: var(--el1);
  border-color: var(--g-border-strong);
}
.rb-legend-badge {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  letter-spacing: 0.1px;
  color: var(--rb-c, var(--g-text));
  background: var(--rb-bg, var(--g-bg2));
}
.rb-legend-range {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--g-text2);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Inline status bar (loading + error) — appears between cards */
.rb-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 13px;
}
.rb-status .ic { width: 16px; height: 16px; }
.rb-status[data-tone="loading"] { background: var(--g-blue-50);  color: var(--g-blue-700); border: 1px solid var(--g-blue-100); }
.rb-status[data-tone="error"]   { background: var(--g-red-bg);   color: var(--g-red);      border: 1px solid #fbc9c4; }
.rb-status[data-tone="ok"]      { background: var(--g-green-bg); color: var(--g-green);    border: 1px solid #bcdfc4; }

/* Results table */
.rb-table-wrap { overflow-x: auto; }
.rb-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font-body);
  font-size: 13.5px;
  table-layout: fixed;
}
.rb-table col.rb-c-num  { width: 60px;  }
.rb-table col.rb-c-sym  { width: 160px; }
.rb-table col.rb-c-beta { width: 120px; }
.rb-table col.rb-c-risk { width: 140px; }
.rb-table col.rb-c-obs  { width: 100px; }

.rb-table thead th {
  background: var(--g-bg2);
  color: var(--g-muted);
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 12px 20px;
  text-align: left;
  border-bottom: 1px solid var(--g-border);
  white-space: nowrap;
}
.rb-table thead th.rb-th-num  { text-align: center; }
.rb-table thead th.rb-th-beta,
.rb-table thead th.rb-th-risk { text-align: center; }
.rb-table thead th.rb-th-obs  { text-align: right;  }

.rb-row { transition: background-color 0.12s ease; }
.rb-row:hover { background: var(--g-hover); }
.rb-row + .rb-row .rb-td { border-top: 1px solid var(--g-border); }

.rb-td {
  padding: 14px 20px;
  vertical-align: middle;
  color: var(--g-text);
  font-family: var(--font-body);
}
.rb-td-num {
  color: var(--g-muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: center;
  font-size: 12.5px;
}
.rb-symbol {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--g-blue-700);
  font-size: 13.5px;
  letter-spacing: 0.2px;
}
.rb-td-beta { text-align: center; }
.rb-beta {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1px;
  color: var(--g-text);
}
.rb-beta[data-tone="up"]      { color: var(--g-red);      }
.rb-beta[data-tone="flat"]    { color: var(--g-blue-700); }
.rb-beta[data-tone="down"]    { color: var(--g-green);    }
.rb-beta[data-tone="inverse"] { color: #7b1fa2;           }

.rb-td-risk { text-align: center; }
.rb-risk {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  letter-spacing: 0.1px;
  white-space: nowrap;
}
.rb-risk[data-band="very-high"] { background: #FEE2E2; color: #B91C1C; }
.rb-risk[data-band="high"]      { background: #FEF3C7; color: #92400E; }
.rb-risk[data-band="moderate"]  { background: #DBEAFE; color: #1D4ED8; }
.rb-risk[data-band="low"]       { background: #DCFCE7; color: #15803D; }
.rb-risk[data-band="inverse"]   { background: #FAF5FF; color: #6D28D9; }

.rb-td-obs {
  text-align: right;
  font-family: var(--font-mono);
  color: var(--g-muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.rb-td-note {
  color: var(--g-text2);
  font-family: var(--font-body);
  font-size: 13px;
  white-space: normal;
}
.rb-note-ic {
  display: inline-block;
  width: 14px;
  margin-right: 8px;
  font-weight: 700;
  font-size: 11px;
  line-height: 1;
  text-align: center;
  vertical-align: baseline;
}
.rb-note-ic[data-tone="up"]      { color: var(--g-red);      }
.rb-note-ic[data-tone="flat"]    { color: var(--g-blue-700); }
.rb-note-ic[data-tone="down"]    { color: var(--g-green);    }
.rb-note-ic[data-tone="inverse"] { color: #7b1fa2;           }

.rb-row-empty .rb-td       { color: var(--g-muted); }
.rb-row-empty .rb-td-note  { color: var(--g-red); font-size: 12.5px; }
.rb-row-empty .rb-symbol   { color: var(--g-muted); }

/* Pagination lives inside the results card — give it its own top border. */
.rb-card #pg-rb-results {
  border-top: 1px solid var(--g-border);
  background: var(--g-white);
}

/* Chart card actions (right side of the head — segmented + tool strip stack) */
.an-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Zoom / pan / reset tool strip (top-right of every chart) */
.an-chart-tools {
  display: inline-flex;
  align-items: center;
  background: var(--g-bg2);
  border: 1px solid var(--g-border);
  border-radius: var(--r-pill);
  padding: 3px;
  gap: 2px;
}
.an-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--g-muted);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}
.an-tool-btn:hover:not(:disabled):not(.active) {
  background: var(--g-hover);
  color: var(--g-text);
}
.an-tool-btn.active,
.an-tool-btn:active {
  background: var(--g-white);
  color: var(--g-blue-700);
  box-shadow: var(--el1);
}
.an-tool-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.an-tool-btn .ic { width: 13px; height: 13px; stroke-width: 2; }
.an-tool-sep {
  width: 1px;
  align-self: stretch;
  background: var(--g-border);
  margin: 3px 2px;
}

/* Chart wrapper interaction modes.
   `pan-mode` — cursor hints for drag-to-pan (CSS-transform donuts + plugin line/bar).
   `overflow: hidden` clips the CSS-scaled canvas so it never bleeds outside the card body. */
.an-chart-wrap { overflow: hidden; }
.an-chart-wrap.pan-mode { cursor: grab; }
.an-chart-wrap.pan-mode:active { cursor: grabbing; }
.an-chart-wrap canvas {
  transform-origin: center center;
  transition: transform 0.12s ease;
}
.an-chart-wrap.dragging canvas { transition: none; }
