:root {
  --bg: #0f1216;
  --panel: #171b21;
  --line: #242a32;
  --text: #e6e9ee;
  --muted: #9aa4b2;
  --accent: #4c8dff;
  --bench: #f0a020;
  --good: #35c08a;
  --bad: #e5604d;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
main { max-width: 1040px; margin: 0 auto; padding: 32px 20px 56px; }
header h1 { font-size: 26px; margin: 0 0 6px; }
.sub { color: var(--muted); margin: 0 0 24px; }

.lesson { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 12px; padding: 16px 18px; margin-bottom: 24px; }
.lesson h2 { font-size: 16px; margin: 0 0 6px; }
.lesson p { margin: 0 0 8px; color: var(--muted); }
.lesson p:last-child { margin-bottom: 0; }
.lesson a { color: var(--accent); }
.lesson strong { color: var(--text); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
/* Strategy row and S&P 500 row: three aligned columns so the two rows line up. */
.cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#cards-edge { display: flex; justify-content: center; margin-bottom: 24px; }
#cards-edge .card { width: 100%; max-width: 300px; text-align: center; }
@media (max-width: 560px) { .cards-3 { grid-template-columns: 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.card .value { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.card .sub2 { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pos { color: var(--good); } .neg { color: var(--bad); }

.chart-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 24px; }
canvas { width: 100%; }
.ranges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.range-btn {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer;
}
.range-btn:hover { border-color: var(--accent); color: var(--text); }
.range-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }

.holdings { margin-top: 24px; }
.holdings h2 { font-size: 16px; }
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 8px 14px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
#holdings td:last-child, #holdings th:last-child { text-align: right; }
.tk { font-weight: 600; }
.trade { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.trade.buy { color: var(--good); background: rgba(53,192,138,0.12); }
.trade.sell { color: var(--bad); background: rgba(229,96,77,0.12); }
.count { color: var(--muted); font-size: 13px; font-weight: 400; }

.filters { display: flex; gap: 10px; margin: 8px 0 12px; flex-wrap: wrap; }
.filters input, .filters select {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font: inherit;
}
.filters input { flex: 1; min-width: 200px; }
.filters input::placeholder { color: var(--muted); }

.empty { color: var(--muted); }

/* Scrollable trade list: shows about 20 rows, then scrolls, with a pinned header. */
.scroll { max-height: 740px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.scroll table { border: 0; border-radius: 0; }
.scroll thead th { position: sticky; top: 0; z-index: 1; background: var(--panel); }

footer { margin-top: 28px; color: var(--muted); font-size: 13px; }
.src a, footer a { color: var(--accent); }
