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

:root {
  --bg: #0a0b10;
  --surface: #12131a;
  --surface-2: #1a1b26;
  --border: #1e2030;
  --border-hover: #2a2d3e;
  --text: #e0e0e0;
  --text-dim: #888;
  --text-muted: #555;
  --accent: #00e5ff;
  --accent-dim: rgba(0, 229, 255, 0.12);
  --danger: #ff5252;
  --danger-dim: rgba(255, 82, 82, 0.12);
  --success: #3dd68c;
  --warning: #ffcc4d;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
  --radius: 10px;
  --radius-sm: 6px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 11, 16, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.topbar-brand svg { flex-shrink: 0; }

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.topbar-sub {
  font-size: 12px;
  color: var(--text-dim);
  display: none;
}

@media (min-width: 640px) {
  .topbar-sub { display: inline; margin-left: 8px; }
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

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

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

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

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

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

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

.stat-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}

.stat-value.accent { color: var(--accent); }
.stat-value.danger { color: var(--danger); }

.stat-detail {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Section headers */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.section-subtitle {
  font-size: 12px;
  color: var(--text-dim);
}

/* Charts */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

@media (max-width: 768px) {
  .charts-row { grid-template-columns: 1fr; }
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.chart-card canvas {
  width: 100% !important;
  max-height: 280px;
}

/* Table */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 28px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

tbody tr { cursor: pointer; transition: background 0.15s; }

/* Badges */
.eco-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
  text-transform: lowercase;
}

.eco-badge.npm { background: rgba(203, 56, 55, 0.15); color: #e05555; }
.eco-badge.pypi { background: rgba(55, 118, 171, 0.15); color: #5b9bd5; }
.eco-badge.go { background: rgba(0, 173, 216, 0.15); color: #00bcd4; }
.eco-badge.crates { background: rgba(222, 165, 43, 0.15); color: #dea52b; }

.lag-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--mono);
}

.lag-badge.stealth { background: var(--danger-dim); color: var(--danger); }
.lag-badge.normal { background: var(--accent-dim); color: var(--accent); }
.lag-badge.unknown { background: rgba(255,255,255,0.05); color: var(--text-dim); }

/* Links in table */
.link-group {
  display: flex;
  gap: 8px;
}

.link-group a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 12px;
  transition: color 0.15s;
}

.link-group a:hover { color: var(--accent); }

/* Loading state */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-state p { margin-bottom: 8px; }

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover { border-color: var(--border-hover); color: var(--text); }
.filter-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* Footer */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

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

/* Responsive */
@media (max-width: 640px) {
  .container { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 24px; }
  table { font-size: 12px; }
  thead th, tbody td { padding: 8px 10px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }
