:root {
  --bg: #131722;
  --panel: #1e222d;
  --border: #2a2e39;
  --text: #d1d4dc;
  --muted: #787b86;
  --accent: #2962ff;
  --live: #26a69a;
  --warn: #f9a825;
  --error: #ef5350;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  min-width: 0;
}

select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font: inherit;
  font-weight: 600;
}

#timeframes {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}

#timeframes button, .tool {
  background: none;
  color: var(--text);
  border: 0;
  border-radius: 4px;
  padding: 4px 8px;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

#timeframes button:hover, .tool:hover { background: var(--panel); }
#timeframes button.active, .tool.active { color: var(--accent); font-weight: 600; }
.tool { flex: none; }
.tool[data-drawing] { background: var(--accent); color: #fff; }

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

.status {
  margin-left: auto;
  white-space: nowrap;
  color: var(--muted);
}
.status[data-status="live"] { color: var(--live); }
.status[data-status="reconnecting"] { color: var(--warn); }

.banner {
  padding: 4px 12px;
  background: #3a2f0b;
  color: var(--warn);
  border-bottom: 1px solid var(--border);
}
.banner.error { background: #3b1518; color: var(--error); }

.chart {
  position: relative;
  flex: 1;
  min-height: 0;
}
.chart.drawing { cursor: crosshair; }

.legend {
  position: absolute;
  left: 8px;
  z-index: 3;
  pointer-events: none;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  display: flex;
  flex-wrap: wrap;
  column-gap: 8px;
  max-width: calc(100% - 90px);
}

.legend > div {
  display: flex;
  flex-wrap: wrap;
  column-gap: 8px;
  width: 100%;
}
