:root {
  --bg: #07090c;
  --bg-elevated: #0d1117;
  --bg-row: #0f141b;
  --bg-row-hover: #151b24;
  --border: #1c2430;
  --border-soft: #161c26;
  --text: #e8edf5;
  --text-muted: #8b95a8;
  --text-dim: #5c6678;
  --accent: #2ee59d;
  --accent-dim: rgba(46, 229, 157, 0.14);
  --accent-strong: #1fc87f;
  --down: #ff5a6a;
  --down-dim: rgba(255, 90, 106, 0.14);
  --undefined: #6b7385;
  --undefined-dim: rgba(107, 115, 133, 0.18);
  --score-mid: #e8b84a;
  --radius: 10px;
  --tabs-radius: 999px;
  --font-ui: "Sora", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --topbar-bg: rgba(7, 9, 12, 0.85);
  --body-glow-1: radial-gradient(1200px 600px at 10% -10%, rgba(46, 229, 157, 0.07), transparent 55%);
  --body-glow-2: radial-gradient(900px 500px at 90% 0%, rgba(56, 120, 255, 0.05), transparent 50%);
  --brand-mark-bg: linear-gradient(145deg, rgba(46, 229, 157, 0.25), rgba(46, 229, 157, 0.05));
  --brand-mark-border: rgba(46, 229, 157, 0.35);
  --brand-mark-color: var(--accent);
  --chart-candle-up: #2ee59d;
  --chart-candle-down: #ff5a6a;
  --chart-up: rgba(46, 229, 157, 0.22);
  --chart-down: rgba(255, 90, 106, 0.22);
  --chart-flat: rgba(107, 115, 133, 0.2);
  --chart-axis: #5c6678;
  --chart-split: #1c2430;
  --chart-text: #8b95a8;
  --chart-alert: #e8b84a;
  --chart-vp: rgba(91, 140, 255, 0.45);
  --chart-vp-poc: rgba(91, 140, 255, 0.85);
  --chart-donchian: rgba(120, 180, 255, 0.95);
  --chart-donchian-mid: rgba(120, 180, 255, 0.45);
  --chart-nw: rgba(232, 184, 74, 0.95);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--body-glow-1), var(--body-glow-2), var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

