:root {
  --bg: #10131a;
  --panel: #171b24;
  --line: #262c38;
  --text: #d7dde8;
  --dim: #8b97ab;
  --accent: #4c9aff;
  --up: #2ecc71;
  --down: #ff5c5c;
  --warn: #f5a623;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 "Inter", "Segoe UI", system-ui, sans-serif;
}
body.centered { display: grid; place-items: center; min-height: 100vh; }
a { color: var(--accent); }
h1 { font-size: 18px; margin: 0 0 6px; }
h3 { font-size: 14px; margin: 18px 0 6px; }
h4 { font-size: 12px; margin: 0 0 6px; color: var(--dim); text-transform: uppercase; letter-spacing: .04em; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  background: #0c0f15; position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 600; letter-spacing: .02em; }
.brand span { color: var(--dim); font-weight: 400; }
.freshness { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.chip {
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px;
  background: var(--panel); color: var(--dim); white-space: nowrap;
}
.chip b { color: var(--text); font-weight: 600; }
.chip.live { border-color: #1d5c34; color: #9de8bd; }
.chip.stale { border-color: #6b4a12; color: #ffd699; }

.tabs { display: flex; gap: 2px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tab, .seg, .ghost, .primary {
  font: inherit; cursor: pointer; border-radius: 6px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); padding: 6px 11px;
}
.tab { border-bottom: none; border-radius: 6px 6px 0 0; }
.tab.active { background: #1e2532; color: #fff; border-color: #37425a; }
.primary { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.ghost { background: transparent; }
.seg.active { background: #1e2532; border-color: #37425a; }
main { padding: 14px 16px 60px; }
.panel { display: none; }
.panel.active { display: block; }

.controls { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.controls label { display: flex; gap: 6px; align-items: center; color: var(--dim); }
input, select {
  font: inherit; background: #0e1219; color: var(--text);
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px;
}
.hint { color: var(--dim); font-size: 12px; }
.error { color: var(--down); min-height: 18px; margin: 8px 0 0; }

.tablewrap { overflow: auto; max-height: 62vh; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 4px 9px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th { position: sticky; top: 0; background: #1b2130; cursor: pointer; z-index: 1; text-align: right; }
th:first-child, td:first-child { text-align: left; }
tbody tr:hover { background: #1c2432; }
td.num.neg, .neg { color: var(--down); }
td.num.pos, .pos { color: var(--up); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.login { width: 340px; display: grid; gap: 10px; }
.login input { width: 100%; }
.chartgrid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.chart { height: 460px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.chart.small { height: 170px; }
.gexgrid { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 10px; align-items: start; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-variant-numeric: tabular-nums; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; }
.bars { display: grid; gap: 3px; }
.bar { display: grid; grid-template-columns: 68px 1fr 78px; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.bar .track { height: 12px; background: #0e1219; border-radius: 3px; position: relative; overflow: hidden; }
.bar .fill { position: absolute; top: 0; bottom: 0; }
.bar .fill.p { background: #2ecc71aa; left: 50%; }
.bar .fill.n { background: #ff5c5caa; right: 50%; }
.sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.sheets figure { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.sheets img { width: 100%; display: block; border-radius: 4px; }
.sheets figcaption { color: var(--dim); font-size: 12px; margin-top: 4px; }
