/* ── RESET & BASE ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #080D1A;
  --surface:   #0E1628;
  --card:      #111D33;
  --card-hover:#152240;
  --border:    #1A2A44;
  --blue:      #1A6BFF;
  --blue-glow: rgba(26,107,255,0.18);
  --cyan:      #00D4FF;
  --green:     #22C55E;
  --red:       #EF4444;
  --amber:     #EAB308;
  --white:     #FFFFFF;
  --lgrey:     #C8D0E0;
  --mgrey:     #8899BB;
  --dgrey:     #3A4A66;
  --font:      'Inter', sans-serif;
  --mono:      'JetBrains Mono', monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--lgrey);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── TOP NAV ──────────────────────────────────────────────────────────────── */
.topnav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  height: 56px;
  background: rgba(8,13,26,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-brand { display: flex; align-items: center; gap: 12px; }

.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 10px var(--blue);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { box-shadow: 0 0 6px var(--blue); }
  50%      { box-shadow: 0 0 18px var(--blue), 0 0 30px rgba(26,107,255,0.4); }
}

.brand-name {
  font-size: 18px; font-weight: 800; letter-spacing: 2px;
  color: var(--white);
}
.brand-accent { color: var(--blue); }
.brand-tag {
  font-size: 11px; font-weight: 500; color: var(--mgrey);
  letter-spacing: 1px; text-transform: uppercase;
  padding: 3px 8px; border: 1px solid var(--border); border-radius: 4px;
}

.nav-meta { display: flex; align-items: center; gap: 16px; }

.nav-badge {
  font-size: 11px; font-weight: 600; letter-spacing: 1px;
  padding: 3px 10px; border-radius: 20px;
}
.nav-badge.live {
  background: rgba(34,197,94,0.15);
  color: var(--green);
  border: 1px solid rgba(34,197,94,0.3);
  animation: live-blink 2s ease-in-out infinite;
}
@keyframes live-blink {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.6; }
}

.nav-date { font-size: 12px; color: var(--mgrey); }
.nav-conf {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--amber); opacity: 0.8;
}

/* ── KPI ROW ──────────────────────────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}

.kpi-card {
  background: var(--surface);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: background 0.2s;
}
.kpi-card:hover { background: var(--card-hover); }
.kpi-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--border);
}
.kpi-card.primary::before { background: var(--blue); }
.kpi-card.highlight-green::before { background: var(--green); }

.kpi-label {
  font-size: 10px; font-weight: 600; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--mgrey);
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 32px; font-weight: 800; color: var(--white);
  line-height: 1; margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}
.kpi-unit { font-size: 18px; font-weight: 600; color: var(--mgrey); }
.kpi-delta {
  font-size: 12px; font-weight: 600; margin-bottom: 4px;
}
.kpi-delta.up { color: var(--green); }
.kpi-delta.down { color: var(--red); }
.kpi-sub { font-size: 11px; color: var(--mgrey); }

/* ── DASHBOARD GRID ───────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 20px 24px;
  max-width: 1600px;
  margin: 0 auto;
}

/* ── CARDS ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover {
  border-color: rgba(26,107,255,0.3);
  box-shadow: 0 0 24px rgba(26,107,255,0.06);
}
.card.span-2 { grid-column: span 2; }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-header h2 {
  font-size: 14px; font-weight: 700; color: var(--white);
  letter-spacing: 0.3px;
}
.card-badge {
  font-size: 10px; font-weight: 600; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--mgrey);
  padding: 3px 8px; border: 1px solid var(--border); border-radius: 4px;
}

/* ── CHART WRAPPERS ───────────────────────────────────────────────────────── */
.chart-wrap { position: relative; height: 280px; }
.chart-wrap.tall { height: 340px; }

/* ── FUNNEL ───────────────────────────────────────────────────────────────── */
.funnel-wrap {
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px 0;
}

.funnel-stage {
  display: flex; align-items: center; gap: 12px;
}
.funnel-bar-wrap {
  flex: 1; height: 36px; background: var(--surface);
  border-radius: 4px; overflow: hidden; position: relative;
}
.funnel-bar {
  height: 100%; border-radius: 4px;
  display: flex; align-items: center; padding-left: 12px;
  font-size: 12px; font-weight: 700; color: var(--white);
  transition: width 1s ease;
}
.funnel-label {
  width: 130px; font-size: 11px; color: var(--mgrey);
  text-align: right; flex-shrink: 0;
}
.funnel-count {
  width: 50px; font-size: 12px; font-weight: 700;
  color: var(--white); text-align: right; flex-shrink: 0;
  font-family: var(--mono);
}