#app {
  height: 100vh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────────────── */

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--brand-mark-bg);
  border: 1px solid var(--brand-mark-border);
  color: var(--brand-mark-color);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-mark svg {
  width: 20px;
  height: 20px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-name {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand-tag {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--tabs-radius);
  padding: 4px;
}

.tab {
  padding: 8px 22px;
  border-radius: 999px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  transition: color 0.15s, background 0.15s;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(46, 229, 157, 0.35);
}

.tab-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 6px;
  padding: 8px 12px 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(46, 229, 157, 0.45);
  background: rgba(46, 229, 157, 0.08);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.tab-check input {
  width: 16px;
  height: 16px;
  accent-color: #2ee59d;
  cursor: pointer;
}
.tab-check:has(input:checked) {
  background: rgba(46, 229, 157, 0.2);
  box-shadow: inset 0 0 0 1px rgba(46, 229, 157, 0.7);
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  transition: border-color 0.15s, color 0.15s;
}

.icon-btn:hover {
  color: var(--text);
  border-color: #2a3545;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

/* ── Views ──────────────────────────────────────────── */

.view {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.view.active {
  display: flex;
}

.panel {
  padding: 18px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.scanner-panel {
  padding-bottom: 16px;
}

.scanner-split {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Scanner controls ───────────────────────────────── */

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px 28px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.seg-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12.5px;
  transition: all 0.15s;
}

.seg-btn:hover {
  color: var(--text);
  border-color: #2a3545;
}

.seg-btn.active {
  background: var(--accent-dim);
  border-color: rgba(46, 229, 157, 0.45);
  color: var(--accent);
}

.volume-field {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  overflow: hidden;
}

.volume-field input {
  width: 148px;
  padding: 9px 12px;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 13px;
}

.volume-field .filter-btn {
  width: 38px;
  height: 38px;
  border-left: 1px solid var(--border);
  color: var(--text-muted);
  display: grid;
  place-items: center;
}

.volume-field .filter-btn:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

.status-line {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 12.5px;
}

.hint-keys {
  font-size: 11px;
  color: var(--text-dim);
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
}

/* Primary Scan CTA — same look on every tab */
.scan-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid rgba(46, 229, 157, 0.5);
  background: linear-gradient(180deg, rgba(46, 229, 157, 0.22), rgba(46, 229, 157, 0.1));
  color: #2ee59d;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.03em;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  box-shadow:
    0 1px 0 rgba(46, 229, 157, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease,
    box-shadow 0.15s ease;
}
.scan-btn:hover {
  background: linear-gradient(180deg, rgba(46, 229, 157, 0.32), rgba(46, 229, 157, 0.16));
  border-color: rgba(46, 229, 157, 0.85);
  color: #6ff5bc;
  box-shadow: 0 0 0 3px rgba(46, 229, 157, 0.12);
}
.scan-btn:active {
  transform: translateY(1px);
}
.scan-btn svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}
.scan-btn.spinning svg {
  animation: spin 0.8s linear infinite;
}
.scan-btn--block {
  width: 100%;
}
.status-line .scan-btn {
  flex: 0 0 auto;
}

/* legacy alias while JS still toggles .pat-group-scan-btn */
.pat-group-scan-btn.scan-btn {
  /* inherits .scan-btn */
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.ws-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--undefined);
}

.ws-dot.live {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(46, 229, 157, 0.7);
}

.ws-dot.err {
  background: var(--down);
}

/* ── Table ──────────────────────────────────────────── */

.table-wrap {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  overflow: auto;
}

table.scanner {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

table.scanner thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #10151d;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  user-select: none;
}

table.scanner thead th.sortable {
  cursor: pointer;
}

table.scanner thead th.sortable:hover {
  color: var(--text);
}

table.scanner thead th.sorted {
  color: var(--accent);
}

.sort-ind {
  font-size: 9px;
  margin-left: 2px;
  opacity: 0.85;
}

table.scanner tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}

table.scanner tbody tr:hover {
  background: var(--bg-row-hover);
}

table.scanner tbody tr.selected {
  background: rgba(46, 229, 157, 0.08);
  box-shadow: inset 3px 0 0 var(--accent);
}

table.scanner tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  font-size: 13px;
}

table.scanner .col-fav {
  width: 36px;
  padding-left: 10px;
  padding-right: 0;
}

table.scanner .col-rank {
  width: 48px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
}

table.scanner .col-symbol {
  width: 200px;
}

table.scanner .col-ex {
  display: none;
}

table.scanner .ex-pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.03);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.ex-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 3px;
}

.contract-line {
  margin-top: 3px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.25;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ex-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 16px;
  padding: 0 4px;
  border-radius: 4px;
  border: 1px solid rgba(139, 149, 168, 0.35);
  background: rgba(255, 255, 255, 0.04);
  color: #8b95a8;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  cursor: pointer;
}

.ex-ico:hover {
  border-color: rgba(46, 229, 157, 0.55);
  color: #c8d0e0;
}

.ex-ico.is-active {
  border-color: rgba(46, 229, 157, 0.7);
  background: rgba(46, 229, 157, 0.12);
  color: #2ee59d;
}

.sym-cell-compact .sym-ticker {
  font-size: 13px;
}

table.scanner .col-score {
  width: 180px;
}

table.scanner .col-trend {
  width: 170px;
}

table.scanner .col-snr {
  width: 90px;
}

table.scanner .col-vol {
  width: 110px;
}

table.scanner .col-oi {
  width: 110px;
}

table.scanner .col-imb {
  width: 110px;
}

table.scanner .col-chg {
  width: 110px;
}

table.scanner .col-go {
  width: 40px;
  color: var(--text-dim);
  text-align: right;
}

.star-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--text-dim);
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
  transition: color 0.12s, transform 0.12s;
}

