:root {
  --bg: #0f1419; --panel: #161c24; --panel2: #1d2530; --border: #2a3441; --text: #e6edf3; --muted: #8b98a8;
  --accent: #4cc2ff; --up: #2ecc71; --down: #ff5c5c; --warn: #f5b942;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); }
header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
nav { display: flex; flex-wrap: wrap; gap: 4px 0; }
.brand { font-weight: 700; font-size: 18px; letter-spacing: .3px; }
nav a { color: var(--muted); text-decoration: none; margin-right: 16px; padding: 6px 2px; border-bottom: 2px solid transparent; }
nav a.active { color: var(--text); border-color: var(--accent); }
#asof { margin-left: auto; font-size: 12px; text-align: right; }
main { padding: 16px 20px 40px; max-width: 1600px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 12px; }
.toolbar label { color: var(--muted); font-size: 12px; }
select, input { background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; font-size: 13px; }
input { min-width: 220px; }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { position: sticky; top: 0; background: var(--panel2); color: var(--muted); font-weight: 600; cursor: pointer; user-select: none; }
th.sorted-asc::after { content: " ▲"; } th.sorted-desc::after { content: " ▼"; }
tr:hover td { background: rgba(76,194,255,.05); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); } .warn { color: var(--warn); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; background: var(--panel2); border: 1px solid var(--border); color: var(--muted); }
.tag.positive { color: var(--up); border-color: rgba(46,204,113,.4); }
.tag.negative { color: var(--down); border-color: rgba(255,92,92,.4); }
.tag.mixed { color: var(--warn); }
.title-cell { max-width: 520px; overflow: hidden; text-overflow: ellipsis; }
a { color: var(--accent); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.cardlet { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.cardlet .v { font-size: 22px; font-weight: 700; }
.cardlet .k { color: var(--muted); font-size: 12px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-bottom: 16px; }
.card h3 { margin: 0 0 10px; font-size: 14px; color: var(--muted); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 20; }
.modal.hidden { display: none; }
.modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 20px; max-width: 900px; width: 92%; max-height: 85vh; overflow: auto; position: relative; }
#modalClose { position: absolute; right: 10px; top: 8px; background: none; border: none; color: var(--muted); font-size: 22px; cursor: pointer; }
pre { white-space: pre-wrap; font-size: 12px; color: var(--muted); }
.ticker { font-weight: 700; cursor: pointer; }
canvas { max-height: 320px; }
