:root {
  --bg: #0a0e12;
  --card: #141a22;
  --border: #1f2a33;
  --text: #dfe9f0;
  --muted: #5e7a8a;
  --accent: #1e90ff;
  --accent-bg: #0a1f3f;
  --accent-deep: #1d4ed8;
  --positive: #22c55e;
  --warning: #facc15;
  --negative: #ef4444;
}

* { box-sizing: border-box; }
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

.hero {
  text-align: center;
  padding: 48px 24px 24px;
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  margin: 0;
  font-size: 36px;
  letter-spacing: 0.04em;
  color: var(--accent);
  font-weight: 700;
}
.hero-meta {
  margin-top: 8px;
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
  font-size: 12px;
}
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}
.badge-live { background: #0f2a1a; color: var(--positive); }
.badge-stale { background: #2a1a08; color: var(--warning); }
.muted { color: var(--muted); }

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.portfolio-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px;
}
.stat-card .label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.stat-card .value {
  color: var(--accent);
  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
}
.stat-card .sub {
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
}

.bot-cards { display: flex; flex-direction: column; gap: 18px; }
.bot-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
}
.bot-card .head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.bot-card .pair { display: flex; gap: 10px; align-items: center; }
.bot-card .pair-name { font-size: 18px; font-weight: 600; }
.bot-card .chip {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}
.chip-tier  { background: var(--accent-bg); color: var(--accent); }
.chip-fee   { background: #1f2937; color: #9ca3af; }
.chip-range { background: #0f2a1a; color: var(--positive); }
.chip-stale { background: #2a1a08; color: var(--warning); }

.chart-pane {
  width: 100%;
  height: 280px;
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--card);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.stat-row .stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 12px;
}
.stat-row .stat .label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.stat-row .stat .value {
  font-size: 20px;
  font-weight: 700;
  margin-top: 4px;
}
.stat-row .stat.positive .value { color: var(--positive); }
.stat-row .stat.accent   .value { color: var(--accent); }

.apr-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 14px;
  margin-top: 14px;
}
.apr-row .apr-cell .label { color: var(--muted); font-size: 11px; }
.apr-row .apr-cell .value { color: var(--positive); font-size: 18px; font-weight: 700; }
.apr-row .apr-cell .sub   { color: var(--muted); font-size: 10px; }

.methodology {
  margin-top: 36px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.6;
}
.methodology h2 {
  color: var(--accent);
  font-size: 16px;
  margin: 0 0 10px;
  letter-spacing: 0.05em;
}

footer {
  text-align: center;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  font-size: 11px;
}

.error-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: 10px 16px;
  text-align: center;
  font-size: 13px;
  background: var(--warning);
  color: #0a0e12;
  font-weight: 600;
  z-index: 100;
}
.error-banner.fatal { background: var(--negative); color: #fff; }

@media (max-width: 640px) {
  .hero h1 { font-size: 28px; }
  .stat-row, .apr-row { grid-template-columns: 1fr 1fr; }
  .bot-card .head { flex-direction: column; gap: 8px; }
}
