:root {
  color-scheme: dark;
  --bg: #101318;
  --panel: #171b22;
  --line: #2c3340;
  --text: #e7ebf2;
  --muted: #8e98a8;
  --accent: #e07a5f;
  --up: #3ecf8e;
  --down: #f07178;
  --row: #1d232d;
}

* { box-sizing: border-box; }

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

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

button, input { font: inherit; color: inherit; }

.top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--line);
}

h1, h2 { margin: 0; font-weight: 600; }

h1 { font-size: 20px; }

h2 { font-size: 18px; }

#rule, .meta, #schedule, #progress, #chart-sub, #readout {
  margin: 4px 0 0;
  color: var(--muted);
}

#rule { max-width: 880px; }

.status-block { min-width: 280px; text-align: right; }

.bar {
  height: 4px;
  margin: 8px 0;
  background: #2a3140;
  border-radius: 99px;
  overflow: hidden;
}

#bar-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}

#scan, .zoom button, .filters button, .toggles button {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}

#scan:disabled { opacity: 0.55; cursor: default; }

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 380px) minmax(0, 1fr);
  grid-template-areas: "list chart";
}

.list-pane, .chart-pane {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.list-pane { grid-area: list; border-right: 1px solid var(--line); }

.chart-pane { grid-area: chart; }

.list-tools, .chart-head, .chart-foot { padding: 12px 14px; }

.list-tools { border-bottom: 1px solid var(--line); }

#search {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

.filters, .toggles, .zoom, .chart-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filters { margin-top: 8px; }

.filters button.on, .toggles button.on {
  border-color: var(--swatch, var(--accent));
  color: var(--text);
}

.rows { overflow: auto; flex: 1; }

.row {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  cursor: pointer;
}

.row.selected { background: var(--row); box-shadow: inset 3px 0 0 var(--accent); }

.row-top, .row-bottom {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.symbol { font-weight: 650; letter-spacing: 0.02em; }

.move { font-weight: 650; }

.move.up { color: var(--up); }

.move.down { color: var(--down); }

.name {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 230px;
}

.tag {
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 99px;
  padding: 0 6px;
  font-size: 12px;
}

.empty { padding: 18px 14px; color: var(--muted); }

.chart-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

#chart-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-actions {
  width: 100%;
  flex-direction: column;
  align-items: flex-start;
}

#chart { flex: 1; min-height: 280px; }

.chart-foot {
  display: flex;
  gap: 16px;
  align-items: baseline;
  padding: 6px 12px;
  border-top: 1px solid var(--line);
}

.chart-foot p {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#readout { color: var(--text); }

@media (max-width: 800px) {
  .top { flex-direction: column; }
  .status-block { min-width: 0; text-align: left; }
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(360px, 58vh) minmax(240px, 1fr);
    grid-template-areas:
      "chart"
      "list";
  }
  .list-pane { border-right: 0; border-top: 1px solid var(--line); }
}
