/* 12-charts.css — the "Charts" live terminal. Matches the site tokens (01-tokens.css): RunPod-dark
   surfaces, violet accent, JetBrains Mono numerics, TradingView up/down. Namespace: .cx-* */

.cx-wrap { display: flex; flex-direction: column; gap: 12px; }

/* ── top bar: symbol pills + live status + clock ─────────────────────────── */
.cx-top {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 2px 2px 0;
}
.cx-title { font-size: 15px; font-weight: 500; color: var(--text-primary); letter-spacing: .01em; }
.cx-title__sub { font-size: 12px; color: var(--text-tertiary); margin-left: 2px; }
.cx-syms { display: flex; gap: 7px; }
.cx-sym {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer; white-space: nowrap;
  padding: 6px 13px; font-family: var(--font-mono); font-size: 12px; line-height: 1.2;
  color: var(--text-secondary); background: var(--bg-inset);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-pill);
  transition: border-color .12s, background .12s, color .12s;
}
.cx-sym:hover { border-color: var(--border-strong); color: var(--text-primary); }
.cx-sym.is-active { background: var(--accent-soft); border-color: rgba(95,76,254,.5); color: var(--accent-secondary); }
.cx-sym__name { font-weight: 600; }
.cx-sym__px { font-variant-numeric: tabular-nums; color: var(--text-tertiary); }
.cx-sym.is-active .cx-sym__px { color: var(--text-secondary); }

.cx-status { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-tertiary); }
.cx-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); box-shadow: 0 0 6px transparent; transition: background .2s, box-shadow .2s; }
.cx-dot.is-live { background: var(--up-bright); box-shadow: 0 0 7px var(--up-bright); }
.cx-dot.is-connecting { background: var(--warning); box-shadow: 0 0 7px var(--warning); }
.cx-dot.is-offline { background: var(--down); box-shadow: 0 0 7px var(--down); }
.cx-clock { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); }

/* ── toolbar: candle type + overlay toggles ─────────────────────────────── */
.cx-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 2px; }
.cx-tg { display: inline-flex; gap: 5px; }
.cx-tlabel { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.cx-tsep { width: 1px; align-self: stretch; background: var(--border-subtle); margin: 2px 4px; }
.cx-tool {
  font-family: var(--font-mono); font-size: 11px; line-height: 1.2; cursor: pointer; white-space: nowrap;
  padding: 5px 10px; color: var(--text-tertiary); background: var(--bg-inset);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  transition: border-color .12s, background .12s, color .12s;
}
.cx-tool:hover { border-color: var(--border-strong); color: var(--text-secondary); }
.cx-tool.is-active { background: var(--accent-soft); border-color: rgba(95,76,254,.5); color: var(--accent-secondary); }
.cx-book-note { font-family: var(--font-mono); font-size: 11px; color: var(--warning); margin-left: auto; }

/* ── terminal grid: charts column + right sidebar ───────────────────────── */
.cx-terminal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 336px;
  gap: 14px;
  height: calc(100vh - var(--topbar-height) - 168px);
  min-height: 560px;
}
.cx-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1.65fr 1fr;
  gap: 12px;
  min-height: 0; min-width: 0;
}
.cx-pane { grid-column: auto; }
.cx-pane--main { grid-column: 1 / -1; }

/* ── a chart pane (card) ─────────────────────────────────────────────────── */
.cx-pane {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); overflow: hidden;
}
.cx-pane__head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 7px 11px; border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono); min-height: 18px;
}
.cx-pane__tf {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-secondary); background: var(--accent-soft);
  padding: 2px 7px; border-radius: var(--radius-pill);
}
.cx-pane__ohlc { display: inline-flex; gap: 10px; font-size: 11px; color: var(--text-tertiary); }
.cx-pane__ohlc b { color: var(--text-secondary); font-weight: 500; }
.cx-pane__last { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.cx-pane__chg { font-size: 11px; font-variant-numeric: tabular-nums; }
.cx-pane__chg.up, .cx-up { color: var(--up-bright); }
.cx-pane__chg.down, .cx-down { color: var(--down-bright); }
.cx-pane__host { position: relative; flex: 1 1 auto; min-height: 0; background: var(--bg-inset); }
.cx-pane__msg {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-tertiary); pointer-events: none; text-align: center; padding: 1rem;
}

/* ── right sidebar ───────────────────────────────────────────────────────── */
.cx-side { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; padding-right: 2px; }
.cx-card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
.cx-card__h {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; border-bottom: 1px solid var(--border-subtle);
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-tertiary);
}
.cx-card__b { padding: 11px 12px; }

/* live price block */
.cx-price { display: flex; align-items: baseline; gap: 10px; font-family: var(--font-mono); }
.cx-price__mid { font-size: 26px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; line-height: 1; }
.cx-price__sub { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--text-tertiary); }
.cx-price__sub span b { color: var(--text-secondary); font-weight: 500; }