.star-btn:hover {
  color: var(--score-mid);
  transform: scale(1.08);
}

.star-btn.on {
  color: var(--score-mid);
}

.sym-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sym-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1a2230;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  overflow: hidden;
}

.sym-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sym-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sym-ticker {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sym-name {
  color: var(--text-muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-val {
  font-family: var(--font-mono);
  font-weight: 600;
  width: 28px;
  flex-shrink: 0;
}

.score-bar {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  background: #1a2230;
  overflow: hidden;
}

.score-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
}

.score-bar.mid > span {
  background: linear-gradient(90deg, #c98a1a, var(--score-mid));
}

.score-bar.low > span {
  background: linear-gradient(90deg, #8a3a3a, #d96a4a);
}

.trend-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trend-arrow {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.trend-arrow.up {
  background: var(--accent-dim);
  color: var(--accent);
}

.trend-arrow.down {
  background: var(--down-dim);
  color: var(--down);
}

.trend-arrow.flat {
  background: var(--undefined-dim);
  color: var(--undefined);
}

.trend-arrow svg {
  width: 12px;
  height: 12px;
}

.trend-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.25;
}

.trend-dir {
  font-weight: 600;
  font-size: 12.5px;
}

.trend-dir.up {
  color: var(--accent);
}

.trend-dir.down {
  color: var(--down);
}

.trend-dir.flat {
  color: var(--undefined);
}

.trend-age {
  color: var(--text-muted);
  font-size: 11px;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.pos {
  color: var(--accent);
}

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

.empty-state,
.loading-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Preview pane ───────────────────────────────────── */

.preview-pane {
  flex: 0 0 38vh;
  min-height: 280px;
  max-height: 48vh;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-pane[hidden] {
  display: none;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
}

.preview-asset {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.preview-price-block {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-left: 8px;
  font-size: 14px;
  font-weight: 600;
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-chart-shell {
  flex: 1;
  min-height: 0;
  position: relative;
}

#preview-chart {
  width: 100%;
  height: 100%;
}

#pat-preview-chart {
  width: 100%;
  height: 100%;
}

.patterns-split {
  flex: 1;
  min-height: 0;
}

.patterns-table-wrap {
  flex: 1;
  min-height: 180px;
  overflow: auto;
}

.patterns-table tr.scanner-row.selected {
  background: rgba(91, 140, 255, 0.12);
}

#pat-preview-meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.corr-class {
  font-size: 12px;
  font-weight: 600;
}

.corr-class.high {
  color: #5b8cff;
}

.corr-class.low {
  color: #e8b84a;
}

.corr-rho {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 12px;
}

.corr-rho.high {
  color: #5b8cff;
}

.corr-rho.low {
  color: #e8b84a;
}

.corr-rho.mid {
  color: var(--text-muted);
}

#corr-preview-chart {
  width: 100%;
  height: 100%;
}

/* ── Chart view ─────────────────────────────────────── */

.chart-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
}

.chart-asset {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.back-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  display: grid;
  place-items: center;
}

.back-btn:hover {
  color: var(--text);
  border-color: #2a3545;
}

.chart-price-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 8px;
}

.chart-sym-meta {
  min-width: 140px;
  max-width: 260px;
}

.chart-sym-combo {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.chart-sym-input {
  width: 100%;
  min-width: 120px;
  max-width: 220px;
  padding: 4px 28px 4px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  font-family: inherit;
  outline: none;
}

.chart-sym-input:hover,
.chart-sym-combo.open .chart-sym-input,
.chart-sym-input:focus {
  border-color: var(--border);
  background: var(--bg-elevated);
}

.chart-sym-caret {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  font-size: 11px;
}

.chart-sym-caret:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.chart-sym-list {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 240px;
  max-height: min(360px, 50vh);
  overflow: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-panel, #121820);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.chart-sym-list[hidden] {
  display: none !important;
}

.chart-sym-option {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  align-items: baseline;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text);
}

.chart-sym-option:hover,
.chart-sym-option.active {
  background: rgba(91, 140, 255, 0.14);
}

.chart-sym-option-sym {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.01em;
}

.chart-sym-option-ex {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.chart-sym-option-px {
  grid-column: 1 / -1;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.chart-sym-empty {
  padding: 12px 10px;
  color: var(--text-muted);
  font-size: 12px;
}

.chart-price {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.chart-chg {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}

.chart-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.tf-btn {
  min-width: 48px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 12px;
}

.tf-btn.active {
  border-color: rgba(46, 229, 157, 0.5);
  background: var(--accent-dim);
  color: var(--accent);
}

#alert-mode-btn.active {
  background: rgba(232, 184, 74, 0.16);
  border-color: rgba(232, 184, 74, 0.55);
  color: var(--score-mid);
}

.select-wrap select {
  appearance: none;
  padding: 8px 32px 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b95a8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
}

.legend {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-muted);
  font-size: 12px;
}

.legend-row {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.legend-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  row-gap: 8px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot.up { background: var(--accent); }
.legend-dot.down { background: var(--down); }
.legend-dot.flat { background: var(--undefined); }
.legend-dot.alert { background: var(--score-mid); }
.legend-dot.vp { background: #5b8cff; }
.legend-dot.donchian { background: #78b4ff; }
.legend-dot.nw { background: #e8b84a; }
.legend-dot.of-up { background: #2ee59d; }
.legend-dot.of-down { background: #ff5a6a; }
.legend-of {
  gap: 8px;
  color: var(--text-muted);
}
.legend-of-swatch {
  display: inline-flex;
  width: 14px;
  height: 8px;
  border-radius: 2px;
  overflow: hidden;
}
.legend-of-swatch .of-buy,
.legend-of-swatch .of-sell {
  flex: 1;
}
.legend-of-swatch .of-buy { background: #2ee59d; }
.legend-of-swatch .of-sell { background: #ff5a6a; }
.legend-tri.of-flip {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 7px solid #2ee59d;
  background: transparent;
  border-radius: 0;
  display: inline-block;
}
.legend-dot.ict {
  background: linear-gradient(135deg, rgba(46, 229, 157, 0.85), rgba(255, 90, 106, 0.85));
}

.overlay-btn.active {
  border-color: rgba(91, 140, 255, 0.55);
  background: rgba(91, 140, 255, 0.14);
  color: #9cbcff;
}

.alerts-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.alerts-label {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.alerts-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.alert-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(232, 184, 74, 0.35);
  background: rgba(232, 184, 74, 0.1);
  color: var(--score-mid);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.alert-chip-of {
  border-color: rgba(46, 229, 157, 0.35);
  background: rgba(46, 229, 157, 0.08);
  color: #8fd9b8;
}

.alert-chip-meta {
  color: var(--text-dim);
  font-size: 10px;
  font-family: var(--font-sans, IBM Plex Sans, system-ui, sans-serif);
}

.of-alert-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 8px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.02);
}

.of-alert-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-right: 2px;
}

.of-alert-wrap select {
  appearance: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  color: var(--text);
  font-size: 11px;
  padding: 4px 8px;
  margin-right: 2px;
}

.of-alert-btn {
  padding: 4px 8px;
  font-size: 11px;
}

.toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: min(360px, calc(100vw - 32px));
}

.toast {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #121820;
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-up {
  border-color: rgba(46, 229, 157, 0.45);
}

.toast-down {
  border-color: rgba(255, 90, 106, 0.45);
}

.alert-chip button {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1;
  padding: 0 2px;
}

.alert-chip button:hover {
  color: var(--down);
}

.alerts-empty {
  color: var(--text-dim);
  font-size: 12px;
}

.chart-shell {
  flex: 1;
  min-height: 480px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  overflow: hidden;
  position: relative;
}

.chart-shell.alert-cursor {
  cursor: crosshair;
}

#chart {
  width: 100%;
  height: 100%;
  min-height: 480px;
}

.chart-overlay {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(7, 9, 12, 0.55);
  z-index: 5;
}

.chart-overlay.visible {
  display: grid;
}

.alert-hint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(18, 24, 32, 0.92);
  border: 1px solid rgba(232, 184, 74, 0.45);
  color: var(--score-mid);
  font-size: 12.5px;
  font-weight: 600;
  pointer-events: none;
}

.alert-hint[hidden] {
  display: none;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr;
    justify-items: start;
    padding: 12px 16px;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .panel {
    padding: 14px 16px 20px;
  }

  .status-line {
    margin-left: 0;
  }

  .preview-pane {
    flex-basis: 28vh;
    min-height: 180px;
  }

  table.scanner .col-vol,
  table.scanner .col-go {
    display: none;
  }
}

/* ── Settings ───────────────────────────────────────── */

/* ── Patterns (test) ────────────────────────────────── */

.patterns-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  flex: 1;
  overflow: auto;
}

.patterns-hero {
  max-width: 72ch;
}

.patterns-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.patterns-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #e8b84a;
  border: 1px solid rgba(232, 184, 74, 0.4);
  background: rgba(232, 184, 74, 0.1);
  border-radius: 999px;
  padding: 2px 8px;
}

.patterns-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.patterns-controls {
  align-items: flex-end;
  flex-wrap: wrap;
}

.pat-help {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  margin: 0 2px;
  z-index: 5;
}

.pat-help-q {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(139, 149, 168, 0.55);
  color: #8b95a8;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  background: rgba(255, 255, 255, 0.04);
}

.pat-help-pop {
  display: none;
  position: fixed;
  z-index: 10000;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: #0e1218;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  width: min(440px, calc(100vw - 24px));
  pointer-events: none;
  top: 0;
  left: 0;
}

.pat-help-pop img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.pat-help-pop.is-visible {
  display: block;
}

.pat-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
}

.pat-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  min-width: min(100%, 280px);
  flex: 1 1 280px;
}

.pat-group-shared {
  flex: 1 1 100%;
  align-items: center;
}

.pat-group-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  margin-bottom: 4px;
}

.pat-group-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pat-group-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.pat-age-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pat-age-row select,
.pat-age-row input,
.pat-zmax {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  padding: 6px 8px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
}

.pat-age-row input,
.pat-zmax {
  width: 64px;
}

.pat-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 4px;
}

.patterns-method {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.patterns-method summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}

.patterns-method ul {
  margin: 8px 0 4px;
  padding-left: 18px;
  line-height: 1.45;
}

.pat-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}

