/* =========================================================================
   CryptoQuant · KPI Dashboard — dark "Bloomberg terminal" theme
   Matches alpha.cryptoquant.com: Neue Haas Grotesk on #0a0a0a, subtle
   neutral hairlines, emerald/red signal accents, light lines on dark.
   ========================================================================= */

/* ---------- Neue Haas Grotesk (shared with alpha.cryptoquant.com) ---------- */
@font-face {
  font-family: "Neue Haas Grotesk Text";
  src: url("/fonts/NeueHaasGrotText-Roman.otf") format("opentype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Neue Haas Grotesk Text";
  src: url("/fonts/NeueHaasGrotText-Medium.otf") format("opentype");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Neue Haas Grotesk Text";
  src: url("/fonts/NeueHaasGrotText-Bold.otf") format("opentype");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Neue Haas Grotesk Display";
  src: url("/fonts/NeueHaasGrotDisp-Medium.otf") format("opentype");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Neue Haas Grotesk Display";
  src: url("/fonts/NeueHaasGrotDisp-Bold.otf") format("opentype");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  color-scheme: dark;
  --sans: "Neue Haas Grotesk Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --display: "Neue Haas Grotesk Display", "Neue Haas Grotesk Text", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --bg: #0a0a0a;          /* page */
  --bg-soft: #141414;     /* hover / inset surface */
  --bg-soft-2: #1f1f1f;   /* progress track */
  --panel: #0c0c0c;       /* panel face */

  --ink: #fafafa;         /* brightest */
  --ink-1: #ededed;       /* default text */
  --ink-2: #d4d4d4;       /* names / headings */
  --g1: #a3a3a3;          /* secondary */
  --g2: #737373;          /* muted */
  --g3: #525252;          /* faint */
  --g4: #404040;

  --line: #1c1c1c;        /* hairline grid gaps */
  --line-2: #2a2a2a;      /* stronger borders */

  --up: #34d399;          /* emerald-400 — bull / positive */
  --up-dim: #16a34a;
  --down: #f87171;        /* red-400 — bear / negative */
  --down-dim: #b91c1c;
  --series: #e5e5e5;      /* primary line / bar on dark */
  --series-2: #525252;    /* secondary series */
  --brand: #7c6cff;       /* CryptoQuant violet, lifted for dark */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  background: var(--bg);
  color: var(--ink-1);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--display); }
