:root {
  --bg: #11141a;
  --panel: #1c212a;
  --field: #252d38;
  --line: #364150;
  --text: #e4e9f1;
  --muted: #a6b1c1;
  --accent: #89b8ff;
  --buy: #45d2ac;
  --sell: #ff8595;
  --warm: #efc379;
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
button, select, input { font: inherit; color: inherit; }
button, select, input:not([type="checkbox"], [type="range"]) {
  min-height: 36px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); padding: 6px 9px;
}
button { cursor: pointer; white-space: nowrap; }
button:hover:not(:disabled), a:hover { color: var(--accent); }
button:disabled { cursor: default; opacity: .52; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, canvas:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
input[type="number"] { width: min(12ch, 100%); }
input[type="range"], input[type="checkbox"] { accent-color: var(--accent); }
.masthead {
  padding: 14px clamp(12px, 3vw, 36px); display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 20px;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.masthead h1 { margin: 0; font-size: 19px; font-weight: 650; }
.venue, .return, label, #chart-scale, .details-line, footer { font-size: 12px; }
.venue, label, #chart-scale, .details-line, footer, .empty { color: var(--muted); }
main { padding: 12px clamp(8px, 2vw, 24px) 20px; }
.toolbar, .date-form, .navigation, .filters, .readout, .playback, #replay-controls {
  display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
}
.toolbar { gap: 10px 14px; padding-bottom: 12px; }
label { display: inline-flex; gap: 6px; align-items: center; }
label > :is(input, select) { font-size: 13px; color: var(--text); }
.date-form { margin: 0; }
.navigation button { min-width: 36px; }
.dashboard { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 322px); gap: 10px; }
.chart-panel, .data-panel, .scan-panel {
  min-width: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--panel);
}
.panel-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px; padding: 8px;
  border-bottom: 1px solid var(--line);
}
.segment { display: flex; gap: 3px; flex-wrap: wrap; }
.segment button { padding-inline: 10px; min-height: 32px; border-color: transparent; background: transparent; color: var(--muted); }
.segment button[aria-pressed="true"] { border-color: var(--line); background: var(--field); color: var(--accent); }
.plot { position: relative; height: clamp(335px, 57vh, 710px); background: #141922; }
canvas { width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: pan-y; }
#chart-empty {
  position: absolute; inset: 14% 10% auto; text-align: center; color: var(--muted); pointer-events: none;
}
.readout, .playback { padding: 8px 10px; border-top: 1px solid var(--line); }
.readout { font-size: 12px; gap: 4px 12px; font-variant-numeric: tabular-nums; min-height: 38px; }
.readout strong { font-weight: 650; }
#candle-coverage { color: var(--muted); }
.playback { min-height: 52px; }
#replay-controls { flex: 1 1 100%; }
#seek { min-width: 105px; flex: 1 1 105px; }
#playhead { font: 12px ui-monospace, monospace; white-space: nowrap; }
.data-panel { display: flex; flex-direction: column; overflow: hidden; }
.data-panel > .segment { padding: 8px; border-bottom: 1px solid var(--line); }
.data-panel section { padding: 8px; min-height: 0; }
.filters { margin-bottom: 8px; gap: 7px 12px; }
.data-panel .filters label { flex: 1 1 auto; justify-content: space-between; }
.details-line { min-height: 28px; display: flex; justify-content: space-between; align-items: center; gap: 6px; margin: 0 0 6px; }
.details-line button { min-height: 28px; font-size: 12px; }
.table-scroll { overflow: auto; height: max(190px, calc(57vh - 18px)); overscroll-behavior: contain; }
table { width: 100%; border-collapse: collapse; text-align: right; font: 12px ui-monospace, monospace; }
thead { position: sticky; top: 0; background: var(--panel); color: var(--muted); }
td, th { padding: 6px 5px; border-bottom: 1px solid #343d4c80; white-space: nowrap; }
th { font: 12px Inter, system-ui, sans-serif; }
td:first-child, th:first-child { text-align: left; }
.buy { color: var(--buy); }
.sell { color: var(--sell); }
.large { font-weight: 750; background: #36517455; }
.profile-value { position: relative; isolation: isolate; min-width: 72px; }
.profile-bar { position: absolute; height: 70%; inset: 15% auto auto 4px; z-index: -1; opacity: .64; }
.scan-panel { margin-top: 10px; padding: 10px; }
.scan-panel summary { cursor: pointer; color: var(--text); }
.scan-panel .filters { margin-top: 10px; }
#scanner { color: var(--muted); font-size: 12px; }
.empty { font-size: 13px; }
footer { padding: 9px 2px 0; display: flex; gap: 4px 20px; flex-wrap: wrap; }
#status[data-error="true"] { color: var(--sell); }
#notification {
  position: fixed; right: 14px; bottom: 14px; z-index: 5; max-width: min(320px, calc(100% - 28px));
  background: var(--field); border: 1px solid var(--accent); border-radius: 8px; padding: 11px 14px;
}
@media (max-width: 960px) {
  .dashboard { grid-template-columns: minmax(0, 1fr) minmax(235px, 265px); }
}
@media (max-width: 720px) {
  .dashboard { grid-template-columns: minmax(0, 1fr); }
  .plot { height: clamp(320px, 50vh, 500px); }
  .table-scroll { height: 260px; }
}
@media (pointer: coarse) {
  button, select, input:not([type="checkbox"], [type="range"]) { min-height: 40px; }
}