.pat-type.brush {
  color: #e8b84a;
}

.pat-type.step-up {
  color: #9eb6ff;
}

.pat-type.step-down {
  color: #ff9e9e;
}

.pat-type.trend-up {
  color: var(--accent);
}

.pat-type.trend-down {
  color: var(--down);
}

.pat-type.crt-manip {
  color: #7da8ff;
}

.pat-type.crt-dist {
  color: #c4a3ff;
}

.pat-type.wyck-spring {
  color: #2ee59d;
}

.pat-type.wyck-upthrust {
  color: #ff9e9e;
}

.pat-type.demand-long {
  color: #4ac8b4;
}

.pat-type.demand-short {
  color: #ff8c64;
}

.pat-type.lbf-bottom {
  color: #2ee59d;
}

.pat-type.lbf-top {
  color: #ff785a;
}

.pat-help-pop-text {
  max-width: 360px;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text, #e8edf5);
}

.pat-help-pop-text strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.pat-help-pop-text p {
  margin: 0 0 8px;
}

.pat-help-pop-text ol {
  margin: 0 0 8px;
  padding-left: 18px;
}

.pat-help-pop-text .pat-help-note {
  margin: 0;
  color: var(--muted, #8b95a8);
  font-size: 11px;
}

.pat-metrics {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 11px;
  color: var(--text-muted);
}

.go-btn {
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
}

.go-btn:hover {
  color: var(--accent);
}

.settings-panel {
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
  overflow: auto;
}

.settings-hero {
  margin-bottom: 8px;
}

.settings-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.settings-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
  max-width: 56ch;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 8px;
}