::selection { background: var(--series); color: #0a0a0a; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2e2e2e; border: 2px solid var(--bg); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3f3f3f; }

/* ---------- Auth gate ---------- */
.auth-gate { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 50; }
.auth-panel { width: 380px; max-width: 90vw; border: 1px solid var(--line-2); border-top: 2px solid var(--brand); padding: 34px 30px; display: flex; flex-direction: column; gap: 12px; background: var(--panel); }
.auth-kicker { font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--g1); font-weight: 700; }
.auth-logo { position: relative; width: 56px; height: 56px; display: grid; place-items: center; overflow: hidden; margin-bottom: 4px; }
.auth-logo img.brand-mark { width: 100%; height: 100%; object-fit: contain; }
.auth-panel h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.6px; color: var(--ink); }
.auth-panel p { font-size: 12px; color: var(--g1); }
.google-btn { margin-top: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; background: var(--ink); color: #0a0a0a; text-decoration: none; font-size: 13px; font-weight: 700; letter-spacing: 0.3px; padding: 12px 16px; border: 1px solid var(--ink); transition: 0.12s; }
.google-btn:hover { background: transparent; color: var(--ink); }
.google-mark { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; background: #fff; border-radius: 4px; }
.google-mark svg { display: block; }
.auth-error { color: var(--down); font-weight: 700; font-size: 11px; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar { width: 224px; flex: 0 0 224px; border-right: 1px solid var(--line-2); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; background: var(--panel); }
.side-brand { display: flex; align-items: center; gap: 11px; padding: 16px 16px 15px; border-bottom: 1px solid var(--line); }
.cmd-logo { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; }
.cmd-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.side-brand .brand-text { display: flex; flex-direction: column; }
.side-brand .brand-wordmark { height: 14px; width: auto; display: block; }
.side-brand span { font-size: 9.5px; color: var(--g2); letter-spacing: 1px; text-transform: uppercase; margin-top: 4px; }

.side-nav { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; }
.nav-group { font-size: 9px; letter-spacing: 1.2px; color: var(--g3); text-transform: uppercase; padding: 16px 10px 5px; font-weight: 700; }
.navitem { display: flex; align-items: center; gap: 11px; text-align: left; background: transparent; border: none; color: var(--g1); font-family: var(--sans); font-size: 12.5px; font-weight: 500; letter-spacing: 0.1px; padding: 10px 11px; cursor: pointer; border-radius: 4px; transition: 0.1s; }
.navitem:hover { background: var(--bg-soft); color: var(--ink-1); }
.navitem.active { background: var(--ink); color: #0a0a0a; font-weight: 700; }
.nav-ic { width: 16px; height: 16px; flex: none; opacity: 0.7; }
.navitem.active .nav-ic { opacity: 1; }

.side-foot { padding: 12px 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.userbox { display: flex; flex-direction: column; gap: 6px; }
#userName { font-size: 9px; color: var(--g1); letter-spacing: 0.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.src { display: flex; align-items: center; gap: 7px; font-size: 10px; font-weight: 700; letter-spacing: 0.8px; color: var(--g1); }
.src .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--g3); }
.src.live .dot { background: var(--up); box-shadow: 0 0 6px var(--up); animation: pulse 1.6s infinite; }
.src.live { color: var(--up); }
.src.demo .dot { background: var(--g2); }
.src.error .dot { background: var(--down); }
.src.error { color: var(--down); }
.src.connecting { color: var(--ink-2); }
.src.connecting .dot { background: var(--ink-2); box-shadow: 0 0 6px var(--ink-2); animation: pulse 0.9s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ---------- loading / skeleton ---------- */
@keyframes shimmer { 0% { background-position: -340px 0; } 100% { background-position: 340px 0; } }
.skel {
  display: block; border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-soft) 25%, var(--bg-soft-2) 50%, var(--bg-soft) 75%);
  background-size: 680px 100%;
  animation: shimmer 1.3s infinite linear;
}
.skel-kpi { gap: 9px; }
.skel-kpi .skel { height: 9px; }
.skel-kpi .sk-sm { width: 42%; }
.skel-kpi .sk-lg { width: 74%; height: 20px; margin: 3px 0 1px; }
.skel-kpi .sk-md { width: 56%; }
/* Panel body overlay — shimmer sits on top, real chart/table renders underneath once data lands. */
.pbody.is-loading { position: relative; }
.pbody.is-loading::after {
  content: ""; position: absolute; inset: 10px;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--bg-soft) 25%, var(--bg-soft-2) 50%, var(--bg-soft) 75%);
  background-size: 680px 100%;
  animation: shimmer 1.3s infinite linear;
}
.pbody.is-loading::before {
  content: "LOADING…"; position: absolute; inset: 10px; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px; color: var(--g2);
}

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.top-title h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.6px; line-height: 1.05; color: var(--ink); }
.top-title span { font-size: 11px; color: var(--g1); }
.top-right { display: flex; align-items: center; gap: 16px; }

