:root {
  --bg: #0e1116;
  --panel: #151a21;
  --line: #232a34;
  --text: #dfe6ee;
  --muted: #8b98a8;
  --kalshi-buy: #26a69a;
  --kalshi-sell: #ef5350;
  --pm-buy: #4593ff;
  --pm-sell: #f7a600;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.layout { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar {
  width: 288px; flex: 0 0 288px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.sidebar.collapsed { display: none; }
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.sidebar-head strong { font-size: 14px; }
.sidebar-head button, .reveal {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 6px; cursor: pointer; padding: 3px 8px;
}
.sidebar-body { padding: 12px 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.filters { display: flex; flex-direction: column; gap: 10px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.filters select {
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 7px 8px; font-size: 13px;
}
.section-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.muted-note { text-transform: none; letter-spacing: 0; font-size: 10px; opacity: .75; margin-left: 6px; }

.range-section { border-top: 1px solid var(--line); padding-top: 14px; }
.range-buttons { display: flex; gap: 6px; }
.range-buttons button {
  flex: 1; padding: 7px 6px; font-size: 12px; cursor: pointer;
  background: var(--bg); color: var(--muted);
  border: 1px solid var(--line); border-radius: 6px;
}
.range-buttons button:hover { color: var(--text); }
.range-buttons button.active { background: #1e2937; color: var(--text); border-color: #33506e; }

.series-toggles { border-top: 1px solid var(--line); padding-top: 14px; }
.tog { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.tog input { accent-color: #4593ff; }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 12px; }
.swatch[data-series="kalshi_buy"] { background: var(--kalshi-buy); }
.swatch[data-series="kalshi_sell"] { background: var(--kalshi-sell); }
.swatch[data-series="pm_buy"] { background: var(--pm-buy); }
.swatch[data-series="pm_sell"] { background: var(--pm-sell); }

.matchlist { border-top: 1px solid var(--line); padding-top: 14px; flex: 1; min-height: 0; display: flex; flex-direction: column; }
#matches { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
#matches li { padding: 7px 8px; border-radius: 6px; cursor: pointer; border: 1px solid transparent; }
#matches li:hover { background: var(--bg); }
#matches li.active { background: var(--bg); border-color: var(--line); }
#matches .m-teams { font-size: 12.5px; }
#matches .m-sub { font-size: 11px; color: var(--muted); display: flex; gap: 6px; }
.venue-pill { font-size: 9px; padding: 1px 4px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }

.reveal { position: absolute; left: 8px; top: 10px; z-index: 5; }

/* Content */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.match-head { padding: 12px 18px; border-bottom: 1px solid var(--line); }
.mh-title { font-size: 15px; font-weight: 600; }
.mh-meta { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 12px; }
.mh-meta b { color: var(--text); font-weight: 600; }
.mh-meta .warn { color: var(--pm-sell); }

/* Events */
.events-panel { padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--panel); }
.events-list { list-style: none; margin: 0; padding: 0; max-height: 132px; overflow-y: auto; font-size: 12px; }
.events-list .ev-half {
  color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
  margin: 6px 0 3px; border-bottom: 1px solid var(--line); padding-bottom: 2px;
}
.events-list .ev { display: flex; align-items: baseline; gap: 8px; padding: 2px 0; }
.events-list .ev-min { width: 46px; flex: 0 0 46px; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.events-list .ev-type { width: 44px; flex: 0 0 44px; font-size: 11px; }
.events-list .ev-who { color: var(--text); }
.events-list .ev-detail { color: var(--muted); font-size: 11px; }
.ev-goal .ev-type { color: var(--kalshi-buy); font-weight: 600; }
.ev-red .ev-type { color: var(--kalshi-sell); font-weight: 600; }
.ev-yellow .ev-type { color: var(--pm-sell); }
.ev-var .ev-type { color: var(--pm-buy); }
.ev-sub { opacity: .6; }

/* Charts */
.charts { flex: 1; overflow-y: auto; padding: 12px 18px 24px; display: flex; flex-direction: column; gap: 18px; }
.chart-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px; }
.chart-label { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.chart-label .ctitle { font-weight: 600; }
.chart-label .cwin { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.chart-label .cinfo { margin-left: auto; color: var(--muted); font-size: 11px; }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot.home { background: var(--kalshi-buy); }
.dot.draw { background: var(--pm-sell); }
.dot.away { background: var(--pm-buy); }
.chart-price { height: 380px; position: relative; }
.chart-price .scatter { position: absolute; inset: 0; pointer-events: none; width: 100%; height: 100%; z-index: 3; }
.chart-rate-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 6px 0 2px; }
.chart-rate { height: 110px; }