.settings-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-block-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field.grow {
  flex: 1;
}

.field-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.field-hint {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--text-muted);
}

.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: rgba(46, 229, 157, 0.45);
}

.fields-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}

.check-field input {
  accent-color: var(--accent);
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.settings-status {
  color: var(--text-muted);
  font-size: 12.5px;
}

.settings-status.ok {
  color: var(--accent);
}

.settings-status.err {
  color: var(--down);
}

.help-dialog {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 560px;
  width: calc(100% - 32px);
}

.help-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.help-dialog-inner {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  color: var(--text);
}

.help-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.help-dialog-head h2 {
  margin: 0;
  font-size: 16px;
}

.help-dialog-body {
  padding: 16px 18px 20px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  max-height: min(70vh, 520px);
  overflow: auto;
}

.help-dialog-body h3 {
  margin: 14px 0 8px;
  font-size: 13px;
  color: var(--text);
}

.help-dialog-body h3:first-child {
  margin-top: 0;
}

.help-dialog-body ol,
.help-dialog-body ul {
  margin: 0 0 4px;
  padding-left: 1.2em;
}

.help-dialog-body li {
  margin-bottom: 6px;
}

.help-dialog-body code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--accent);
}

.help-note {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(232, 184, 74, 0.1);
  border: 1px solid rgba(232, 184, 74, 0.28);
  color: var(--score-mid);
  font-size: 12.5px;
}

