/* Lord of TA — design language inherited from the sg_tas dashboard / jec's web kit */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600;700&display=swap');

:root {
  --bg: #0a0b0d; --surface: #111318; --surface2: #181c23; --surface3: #1e2330;
  --border: #252b38; --border2: #2d3547;
  --text: #e8eaf0; --muted: #6b7694; --muted2: #8892b0;
  --green: #00d084; --green-dim: #00d08420;
  --red: #ff4d6a; --red-dim: #ff4d6a20;
  --yellow: #ffb938; --yellow-dim: #ffb93820;
  --blue: #4e9eff; --blue-dim: #4e9eff15;
  --purple: #a78bfa; --purple-dim: #a78bfa20;
  --orange: #fb923c; --cyan: #22d3ee; --pink: #f472b6;
  --radius: 8px;
  --mono: 'JetBrains Mono', monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif; font-size: 13px;
  display: flex; flex-direction: column; overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────────────────── */
header {
  background: var(--surface); border-bottom: 1px solid var(--border);
  height: 48px; padding: 0 16px; display: flex; align-items: center; gap: 14px;
  flex-shrink: 0; z-index: 10;
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; letter-spacing: -0.3px; white-space: nowrap; }
.logo-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.logo .sub { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; margin-left: 4px; }
.hdr-divider { width: 1px; height: 20px; background: var(--border); }

.sym-form { display: flex; align-items: center; gap: 8px; }
.sym-input {
  background: var(--surface2); border: 1px solid var(--border2); color: var(--text);
  font-family: var(--mono); font-size: 14px; font-weight: 700; text-transform: uppercase;
  padding: 6px 10px; border-radius: 6px; width: 110px; outline: none;
}
.sym-input:focus { border-color: var(--blue); }

.pills { display: flex; gap: 4px; }
.pill {
  background: var(--surface2); border: 1px solid var(--border); color: var(--muted2);
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px;
  cursor: pointer; user-select: none; transition: all .12s; font-family: var(--mono);
}
.pill:hover { color: var(--text); border-color: var(--border2); }
.pill.active { background: var(--blue-dim); color: var(--blue); border-color: #4e9eff50; }
.pill.live-pill.active { background: var(--green-dim); color: var(--green); border-color: #00d08450; }

.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.quote-strip { font-family: var(--mono); font-size: 13px; display: flex; gap: 10px; align-items: baseline; }
.quote-strip .px { font-size: 15px; font-weight: 700; }
.quote-strip .chg.pos { color: var(--green); } .quote-strip .chg.neg { color: var(--red); }
#live-clock { font-family: var(--mono); font-size: 12px; color: var(--muted2); }
.market-badge { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.market-badge.live { background: var(--green-dim); color: var(--green); border: 1px solid #00d08440; }
.market-badge.delayed { background: #ffffff08; color: var(--muted); border: 1px solid var(--border); }

/* ── Layout ─────────────────────────────────────────────────────────── */
.layout { display: flex; flex: 1; overflow: hidden; }

.sidebar {
  width: 200px; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0; padding: 8px 0; overflow-y: auto;
}
.sidebar-label { padding: 12px 16px 6px; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.ch-btn {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 7px 12px 7px 14px; margin: 1px 6px; border-radius: 6px; cursor: pointer;
  color: var(--muted2); font-size: 12.5px; font-weight: 500; transition: all .12s; user-select: none;
}
.ch-btn:hover { background: var(--surface2); color: var(--text); }
.ch-btn.active { background: var(--blue-dim); color: var(--blue); }
.ch-btn.active::before { content: ''; position: absolute; left: 0; top: 20%; height: 60%; width: 3px; background: var(--blue); border-radius: 0 2px 2px 0; }
.ch-btn .cnt { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.sidebar-sep { height: 1px; background: var(--border); margin: 8px 12px; }
.watch-sym { font-family: var(--mono); font-weight: 600; }
.attn-badge { font-size: 10px; cursor: help; }

/* ── Main ───────────────────────────────────────────────────────────── */
.main { flex: 1; display: flex; overflow: hidden; }
.center { flex: 1; display: flex; flex-direction: column; overflow: hidden; padding: 10px; gap: 10px; }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px;
}
.panel-title { font-size: 10px; font-weight: 700; letter-spacing: 1.4px; color: var(--muted); text-transform: uppercase; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.panel-title .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.chart-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.chart-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tool-label { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-right: 2px; }
.chart-host { flex: 1; min-height: 0; position: relative; }
.chart-host svg { display: block; }

.hover-readout {
  position: absolute; top: 6px; left: 10px; font-family: var(--mono); font-size: 11px;
  color: var(--muted2); pointer-events: none; z-index: 5; background: #0a0b0dcc;
  padding: 2px 8px; border-radius: 4px; white-space: nowrap;
}
.hover-readout b { color: var(--text); }
.hover-readout .pos { color: var(--green); } .hover-readout .neg { color: var(--red); }

.marker-tip {
  position: absolute; z-index: 20; background: var(--surface3); border: 1px solid var(--border2);
  border-radius: 8px; padding: 10px 12px; font-family: var(--mono); font-size: 11.5px;
  box-shadow: 0 8px 30px #000a; pointer-events: none; min-width: 200px;
}
.marker-tip .tt-title { font-weight: 700; font-size: 12px; margin-bottom: 6px; font-family: 'Inter', sans-serif; }
.marker-tip .row { display: flex; justify-content: space-between; gap: 16px; padding: 1px 0; color: var(--muted2); }
.marker-tip .row b { color: var(--text); }
.marker-tip .pos { color: var(--green) !important; } .marker-tip .neg { color: var(--red) !important; }

/* ── Right rank panel ───────────────────────────────────────────────── */
.rank-pane {
  width: 400px; flex-shrink: 0; border-left: 1px solid var(--border); background: var(--surface);
  display: flex; flex-direction: column; overflow: hidden;
}
.rank-hdr { padding: 12px 14px 0; }
.rank-title { font-size: 10px; font-weight: 700; letter-spacing: 1.4px; color: var(--muted); text-transform: uppercase; }
.rank-sym { font-size: 18px; font-weight: 700; font-family: var(--mono); margin-top: 2px; display: flex; align-items: baseline; gap: 10px; }
.regime-badges { display: flex; gap: 6px; margin: 8px 0 10px; flex-wrap: wrap; }
.badge { padding: 3px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 600; border: 1px solid var(--border); color: var(--muted2); background: var(--surface2); }
.badge.up { background: var(--green-dim); color: var(--green); border-color: #00d08440; }
.badge.down { background: var(--red-dim); color: var(--red); border-color: #ff4d6a40; }
.badge.chop { background: var(--yellow-dim); color: var(--yellow); border-color: #ffb93840; }
.badge.hi { background: var(--purple-dim); color: var(--purple); border-color: #a78bfa40; }

.tabs { display: flex; gap: 2px; padding: 0 14px; border-bottom: 1px solid var(--border); }
.tab { padding: 8px 12px; font-size: 11.5px; font-weight: 600; color: var(--muted2); cursor: pointer; border-bottom: 2px solid transparent; user-select: none; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.rank-body { flex: 1; overflow-y: auto; padding: 10px 14px; }

table.lb { width: 100%; border-collapse: collapse; font-size: 11.5px; }
table.lb th {
  text-align: right; font-size: 9.5px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--border);
  position: sticky; top: -10px; background: var(--surface); cursor: default;
}
table.lb th:first-child, table.lb td:first-child { text-align: left; }
table.lb td { padding: 6px; text-align: right; font-family: var(--mono); border-bottom: 1px solid #1a1f2a; color: var(--muted2); }
table.lb td:first-child { font-family: 'Inter', sans-serif; font-weight: 600; color: var(--text); }
table.lb tr.rule-row { cursor: pointer; transition: background .1s; }
table.lb tr.rule-row:hover td { background: var(--surface2); }
table.lb tr.rule-row.sel td { background: var(--blue-dim); }
table.lb tr.rule-row.sel td:first-child { color: var(--blue); }
td.pos, span.pos { color: var(--green) !important; } td.neg, span.neg { color: var(--red) !important; }
.side-tag { font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 8px; margin-left: 6px; vertical-align: 1px; }
.side-tag.buy { background: var(--green-dim); color: var(--green); }
.side-tag.sell { background: var(--red-dim); color: var(--red); }
.hot-tag { font-size: 9px; font-weight: 700; margin-left: 6px; }
.hot-tag.HOT { color: var(--green); } .hot-tag.COLD { color: var(--red); } .hot-tag.WARM { color: var(--yellow); }

.combo-card { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.combo-rules { font-weight: 600; font-size: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.combo-plus { color: var(--muted); font-weight: 700; }
.combo-rule { color: var(--blue); cursor: pointer; }
.combo-rule:hover { text-decoration: underline; }
.combo-stats { display: flex; gap: 14px; margin-top: 6px; font-family: var(--mono); font-size: 11px; color: var(--muted2); }
.combo-stats b { color: var(--text); }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.stat-tile { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.stat-tile .v { font-family: var(--mono); font-size: 15px; font-weight: 700; }
.stat-tile .l { font-size: 9px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin-top: 2px; }

.note { font-size: 11px; color: var(--muted); line-height: 1.5; margin: 8px 0; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 12px; }
.spin { color: var(--muted); text-align: center; padding: 30px; font-size: 12px; animation: pulse 1.2s ease infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.err-box { background: var(--red-dim); border: 1px solid #ff4d6a40; color: var(--red); border-radius: 8px; padding: 10px 12px; font-size: 12px; margin: 10px 0; }

/* ── Screener table ─────────────────────────────────────────────────── */
.screener-wrap { flex: 1; overflow: auto; }
table.scr { width: 100%; border-collapse: collapse; font-size: 11.5px; }
table.scr th { text-align: right; font-size: 9.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 6px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); cursor: pointer; }
table.scr th:first-child, table.scr td:first-child { text-align: left; }
th.th-help { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }
table.scr td { padding: 6px; text-align: right; font-family: var(--mono); border-bottom: 1px solid #1a1f2a; color: var(--muted2); white-space: nowrap; }
table.scr td:first-child { font-weight: 700; color: var(--text); cursor: pointer; }
table.scr tr:hover td { background: var(--surface2); }
.sig-OVERBOUGHT { color: var(--red); font-weight: 700; } .sig-OVERSOLD { color: var(--green); font-weight: 700; }
.sig-Bullish { color: var(--green); } .sig-Bearish { color: var(--red); } .sig-Neutral { color: var(--muted); }
.sig-HIGH { color: var(--orange); } .sig-LOW { color: var(--blue); } .sig-SQUEEZE, .sig-SQUEEZEFIRED { color: var(--purple); font-weight: 700; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 1100px) { .rank-pane { width: 330px; } .sidebar { width: 160px; } }
