/* ============================================================================
   BillBook · Growth — flagship founder metrics dashboard
   Dark, refined, Linear/Vercel/Stripe-grade. Hand-tuned tokens.
   ========================================================================== */

:root {
  /* ---- Palette: deep slate canvas + sophisticated teal/emerald accent ---- */
  --bg:          #07090c;   /* near-black, faint blue */
  --bg-2:        #0a0e13;   /* app frame */
  --panel:       #0e141b;   /* card surface */
  --panel-2:     #121a23;   /* raised surface / table head */
  --panel-hover: #16202b;
  --line:        #1b2530;   /* hairline border */
  --line-soft:   #141d26;
  --line-strong: #25323f;

  --ink:         #eef4f2;   /* primary text */
  --ink-2:       #aebbc4;   /* secondary */
  --ink-3:       #6f7e89;   /* tertiary / labels */
  --ink-4:       #47545e;   /* faint / disabled */

  /* Brand accent — BillBook teal→emerald, desaturated for a premium feel */
  --acc:         #2dd4bf;   /* teal-400 */
  --acc-2:       #34d399;   /* emerald-400 */
  --acc-deep:    #0f766e;   /* teal-700 */
  --acc-ink:     #062b27;   /* text on accent */
  --acc-glow:    rgba(45, 212, 191, .14);
  --acc-soft:    rgba(45, 212, 191, .08);

  /* Stage / semantic hues (for badges, funnel, charts) */
  --c-acq:    #60a5fa;  /* acquisition  — blue   */
  --c-act:    #2dd4bf;  /* activation   — teal   */
  --c-ret:    #a78bfa;  /* retention    — violet */
  --c-mon:    #34d399;  /* monetization — emerald*/
  --c-ref:    #fbbf24;  /* referral     — amber  */
  --c-warn:   #f87171;  /* error/down   — red    */
  --c-pos:    #34d399;
  --c-neg:    #f87171;

  /* Type */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  /* Radii / shadow */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.7);
  --ring: 0 0 0 1px var(--line), 0 0 0 4px rgba(45,212,191,.10);

  --maxw: 1320px;
}