/* Liq Map */
.liq-sym-input {
  width: 120px !important;
  text-transform: uppercase;
}

.liq-tier-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(10, 12, 18, 0.55);
  border: 1px solid rgba(253, 231, 37, 0.12);
}

.liq-tier-row .pat-check {
  font-size: 12px;
  color: #dfe7f2;
}

.liqmap-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 4px 0 12px;
}

.liq-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 110px;
}

.liq-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.liq-stat-val {
  font-size: 15px;
  font-weight: 600;
}

.liq-stat.buy .liq-stat-val {
  color: var(--pos, #2ee59d);
}

.liq-stat.sell .liq-stat-val {
  color: var(--neg, #ff5a6a);
}

.liq-hud {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 4;
  min-width: 200px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(10, 12, 18, 0.92);
  border: 1px solid rgba(253, 231, 37, 0.35);
  box-shadow: 0 0 0 1px rgba(253, 231, 37, 0.08);
  pointer-events: none;
  font-size: 11px;
  line-height: 1.35;
  color: #dfe7f2;
}

.liq-hud-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(253, 231, 37, 0.2);
  color: #fde725;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.liq-hud-title span:last-child {
  color: #5f7186;
  font-weight: 500;
  text-transform: none;
}

.liq-hud-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 3px 0;
}

.liq-hud-row .muted {
  color: #5f7186;
}

.liq-hud-row .acc {
  color: #fde725;
}

.liq-hud-row .bar {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: -0.04em;
  color: #8b95a8;
}

.liq-hud-row.best .bar,
.liq-hud-row.best .acc {
  color: #fde725;
}

.liqmap-split {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
  min-height: 480px;
}

.liqmap-chart-shell {
  position: relative;
  min-height: 460px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

#liqmap-chart {
  width: 100%;
  height: 100%;
  min-height: 460px;
}

.liqmap-table-wrap {
  max-height: 520px;
  overflow: auto;
}

.liqmap-method {
  margin-top: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.liqmap-method summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}

.liqmap-method ul {
  margin: 8px 0 4px;
  padding-left: 1.2em;
}

.liqmap-method code {
  font-family: var(--font-mono);
  font-size: 11px;
}

@media (max-width: 1100px) {
  .liqmap-split {
    grid-template-columns: 1fr;
  }
}

.dch-split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 400px) 1fr;
  gap: 12px;
}

.dch-table-wrap {
  min-height: 180px;
  overflow: auto;
}

.dch-table-wrap table.scanner {
  table-layout: fixed;
}

