@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=IBM+Plex+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #161f33;
  --bg-card-hover: #1c2640;
  --border: #1e2a45;
  --border-accent: #2a3a5c;
  --text-primary: #e2e8f0;
  --text-secondary: #8892a8;
  --text-muted: #4a5568;
  --accent-green: #22c55e;
  --accent-green-dim: #16a34a;
  --accent-blue: #3b82f6;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --accent-teal: #14b8a6;
  --accent-purple: #a78bfa;
  --tier-1: #22c55e;
  --tier-2: #3b82f6;
  --tier-3: #f59e0b;
  --tier-4: #6b7280;
  --glow-green: rgba(34, 197, 94, 0.15);
  --glow-blue: rgba(59, 130, 246, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    linear-gradient(rgba(30, 42, 69, 0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 42, 69, 0.3) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

.dashboard {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 32px 48px;
}

/* -- HEADER -- */
.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.header-left h1 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.header-left h1 span.nano { color: var(--accent-green); }

.header-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 4px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: var(--accent-green);
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: pulse 2s ease-in-out infinite;
}

.status-badge.error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
  color: var(--accent-red);
}

.status-badge.error::before {
  background: var(--accent-red);
  animation: none;
}

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

.last-updated {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}

/* -- STATS ROW -- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  transition: border-color 0.2s;
}

.stat-card:hover { border-color: var(--border-accent); }

.stat-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-value.green { color: var(--accent-green); }
.stat-value.blue { color: var(--accent-blue); }
.stat-value.amber { color: var(--accent-amber); }
.stat-value.red { color: var(--accent-red); }
.stat-value.teal { color: var(--accent-teal); }

.stat-detail {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* -- MAIN GRID -- */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.panel-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title::before {
  content: '';
  width: 3px;
  height: 14px;
  border-radius: 2px;
}

.panel-title.green::before { background: var(--accent-green); }
.panel-title.blue::before { background: var(--accent-blue); }
.panel-title.amber::before { background: var(--accent-amber); }
.panel-title.teal::before { background: var(--accent-teal); }
.panel-title.purple::before { background: var(--accent-purple); }
.panel-title.red::before { background: var(--accent-red); }

/* -- PIPELINE FUNNEL -- */
.full-width { grid-column: 1 / -1; }

.funnel {
  display: flex;
  align-items: stretch;
  gap: 2px;
  height: 90px;
}

.funnel-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: var(--bg-secondary);
  border-radius: 4px;
  padding: 8px 4px;
  transition: background 0.2s;
}

.funnel-stage:hover { background: var(--bg-card-hover); }

.funnel-stage .count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.funnel-stage .label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 6px;
}

.funnel-arrow {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 0 2px;
}

.funnel-stage:nth-child(1) { border-top: 2px solid var(--text-muted); }
.funnel-stage:nth-child(3) { border-top: 2px solid var(--accent-blue); }
.funnel-stage:nth-child(5) { border-top: 2px solid var(--accent-teal); }
.funnel-stage:nth-child(7) { border-top: 2px solid var(--accent-green); }
.funnel-stage:nth-child(9) { border-top: 2px solid var(--accent-amber); }
.funnel-stage:nth-child(11) { border-top: 2px solid var(--accent-purple); }
.funnel-stage:nth-child(13) { border-top: 2px solid var(--accent-green); }

/* -- TIER DISTRIBUTION -- */
.tier-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tier-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tier-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  width: 64px;
  flex-shrink: 0;
}

.tier-label.t1 { color: var(--tier-1); }
.tier-label.t2 { color: var(--tier-2); }
.tier-label.t3 { color: var(--tier-3); }
.tier-label.t4 { color: var(--tier-4); }

.tier-bar-track {
  flex: 1;
  height: 24px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.tier-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease-out;
  position: relative;
}

.tier-bar-fill.t1 { background: linear-gradient(90deg, var(--tier-1), #4ade80); }
.tier-bar-fill.t2 { background: linear-gradient(90deg, var(--tier-2), #60a5fa); }
.tier-bar-fill.t3 { background: linear-gradient(90deg, var(--tier-3), #fbbf24); }
.tier-bar-fill.t4 { background: linear-gradient(90deg, var(--tier-4), #9ca3af); }

.tier-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  width: 32px;
  text-align: right;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.tier-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* -- BAIT & SWITCH METER -- */
.bs-meter {
  text-align: center;
  padding: 12px 0;
}

.bs-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 56px;
  font-weight: 700;
  color: var(--accent-red);
  line-height: 1;
  margin-bottom: 4px;
}

.bs-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.bs-breakdown {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.bs-item { text-align: center; }

.bs-item-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
}

.bs-item-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* -- MARKET INTEL CARDS -- */
.intel-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.intel-card {
  background: var(--bg-secondary);
  border-radius: 6px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent-teal);
}

.intel-card-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-teal);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.intel-card-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.intel-card-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* -- ARCHITECTURE SECTION -- */
.arch-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 16px 0;
}

.arch-node {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 4px;
  border: 1px solid var(--border-accent);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  white-space: nowrap;
}

.arch-node.active {
  border-color: var(--accent-green);
  color: var(--accent-green);
  background: var(--glow-green);
}

.arch-arrow {
  color: var(--text-muted);
  font-size: 16px;
}

.arch-desc {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 12px;
  line-height: 1.6;
}

/* -- LOADING / ERROR -- */
.loading-skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-card-hover) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  height: 28px;
  width: 80px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.error-banner {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--accent-red);
}

.error-banner.visible { display: flex; }

/* -- FOOTER -- */
.footer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.footer-text a {
  color: var(--accent-green);
  text-decoration: none;
}

.footer-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* -- RESPONSIVE -- */
@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(3, 1fr); }
  .main-grid { grid-template-columns: 1fr; }
  .funnel { flex-wrap: wrap; height: auto; }
  .funnel-arrow { display: none; }
  .funnel-stage { min-width: 80px; padding: 12px; }
  .dashboard { padding: 16px; }
  .header { flex-direction: column; gap: 12px; }
  .header-right { align-items: flex-start; }
}

/* -- ANIMATIONS -- */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.stat-card, .panel {
  animation: fadeSlideIn 0.4s ease-out backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }
.stat-card:nth-child(5) { animation-delay: 0.25s; }