/* ----------------------------------------------------------------- reset -- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
  min-height: 100vh;
}
/* Ambient gradient wash — subtle, expensive */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 480px at 88% -8%, rgba(45,212,191,.07), transparent 60%),
    radial-gradient(800px 520px at -6% 4%, rgba(52,211,153,.05), transparent 55%),
    radial-gradient(1200px 900px at 50% 120%, rgba(96,165,250,.04), transparent 60%);
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.mono { font-family: var(--font-mono); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #1d2935; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #293946; }
::selection { background: rgba(45,212,191,.28); color: #fff; }

/* =============================================================== layout == */
.app { max-width: var(--maxw); margin: 0 auto; padding: 0 22px 96px; }

/* ---------------------------------------------------------------- header -- */
.top {
  position: sticky; top: 0; z-index: 40;
  margin: 0 -22px 0;
  padding: 14px 22px;
  background: linear-gradient(180deg, rgba(7,9,12,.92), rgba(7,9,12,.72));
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.top-row { max-width: var(--maxw); margin: 0 auto; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--acc), var(--acc-2));
  box-shadow: 0 4px 14px -4px rgba(45,212,191,.6), inset 0 1px 0 rgba(255,255,255,.35);
}
.mark svg { width: 17px; height: 17px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-txt b { font-size: 14.5px; font-weight: 650; letter-spacing: -0.02em; }
.brand-txt b span { color: var(--ink-3); font-weight: 500; }
.brand-txt small { font-size: 11px; color: var(--ink-3); font-weight: 500; letter-spacing: .01em; }

.top-spacer { flex: 1; }

/* window segmented control */
.seg {
  display: inline-flex; align-items: center; padding: 3px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px;
  gap: 2px;
}
.seg button {
  padding: 6px 13px; font-size: 12.5px; font-weight: 550; color: var(--ink-3);
  border-radius: 8px; letter-spacing: -0.01em;
  transition: color .16s, background .16s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] {
  background: linear-gradient(180deg, #1a2530, #141d27);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-strong), 0 1px 2px rgba(0,0,0,.4);
}

.icon-btn {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  color: var(--ink-2); transition: all .16s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); background: var(--panel-hover); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.live {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px 6px 9px;
  font-size: 11.5px; color: var(--ink-2); font-weight: 550;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--acc-2); position: relative; }
.dot::after {
  content:""; position: absolute; inset: -4px; border-radius: 50%;
  background: var(--acc-2); opacity: .4; animation: ping 1.8s cubic-bezier(0,0,.2,1) infinite;
}
@keyframes ping { 75%,100% { transform: scale(2.4); opacity: 0; } }
.live.stale .dot { background: var(--ink-4); }
.live.stale .dot::after { display: none; }

/* ------------------------------------------------------------ KPI strip -- */
.kpis {
  display: grid; gap: 12px; margin: 24px 0 8px;
  grid-template-columns: repeat(4, 1fr) 1.5fr;
}
.kpi {
  position: relative; overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,.014), transparent 40%),
    var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 18px 15px;
  transition: border-color .2s, transform .2s;
}
.kpi:hover { border-color: var(--line-strong); }
.kpi-head { display: flex; align-items: center; gap: 8px; color: var(--ink-3); }
.kpi-head svg { width: 14px; height: 14px; opacity: .9; }
.kpi-label { font-size: 11.5px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.kpi-val {
  margin-top: 11px; font-size: 30px; font-weight: 680; letter-spacing: -0.03em;
  line-height: 1; color: var(--ink);
}
.kpi-val small { font-size: 16px; font-weight: 600; color: var(--ink-3); letter-spacing: -0.01em; }
.kpi-sub { margin-top: 7px; font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 7px;
  font-size: 11px; font-weight: 600; letter-spacing: -0.01em;
}
.chip.pos { color: var(--c-pos); background: rgba(52,211,153,.10); }
.chip.neg { color: var(--c-neg); background: rgba(248,113,113,.10); }
.chip.mut { color: var(--ink-3); background: rgba(255,255,255,.04); }
.kpi-accent { color: var(--acc); }
/* sparkline tucked in the corner */
.kpi .spark { position: absolute; right: 14px; top: 16px; width: 76px; height: 30px; opacity: .85; }

/* the goal KPI spans wider */
.kpi.goal { display: flex; flex-direction: column; }
.goal-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.goal-pct { font-size: 13px; font-weight: 650; color: var(--acc); font-variant-numeric: tabular-nums; }
.bar { margin-top: auto; padding-top: 14px; }
.bar-track {
  height: 9px; border-radius: 999px; background: #0a1117;
  box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; position: relative;
}
.bar-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--acc-deep), var(--acc) 60%, var(--acc-2));
  box-shadow: 0 0 18px var(--acc-glow);
  width: 0; transition: width 1.1s cubic-bezier(.22,1,.36,1);
  position: relative;
}
.bar-fill::after {
  content:""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent);
  transform: translateX(-100%); animation: sheen 2.6s ease-in-out 1s infinite;
}
@keyframes sheen { 60%,100% { transform: translateX(120%); } }
.goal-scale { display: flex; justify-content: space-between; margin-top: 7px; font-size: 10.5px; color: var(--ink-4); font-variant-numeric: tabular-nums; }

/* ============================================================== sections == */
.section { margin-top: 30px; }
.sec-head { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.sec-head h2 { font-size: 13.5px; font-weight: 600; letter-spacing: .01em; color: var(--ink); }
.sec-head .kicker {
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--acc); padding: 3px 8px; border-radius: 6px; background: var(--acc-soft);
}
.sec-head .hint { font-size: 12px; color: var(--ink-4); margin-left: auto; }

