/* ─── Dashboard layout ─────────────────────────────────────────────────────── */

.dash-body {
  background: var(--bg);
  min-height: 100vh;
}

/* ─── Nav ─────────────────────────────────────────────────────────────────── */
.dash-nav {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 32px;
  height: 60px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 100;
}

.dash-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--fg);
  text-decoration: none;
}

.brand-icon {
  color: var(--accent);
  font-size: 1.2rem;
}

.nav-links {
  display: flex;
  gap: 4px;
  margin-right: auto;
}

.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover, .nav-link.active {
  color: var(--fg);
  background: var(--accent-dim);
}

.nav-link.active {
  color: var(--accent);
}

.nav-meta {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* ─── Main ────────────────────────────────────────────────────────────────── */
.dash-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 36px;
}

.dash-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  line-height: 1.1;
}

.dash-subtitle {
  color: var(--fg-muted);
  font-size: 0.9rem;
  margin-top: 6px;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--accent-dim);
  border: 1px solid rgba(62, 207, 142, 0.2);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: 1px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ─── KPI Grid ────────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  transition: border-color 0.25s;
}

.kpi-card:hover {
  border-color: rgba(62, 207, 142, 0.2);
}

.kpi-primary {
  border-color: rgba(62, 207, 142, 0.3);
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(62,207,142,0.04) 100%);
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--fg-muted);
  text-transform: uppercase;
  margin-bottom: 12px;
  font-family: 'Space Grotesk', sans-serif;
}

.kpi-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
  line-height: 1;
}

.kpi-value-md {
  font-size: 1.75rem;
  color: var(--fg);
}

.kpi-sub {
  margin-top: 10px;
  font-size: 0.82rem;
}

.kpi-muted {
  color: var(--fg-muted);
}

.badge-green {
  background: rgba(62, 207, 142, 0.12);
  color: #3ecf8e;
  padding: 3px 10px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.8rem;
}

.badge-blue {
  background: rgba(99, 179, 237, 0.12);
  color: #63b3ed;
  padding: 3px 10px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.8rem;
}

.color-green { color: #3ecf8e; }
.color-amber { color: #f6ad55; }
.color-red   { color: #f87171; }

/* ─── Row layout ──────────────────────────────────────────────────────────── */
.dash-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* ─── Panels ──────────────────────────────────────────────────────────────── */
.dash-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 28px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.panel-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
}

.panel-meta {
  font-size: 0.78rem;
  color: var(--fg-muted);
}

/* ─── Chart ───────────────────────────────────────────────────────────────── */
.chart-panel {
  display: flex;
  flex-direction: column;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--fg-muted);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.accent { background: #3ecf8e; }
.legend-dot.green  { background: #4ade80; }
.legend-dot.red    { background: #f87171; }

.chart-wrap {
  flex: 1;
  height: 240px;
  position: relative;
}

/* ─── Tier breakdown ──────────────────────────────────────────────────────── */
.tier-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tier-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.tier-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tier-count {
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.tier-mrr {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
}

.tier-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 100px;
  font-family: 'Space Grotesk', sans-serif;
}

.tier-enterprise { background: rgba(167, 139, 250, 0.15); color: #a78bfa; }
.tier-pro        { background: rgba(62, 207, 142, 0.12);  color: #3ecf8e; }
.tier-standard   { background: rgba(148, 163, 184, 0.12); color: #94a3b8; }

/* ─── Customer lists ──────────────────────────────────────────────────────── */
.customer-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.customer-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.customer-row:hover {
  background: var(--bg-elevated);
}

.customer-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.customer-avatar.risk {
  background: rgba(248, 113, 113, 0.1);
  color: #f87171;
}

.customer-info {
  flex: 1;
  min-width: 0;
}

.customer-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.customer-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-top: 1px;
}

.customer-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.customer-mrr {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
}

.risk-mrr { color: #f87171; }

.customer-days {
  font-size: 0.72rem;
  color: var(--fg-muted);
}

.tier-badge-inline {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 100px;
  font-family: 'Space Grotesk', sans-serif;
}

.status-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 100px;
  font-family: 'Space Grotesk', sans-serif;
  margin-right: 4px;
}

.status-churned { background: rgba(248,113,113,0.12); color: #f87171; }
.status-trial   { background: rgba(251,191,36,0.12); color: #fbbf24; }
.status-active  { background: rgba(62,207,142,0.12); color: #3ecf8e; }

.empty-state {
  color: var(--fg-muted);
  font-size: 0.875rem;
  padding: 12px 0;
  text-align: center;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .kpi-primary {
    grid-column: span 3;
  }

  .dash-row {
    grid-template-columns: 1fr;
  }

  .chart-wrap {
    height: 200px;
  }
}

@media (max-width: 640px) {
  .dash-nav {
    padding: 0 16px;
    gap: 16px;
  }

  .nav-meta { display: none; }

  .dash-main {
    padding: 24px 16px 60px;
  }

  .dash-header {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .kpi-primary {
    grid-column: span 2;
  }

  .kpi-value { font-size: 2rem; }

  .dash-panel {
    padding: 20px;
  }
}
