/* NiftyOPT Pro — Mobile-first dashboard */
:root {
  --bg: #0a0e1a;
  --bg-card: #131825;
  --bg-card-alt: #1a1f30;
  --border: #252b3d;
  --text: #e5e7eb;
  --text-dim: #9ca3af;
  --text-dimmer: #6b7280;
  --green: #10b981;
  --red: #ef4444;
  --amber: #f59e0b;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --bullish: #10b981;
  --bearish: #ef4444;
  --neutral: #f59e0b;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ─── Login ──────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 24px;
  width: 100%;
  max-width: 340px;
  text-align: center;
}
.login-card h1 { margin: 0 0 8px; font-size: 24px; }
.login-sub { color: var(--text-dim); margin: 0 0 24px; }
#pin-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 20px;
  letter-spacing: 8px;
  text-align: center;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  margin-bottom: 16px;
}
#pin-input:focus { outline: none; border-color: var(--blue); }
#login-btn {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.error { color: var(--red); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ─── Dashboard ──────────────────────────── */
.dashboard {
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 12px 40px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 12px;
}
.top-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 16px;
}
.brand-icon { font-size: 20px; }
.top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.market-status {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.market-status.open { color: var(--green); border-color: var(--green); }
.market-status.closed { color: var(--text-dimmer); }
.icon-btn {
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:active { opacity: 0.7; }

/* ─── Cards ──────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}
.label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
}

/* ─── Bias card ──────────────────────────── */
.bias-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.last-update { font-size: 11px; color: var(--text-dimmer); }
.bias-main {
  display: flex;
  align-items: center;
  gap: 12px;
}
.bias-arrow {
  font-size: 24px;
  width: 28px;
  text-align: center;
}
.bias-arrow.bullish { color: var(--bullish); }
.bias-arrow.bearish { color: var(--bearish); }
.bias-arrow.neutral { color: var(--neutral); }

.bias-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.bias-value.bullish { color: var(--bullish); }
.bias-value.bearish { color: var(--bearish); }
.bias-value.neutral { color: var(--neutral); }

.bias-conf-wrap { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.bias-conf-bar {
  height: 6px;
  background: var(--bg-card-alt);
  border-radius: 3px;
  overflow: hidden;
}
.bias-conf-fill {
  height: 100%;
  width: 0%;
  background: var(--blue);
  transition: width 0.5s ease;
}
.bias-conf-fill.bullish { background: var(--bullish); }
.bias-conf-fill.bearish { background: var(--bearish); }
.bias-conf-fill.neutral { background: var(--neutral); }
.bias-conf-text { font-size: 12px; color: var(--text-dim); text-align: right; }

.bias-reasoning {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ─── Metrics grid ───────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.metric {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
.metric-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.metric-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

/* ─── P&L card ───────────────────────────── */
.pnl-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.regime-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
}
.regime-badge.EXPLORER { color: var(--text); }
.regime-badge.CRUISE { color: var(--blue); border-color: var(--blue); }
.regime-badge.PROTECT { color: var(--green); border-color: var(--green); }
.regime-badge.HIBERNATE { color: var(--green); border-color: var(--green); background: rgba(16,185,129,0.1); }
.regime-badge.WARNING { color: var(--amber); border-color: var(--amber); }
.regime-badge.CIRCUIT_BREAK { color: var(--red); border-color: var(--red); background: rgba(239,68,68,0.1); }

.pnl-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.pnl-cell { text-align: center; }
.pnl-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; margin-bottom: 4px; }
.pnl-value { font-size: 17px; font-weight: 600; }
.pnl-value.profit { color: var(--green); }
.pnl-value.loss { color: var(--red); }

.pnl-peak {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}
.peak-value { color: var(--text); font-weight: 600; margin-left: 6px; }
.drawdown { color: var(--red); margin-left: 10px; }

/* ─── Trade card ─────────────────────────── */
.trade-card { border-color: var(--blue); background: rgba(59, 130, 246, 0.08); }
.trade-action {
  font-size: 18px;
  font-weight: 700;
  margin: 8px 0;
  color: var(--blue);
}
.trade-reasoning {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 8px;
}
.trade-meta {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.trade-meta strong { color: var(--text); }

/* ─── Risk card ──────────────────────────── */
.risk-card { border-color: var(--amber); background: rgba(245, 158, 11, 0.06); }
.risk-list {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--text-dim);
}
.risk-list li { margin-bottom: 4px; }

/* ─── Levels ─────────────────────────────── */
.levels-row {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.level-group { flex: 1; }
.level-title {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 600;
}
.level-group.support {
  border-left: 2px solid var(--green);
  padding-left: 10px;
}
.level-group.resistance {
  border-left: 2px solid var(--red);
  padding-left: 10px;
}
.level-list { display: flex; flex-direction: column; gap: 2px; font-size: 14px; font-weight: 500; }

/* ─── Positions ──────────────────────────── */
.positions-section { margin-top: 10px; }
.section-sub {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.position-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.position-row:last-child { border-bottom: none; }
.position-desc { flex: 1; }
.position-dir { font-weight: 600; }
.position-dir.SHORT { color: var(--red); }
.position-dir.LONG { color: var(--green); }
.position-strike { color: var(--text); }
.position-meta { font-size: 11px; color: var(--text-dim); }
.position-pnl { font-weight: 600; text-align: right; }
.position-pnl.profit { color: var(--green); }
.position-pnl.loss { color: var(--red); }

/* OI overlay sub-row on open positions */
.position-oi {
  flex-basis: 100%;
  width: 100%;
  display: flex;
  flex-wrap: wrap;          /* narrow screens: 2x2 instead of four cramped cells */
  gap: 6px;
  margin-top: 6px;
}
.position-oi .oi-cell {
  flex: 1 1 max(96px, calc(25% - 6px));
  min-width: 0;
  overflow: hidden;         /* a long value must clip inside its own cell, never
                               paint over the neighbour (the bug this fixes) */
  background: var(--bg-elevated, rgba(255,255,255,0.04));
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  text-align: center;
}
.position-oi .oi-lbl {
  display: block;
  font-size: 9px;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.position-oi .oi-val { font-size: 12px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.position-oi .oi-val.profit { color: var(--green); }
.position-oi .oi-val.loss { color: var(--red); }

.no-positions {
  text-align: center;
  color: var(--text-dim);
  padding: 16px;
  font-size: 13px;
}

/* ─── Expiry card ────────────────────────── */
.expiry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.expiry-label { color: var(--text-dim); }
.expiry-value { font-weight: 600; }

/* ─── Actions ────────────────────────────── */
.actions {
  display: flex;
  gap: 10px;
  margin: 12px 0;
}
.btn {
  flex: 1;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.btn-primary {
  background: var(--blue);
  color: white;
}
.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn:active { opacity: 0.7; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.footer {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  font-size: 11px;
  color: var(--text-dimmer);
}
#connection-status { color: var(--green); }
#connection-status.stale { color: var(--amber); }
#connection-status.dead { color: var(--red); }

/* ─── Utilities ──────────────────────────── */
.pulse {
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ═══ V3 ENGINE STYLES ═══ */

.v3-tag {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(139,92,246,0.2);
  color: var(--purple);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Change brackets on metrics */
.metric-chg {
  font-size: 11px;
  font-weight: 600;
  margin-top: 2px;
  min-height: 16px;
}
.metric-chg.up { color: var(--green); }
.metric-chg.down { color: var(--red); }

/* AI Commentary card */
.ai-card {
  border-color: var(--purple);
  background: rgba(139,92,246,0.06);
}
.ai-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.ai-badge {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: white;
  font-size: 9px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 5px;
}
.ai-model {
  font-size: 9px;
  color: var(--text-dimmer);
  margin-left: auto;
}
.ai-narrative {
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-dim);
}
.ai-line {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  align-items: flex-start;
}
.ai-line-icon { font-size: 12px; flex-shrink: 0; margin-top: 1px; }
.ai-line-label {
  font-size: 8px;
  color: var(--text-dimmer);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.ai-line-text { font-size: 12px; line-height: 1.5; }
.ai-line-text.highlight { color: var(--text); }
.ai-line-text.green { color: var(--green); }
.ai-line-text.amber { color: var(--amber); }

/* Macro signal card */
.macro-card { border-color: var(--blue); background: rgba(59,130,246,0.06); }
.macro-signal {
  font-size: 16px;
  font-weight: 700;
  margin: 8px 0 4px;
}
.macro-signal.bullish { color: var(--green); }
.macro-signal.bearish { color: var(--red); }
.macro-signal.conflict { color: var(--amber); }
.macro-detail { font-size: 11px; color: var(--text-dim); line-height: 1.6; }

/* Enhanced risk flags */
.risk-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.risk-count {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--red);
  color: white;
  animation: pulse 2s ease-in-out infinite;
}
.risk-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.risk-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.risk-item:last-child { border-bottom: none; }
.risk-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.risk-dot.high { background: var(--red); box-shadow: 0 0 8px rgba(239,68,68,0.5); }
.risk-dot.medium { background: var(--amber); }
.risk-dot.low { background: var(--blue); }
.risk-text { color: var(--text-dim); line-height: 1.4; }
.risk-flag-name { font-weight: 700; font-size: 10px; letter-spacing: 0.5px; }
.risk-flag-name.high { color: var(--red); }
.risk-flag-name.medium { color: var(--amber); }
.risk-flag-name.low { color: var(--blue); }

/* Enhanced P&L with drawdown bar */
.pnl-total-cell {
  background: rgba(59,130,246,0.06);
  border-radius: 8px;
  padding: 6px;
}
.peak-row { display: flex; align-items: center; flex-wrap: wrap; }
.drawdown-bar {
  height: 6px;
  background: var(--bg-card-alt);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
  position: relative;
}
.drawdown-fill {
  position: absolute;
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.5s ease;
  opacity: 0.4;
  width: 100%;
}
.drawdown-current {
  position: absolute;
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.5s ease;
}
.drawdown-current.loss { background: var(--red); }
.drawdown-warning {
  margin-top: 6px;
  font-size: 11px;
  color: var(--red);
  font-weight: 600;
}

/* Strike Recommendations */
.strikes-card { border-color: var(--green); background: rgba(16,185,129,0.04); }
.strikes-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.strike-row {
  background: var(--bg-card-alt);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.strike-row.top { border-left: 3px solid var(--green); }
.strike-main {
  display: flex;
  flex-direction: column;
}
.strike-name { font-size: 15px; font-weight: 700; }
.strike-meta { font-size: 10px; color: var(--text-dim); margin-top: 2px; }
.strike-reason { font-size: 10px; color: var(--blue); margin-top: 2px; }
.strike-score {
  font-size: 14px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--bg-card);
}
.strike-score.top { background: rgba(16,185,129,0.15); color: var(--green); }

/* Greeks card */
.greeks-card { border-color: var(--text-dimmer); }
.greeks-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.greek-cell {
  background: var(--bg-card-alt);
  border-radius: 6px;
  padding: 8px 6px;
  text-align: center;
}
.greek-label { font-size: 8px; color: var(--text-dimmer); text-transform: uppercase; letter-spacing: 1px; }
.greek-value { font-size: 13px; font-weight: 700; margin-top: 2px; }
.greeks-flags { margin-top: 8px; font-size: 11px; }
.greeks-flags div { color: var(--amber); margin-top: 4px; }

/* ═══ OI HEATMAP BARS ═══ */
.oi-bars-card { border-color: #334155; }
.oi-bars-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.oi-legend { font-size: 9px; color: var(--text-dimmer); }
.oi-leg-ce { color: #ef4444; }
.oi-leg-pe { color: #10b981; }

/* Tabs */
.oi-tabs {
  display: flex;
  gap: 3px;
  background: #1e293b;
  border-radius: 6px;
  padding: 3px;
  margin-bottom: 10px;
}
.oi-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 11px;
  padding: 6px 4px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s ease, color 0.12s ease;
}
.oi-tab:hover { color: #cbd5e1; }
.oi-tab.active {
  background: #334155;
  color: #e2e8f0;
  font-weight: 500;
}

/* Bars wrapper — spot marker lives inside */
.oi-bars-wrap { position: relative; }
.oi-bars-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}

/* Spot marker */
.oi-spot-marker {
  position: absolute;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  z-index: 3;
  transform: translate(-50%, -50%);
}
.oi-spot-marker::before {
  display: none;
}
.oi-spot-pill {
  background: #fbbf24;
  color: #0f172a;
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 2px;
  font-variant-numeric: tabular-nums;
}
.oi-spot-rule {
  position: absolute;
  left: 36px;
  right: 36px;
  border-top: 1px dashed #fbbf24;
  opacity: 0.28;
  pointer-events: none;
  z-index: 1;
  transform: translate(-50%, -50%);
}
.oi-spot-marker.hidden, .oi-spot-rule.hidden { display: none; }

/* Each row */
.oi-row {
  display: grid;
  grid-template-columns: 36px 1fr 52px 1fr 36px;
  align-items: center;
  gap: 4px;
  height: 18px;
  font-size: 10px;
  position: relative;
}
.oi-ce-wrap {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  height: 14px;
}
.oi-pe-wrap {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  height: 14px;
}

/* Count labels (outside bars) */
.oi-count {
  font-variant-numeric: tabular-nums;
  color: #64748b;
  font-size: 10px;
}
.oi-count.ce { text-align: right; }
.oi-count.pe { text-align: left; }
.oi-count.strong-ce { color: #fca5a5; }
.oi-count.strong-pe { color: #6ee7b7; }

/* Directional number colour, all three tabs. Red = bearish pressure (calls
   written OR puts unwound), green = bullish (puts written OR calls unwound).
   Same specificity as .strong-*, so this must stay BELOW it to win. strong-*
   keeps its magnitude role as weight, which hue can no longer carry. */
.oi-count.strong-ce, .oi-count.strong-pe { font-weight: 600; }
.oi-count.oi-dir-bear { color: #fca5a5; }
.oi-count.oi-dir-bull { color: #6ee7b7; }

/* Strike column */
.oi-strike {
  text-align: center;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: #94a3b8;
}
.oi-strike.near { color: #e2e8f0; }
.oi-strike.atm {
  color: #fcd34d;
  font-weight: 500;
}

/* ── Total OI tab bars ── */
.oi-bar-total-ce {
  height: 14px;
  background: #dc2626;
  opacity: 0.85;
  border-radius: 2px 0 0 2px;
  min-width: 2px;
}
.oi-bar-total-pe {
  height: 14px;
  background: #059669;
  opacity: 0.85;
  border-radius: 0 2px 2px 0;
  min-width: 2px;
}

/* ── Change tab bars ── */
.oi-bar-build-ce {
  height: 14px;
  background: #dc2626;
  opacity: 0.9;
  border-radius: 2px 0 0 2px;
  min-width: 2px;
}
.oi-bar-unwind-ce {
  height: 14px;
  background: transparent;
  border: 1px solid #dc2626;
  border-radius: 2px 0 0 2px;
  min-width: 2px;
  box-sizing: border-box;
  opacity: 0.85;
}
.oi-bar-build-pe {
  height: 14px;
  background: #059669;
  opacity: 0.9;
  border-radius: 0 2px 2px 0;
  min-width: 2px;
}
.oi-bar-unwind-pe {
  height: 14px;
  background: transparent;
  border: 1px solid #059669;
  border-radius: 0 2px 2px 0;
  min-width: 2px;
  box-sizing: border-box;
  opacity: 0.85;
}

/* ── Combined tab composite bars ── */
.oi-bar-combined-ce {
  height: 14px;
  display: flex;
  border-radius: 2px 0 0 2px;
  min-width: 2px;
  overflow: hidden;
}
.oi-bar-combined-pe {
  height: 14px;
  display: flex;
  border-radius: 0 2px 2px 0;
  min-width: 2px;
  overflow: hidden;
}
/* Combined segments */
.oi-seg-old-ce { height: 100%; background: #dc2626; opacity: 0.9; }
.oi-seg-old-pe { height: 100%; background: #059669; opacity: 0.9; }
.oi-seg-build-ce {
  height: 100%;
  background-color: #dc2626;
  background-image: radial-gradient(circle, rgba(0,0,0,0.55) 1px, transparent 1.3px);
  background-size: 4px 4px;
}
.oi-seg-build-pe {
  height: 100%;
  background-color: #059669;
  background-image: radial-gradient(circle, rgba(0,0,0,0.55) 1px, transparent 1.3px);
  background-size: 4px 4px;
}
.oi-seg-unwind-ce {
  height: 100%;
  background: transparent;
  border: 1px solid #dc2626;
  box-sizing: border-box;
  opacity: 0.85;
}
.oi-seg-unwind-pe {
  height: 100%;
  background: transparent;
  border: 1px solid #059669;
  box-sizing: border-box;
  opacity: 0.85;
}

/* Legend */
.oi-legend-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #1e293b;
  font-size: 9px;
  color: #94a3b8;
  flex-wrap: wrap;
}
.oi-leg-item { display: flex; align-items: center; gap: 4px; }
.oi-leg-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  vertical-align: middle;
}
.oi-leg-dot.solid-ce { background: #dc2626; }
.oi-leg-dot.solid-pe { background: #059669; }
.oi-leg-dot.hollow-ce { border: 1.5px solid #dc2626; background: transparent; box-sizing: border-box; }
.oi-leg-dot.hollow-pe { border: 1.5px solid #059669; background: transparent; box-sizing: border-box; }

/* ═══ OI FOOTPRINT (event monitor) ═══ */
.footprint-card { border-color: #334155; }
.footprint-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.footprint-summary {
  font-size: 10px;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}
.footprint-filters {
  display: flex;
  gap: 3px;
  background: #1e293b;
  border-radius: 6px;
  padding: 3px;
  margin-bottom: 10px;
}
.fp-filter {
  flex: 1;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 11px;
  padding: 5px 4px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}
.fp-filter:hover { color: #cbd5e1; }
.fp-filter.active {
  background: #334155;
  color: #e2e8f0;
  font-weight: 500;
}
.footprint-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 360px;
  overflow-y: auto;
}
.fp-empty {
  color: #64748b;
  font-size: 11px;
  text-align: center;
  padding: 20px 10px;
  font-style: italic;
}
.fp-strike-group {
  border-bottom: 1px solid #1e293b;
  padding: 6px 0;
}
.fp-strike-group:last-child { border-bottom: none; }
.fp-strike-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  margin-bottom: 3px;
}
.fp-strike-title {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.fp-strike-title.ce { color: #fca5a5; }
.fp-strike-title.pe { color: #6ee7b7; }
.fp-strike-count {
  font-size: 10px;
  color: #64748b;
  background: #1e293b;
  padding: 1px 6px;
  border-radius: 8px;
}
.fp-strike-count.repeat {
  background: #78350f;
  color: #fcd34d;
}
.fp-event-row {
  display: grid;
  grid-template-columns: 44px 34px 50px 60px 1fr;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  padding: 2px 0;
  font-variant-numeric: tabular-nums;
}
.fp-event-time { color: #94a3b8; }
.fp-event-horizon {
  font-size: 9px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.fp-event-severity {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  text-align: center;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.fp-event-severity.major { background: #dc2626; color: #fef2f2; }
.fp-event-severity.notable { background: #ca8a04; color: #fefce8; }
.fp-event-severity.micro { background: #334155; color: #cbd5e1; }
.fp-event-delta { font-weight: 500; }
.fp-event-delta.build.ce { color: #fca5a5; }
.fp-event-delta.build.pe { color: #6ee7b7; }
.fp-event-delta.unwind { color: #64748b; }
.fp-event-meta {
  color: #64748b;
  font-size: 10px;
  text-align: right;
}

/* ═══ TCF (Trend Confirmation Factor) ═══ */
.tcf-card { border-color: #334155; }
.tcf-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tcf-badge {
  font-size: 18px; font-weight: 700; padding: 4px 14px; border-radius: 8px;
  font-variant-numeric: tabular-nums;
}
.tcf-badge.high { background: #059669; color: #ecfdf5; }
.tcf-badge.medium { background: #ca8a04; color: #fefce8; }
.tcf-badge.low { background: #64748b; color: #f1f5f9; }
.tcf-badge.no-trade { background: #dc2626; color: #fef2f2; }
.tcf-direction {
  font-size: 14px; font-weight: 600; margin-bottom: 8px;
  padding: 6px 12px; border-radius: 6px; text-align: center;
}
.tcf-direction.put { background: #064e3b; color: #6ee7b7; }
.tcf-direction.call { background: #7f1d1d; color: #fca5a5; }
.tcf-direction.none { background: #1e293b; color: #94a3b8; }
.tcf-breakdown {
  display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px;
  font-size: 10px; font-variant-numeric: tabular-nums;
}
.tcf-chip {
  padding: 2px 8px; border-radius: 4px; background: #1e293b; color: #94a3b8;
}
.tcf-chip.pos { color: #6ee7b7; }
.tcf-chip.neg { color: #fca5a5; }
.tcf-trade-plan {
  background: #1e293b; border-radius: 8px; padding: 10px 12px; margin-top: 8px;
}
.tcf-plan-header { font-size: 10px; color: #64748b; letter-spacing: 0.5px; margin-bottom: 6px; }
.tcf-plan-action { font-size: 14px; font-weight: 600; color: #e2e8f0; margin-bottom: 6px; }
.tcf-plan-levels {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
  font-size: 11px; font-variant-numeric: tabular-nums;
}
.tcf-level-label { color: #64748b; font-size: 9px; }
.tcf-level-value { font-weight: 500; }
.tcf-level-value.target { color: #6ee7b7; }
.tcf-level-value.stop { color: #fca5a5; }
.tcf-level-value.entry { color: #e2e8f0; }
.tcf-plan-overnight {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid #334155;
  font-size: 11px; color: #94a3b8;
}
.tcf-plan-overnight .on-label { color: #a78bfa; font-weight: 500; }
.tcf-exit-alert {
  margin-top: 8px; padding: 8px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 500;
  animation: tcf-pulse 1s ease-in-out infinite;
}
.tcf-exit-alert.target { background: #064e3b; color: #6ee7b7; }
.tcf-exit-alert.stop { background: #7f1d1d; color: #fca5a5; }
.tcf-exit-alert.wall { background: #78350f; color: #fcd34d; }
@keyframes tcf-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.7; } }

/* ═══ HISTORY PANEL ═══ */
.history-card { border-color: #334155; }
.history-header { display: flex; justify-content: space-between; align-items: center; }
.history-content { margin-top: 10px; }
.history-summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px;
}
.hist-stat {
  background: var(--bg-card-alt); border-radius: 6px; padding: 8px; text-align: center;
}
.hist-stat-label { font-size: 9px; color: var(--text-dimmer); text-transform: uppercase; letter-spacing: 0.5px; }
.hist-stat-value { font-size: 15px; font-weight: 700; margin-top: 2px; }
.history-days { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.hist-day-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; background: var(--bg-card-alt); border-radius: 6px; font-size: 12px;
}
.hist-day-date { color: var(--text-dim); font-weight: 500; }
.hist-day-pnl { font-weight: 700; }
.hist-day-meta { font-size: 10px; color: var(--text-dimmer); }
.history-sub-header {
  font-size: 10px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.5px; margin: 8px 0 6px; padding-top: 8px;
  border-top: 1px solid var(--border);
}
.history-trades { display: flex; flex-direction: column; gap: 3px; }
.hist-trade-row {
  display: flex; justify-content: space-between; font-size: 11px;
  padding: 5px 8px; background: var(--bg-card-alt); border-radius: 4px;
}
.hist-trade-action { font-weight: 600; }
.hist-trade-action.OPENED { color: var(--blue); }
.hist-trade-action.CLOSED { color: var(--text-dim); }
.hist-trade-action.ADDED { color: var(--green); }
.hist-trade-action.REDUCED { color: var(--amber); }
.hist-trade-detail { color: var(--text-dim); }
.hist-trade-context { font-size: 9px; color: var(--text-dimmer); }
.history-signals { display: flex; flex-direction: column; gap: 3px; }
.hist-signal-row {
  display: flex; gap: 8px; font-size: 11px;
  padding: 5px 8px; background: var(--bg-card-alt); border-radius: 4px;
}
.hist-signal-type { font-weight: 600; color: var(--purple); min-width: 60px; }
.hist-signal-data { color: var(--text-dim); flex: 1; }
.hist-signal-time { color: var(--text-dimmer); font-size: 10px; }
.no-history { color: var(--text-dimmer); font-size: 12px; text-align: center; padding: 12px; }

/* Position SELL/BUY styles */
.position-dir.SELL { color: var(--red); }
.position-dir.BUY { color: var(--green); }

/* ═══════════════════════════════════════════════════════════════ */
/* Footprint Intelligence Card */
/* ═══════════════════════════════════════════════════════════════ */
.intel-card {
  border: 1px solid var(--border);
}
.intel-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.intel-asym-pill {
  font-size: 11px; font-weight: 700; padding: 4px 10px;
  border-radius: 12px; background: var(--bg-card-alt); color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.intel-asym-pill.bearish { background: rgba(239,68,68,0.15); color: var(--red); }
.intel-asym-pill.bullish { background: rgba(16,185,129,0.15); color: var(--green); }
.intel-asym-pill.balanced { background: var(--bg-card-alt); color: var(--text-dim); }

.intel-walls {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 12px;
}
.intel-wall-box {
  padding: 10px; background: var(--bg-card-alt); border-radius: 6px;
  border: 1px solid var(--border);
}
.intel-wall-label {
  font-size: 10px; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 4px;
}
.intel-wall-strike {
  font-size: 22px; font-weight: 700; color: var(--text);
}
.intel-wall-oi {
  font-size: 11px; color: var(--text-dim); margin-top: 2px;
}
.intel-wall-migration {
  font-size: 10px; margin-top: 6px; min-height: 12px;
}
.intel-wall-migration.up { color: var(--green); }
.intel-wall-migration.down { color: var(--red); }

.intel-asymmetry {
  padding: 10px; background: var(--bg-card-alt); border-radius: 6px;
  font-size: 11px; color: var(--text-dim); margin-bottom: 12px;
  line-height: 1.5;
}
.intel-asym-stat { display: inline-block; margin-right: 10px; }
.intel-asym-stat .val { font-weight: 600; color: var(--text); }

.intel-tcf-align {
  padding: 8px 10px; border-radius: 6px; font-size: 11px;
  margin-bottom: 12px; min-height: 12px;
}
.intel-tcf-align.confirms { background: rgba(16,185,129,0.1); color: var(--green); border-left: 3px solid var(--green); }
.intel-tcf-align.contradicts { background: rgba(239,68,68,0.1); color: var(--red); border-left: 3px solid var(--red); }
.intel-tcf-align.neutral { background: var(--bg-card-alt); color: var(--text-dim); }

.intel-whales-header {
  font-size: 10px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin: 10px 0 6px; padding-top: 8px; border-top: 1px solid var(--border);
}
.intel-whales, .intel-covering {
  display: flex; flex-direction: column; gap: 4px;
}
.intel-whale-row, .intel-covering-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; padding: 6px 8px;
  background: var(--bg-card-alt); border-radius: 4px;
}
.intel-whale-strike { font-weight: 600; }
.intel-whale-strike.ce { color: var(--red); }
.intel-whale-strike.pe { color: var(--green); }
.intel-whale-delta { font-weight: 600; }
.intel-whale-delta.build { color: var(--red); }
.intel-whale-delta.unwind { color: var(--amber); }
.intel-whale-time { color: var(--text-dimmer); font-size: 10px; }


/* ─── Trap Framework (Phase 2) ─────────────────── */
.trap-framework-card { padding: 16px; }
.trap-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.trap-header .label { font-size: 11px; letter-spacing: 1.5px; color: #94a3b8; font-weight: 600; }
.validation-badge {
  font-size: 10px;
  padding: 2px 8px;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.trap-main { display: flex; flex-direction: column; gap: 12px; }
.risk-pill-wrap { display: flex; align-items: center; gap: 12px; }
.risk-pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 1px;
  background: var(--bg-card-alt);
  color: var(--text);
  border: 1px solid var(--border, #2a3142);
}
.risk-pill.GREEN { background: rgba(16,185,129,0.15); color: #10b981; border-color: #10b981; }
.risk-pill.YELLOW { background: rgba(234,179,8,0.15); color: #eab308; border-color: #eab308; }
.risk-pill.ORANGE { background: rgba(249,115,22,0.15); color: #f97316; border-color: #f97316; }
.risk-pill.RED { background: rgba(239,68,68,0.15); color: #ef4444; border-color: #ef4444; }
.risk-pill.PURPLE { background: rgba(168,85,247,0.15); color: #a855f7; border-color: #a855f7; }
.risk-reason { font-size: 12px; color: #94a3b8; }

.trap-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.trap-stat {
  background: var(--bg-card-alt);
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
}
.trap-stat-label { font-size: 10px; color: #94a3b8; letter-spacing: 0.8px; margin-bottom: 4px; }
.trap-stat-value { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.trap-stat-sub { font-size: 11px; color: #64748b; }

.trap-detector-strip {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: rgba(239, 68, 68, 0.08);
  border-left: 3px solid #ef4444;
  border-radius: 4px;
  margin-top: 4px;
}
.detector-label { font-size: 10px; letter-spacing: 1px; color: #ef4444; font-weight: 700; }
.detector-tag {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--bg-card);
  color: var(--text);
  border-radius: 4px;
  font-family: monospace;
}
.detector-tag.fired { background: rgba(239,68,68,0.25); color: #ef4444; font-weight: 600; }
.detector-strikes { font-size: 11px; color: #94a3b8; font-family: monospace; }

.trap-pe-delta {
  font-size: 11px;
  color: #94a3b8;
  padding-top: 4px;
  border-top: 1px solid var(--border, #2a3142);
}
.trap-pe-delta .positive { color: #10b981; }
.trap-pe-delta .negative { color: #ef4444; }


/* ═══ Order Book Intel cards ═══ */
.ob-intel-card .ob-header,
.ob-activity-card .ob-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.ob-phase-since,
.ob-runner-status {
  font-size: 11px;
  color: var(--muted, #94a3b8);
}
.ob-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ob-phase-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ob-phase-pill {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.ob-phase-pill.NO_TRAP   { background: rgba(100,116,139,0.15); color: #94a3b8; border-color: #64748b; }
.ob-phase-pill.ARMED     { background: rgba(59,130,246,0.15); color: #3b82f6; border-color: #3b82f6; }
.ob-phase-pill.CONFIRMING{ background: rgba(234,179,8,0.15); color: #eab308; border-color: #eab308; }
.ob-phase-pill.TRIGGERED { background: rgba(239,68,68,0.15); color: #ef4444; border-color: #ef4444; animation: ob-pulse 1.2s infinite; }
.ob-phase-pill.EXHAUSTING{ background: rgba(249,115,22,0.15); color: #f97316; border-color: #f97316; }
.ob-phase-pill.EXHAUSTED { background: rgba(16,185,129,0.15); color: #10b981; border-color: #10b981; }

@keyframes ob-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.ob-expected-dir {
  font-size: 13px;
  color: var(--muted, #94a3b8);
}
.ob-pressure-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ob-pressure-row {
  display: grid;
  grid-template-columns: 70px 1fr 50px;
  align-items: center;
  gap: 10px;
}
.ob-pressure-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--muted, #94a3b8);
}
.ob-pressure-bar {
  height: 8px;
  background: rgba(100,116,139,0.18);
  border-radius: 4px;
  overflow: hidden;
}
.ob-pressure-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.ob-pressure-fill.sell { background: linear-gradient(90deg, #ef4444, #f87171); }
.ob-pressure-fill.buy  { background: linear-gradient(90deg, #10b981, #34d399); }
.ob-pressure-val {
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  color: #e2e8f0;
}
.ob-meta-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(148,163,184,0.12);
}
.ob-meta-label {
  font-size: 10px;
  color: var(--muted, #94a3b8);
  letter-spacing: 0.4px;
}
.ob-meta-val {
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
  margin-top: 2px;
}

/* Activity card */
.ob-activity-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ob-sweep-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.ob-sweep-label {
  font-size: 10px;
  color: var(--muted, #94a3b8);
  letter-spacing: 0.4px;
}
.ob-sweep-val {
  font-size: 18px;
  font-weight: 700;
  margin-top: 4px;
  color: #e2e8f0;
}
.ob-sweep-val.sell { color: #ef4444; }
.ob-sweep-val.buy  { color: #10b981; }
.ob-contrib-label {
  font-size: 10px;
  color: var(--muted, #94a3b8);
  letter-spacing: 0.6px;
  margin-top: 4px;
  border-top: 1px solid rgba(148,163,184,0.12);
  padding-top: 8px;
}
.ob-contrib-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ob-contrib-row {
  display: grid;
  grid-template-columns: 90px 1fr 60px;
  align-items: center;
  font-size: 12px;
  gap: 8px;
}
.ob-contrib-sym {
  font-weight: 600;
  color: #e2e8f0;
}
.ob-contrib-bar {
  height: 4px;
  background: rgba(100,116,139,0.15);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.ob-contrib-fill {
  position: absolute;
  height: 100%;
  top: 0;
  left: 50%;
  background: #64748b;
  border-radius: 2px;
}
.ob-contrib-fill.sell { background: #ef4444; transform: translateX(-100%); }
.ob-contrib-fill.buy  { background: #10b981; }
.ob-contrib-imb {
  font-size: 11px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #cbd5e1;
}
.ob-contrib-empty {
  font-size: 12px;
  color: var(--muted, #94a3b8);
  font-style: italic;
  text-align: center;
  padding: 8px;
}


/* ═══ Participant positioning table ═══ */
.participants-table-wrap {
  margin: 12px 0 10px 0;
}
.participants-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.participants-table thead th {
  text-align: right;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted, #94a3b8);
  letter-spacing: 0.5px;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(148,163,184,0.15);
}
.participants-table thead th.participant-col {
  text-align: left;
}
.participants-table tbody td {
  padding: 8px;
  border-bottom: 1px solid rgba(148,163,184,0.08);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: #e2e8f0;
}
.participants-table tbody td.participant-col {
  text-align: left;
  font-weight: 600;
  color: #cbd5e1;
}
.participants-table tbody tr:last-child td {
  border-bottom: none;
}
.participants-empty {
  text-align: center !important;
  font-style: italic;
  color: var(--muted, #94a3b8);
}
.cell-arrow {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
}
.cell-arrow.up   { color: #10b981; }
.cell-arrow.down { color: #ef4444; }
.cell-arrow.flat { color: #64748b; }
.cell-num.positive { color: #10b981; }
.cell-num.negative { color: #ef4444; }
.cell-num.zero     { color: #94a3b8; }
.participants-meta {
  text-align: right;
  font-size: 10px;
  color: var(--muted, #94a3b8);
  margin-top: 4px;
  letter-spacing: 0.3px;
}


/* ═══ Smoothed pressure display (v2) ═══ */
.ob-window {
  font-size: 10px;
  color: var(--muted, #94a3b8);
  font-weight: 400;
  letter-spacing: 0;
}
.ob-pressure-primary {
  margin: 6px 0;
}
.ob-pressure-row-v2 {
  display: grid;
  grid-template-columns: 80px auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
}
.ob-pressure-label-v2 {
  font-size: 11px;
  color: var(--muted, #94a3b8);
  letter-spacing: 0.5px;
  font-weight: 600;
}
.ob-pressure-display {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ob-pressure-num {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #e2e8f0;
}
.ob-pressure-num.positive { color: #10b981; }
.ob-pressure-num.negative { color: #ef4444; }
.ob-pressure-num.neutral  { color: #94a3b8; }
.ob-pressure-trend {
  font-size: 18px;
  font-weight: 600;
}
.ob-pressure-trend.rising  { color: #10b981; }
.ob-pressure-trend.falling { color: #ef4444; }
.ob-pressure-trend.flat    { color: #64748b; }
.ob-pressure-meaning {
  font-size: 12px;
  color: var(--muted, #94a3b8);
  font-style: italic;
  text-align: right;
}

/* 15s fast pressure inline label */
.ob-pressure-fast {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted, #94a3b8);
  margin-left: 6px;
}


/* Gamma Flip card */
.gamma-flip-card {
  border-left: 3px solid var(--border);
  transition: border-left-color 0.3s ease;
}
.gamma-flip-card.state-below {
  border-left-color: #ef4444;
}
.gamma-flip-card.state-above {
  border-left-color: #10b981;
}
.gamma-flip-card.state-transition {
  border-left-color: #f59e0b;
}
.gamma-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.gamma-state-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.gamma-state-badge.state-below {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: #ef4444;
}
.gamma-state-badge.state-above {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-color: #10b981;
}
.gamma-state-badge.state-transition {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-color: #f59e0b;
}
.gamma-levels {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}
.gamma-level-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.gamma-level-row:last-of-type {
  margin-bottom: 0;
}
.gamma-row-label {
  font-size: 11px;
  color: var(--text-muted);
}
.gamma-flip-value, .gamma-spot-value {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.gamma-distance-row {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.gamma-distance {
  font-size: 13px;
  font-weight: 600;
}
.gamma-distance.below {
  color: #ef4444;
}
.gamma-distance.above {
  color: #10b981;
}
.gamma-distance.transition {
  color: #f59e0b;
}
.gamma-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.gamma-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}
.gamma-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.gamma-stat-value {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.gamma-interpretation {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  padding: 8px;
  background: var(--bg-card);
  border-radius: 6px;
  border: 1px solid var(--border);
}


/* Card reorder feature */
#cards-container {
  display: flex;
  flex-direction: column;
}
#cards-container > .card {
  position: relative;
}
.card-reorder-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  z-index: 5;
  opacity: 0.4;
  transition: opacity 0.2s ease;
}
.card:hover .card-reorder-controls {
  opacity: 1;
}
.card-reorder-btn {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-muted);
  user-select: none;
  padding: 0;
}
.card-reorder-btn:hover {
  background: var(--border);
  color: var(--text);
}
.card-reorder-btn:active {
  transform: scale(0.95);
}
.card-reorder-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── F&O Order Book panel ── */
.fno-fut-wrap { margin-bottom: 10px; }
.fno-fut-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 6px;
}
.fno-fut-symbol { font-size: 13px; font-weight: 600; color: #cbd5e1; }
.fno-fut-ltp { font-size: 15px; font-weight: 700; color: #e2e8f0; }
.fno-fut-midlbl { font-size: 11px; font-weight: 600; color: var(--text-dim); letter-spacing: .04em; }
.fno-fut-ofi-row { font-size: 12px; color: var(--text); margin-top: 4px; font-variant-numeric: tabular-nums; }
.fno-opt-list { max-height: none; overflow: visible; }
.fno-chain-wrap { max-height: 380px; overflow: auto; }
.fno-chain { width: 100%; border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; }
.fno-chain thead th { position: sticky; top: 0; background: var(--bg-card); color: var(--text-dimmer);
  font-weight: 600; font-size: 10px; letter-spacing: .04em; padding: 2px 3px; text-align: right; }
.fno-chain thead tr:first-child th { top: 0; }
.fno-chain thead tr:nth-child(2) th { top: 16px; }
.fno-chain th.fno-side-h { text-align: center; }
.fno-chain th.fno-side-h.ce { color: #10b981; }
.fno-chain th.fno-side-h.pe { color: #ef4444; }
.fno-chain td { padding: 2px 3px; border-top: 1px solid rgba(148,163,184,0.08); vertical-align: top; }
.fno-num { text-align: right; white-space: nowrap; }
.fno-num small { display: block; font-size: 9.5px; color: var(--text-dimmer); line-height: 1.1; }
.fno-num.buy { color: #34d399; }
.fno-num.sell { color: #f87171; }
.fno-num.positive { color: #10b981; }
.fno-num.negative { color: #ef4444; }
.fno-num.neutral { color: #94a3b8; }
.fno-spr { color: var(--text-dim); }
.fno-k { text-align: center; font-weight: 700; color: var(--text); background: var(--bg-card-alt); }
.fno-none { color: var(--text-dimmer); text-align: center; }
.fno-atm-row td { background: rgba(234,179,8,0.10); }
.fno-atm-row td.fno-k { color: #eab308; }
.fno-chain td.fno-stale { opacity: .45; }
.fno-age { color: #eab308 !important; }
.fno-conc-heavy { color: #f59e0b; font-weight: 600; }
.fno-conc-mid { color: #93c5fd; }
.fno-conc-light { color: #94a3b8; }
.fno-conc-none { color: #475569; text-align: right; }
.fno-recent-line { font-weight: 500; background: rgba(148,163,184,0.06); color: var(--text-dim);
  border: 1px solid rgba(148,163,184,0.20); }
.fno-rc { margin-left: 10px; white-space: nowrap; }
.fno-rc b { font-weight: 600; margin-left: 4px; }
.fno-rc i { font-style: normal; color: var(--text-dimmer); margin-left: 4px; font-size: 11px; }
.fno-up { color: #16a34a; }
.fno-down { color: #dc2626; }
.fno-flat { color: #94a3b8; }
.fno-warn { color: #eab308 !important; }

/* F&O options-flow bias headline */
.fno-bias-line {
  margin: 6px 0 10px 0;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.fno-bias-bull    { background: rgba(34,197,94,0.12);  color: #16a34a; border: 1px solid rgba(34,197,94,0.35); }
.fno-bias-bear    { background: rgba(239,68,68,0.12);  color: #dc2626; border: 1px solid rgba(239,68,68,0.35); }
.fno-bias-neutral { background: rgba(148,163,184,0.12);color: #64748b; border: 1px solid rgba(148,163,184,0.30); }
.fno-bias-forming { background: rgba(148,163,184,0.08);color: #94a3b8; border: 1px dashed rgba(148,163,184,0.30); font-weight: 500; }
.fno-bias-stale   { opacity: .6; border-style: dashed; }

/* MASTER indicator panel */
.master-card { border-width: 2px; border-style: solid; }
.master-card.m-bull    { border-color: rgba(34,197,94,0.55);  }
.master-card.m-bear    { border-color: rgba(239,68,68,0.55);  }
.master-card.m-neutral { border-color: rgba(148,163,184,0.40);}
.master-headline { display:flex; align-items:baseline; gap:10px; }
.master-dir   { font-size: 18px; font-weight: 800; letter-spacing: 0.02em; }
.master-card.m-bull .master-dir   { color:#16a34a; }
.master-card.m-bear .master-dir   { color:#dc2626; }
.master-card.m-neutral .master-dir{ color:#64748b; }
.master-tier  { font-size: 13px; font-weight: 700; padding: 1px 8px; border-radius: 10px; background: rgba(148,163,184,0.18); }
.master-score { font-size: 12px; color:#94a3b8; }
.master-live  { font-size: 11px; color:#94a3b8; margin-top: 4px; }
.master-flags { margin-top: 8px; display:flex; flex-direction:column; gap:4px; }
.master-flag  { font-size: 11px; padding: 4px 8px; border-radius: 6px; background: rgba(234,179,8,0.12); color:#a16207; border:1px solid rgba(234,179,8,0.30); }
.master-breakdown { margin-top: 10px; display:flex; flex-wrap:wrap; gap:6px; }
.master-chip  { font-size: 11px; padding: 2px 7px; border-radius: 5px; font-weight:600; }
.chip-bull { background: rgba(34,197,94,0.14); color:#16a34a; }
.chip-bear { background: rgba(239,68,68,0.14); color:#dc2626; }
.chip-none { background: rgba(148,163,184,0.12); color:#94a3b8; }


/* Live heatmap honesty (2026-09-19): unknown is a dash, not zero; a stale
   strike is dimmed on its own rather than hidden inside a median age. */
.oi-missing { color: var(--text-dimmer); font-weight: 400; }
.oi-count.oi-stale { opacity: .45; }
.oi-count.oi-stale::after { content: ' \231B'; font-size: 8px; }