.card {
  background:
    linear-gradient(180deg, rgba(255,255,255,.012), transparent 30%),
    var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px; position: relative;
}
.card.flush { padding: 0; overflow: hidden; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ------------------------------------------------------------- FUNNEL --- */
.card.funnel { padding: 26px 26px 18px; }
.funnel-stats { display: flex; gap: 26px; margin-bottom: 22px; flex-wrap: wrap; }
.fstat small { display: block; font-size: 11px; color: var(--ink-3); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.fstat b { font-size: 19px; font-weight: 680; letter-spacing: -0.02em; }
.fstat b span { font-size: 12.5px; color: var(--ink-3); font-weight: 550; }

.funnel-rows { display: flex; flex-direction: column; gap: 3px; }
.frow {
  display: grid; grid-template-columns: 156px 1fr 120px; align-items: center; gap: 14px;
  padding: 5px 0;
}
.frow .flabel { display: flex; align-items: center; gap: 9px; min-width: 0; }
.frow .flabel .fi {
  width: 9px; height: 9px; border-radius: 3px; flex: none;
}
.frow .flabel span { font-size: 12.5px; color: var(--ink-2); font-weight: 540; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fbar-wrap { position: relative; height: 40px; display: flex; align-items: center; }
.fbar {
  height: 40px; border-radius: 9px; min-width: 3px;
  display: flex; align-items: center; padding: 0 13px;
  font-variant-numeric: tabular-nums; font-weight: 650; font-size: 13.5px; color: #051a17;
  position: relative; overflow: hidden;
  transition: width 1s cubic-bezier(.22,1,.36,1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 6px 16px -8px rgba(0,0,0,.5);
}
.fbar::after {
  content:""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,.10), transparent 45%);
}
.fbar .fcount { position: relative; z-index: 1; }
.frow .frate {
  font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-3);
  display: flex; align-items: center; gap: 6px; justify-content: flex-end;
}
.frow .frate b { color: var(--ink); font-weight: 620; }
.frate .drop { color: var(--c-neg); font-size: 11px; }
.frow .frate.first b { color: var(--acc-2); }
/* connector */
.frow.conn { padding: 0; }
.conn-cell { grid-column: 2; font-size: 11px; color: var(--ink-4); padding-left: 13px; display: flex; align-items: center; gap: 6px; height: 16px; }
.conn-cell svg { width: 11px; height: 11px; }

/* ------------------------------------------------------------- charts --- */
.chart-card h3 { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.chart-meta { display: flex; align-items: baseline; gap: 10px; margin: 2px 0 14px; }
.chart-big { font-size: 24px; font-weight: 680; letter-spacing: -0.02em; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-3); font-weight: 540; }
.legend i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.chart-svg { width: 100%; height: 150px; overflow: visible; }
.axis-x { display: flex; justify-content: space-between; margin-top: 8px; font-size: 10px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.gridline { stroke: var(--line-soft); stroke-width: 1; }
.gridline.zero { stroke: var(--line); }
.axis-lbl { fill: var(--ink-4); font-size: 9.5px; font-variant-numeric: tabular-nums; }
.dot-hover { fill: var(--acc); stroke: var(--bg); stroke-width: 2.5; opacity: 0; transition: opacity .12s; }

/* tooltip */
.tip {
  position: fixed; z-index: 80; pointer-events: none; opacity: 0;
  transform: translate(-50%, -118%); transition: opacity .1s;
  background: #0b1118; border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 9px 11px; box-shadow: var(--shadow-lg); min-width: 120px;
  font-variant-numeric: tabular-nums;
}
.tip .tip-d { font-size: 10.5px; color: var(--ink-3); margin-bottom: 6px; font-weight: 600; }
.tip .tip-r { display: flex; align-items: center; gap: 7px; font-size: 12px; margin-top: 3px; }
.tip .tip-r i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.tip .tip-r span { color: var(--ink-3); }
.tip .tip-r b { margin-left: auto; color: var(--ink); font-weight: 620; }

/* --------------------------------------------------------------- tables -- */
.tbl-wrap { overflow-x: auto; }
table.data { font-size: 12.5px; }
table.data thead th {
  text-align: left; padding: 11px 16px; font-size: 10.5px; font-weight: 650;
  letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3);
  background: var(--panel-2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; white-space: nowrap; user-select: none;
}
table.data thead th.sortable { cursor: pointer; transition: color .15s; }
table.data thead th.sortable:hover { color: var(--ink); }
table.data thead th.r { text-align: right; }
table.data thead th .arr { opacity: 0; margin-left: 4px; font-size: 9px; transition: opacity .15s; }
table.data thead th.act .arr { opacity: 1; color: var(--acc); }
table.data tbody td { padding: 11px 16px; border-bottom: 1px solid var(--line-soft); color: var(--ink-2); white-space: nowrap; vertical-align: middle; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: rgba(255,255,255,.018); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td.r { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.strong { color: var(--ink); font-weight: 600; }
.src { display: inline-flex; align-items: center; gap: 8px; }
.src .pip { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.muted { color: var(--ink-4); }
.pct-cell { color: var(--ink-3); font-size: 11.5px; }
.pct-cell b { color: var(--ink-2); font-weight: 600; }
/* mini inline conversion bar in cells */
.minibar { display: inline-block; width: 46px; height: 5px; border-radius: 3px; background: #0e1620; overflow: hidden; vertical-align: middle; margin-left: 8px; }
.minibar i { display: block; height: 100%; background: var(--acc); border-radius: 3px; }
.flag { font-size: 15px; line-height: 1; filter: saturate(1.1); }
.ltv { color: var(--acc-2); font-weight: 600; }

/* ------------------------------------------------------------ retention - */
.cohort { overflow-x: auto; padding-bottom: 4px; }
.ch-grid { display: grid; gap: 4px; align-content: start; grid-auto-rows: 34px; width: max-content; min-width: 100%; }
.ch-grid > * { min-height: 0; }
.ch-h { font-size: 10px; font-weight: 600; color: var(--ink-3); text-align: center; padding: 2px 0 4px; align-self: end; white-space: nowrap; }
.ch-h.ch-lbl, .ch-h.ch-size { color: var(--ink-2); }
.ch-cell {
  height: 34px; display: grid; place-items: center; border-radius: 6px;
  font-size: 11px; font-variant-numeric: tabular-nums; font-weight: 600;
  transition: transform .12s, box-shadow .12s; cursor: default;
}
.ch-cell:hover { transform: scale(1.09); box-shadow: 0 0 0 1.5px rgba(255,255,255,.3); position: relative; z-index: 2; }
.ch-cell.empty { background: var(--panel-2); color: var(--ink-4); font-weight: 400; }
.ch-lbl { display: grid; align-items: center; justify-content: end; padding-right: 12px; color: var(--ink-2); font-weight: 500; font-size: 11.5px; white-space: nowrap; }
.ch-size { display: grid; align-items: center; justify-content: start; padding-left: 2px; color: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.heat-key { display: flex; align-items: center; gap: 9px; margin-top: 14px; font-size: 11px; color: var(--ink-3); }
.heat-grad { width: 130px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #0e1f24, #14524d, #1d8a76, #2dd4bf); }

/* --------------------------------------------------------------- events -- */
.events { display: flex; flex-direction: column; gap: 2px; }
.ev {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 14px;
  padding: 11px 4px; border-bottom: 1px solid var(--line-soft); transition: background .12s;
  border-radius: 8px;
}
.ev:hover { background: rgba(255,255,255,.018); }
.ev:last-child { border-bottom: none; }
.ev-name { display: flex; align-items: center; gap: 11px; min-width: 0; }
.ev-rank { width: 22px; font-size: 11px; color: var(--ink-4); font-variant-numeric: tabular-nums; flex: none; }
.ev-name b { font-weight: 550; color: var(--ink); font-size: 13px; }
.ev-name .ev-mono { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); }
.badge {
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px; white-space: nowrap;
}
.b-acquisition  { color: var(--c-acq); background: rgba(96,165,250,.12); }
.b-activation   { color: var(--c-act); background: rgba(45,212,191,.12); }
.b-retention    { color: var(--c-ret); background: rgba(167,139,250,.12); }
.b-monetization { color: var(--c-mon); background: rgba(52,211,153,.12); }
.b-referral     { color: var(--c-ref); background: rgba(251,191,36,.12); }
.b-other        { color: var(--ink-3); background: rgba(255,255,255,.05); }
.ev-uniques { font-variant-numeric: tabular-nums; font-weight: 650; font-size: 13.5px; min-width: 64px; text-align: right; }
.ev-uniques small { color: var(--ink-4); font-weight: 500; font-size: 11px; margin-left: 3px; }

/* ----------------------------------------------------- REWARDS & LOOPS -- */
/* config pills — three program switches at a glance */
.prog-pills { display: flex; flex-wrap: wrap; gap: 10px; }
.ppill {
  display: flex; align-items: center; gap: 11px; flex: 1 1 240px; min-width: 0;
  padding: 13px 15px; border-radius: var(--r); border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.012), transparent 40%), var(--panel);
  transition: border-color .2s;
}
.ppill.on { border-color: rgba(45,212,191,.34); background: linear-gradient(180deg, var(--acc-soft), transparent 70%), var(--panel); }
.ppill .pp-ico { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--panel-2); color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); }
.ppill.on .pp-ico { background: linear-gradient(150deg, var(--acc), var(--acc-2)); color: var(--acc-ink); box-shadow: 0 4px 14px -5px rgba(45,212,191,.55), inset 0 1px 0 rgba(255,255,255,.3); }
.ppill .pp-ico svg { width: 17px; height: 17px; }
.ppill .pp-body { min-width: 0; flex: 1; }
.ppill .pp-name { font-size: 12.5px; font-weight: 620; color: var(--ink); letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.ppill .pp-terms { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-state { font-size: 9.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; flex: none; }
.pp-state.is-on  { color: var(--acc-ink); background: var(--acc); }
.pp-state.is-off { color: var(--ink-3); background: rgba(255,255,255,.05); }

/* small status dot (used next to "partner codes" header) */
.prog-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--ink-4); box-shadow: 0 0 0 3px rgba(255,255,255,.03); }
.prog-dot.on { background: var(--acc-2); box-shadow: 0 0 0 3px var(--acc-soft); }

/* "everything off" launch-reality note */
.reward-off {
  display: flex; align-items: flex-start; gap: 13px; margin-top: 14px;
  padding: 15px 17px; border-radius: var(--r);
  background: var(--acc-soft); border: 1px solid rgba(45,212,191,.18);
}
.reward-off svg { width: 22px; height: 22px; flex: none; color: var(--acc); margin-top: 1px; }
.reward-off b { font-size: 13px; font-weight: 620; color: var(--ink); }
.reward-off p { font-size: 12px; color: var(--ink-3); margin-top: 3px; line-height: 1.5; }
.reward-off code { font-family: var(--font-mono); font-size: 11px; color: var(--acc-2); background: rgba(45,212,191,.10); padding: 1px 5px; border-radius: 5px; }

.reward-card h3 { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }

/* grants-by-type bars */
.grant-bars { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }
.grant-row { display: grid; grid-template-columns: 88px 1fr auto; align-items: center; gap: 11px; }
.grant-row .g-lbl { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-2); font-weight: 540; white-space: nowrap; }
.grant-row .g-lbl i { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.grant-track { height: 8px; border-radius: 999px; background: #0a1117; box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.grant-track i { display: block; height: 100%; border-radius: 999px; width: 0; transition: width 1s cubic-bezier(.22,1,.36,1); }
.grant-row .g-val { font-size: 12.5px; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }
.grant-row.total { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.grant-row.total .g-lbl { color: var(--ink); font-weight: 620; }
.grant-row.total .g-val { color: var(--acc-2); }

.reward-foot { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line-soft); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.reward-val { font-size: 18px; font-weight: 680; color: var(--ink); letter-spacing: -0.02em; }
.reward-val-lbl { font-size: 11px; color: var(--ink-4); }

/* founder progress card */
.founder-prog { margin-top: 2px; }
.founder-prog .bar { padding-top: 12px; }
.reward-note { font-size: 11.5px; color: var(--ink-4); margin-top: 11px; line-height: 1.45; }

/* referral mini-funnel — reuses the funnel bar aesthetic, compact */
.ref-funnel { display: flex; flex-direction: column; gap: 9px; margin-top: 2px; }
.rstep { display: grid; grid-template-columns: 84px 1fr; align-items: center; gap: 11px; }
.rstep .r-lbl { font-size: 11.5px; color: var(--ink-2); font-weight: 540; }
.rstep .r-lbl small { display: block; color: var(--ink-4); font-size: 10px; font-weight: 500; }
.rbar-wrap { position: relative; height: 30px; display: flex; align-items: center; }
.rbar {
  height: 30px; border-radius: 8px; min-width: 3px; display: flex; align-items: center; padding: 0 11px;
  font-variant-numeric: tabular-nums; font-weight: 650; font-size: 12.5px; color: #051a17;
  width: 0; transition: width 1s cubic-bezier(.22,1,.36,1); position: relative; overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 5px 14px -8px rgba(0,0,0,.5);
}
.rbar::after { content:""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255,255,255,.10), transparent 45%); }
.rbar .rcount { position: relative; z-index: 1; }
.rbar.empty { background: var(--panel-2) !important; color: var(--ink-4); box-shadow: inset 0 0 0 1px var(--line); justify-content: flex-start; }
.rstep .r-conv { font-size: 11px; color: var(--ink-4); font-variant-numeric: tabular-nums; }

/* partner codes table — reuse table.data; code in mono */
td .code-mono { font-family: var(--font-mono); font-size: 12px; color: var(--ink); letter-spacing: .01em; }
.pcode-redeem { font-variant-numeric: tabular-nums; }
.pcode-redeem .pc-max { color: var(--ink-4); }
.tag-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.tag-badge.on  { color: var(--c-act); background: rgba(45,212,191,.12); }
.tag-badge.off { color: var(--ink-3); background: rgba(255,255,255,.05); }
.tag-badge .tb-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============================================================== states === */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 38px 20px; color: var(--ink-3); gap: 10px; min-height: 130px;
}
.empty svg { width: 30px; height: 30px; opacity: .5; color: var(--ink-4); }
.empty b { font-weight: 600; color: var(--ink-2); font-size: 13px; }
.empty p { font-size: 12px; color: var(--ink-4); max-width: 280px; }

.skel { background: linear-gradient(90deg, #0e141b 25%, #131c25 50%, #0e141b 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* gate / key prompt overlay */
.gate {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(900px 500px at 50% -10%, rgba(45,212,191,.10), transparent 60%), var(--bg);
}
.gate-card {
  width: 100%; max-width: 400px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-xl); padding: 30px 28px;
  box-shadow: var(--shadow-lg); text-align: center;
}
.gate-mark { width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 18px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--acc), var(--acc-2));
  box-shadow: 0 10px 30px -8px rgba(45,212,191,.55), inset 0 1px 0 rgba(255,255,255,.4); }
.gate-mark svg { width: 26px; height: 26px; }
.gate-card h1 { font-size: 18px; font-weight: 660; letter-spacing: -0.02em; }
.gate-card h1 span { color: var(--ink-3); font-weight: 500; }
.gate-card p { font-size: 13px; color: var(--ink-3); margin: 8px 0 22px; line-height: 1.55; }
.gate-form { display: flex; flex-direction: column; gap: 10px; }
.gate-input {
  width: 100%; padding: 12px 14px; font-size: 13.5px; color: var(--ink);
  background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 11px;
  font-family: var(--font-mono); letter-spacing: .02em; transition: border-color .15s, box-shadow .15s;
}
.gate-input::placeholder { color: var(--ink-4); font-family: var(--font-sans); letter-spacing: 0; }
.gate-input:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 4px var(--acc-soft); }
.btn {
  padding: 12px 18px; font-size: 13.5px; font-weight: 620; border-radius: 11px;
  background: linear-gradient(180deg, var(--acc), #25b8a5); color: var(--acc-ink);
  box-shadow: 0 6px 18px -6px rgba(45,212,191,.5), inset 0 1px 0 rgba(255,255,255,.3);
  transition: transform .12s, filter .15s; letter-spacing: -0.01em;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--panel); color: var(--ink-2); border: 1px solid var(--line-strong); box-shadow: none; }