.dch-table-wrap table.scanner thead th,
.dch-table-wrap table.scanner td {
  padding: 10px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dch-table-wrap table.scanner .col-rank {
  width: 36px;
  padding-left: 10px;
  padding-right: 4px;
}

.dch-table-wrap table.scanner .col-symbol {
  width: 52%;
}

.dch-table-wrap table.scanner thead th {
  overflow: visible;
  text-overflow: clip;
}

.dch-table-wrap table.scanner .dch-col-r,
.dch-table-wrap table.scanner .dch-col-pos {
  width: 72px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dch-table-wrap table.scanner thead th.dch-col-r,
.dch-table-wrap table.scanner thead th.dch-col-pos {
  text-transform: none;
  letter-spacing: 0;
  text-align: right;
}

.dch-table-wrap table.scanner .col-go {
  width: 32px;
  padding-left: 0;
  padding-right: 8px;
}

.dch-sub {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dch-preview-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  flex: 1 1 auto;
  max-height: none;
  height: 100%;
}

.dch-chart-shell {
  flex: 1;
  min-height: 360px;
}

#dch-preview-chart {
  width: 100%;
  height: 100%;
  min-height: 360px;
}

.dch-edge {
  font-size: 11px;
  font-weight: 700;
}

.dch-edge.lower {
  color: #e8b84a;
}

.dch-edge.upper {
  color: #5b8cff;
}

.dch-chpos {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 12px;
}

/* Orderflow tab */
.of-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  padding-bottom: 12px;
}
.of-glossary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 6px 14px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
  max-height: 120px;
  overflow: auto;
  flex: 0 0 auto;
}
.of-gloss-item .of-state,
.of-gloss-item .of-label {
  margin-right: 6px;
  vertical-align: middle;
}
.of-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.of-top {
  flex: 1 1 48%;
  min-height: 180px;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 1fr);
  gap: 10px;
  min-width: 0;
}
.of-table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
}
.of-detail-pane {
  flex: unset;
  min-height: 0;
  max-height: none;
  height: 100%;
}
.of-chart-panel {
  flex: 1 1 52%;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  overflow: hidden;
}
.of-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}
.of-chart-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.of-chart-title strong {
  font-size: 13px;
}
.of-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 11px;
  color: var(--text-muted);
  align-items: center;
}
.of-mark {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}
.of-mark.burst { background: #e8b84a; }
.of-mark.pusher { background: #2ee59d; }
.of-mark.absorb { background: #ff5a6a; }
.of-chart-shell {
  position: relative;
  flex: 1;
  min-height: 0;
}
#of-chart {
  width: 100%;
  height: 100%;
  min-height: 220px;
}
.of-chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  margin: 0;
  background: transparent;
}
.of-chart-empty[hidden] {
  display: none;
}
@media (max-width: 960px) {
  .of-top {
    grid-template-columns: 1fr;
    flex: 1 1 55%;
  }
  .of-detail-pane {
    min-height: 180px;
  }
  .of-glossary {
    max-height: 90px;
  }
}

.of-state {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: rgba(107, 115, 133, 0.2);
  color: var(--text-muted);
}
.of-state.burst { background: rgba(232, 184, 74, 0.18); color: #e8b84a; }
.of-state.pusher { background: rgba(46, 229, 157, 0.16); color: #2ee59d; }
.of-state.absorb { background: rgba(255, 90, 106, 0.16); color: #ff5a6a; }
.of-state.idle { opacity: 0.75; }
.of-state.inplay { background: rgba(46, 229, 157, 0.16); color: #2ee59d; }
.of-state.quiet { background: rgba(107, 115, 133, 0.18); color: var(--text-muted); }
.scanner-row.is-quiet { opacity: 0.55; }
.of-label.cont { color: #2ee59d; font-weight: 600; }
.of-label.absorb { color: #ff5a6a; font-weight: 600; }
.of-detail-body {
  padding: 10px 14px 14px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.of-events {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.of-event {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.of-bars {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.of-bars th,
.of-bars td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--border-soft);
  text-align: right;
}
.of-bars th:first-child,
.of-bars td:first-child {
  text-align: left;
}
.text-dim { color: var(--text-dim); font-size: 11px; }

/* Adsorbtion gallery (examples_10 style) */
.abs-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  padding-bottom: 12px;
}
.abs-gallery {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 2px 2px 20px;
}
.abs-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 12px 14px 8px;
}
.abs-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.abs-meta .sym {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.abs-meta b { color: var(--text); font-weight: 560; }
.abs-tag {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(46, 229, 157, 0.14);
  color: #2ee59d;
}
.abs-card canvas {
  width: 100%;
  height: 260px;
  display: block;
  background: #121820;
  border-radius: 6px;
}
.abs-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 6px;
}
.abs-legend span::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 3px;
  margin-right: 5px;
  vertical-align: middle;
  background: currentColor;
}
.abs-l-price { color: #c5d0dc; }
.abs-l-abs { color: #7aa2f7; }
.abs-l-bos { color: #ffcc66; }
.abs-l-ev { color: #ff7b72; }

/* ── Strategies catalog ─────────────────────────────────────────── */
.strat-panel { padding-bottom: 28px; }
.strat-level-filters {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: 12px;
}
.filter-chip {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.filter-chip:hover { color: var(--text); border-color: var(--text-dim); }
.filter-chip.active {
  color: var(--accent);
  border-color: rgba(46, 229, 157, 0.45);
  background: var(--accent-dim);
}
.strat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(520px, 1fr));
  gap: 18px;
  padding: 4px 2px 12px;
}
.strat-card {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
}
.strat-badge.recommended { background: rgba(46, 229, 157, 0.16); color: #2ee59d; }
.strat-badge.not_offered { background: rgba(255, 90, 106, 0.14); color: #ff5a6a; }
.strat-fig {
  margin: 0;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  overflow: hidden;
  background: #07090c;
}
.strat-fig img {
  display: block;
  width: 100%;
  height: auto;
}
.strat-fig figcaption {
  padding: 6px 10px 8px;
  font-size: 11px;
  color: var(--text-dim);
  border-top: 1px solid var(--border-soft);
}
.strat-examples {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 900px) {
  .strat-examples {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .strat-grid {
    grid-template-columns: 1fr;
  }
}
@media (min-width: 1400px) {
  .strat-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.strat-card.is-prod {
  border-color: rgba(46, 229, 157, 0.4);
  box-shadow: inset 0 0 0 1px rgba(46, 229, 157, 0.12);
}
.strat-card.is-avoid { opacity: 0.72; }
.strat-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.strat-card h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
  flex: 1 1 auto;
}
.strat-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(107, 115, 133, 0.2);
  color: var(--text-muted);
}
.strat-badge.beginner { background: rgba(91, 140, 255, 0.16); color: #7aa2f7; }
.strat-badge.intermediate { background: rgba(232, 184, 74, 0.16); color: #e8b84a; }
.strat-badge.production_candidate { background: rgba(46, 229, 157, 0.16); color: #2ee59d; }
.strat-badge.watchlist { background: rgba(232, 184, 74, 0.14); color: #e8b84a; }
.strat-badge.avoid_live,
.strat-badge.research { background: rgba(255, 90, 106, 0.14); color: #ff5a6a; }
.strat-tab {
  font-size: 12px;
  color: var(--text-dim);
}
.strat-summary {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.45;
  font-size: 13px;
}
.strat-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.strat-stat {
  background: var(--bg-row);
  border-radius: 8px;
  padding: 8px 10px;
}
.strat-stat .k {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 2px;
}
.strat-stat .v {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
}
.strat-stat .v.pos { color: var(--accent); }
.strat-stat .v.neg { color: var(--down); }
.strat-rules {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.45;
}
.strat-rules li { margin-bottom: 4px; }
.strat-note {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
  border-top: 1px solid var(--border-soft);
  padding-top: 8px;
}
.strat-how-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.strat-how .strat-rules { margin-bottom: 0; }