/* HTF trend rows */
.cx-trend { display: flex; flex-direction: column; gap: 8px; font-family: var(--font-mono); }
.cx-trend__row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.cx-trend__tf { color: var(--text-tertiary); }
.cx-trend__v { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.cx-trend__v.up { color: var(--up-bright); }
.cx-trend__v.down { color: var(--down-bright); }
.cx-trend__v.flat { color: var(--text-muted); }

/* news list — compact single line per event */
.cx-card--news .cx-card__b { padding: 8px 10px; }
.cx-news { display: flex; flex-direction: column; gap: 5px; }
.cx-news__item { display: flex; align-items: center; gap: 7px; min-width: 0; }
.cx-news__when { font-family: var(--font-mono); font-size: 10.5px; color: var(--accent-secondary); flex: 0 0 auto; min-width: 44px; }
.cx-news__imp { flex: 0 0 auto; width: 14px; text-align: center; font-size: 9px; font-weight: 700; padding: 1px 0; border-radius: var(--radius-xs); }
.cx-news__imp.high { background: var(--down-soft); color: var(--down-bright); }
.cx-news__imp.medium { background: var(--warning-soft); color: var(--warning); }
.cx-news__title { font-size: 11px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* levels table */
.cx-levels { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 11.5px; }
.cx-levels td { padding: 4px 2px; border-bottom: 1px solid var(--border-faint); }
.cx-levels tr:last-child td { border-bottom: none; }
.cx-levels__k { color: var(--text-tertiary); }
.cx-levels__v { text-align: right; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.cx-levels__v.near { color: var(--accent-secondary); font-weight: 600; }

.cx-muted { color: var(--text-muted); font-size: 11.5px; font-family: var(--font-mono); }

/* responsive: stack the sidebar under the charts, shrink panes */
@media (max-width: 1200px) {
  .cx-terminal { grid-template-columns: 1fr; height: auto; }
  .cx-charts { height: 78vh; }
  .cx-side { overflow: visible; }
}
@media (max-width: 760px) {
  .cx-charts { grid-template-columns: 1fr; grid-template-rows: 1.4fr 1fr 1fr; height: 120vh; }
  .cx-pane--main { grid-column: 1; }
}

/* ── info (ⓘ) dropdown ───────────────────────────────────────────────────── */
.cx-tool--i { width: 26px; padding: 5px 0; font-style: italic; font-weight: 700; border-radius: 50%; }
.cx-info { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 12px 14px; }
.cx-info__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px 18px; }
.cx-info__item { font-size: 11.5px; line-height: 1.45; color: var(--text-tertiary); }
.cx-info__item b { display: block; color: var(--text-primary); font-weight: 600; font-size: 12px; margin-bottom: 2px; }
.cx-info__item em { color: var(--accent-secondary); font-style: normal; font-weight: 600; }

/* ── hover tooltip (names the line under the cursor) ─────────────────────── */
.cx-tip { position: fixed; z-index: 9999; pointer-events: none; background: var(--bg-surface-strong);
  border: 1px solid var(--border-default); border-radius: var(--radius-sm); padding: 5px 8px;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-primary); box-shadow: var(--shadow-md); white-space: nowrap; }
.cx-tip__sw { display: inline-block; width: 10px; height: 2px; vertical-align: middle; margin-right: 6px; }

/* ── book widget ─────────────────────────────────────────────────────────── */
.cx-skew { display: flex; height: 18px; border-radius: var(--radius-xs); overflow: hidden; font-family: var(--font-mono); font-size: 10px; font-weight: 600; }
.cx-skew__l { background: var(--up-soft); color: var(--up-bright); display: flex; align-items: center; padding-left: 6px; white-space: nowrap; }
.cx-skew__s { background: var(--down-soft); color: var(--down-bright); display: flex; align-items: center; justify-content: flex-end; padding-right: 6px; }
.cx-skew__note { font-size: 10.5px; color: var(--text-tertiary); margin: 5px 0 8px; font-family: var(--font-mono); }
.cx-bk-h { font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 5px; }
.cx-bk-row { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.cx-bk-px { flex: 0 0 56px; text-align: right; font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.cx-bk-px.near { color: var(--accent-secondary); font-weight: 600; }
.cx-bk-bar { flex: 1 1 auto; height: 6px; background: var(--bg-inset); border-radius: 3px; overflow: hidden; }
.cx-bk-bar > span { display: block; height: 100%; background: var(--accent); opacity: .7; border-radius: 3px; }

/* ── session bar atop each chart ─────────────────────────────────────────── */
.cx-sess { display: flex; align-items: center; gap: 9px; padding: 4px 11px; border-bottom: 1px solid var(--border-faint); }
.cx-sess__lbl { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; color: var(--text-secondary); letter-spacing: .02em; }
.cx-sess__dot { width: 7px; height: 7px; border-radius: 50%; }
.cx-sess__bar { position: relative; flex: 1 1 auto; display: flex; height: 5px; border-radius: 3px; overflow: hidden; }
.cx-sess__bar .seg { display: block; height: 100%; opacity: .30; }
.cx-sess__bar .seg.is-now { opacity: 1; }
.cx-sess__bar .seg.asia, .cx-sess__dot.asia { background: #5b6cf0; }
.cx-sess__bar .seg.london, .cx-sess__dot.london { background: #2bb6a3; }
.cx-sess__bar .seg.ny, .cx-sess__dot.ny { background: #e0913a; }
.cx-sess__bar .seg.late, .cx-sess__dot.late { background: #6b7280; }
.cx-sess__now { position: absolute; top: -1px; bottom: -1px; width: 2px; background: #fff; box-shadow: 0 0 4px rgba(255,255,255,.7); transform: translateX(-1px); }

/* ── candle-aligned session strip (overlay at top of each chart) ─────────── */
.cx-sstrip { position: absolute; top: 0; left: 0; right: 0; height: 4px; z-index: 3; pointer-events: none; }
.cx-sstrip .seg { position: absolute; top: 0; height: 4px; opacity: .45; }
.cx-sstrip .seg.is-now { opacity: 1; }
.cx-sstrip .seg.asia { background: #5b6cf0; }
.cx-sstrip .seg.london { background: #2bb6a3; }
.cx-sstrip .seg.ny { background: #e0913a; }
.cx-sstrip .seg.late { background: #6b7280; }
.cx-slabel { position: absolute; top: 8px; left: 8px; z-index: 3; pointer-events: none;
  display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 10px;
  font-weight: 600; color: var(--text-secondary); background: rgba(18,18,18,0.55); padding: 1px 7px; border-radius: var(--radius-pill); }
.cx-slabel__dot { width: 6px; height: 6px; border-radius: 50%; }
.cx-slabel__dot.asia { background: #5b6cf0; } .cx-slabel__dot.london { background: #2bb6a3; }
.cx-slabel__dot.ny { background: #e0913a; } .cx-slabel__dot.late { background: #6b7280; }

/* ── LinReg bars slider ──────────────────────────────────────────────────── */
.cx-lrcbars { display: inline-flex; align-items: center; gap: 7px; }
.cx-range { width: 110px; accent-color: var(--accent); cursor: pointer; }
.cx-range__v { font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); min-width: 24px; }

/* ── book distilled rows (skew + nearest walls) ──────────────────────────── */
.cx-bk-tag { flex: 0 0 46px; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.cx-bk-dist { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary); }

/* ── vertical session-boundary lines ─────────────────────────────────────── */
.cx-vlines { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.cx-vlines .vl { position: absolute; top: 4px; bottom: 0; width: 0; border-left: 1px dashed rgba(175,180,195,0.22); transform: translateX(-0.5px); }
.cx-vlines .vl.asia { border-left-color: rgba(91,108,240,0.38); }
.cx-vlines .vl.london { border-left-color: rgba(43,182,163,0.40); }
.cx-vlines .vl.ny { border-left-color: rgba(224,145,58,0.42); }
.cx-vlines .vl.late { border-left-color: rgba(107,114,128,0.40); }
.cx-vlines .vl-lbl { position: absolute; top: 6px; transform: translateX(3px); font-family: var(--font-mono);
  font-size: 8.5px; font-weight: 700; letter-spacing: .04em; color: var(--text-muted); }

/* ── MA period number input ──────────────────────────────────────────────── */
.cx-num { width: 48px; background: var(--bg-inset); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  color: var(--text-primary); font-family: var(--font-mono); font-size: 11px; padding: 4px 6px; }
.cx-num:focus { outline: none; border-color: rgba(95,76,254,.5); }

/* ── pre-open shading + HA-flip gates + free-drag ────────────────────────── */
.cx-sstrip .seg.pre { opacity: .16; }       /* pre-open = faint band before each session */
.cx-sstrip .seg.is-now { opacity: 1; }      /* (reaffirm after .pre so the live band still lights) */
.cx-vlines .vl.pre { border-left-style: dotted; }
.cx-flip { display: inline-flex; align-items: center; gap: 6px; }
.cx-flip-gates { display: inline-flex; align-items: center; gap: 5px; }
.cx-tool--sm { padding: 3px 7px; font-size: 10px; }
/* free-drag: don't let click-drag select overlay text/elements instead of panning the chart */
.cx-pane { user-select: none; -webkit-user-select: none; }
.cx-pane__host { touch-action: none; }

/* charts page fills the viewport — no document scroll competing with chart drag (sidebar scrolls internally) */
body.cx-charts-page { overflow: hidden; }

/* ── candle-close countdown (right edge, like TradingView) ────────────────── */
.cx-cd { position: absolute; right: 1px; z-index: 4; pointer-events: none; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; line-height: 1; letter-spacing: .02em;
  padding: 2px 4px; border-radius: var(--radius-xs); background: var(--accent); color: #fff; box-shadow: var(--shadow-xs); }
.cx-cd.soon { background: var(--warning); color: #1a1a1a; }
