:root {
  color-scheme: dark;
  --bg: #10131a;
  --panel: #161b24;
  --line: #242a36;
  --text: #e8edf5;
  --muted: #8b95a7;
  --ok: #3dd68c;
  --accent: #6aa6ff;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.35 "Segoe UI", system-ui, sans-serif;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.cluster { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lbl, label { color: var(--muted); }
input[type="number"] {
  width: 56px;
  background: #10131a;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 6px;
}
#threshold { width: 52px; }
select, button, #ticker, #jumpDate {
  background: #10131a;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
}
#ticker { cursor: text; width: 96px; text-transform: uppercase; }
.ticker-box { position: relative; }
#ticker-suggest {
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 20;
  margin: 2px 0 0;
  padding: 4px 0;
  list-style: none;
  min-width: 140px;
  max-height: 280px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 8px 24px #0008;
}
#ticker-suggest li {
  padding: 4px 10px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
#ticker-suggest li:hover, #ticker-suggest li.on { background: #1e2633; color: var(--accent); }
#jumpDate { width: 132px; cursor: text; }
button.on { border-color: var(--accent); color: var(--accent); }
.seg { display: flex; gap: 4px; }
.chk { display: inline-flex; align-items: center; gap: 4px; color: var(--text); }
.workspace { flex: 1; min-height: 0; display: flex; }
.charts { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#price { flex: 1.35; min-height: 180px; }
#csi-wrap { flex: 1; min-height: 180px; position: relative; border-top: 1px solid var(--line); }
#csi { height: 100%; }
#csi-count {
  position: absolute;
  left: 36px;
  top: 8px;
  z-index: 2;
  color: var(--muted);
  font-size: 11px;
  pointer-events: none;
}
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
#csi-labels span {
  position: absolute;
  right: 56px;
  transform: translateY(-50%);
  background: #161b24ee;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
#csi-tip {
  position: absolute;
  pointer-events: none;
  z-index: 4;
  background: #0d1118;
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
aside {
  width: 196px;
  border-left: 1px solid var(--line);
  overflow: auto;
  background: var(--panel);
}
.rank-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 10px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.rank-row:hover, .rank-row.active { background: #1e2633; }
.rank-row.ref span:first-child { color: #f5c15d; font-weight: 600; }
.rank-row .neg { color: #ff6b6b; }
.replay {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
#scrub { flex: 1; }
#asofLabel { color: var(--muted); min-width: 140px; }
#status { color: var(--muted); }
