:root {
  --bg: #131722;
  --panel: #1e222d;
  --line: #2a2e39;
  --text: #d1d4dc;
  --muted: #787b86;
  --accent: #2962ff;
  --bull: #26a69a;
  --bear: #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; }

button, select, input {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
}

button { cursor: pointer; }
button:hover { background: var(--line); }

.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.bar select { background: var(--panel); border-color: var(--line); padding: 4px 6px; }
.group { display: flex; gap: 2px; }
.group button { padding: 4px 8px; }
.group button.on { color: var(--accent); background: rgba(41, 98, 255, .12); }
.field input { width: 52px; background: var(--panel); border-color: var(--line); padding: 3px 5px; }
.check { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.sep { width: 1px; height: 20px; background: var(--line); }
.status { margin-left: auto; color: var(--muted); }
.status.error { color: var(--bear); }

.layout { flex: 1; display: flex; min-height: 0; }

.tools {
  width: 64px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 4px;
}

.tools button {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0;
  font-size: 18px;
  line-height: 1;
}

.tools button span { font-size: 10px; margin-top: 3px; color: var(--muted); }
.tools button.active, .tools button.toggle.on { background: rgba(41, 98, 255, .18); color: var(--accent); }
.tools button:disabled { opacity: .35; cursor: default; background: transparent; }
.tools hr { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

.chart { position: relative; flex: 1; min-width: 0; background: var(--chart-bg, var(--bg)); }

.tools { overflow-y: auto; }
.swatch { width: 20px; height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 50%; }
.swatch.on { outline: 2px solid var(--text); outline-offset: 1px; }
.custom-color { position: relative; align-self: center; width: 44px; height: 20px; border: 1px dashed var(--muted); border-radius: 4px; text-align: center; line-height: 18px; color: var(--muted); cursor: pointer; }
.custom-color input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.theme-panel select { background: var(--bg); border-color: var(--line); padding: 2px 4px; }

.theme-wrap { position: relative; }
.theme-btn { background: var(--panel); border-color: var(--line); padding: 4px 8px; }
.theme-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 10;
  display: grid;
  gap: 8px;
  min-width: 180px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}
.theme-panel[hidden] { display: none; }
.theme-panel label { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.theme-panel input[type="color"] { width: 36px; height: 24px; padding: 0; border: 1px solid var(--line); cursor: pointer; }
.theme-panel button { border-color: var(--line); padding: 4px; }

.panel {
  width: 240px;
  border-left: 1px solid var(--line);
  padding: 10px;
  overflow-y: auto;
}

.panel h2 { font-size: 13px; margin: 0 0 8px; }
.hint { color: var(--muted); font-size: 12px; }

.ob-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

.ob-list li {
  padding: 6px 8px;
  border-radius: 4px;
  background: var(--panel);
  border-left: 3px solid var(--muted);
  cursor: pointer;
}

.ob-list li.bull { border-left-color: var(--bull); }
.ob-list li.bear { border-left-color: var(--bear); }
.ob-list li.mitigated { opacity: .5; }
.ob-list li:hover { background: var(--line); }
.ob-list .meta { color: var(--muted); font-size: 11px; }

.edit-bar {
  position: absolute;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}
.edit-bar[hidden] { display: none; }
.edit-bar .custom-color { width: 22px; height: 20px; line-height: 18px; }
.bar-sep { width: 1px; height: 18px; background: var(--line); margin: 0 2px; }
.width-btn { width: 26px; height: 22px; padding: 0 4px; display: flex; align-items: center; }
.width-btn i { display: block; width: 100%; background: var(--text); border-radius: 2px; }
.width-btn.on { background: rgba(41, 98, 255, .18); }
.width-btn.on i { background: var(--accent); }
.bar-btn { width: 26px; height: 22px; padding: 0; }
.bar-btn[hidden] { display: none; }
.bar-btn.danger:hover { background: rgba(239, 83, 80, .25); }

.note-editor {
  position: absolute;
  z-index: 25;
  min-width: 180px;
  padding: 4px 6px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 4px;
  outline: none;
}

.live-dot { font-size: 12px; white-space: nowrap; }
.live-dot[data-state="live"] { color: var(--bull); }
.live-dot[data-state="reconnecting"] { color: #ff9800; }
