:root {
  --bg: #0a0e17;
  --bg2: #0e1422;
  --panel: #131a28;
  --panel2: #172033;
  --border: #1f2a3d;
  --border2: #283650;
  --text: #e8eef6;
  --muted: #8b97a8;
  --faint: #5d6b80;
  --green: #2ee6a6;
  --green-dim: rgba(46, 230, 166, 0.14);
  --red: #ff6b6b;
  --red-dim: rgba(255, 107, 107, 0.14);
  --accent: #4f8cff;
  --accent2: #22d3ee;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background:
    radial-gradient(1100px 500px at 12% -8%, rgba(79, 140, 255, 0.12), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(34, 211, 238, 0.08), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}

.wrap { max-width: 1160px; margin: 0 auto; padding: 22px 20px 56px; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  font-size: 26px; width: 48px; height: 48px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--panel2), var(--panel));
  border: 1px solid var(--border2); border-radius: 14px; box-shadow: var(--shadow);
}
h1 { font-size: 21px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.sub { color: var(--muted); font-size: 12.5px; }
.status {
  display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 7px 13px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 var(--green); animation: pulse 2s infinite; }
.dot.err { background: var(--red); animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 230, 166, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(46, 230, 166, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 230, 166, 0); }
}

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.hero-card {
  background: linear-gradient(160deg, var(--panel2), var(--panel));
  border: 1px solid var(--border); border-radius: 18px; padding: 20px 22px; box-shadow: var(--shadow);
}
.hero-card.primary { border-color: var(--border2); position: relative; overflow: hidden; }
.hero-card.primary::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(135deg, rgba(79, 140, 255, 0.16), transparent 45%);
}
.hero-card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.hero-value { font-size: 34px; font-weight: 700; margin-top: 6px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hero-card.primary .hero-value { color: #fff; }
.hero-foot { margin-top: 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
.hero-foot .muted { margin-right: 4px; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 16px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 15px 17px;
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--border2); transform: translateY(-1px); }
.card .label { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; }
.card .value { font-size: 21px; font-weight: 650; margin-top: 5px; font-variant-numeric: tabular-nums; }

/* ---------- period returns ---------- */
.periods { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.period {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
  padding: 13px 14px; text-align: center;
}
.period .pk { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.period .pv { font-size: 20px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.period .pspy { color: var(--faint); font-size: 12px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.period .pspy b { font-weight: 600; }

/* ---------- panels ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.panel h2 {
  display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; margin: 0 0 16px;
}
.panel h2 .bar { width: 4px; height: 16px; border-radius: 3px; background: linear-gradient(var(--accent), var(--accent2)); }
.muted { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.note { color: var(--faint); font-size: 12px; margin: 14px 0 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- charts ---------- */
.chart-panel .chart-box { position: relative; height: 230px; }

/* ---------- stats grid ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 22px; }
.stat { display: flex; justify-content: space-between; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--border); }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 13.5px; }
th, td { text-align: right; padding: 9px 12px; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th {
  color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border2); position: sticky; top: 0; background: var(--panel);
}
tbody td { border-bottom: 1px solid var(--border); }
tbody tr { transition: background 0.12s; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
tbody tr:last-child td { border-bottom: none; }
td:first-child { font-weight: 600; }

/* color + badges */
.pos { color: var(--green); }
.neg { color: var(--red); }
.value.pos { color: var(--green); }
.value.neg { color: var(--red); }
.hero-value.pos { color: var(--green); }
.hero-value.neg { color: var(--red); }

.buy, .sell { font-weight: 600; font-size: 11px; padding: 2px 8px; border-radius: 999px; letter-spacing: 0.03em; }
.buy { color: var(--green); background: var(--green-dim); }
.sell { color: var(--red); background: var(--red-dim); }

.lb-best h2 .bar { background: var(--green); }
.lb-worst h2 .bar { background: var(--red); }

footer { margin-top: 26px; text-align: center; color: var(--faint); font-size: 12px; }