/* ── HEALTH TABLE ─────────────────────────────────────────────────────────── */
.health-table { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }

.health-row {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  align-items: center; padding: 10px 12px;
  border-radius: 6px; gap: 8px;
}
.health-row.header {
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--mgrey);
  background: transparent; padding-bottom: 6px;
}
.health-row:not(.header) { background: var(--surface); }
.health-row.total { background: rgba(26,107,255,0.08); border: 1px solid rgba(26,107,255,0.2); }

.tier {
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  padding: 2px 8px; border-radius: 4px; display: inline-block;
}
.tier.enterprise { background: rgba(26,107,255,0.2); color: var(--cyan); }
.tier.professional { background: rgba(0,212,255,0.1); color: var(--cyan); }
.tier.starter { background: rgba(234,179,8,0.1); color: var(--amber); }
.tier.total-label { background: transparent; color: var(--white); font-size: 12px; }

.nps-badge {
  font-size: 13px; font-weight: 800; font-family: var(--mono);
  padding: 2px 6px; border-radius: 4px;
}
.nps-badge.high { color: var(--green); }
.nps-badge.med  { color: var(--amber); }

.nrr-badge {
  font-size: 12px; font-weight: 700; color: var(--cyan);
  font-family: var(--mono);
}

.risk-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  padding: 2px 7px; border-radius: 10px;
}
.risk-badge.none { background: rgba(34,197,94,0.15); color: var(--green); }
.risk-badge.low  { background: rgba(234,179,8,0.15);  color: var(--amber); }

.zero-churn-badge {
  display: flex; align-items: center; gap: 8px;
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: 6px; padding: 10px 14px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
  color: var(--green);
}
.zc-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  flex-shrink: 0;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

/* ── TIMELINE ─────────────────────────────────────────────────────────────── */
.timeline {
  display: flex; flex-direction: column; gap: 0;
  position: relative; padding-left: 28px;
}
.timeline::before {
  content: '';
  position: absolute; left: 7px; top: 8px; bottom: 8px;
  width: 2px; background: var(--border);
}

.tl-item {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 12px 0; position: relative;
}

.tl-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--dgrey); border: 2px solid var(--border);
  flex-shrink: 0; margin-top: 2px;
  position: absolute; left: -28px;
}
.tl-item.done .tl-dot {
  background: var(--blue); border-color: var(--blue);
  box-shadow: 0 0 8px rgba(26,107,255,0.5);
}
.tl-item.done.active .tl-dot.pulse {
  background: var(--green); border-color: var(--green);
  box-shadow: 0 0 12px var(--green);
  animation: pulse-tl 1.5s ease-in-out infinite;
}
@keyframes pulse-tl {
  0%,100% { box-shadow: 0 0 8px var(--green); }
  50%      { box-shadow: 0 0 20px var(--green), 0 0 35px rgba(34,197,94,0.3); }
}
.tl-item.future .tl-dot.future-dot {
  background: transparent; border-color: var(--dgrey);
  border-style: dashed;
}

.tl-content { flex: 1; }
.tl-date {
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--mgrey); margin-bottom: 3px;
}
.tl-item.done.active .tl-date { color: var(--green); }
.tl-item.future .tl-date { color: var(--dgrey); }

.tl-title {
  font-size: 13px; font-weight: 700; color: var(--white); margin-bottom: 3px;
}
.tl-item.future .tl-title { color: var(--mgrey); }

.tl-desc { font-size: 11px; color: var(--mgrey); line-height: 1.5; }

/* ── FOOTER ───────────────────────────────────────────────────────────────── */
.dash-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  font-size: 11px; color: var(--mgrey);
  background: var(--surface);
  margin-top: 8px;
}
.footer-conf { color: var(--amber); font-weight: 600; letter-spacing: 0.5px; }

/* ── SCROLLBAR ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--dgrey); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--blue); }

/* ── RESPONSIVE ───────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .card.span-2 { grid-column: span 1; }
}
@media (max-width: 640px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .topnav { padding: 0 16px; }
  .dashboard-grid { padding: 12px; gap: 12px; }
}