.btn.ghost:hover { background: var(--panel-hover); color: var(--ink); }
.gate-err {
  font-size: 12.5px; color: var(--c-warn); display: none; align-items: center; gap: 7px;
  justify-content: center; padding: 9px; background: rgba(248,113,113,.08);
  border: 1px solid rgba(248,113,113,.2); border-radius: 9px;
}
.gate-err.show { display: flex; }
.gate-err svg { width: 14px; height: 14px; flex: none; }
.gate-foot { margin-top: 18px; font-size: 11px; color: var(--ink-4); }

/* page-level error banner */
.banner {
  display: none; align-items: center; gap: 12px; padding: 13px 16px; margin: 18px 0 0;
  background: rgba(248,113,113,.06); border: 1px solid rgba(248,113,113,.22); border-radius: 12px;
  font-size: 13px; color: #fcaca5;
}
.banner.show { display: flex; }
.banner svg { width: 17px; height: 17px; flex: none; color: var(--c-warn); }
.banner .btn { padding: 7px 13px; font-size: 12px; margin-left: auto; flex: none; }

/* generic loading veil for the body */
.loading .card, .loading .kpi { position: relative; }
body.is-loading .grid-cloak { opacity: .35; pointer-events: none; transition: opacity .2s; }

footer { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line-soft);
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  font-size: 11.5px; color: var(--ink-4); }
footer code { font-family: var(--font-mono); color: var(--ink-3); font-size: 11px; }
footer .endpoint { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; overflow: hidden; }
footer .endpoint span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================ responsive = */
@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpis .goal { grid-column: 1 / -1; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .app { padding: 0 14px 70px; }
  .top { padding: 12px 14px; margin: 0 -14px; }
  .top-row { flex-wrap: wrap; gap: 10px; }
  .top-spacer { display: none; }
  .seg { order: 3; flex: 1; justify-content: space-between; }
  .seg button { flex: 1; text-align: center; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 9px; }
  .kpi-val { font-size: 24px; }
  .kpi .spark { display: none; }
  .frow { grid-template-columns: 96px 1fr; }
  .frow .frate { display: none; }
  .frow .flabel span { font-size: 11.5px; }
  .funnel-stats { gap: 16px; }
  .card { padding: 16px; }
  .card.funnel { padding: 18px 16px; }
  .sec-head .hint { display: none; }
  .brand-txt small { display: none; }
}
@media (max-width: 420px) {
  .kpis { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