/* Accrual / Cash side-by-side columns (Expenses + Cash sections) */
.basis-col.acc-col { border-top: 2px solid var(--up, #34d399); }
.basis-col.cash-col { border-top: 2px solid var(--g1); }
.phead .bp { font-weight: 700; letter-spacing: 0.4px; }
.phead .bp.acc { color: #34d399; }
.phead .bp.cash { color: #9aa0a6; }
.period { font-size: 10px; font-weight: 700; letter-spacing: 1px; border: 1px solid var(--line-2); padding: 5px 9px; color: var(--g1); border-radius: 3px; }
.clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.clock strong { font-size: 13px; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.clock span { font-size: 9px; color: var(--g2); letter-spacing: 0.6px; }
.cmd-action { background: transparent; border: 1px solid var(--line-2); color: var(--ink-1); font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: 0.5px; padding: 8px 13px; cursor: pointer; transition: 0.12s; border-radius: 3px; }
.cmd-action:hover { background: var(--ink); color: #0a0a0a; border-color: var(--ink); }
.cmd-action.compact { padding: 5px 9px; font-size: 10px; }

/* ---------- Source-logo loading animation ---------- */
.load-hero { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 26px 20px; }
.load-hero .lh-logos { display: flex; align-items: center; gap: 14px; }
.load-hero .lh-logo { width: 32px; height: 32px; animation: lhpulse 1.3s ease-in-out infinite; }
.load-hero .lh-logo svg { width: 100%; height: 100%; display: block; }
.load-hero .lh-logo:nth-child(2) { animation-delay: 0.16s; }
.load-hero .lh-logo:nth-child(3) { animation-delay: 0.32s; }
.load-hero .lh-text { font-size: 12px; color: var(--g1); font-weight: 600; letter-spacing: 0.3px; }
@keyframes lhpulse { 0%, 100% { opacity: 0.3; transform: scale(0.9); } 50% { opacity: 1; transform: scale(1.08); } }

/* ---------- Global period picker (top-right) ---------- */
.top-right-group { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.period-picker { display: inline-flex; align-items: center; gap: 1px; background: var(--bg-soft); border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; }
.period-picker.disabled { opacity: 0.4; }
.pp-btn { background: transparent; border: none; color: var(--g1); font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: 0.3px; padding: 5px 11px; border-radius: 999px; cursor: pointer; transition: 0.12s; }
.pp-btn:hover:not(:disabled):not(.active) { color: var(--ink-1); background: var(--bg-soft-2); }
.pp-btn.active { background: var(--ink); color: #0a0a0a; }
.pp-btn:disabled { cursor: default; }
.pp-custom { display: inline-flex; align-items: center; gap: 6px; margin: 0 4px 0 6px; }
.pp-custom input[type="month"] { background: var(--bg-soft-2); border: 1px solid var(--line-2); color: var(--ink-1); font-family: var(--sans); font-size: 11px; padding: 4px 7px; border-radius: 5px; color-scheme: dark; }
.pp-custom > span { color: var(--g2); font-size: 11px; }

/* ---------- Per-page data-source logos (top-right) ---------- */
.top-source { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ds-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 8px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--bg-soft); font-size: 11px; font-weight: 600; letter-spacing: 0.2px; color: var(--ink-1); white-space: nowrap; }
.ds-chip svg { width: 16px; height: 16px; display: block; flex-shrink: 0; }
.ds-chip .ds-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--g2); margin-left: 1px; }
.ds-chip.live .ds-dot { background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.14); }
.ds-chip.demo .ds-dot { background: #f59e0b; }
.ds-chip.loading .ds-dot { background: var(--ink-2); animation: pulse 0.9s infinite; }
.ds-chip.loading { color: var(--g1); }
.ds-chip.error .ds-dot { background: var(--down); }
.ds-chip.error { color: var(--down); border-color: var(--down-dim); }
.ds-chip .ds-name { color: var(--ink-1); }
@media (max-width: 760px) { .ds-chip .ds-name { display: none; } .ds-chip { padding: 5px; } }

/* Chart placeholder shown while a required data feed is still loading (no partial charts) */
.chart-wait { min-height: 200px; height: auto !important; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line-2); border-radius: 4px; }
.chart-pending { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; padding: 24px; text-align: center; }
.cp-spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--ink-2); animation: spin 0.8s linear infinite; }
.cp-text { font-size: 12px; font-weight: 700; color: var(--ink-2); letter-spacing: 0.2px; }
.cp-sub { font-size: 10px; color: var(--g2); letter-spacing: 0.2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.k-pending { color: var(--g2); font-weight: 600; font-size: 0.62em; letter-spacing: 0.4px; text-transform: uppercase; }

.src-line { font-size: 10px; color: var(--g1); letter-spacing: 0.3px; padding: 6px 20px; background: var(--bg-soft); border-bottom: 1px solid var(--line); }

/* ---------- KPI strip ---------- */
.kpi-strip { display: grid; grid-template-columns: repeat(6, 1fr); border-bottom: 1px solid var(--line-2); background: var(--line); gap: 1px; }
.kpi { padding: 14px 16px 15px; display: flex; flex-direction: column; gap: 5px; background: var(--panel); }
.kpi .k-label { font-size: 10px; letter-spacing: 0.7px; color: var(--g1); text-transform: uppercase; font-weight: 600; }
.kpi .k-val { font-size: 26px; font-weight: 700; color: var(--ink); letter-spacing: -0.8px; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi .k-foot { display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--g2); }
.kpi .k-delta { font-weight: 700; font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }

/* Rep-leaderboard WIN rate: never red. Strong = bright green + bold, decent =
   green, weak = neutral text. */
.win-great { color: #4ade80; font-weight: 700; }
.win-good { color: var(--up); }
.win-flat { color: var(--ink-1); }

/* ---------- Grid ---------- */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); flex: 1; align-content: start; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }

.panel { background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.panel.hidden { display: none; }
.phead { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px 10px; border-bottom: 1px solid var(--line-2); }
.phead h2 { font-size: 12px; font-weight: 700; letter-spacing: 0.3px; color: var(--ink-1); text-transform: uppercase; display: flex; align-items: center; gap: 9px; }
.phead h2 small { font-weight: 400; color: var(--g2); letter-spacing: 0; text-transform: none; }
.pn { font-size: 10px; color: var(--g3); font-weight: 700; }
.phead-val { font-size: 13px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.pbody { padding: 14px 16px; flex: 1; min-height: 0; }
.table-body { padding: 0; }
.chart { width: 100%; min-height: 180px; }
.chart svg { display: block; width: 100%; height: auto; }
.ax-line { stroke: var(--line-2); stroke-width: 1; }
.ax-text { fill: var(--g2); font-size: 9px; font-family: var(--sans); font-variant-numeric: tabular-nums; }

/* ---------- Effboard / statgrid / cash board ---------- */
.effboard, .statgrid, .cash { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.eff { background: var(--panel); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.eff .e-label { font-size: 9px; letter-spacing: 0.5px; color: var(--g1); text-transform: uppercase; font-weight: 600; }
.eff .e-val { font-size: 18px; font-weight: 700; color: var(--ink); letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }
.eff .e-bench { font-size: 9px; color: var(--g2); }
.e-val.good { color: var(--up); }
.e-val.warn { color: var(--g1); }
.e-val.bad { color: var(--down); }
.e-val.bad::after { content: " ⚠"; font-size: 10px; }

/* ---------- Funnel ---------- */
.funnel { display: flex; flex-direction: column; gap: 8px; }
.fn-row { display: grid; gap: 3px; }
.fn-top { display: flex; justify-content: space-between; font-size: 10px; }
.fn-name { color: var(--ink-2); font-weight: 600; }
.fn-meta { color: var(--g1); font-variant-numeric: tabular-nums; }
.fn-meta b { color: var(--ink); font-weight: 700; }
.fn-bar { height: 16px; background: var(--bg-soft-2); position: relative; overflow: hidden; border-radius: 2px; }
.fn-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--series); display: flex; align-items: center; justify-content: flex-end; padding-right: 6px; }
.fn-wt { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(124,108,255,0.35); border-right: 1px solid var(--brand); }
.fn-amt { font-size: 9px; color: #0a0a0a; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Horizontal bars ---------- */
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; gap: 4px; }
.hbar-top { display: flex; justify-content: space-between; font-size: 10px; gap: 8px; }
.hbar-name { color: var(--ink-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-vals { color: var(--g1); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-vals b { color: var(--ink); font-weight: 700; }
.hbar-track { height: 9px; background: var(--bg-soft-2); border-radius: 2px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 2px; }
.hbar-nrr { font-weight: 700; }
.conc-note { font-size: 10px; color: var(--g1); padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--line); }
.conc-note b { color: var(--ink); }

/* ---------- Win / Loss ---------- */
.winloss { display: flex; align-items: center; gap: 16px; }
.wl-pie { flex: 1 1 auto; min-width: 0; }
.wl-stats { flex: 0 0 auto; display: flex; flex-direction: column; gap: 14px; padding-right: 4px; }
.wl-stat { display: flex; flex-direction: column; line-height: 1.1; }
.wl-stat b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wl-stat span { font-size: 9px; color: var(--g2); letter-spacing: 0.6px; text-transform: uppercase; margin-top: 2px; }

/* ---------- Cohort heatmap ---------- */
.cohort { overflow-x: auto; }
.cohort table { border-collapse: collapse; width: 100%; font-size: 10px; }
.cohort th { color: var(--g1); font-weight: 600; text-align: center; padding: 4px 2px; font-size: 9px; letter-spacing: 0.3px; }
.cohort th.row-h { text-align: left; padding-left: 4px; }
.cohort td { text-align: center; padding: 6px 2px; font-weight: 700; border: 1px solid var(--bg); min-width: 42px; font-variant-numeric: tabular-nums; }
.cohort td.cell-label { background: transparent; color: var(--ink-2); text-align: left; padding-left: 4px; font-weight: 600; }
.cohort td.empty { background: transparent; border: none; }

/* ---------- Health ---------- */
.health { display: flex; flex-direction: column; gap: 14px; }
.health-bar { display: flex; height: 28px; overflow: hidden; border: 1px solid var(--line-2); border-radius: 3px; }
.health-seg { display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.health-legend { display: flex; flex-direction: column; gap: 9px; }
.hl-row { display: grid; grid-template-columns: 14px 1fr auto auto; gap: 12px; align-items: center; font-size: 11px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.hl-row i { width: 11px; height: 11px; border-radius: 2px; }
.hl-row .hl-name { color: var(--ink-2); font-weight: 600; }
.hl-row .hl-logos { color: var(--g1); font-variant-numeric: tabular-nums; }
.hl-row .hl-arr { color: var(--ink); font-weight: 700; min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Grid tables ---------- */
.grid-table { width: 100%; font-size: 11px; }
.gt-head, .gt-row { display: grid; align-items: center; gap: 10px; padding: 9px 16px; }
.gt-head { color: var(--g1); font-size: 9px; letter-spacing: 0.7px; text-transform: uppercase; font-weight: 600; border-bottom: 1px solid var(--line-2); background: var(--panel); }
.gt-row { border-bottom: 1px solid var(--line); }
.gt-row:hover { background: var(--bg-soft); }
.gt-row .num, .gt-head .num { text-align: right; font-variant-numeric: tabular-nums; }
.gt-name { color: var(--ink); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 9px; }
.gt-sub { color: var(--g1); font-size: 9px; }
.gt-mono { color: var(--g1); font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Scrollable ledger / client tables on the restricted accrual page. */
.acc-scroll { max-height: 360px; overflow-y: auto; }
.acc-scroll.tall { max-height: 460px; }
.acc-scroll .gt-head { position: sticky; top: 0; z-index: 1; }

/* Methodology note (B2C accrual page). */
.method-note { font-size: 12px; line-height: 1.7; color: var(--g1); }
.method-note p { margin: 0 0 10px; }
.method-note strong { color: var(--ink, #e8e8e8); font-weight: 600; }
.method-note code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--g1); background: rgba(255,255,255,0.05); padding: 1px 5px; border-radius: 4px; }

.acct-mono { position: relative; width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center; background: #161616; color: var(--g1); font-size: 10px; font-weight: 800; letter-spacing: -0.3px; overflow: hidden; border: 1px solid var(--line-2); border-radius: 3px; }
.acct-logo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }

.pill { display: inline-block; font-size: 8px; padding: 1px 5px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; border: 1px solid var(--line-2); vertical-align: middle; border-radius: 3px; }
.pill.healthy { background: rgba(52,211,153,0.15); color: var(--up); border-color: rgba(52,211,153,0.4); }
.pill.watch { background: rgba(163,163,163,0.12); color: var(--g1); border-color: var(--g4); }
.pill.risk { background: rgba(248,113,113,0.13); color: var(--down); border-color: rgba(248,113,113,0.4); }

.mini-track { height: 6px; background: var(--bg-soft-2); min-width: 50px; border-radius: 2px; overflow: hidden; }
.mini-fill { height: 100%; background: var(--g2); }
.mini-fill.over { background: var(--up); }

/* ---------- Stat grid (B2C) ---------- */
.statgrid { grid-template-columns: 1fr 1fr; }

/* ---------- Alerts ---------- */
.alerts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); }
.alerts.alerts-stack { grid-template-columns: 1fr; background: transparent; gap: 8px; }
.alert { border-top: 2px solid var(--g3); padding: 12px 14px; background: var(--panel); display: flex; flex-direction: column; gap: 5px; }
.alerts-stack .alert { border: 1px solid var(--line-2); border-left: 2px solid var(--g3); border-radius: 3px; }
.alert.watch { border-top-color: var(--g1); }
.alerts-stack .alert.watch { border-left-color: var(--g1); }
.alert.risk { border-top-color: var(--down); }
.alerts-stack .alert.risk { border-left-color: var(--down); }
.alert.risk::before { content: "▲ ALERT"; font-size: 8px; font-weight: 700; letter-spacing: 0.5px; color: var(--down); }
.alert.neutral { border-top-color: var(--g3); }
.alert strong { font-size: 12px; color: var(--ink); font-weight: 700; }
.alert span { font-size: 10px; color: var(--g1); line-height: 1.45; }

.empty { color: var(--g1); font-size: 11px; padding: 20px; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .kpi-strip { grid-template-columns: repeat(3, 1fr); }
  .span-3, .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 6; }
}
@media (max-width: 900px) {
  .sidebar { position: static; height: auto; width: 100%; flex-basis: auto; flex-direction: row; flex-wrap: wrap; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .nav-group { display: none; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .span-3, .span-4, .span-5, .span-6, .span-7, .span-8, .span-12 { grid-column: span 12; }
  .app { flex-direction: column; }
  .winloss { grid-template-columns: 1fr; }
  .wl-donut { border-right: none; border-bottom: 1px solid var(--line-2); padding: 0 0 14px; }
}
