/* ═══════════════════════════════════════════════════════
   Orderflow tab — engine-driven panels (Phase 5)
   Dark-on-dark dashboard, monospace numerics, low chrome.
   ═══════════════════════════════════════════════════════ */

#tab-orderflow.active {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Tab header strip ─────────────────────────────────── */
.of-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255,196,0,0.04);
    border-bottom: 1px solid rgba(255,196,0,0.10);
    flex-shrink: 0; gap: 16px; flex-wrap: wrap;
}
.of-header-left {
    display: flex; align-items: center; gap: 7px;
    font-size: 11px; color: #ffc400; font-weight: 700; letter-spacing: 0.5px;
}
.of-status-text { color: #888; font-weight: 400; margin-left: 6px; font-size: 10px; }

.of-live-dot {
    width: 6px; height: 6px; border-radius: 50%; background: #444;
}
.of-live-dot.connected { background: #00e676; box-shadow: 0 0 6px #00e676; animation: of-pulse 1.6s ease-in-out infinite; }
.of-live-dot.connecting { background: #ffc400; box-shadow: 0 0 6px #ffc400; }
.of-live-dot.disconnected { background: #ff5252; }
@keyframes of-pulse {
    0%,100% { opacity:1; } 50% { opacity:0.3; }
}

/* Pill in the main tab button */
.of-pill {
    background: rgba(255,196,0,0.10); color: #ffc400;
    border: 1px solid rgba(255,196,0,0.25); font-size: 9px; font-weight: 700;
    padding: 1px 6px; border-radius: 8px; letter-spacing: 0.4px;
}
.of-pill-init        { background: rgba(255,255,255,0.04); color: #555; border-color: transparent; }
.of-pill-connected   { background: rgba(0,230,118,0.10); color: #00e676; border-color: rgba(0,230,118,0.25); }
.of-pill-disconnected{ background: rgba(255,82,82,0.10); color: #ff5252; border-color: rgba(255,82,82,0.25); }

/* ── Sub-panel selector ───────────────────────────────── */
.of-subnav { display: flex; gap: 2px; }
.of-subnav-btn {
    background: transparent; border: 1px solid transparent;
    color: #888; font-size: 10px; font-weight: 600;
    padding: 4px 10px; border-radius: 3px; cursor: pointer; letter-spacing: 0.3px;
    display: inline-flex; align-items: center; gap: 5px;
}
.of-subnav-btn:hover { background: rgba(255,255,255,0.04); color: #ddd; }
.of-subnav-btn.active {
    background: rgba(255,196,0,0.10); color: #ffc400;
    border-color: rgba(255,196,0,0.25);
}
.of-count {
    background: rgba(255,255,255,0.06); color: #aaa; font-size: 9px;
    padding: 1px 5px; border-radius: 8px; min-width: 14px; text-align: center;
}
.of-count-alert.has-alerts { background: rgba(255,82,82,0.18); color: #ff5252; }

/* ── Stats bar ────────────────────────────────────────── */
.of-stats-bar {
    display: flex; align-items: center; gap: 16px;
    padding: 5px 12px;
    background: rgba(255,255,255,0.015);
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 10px; flex-shrink: 0;
}
.of-stat-item { display: flex; gap: 4px; }
.of-stat-label { color: #444; }
.of-stat-val { color: #888; font-family: 'JetBrains Mono', monospace; font-weight: 600; }

/* ── Panels (mutually exclusive) ──────────────────────── */
.of-panel { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.of-panel.active { display: flex; }
.of-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 12px; font-size: 10px; color: #777;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    background: rgba(0,0,0,0.20); flex-shrink: 0;
}
.of-panel-hint { color: #444; font-size: 9px; font-style: italic; }
.of-empty { text-align: center; color: #2a2a3a; padding: 30px 20px; font-size: 11px; }

/* Filters in signal header */
.of-filters { display: flex; gap: 6px; }
.of-filters select {
    background: #0c0c10; color: #ccc; border: 1px solid rgba(255,255,255,0.08);
    border-radius: 3px; padding: 3px 6px; font-size: 10px;
    font-family: inherit; cursor: pointer;
}

/* ── Signals table ────────────────────────────────────── */
.of-table-wrap { overflow-y: auto; flex: 1; background: #080808; }
.of-table-wrap::-webkit-scrollbar { width: 3px; }
.of-table-wrap::-webkit-scrollbar-thumb { background: #1e1e2a; border-radius: 2px; }
.of-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.of-table thead th {
    padding: 5px 8px; text-align: left;
    color: #3a3a5a; font-weight: 600; font-size: 9px;
    text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    white-space: nowrap; user-select: none;
    position: sticky; top: 0; background: #080808; z-index: 1;
}
.of-row { border-bottom: 1px solid rgba(255,255,255,0.025); cursor: pointer; transition: background 0.12s; }
.of-row:hover { background: rgba(255,255,255,0.03); }
.of-row td { padding: 6px 8px; vertical-align: middle; }
.of-row.long-row  { border-left: 2px solid rgba(0,230,118,0.35); }
.of-row.short-row { border-left: 2px solid rgba(255,23,68,0.35); }

/* Coin name */
.of-coin { display: flex; align-items: baseline; gap: 4px; }
.of-coin-name { font-weight: 700; color: #fff; font-size: 11px; }
.of-coin-ex   { font-size: 8px; color: #444; text-transform: uppercase; }

/* Bias */
.of-bias {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 7px; border-radius: 3px;
    font-size: 9px; font-weight: 700; letter-spacing: 0.4px;
    white-space: nowrap;
}
.of-bias.long  { background: rgba(0,230,118,0.10); color: #00e676; border: 1px solid rgba(0,230,118,0.25); }
.of-bias.short { background: rgba(255,23,68,0.10); color: #ff1744; border: 1px solid rgba(255,23,68,0.25); }

/* Quality */
.of-quality {
    display: inline-block; padding: 2px 7px; border-radius: 3px;
    font-size: 9px; font-weight: 700; letter-spacing: 0.4px; cursor: help;
}
.of-quality.strong   { background: rgba(0,230,118,0.14); color:#00e676; border:1px solid rgba(0,230,118,0.30); }
.of-quality.good     { background: rgba(255,215,64,0.10); color:#ffd740; border:1px solid rgba(255,215,64,0.25); }
.of-quality.marginal { background: rgba(255,152,0,0.08);  color:#ffb74d; border:1px solid rgba(255,152,0,0.20); }

/* Confidence bar */
.of-conf-cell { min-width: 50px; }
.of-conf-val { font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700; }
.of-conf-bar-track {
    height: 2px; border-radius: 1px; background: rgba(255,255,255,0.06);
    overflow: hidden; width: 50px; margin-top: 2px;
}
.of-conf-bar { height: 100%; transition: width 0.4s ease; }
.of-conf-high { color: #ffd740; }
.of-conf-good { color: #69f0ae; }
.of-conf-ok   { color: #ffb74d; }
.of-conf-low  { color: #666; }
.of-conf-bar.of-conf-high { background: #ffd740; }
.of-conf-bar.of-conf-good { background: #00e676; }
.of-conf-bar.of-conf-ok   { background: #ff9800; }
.of-conf-bar.of-conf-low  { background: #444; }

/* Numeric cells */
.of-num { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: #aaa; }
.of-num.pos { color: #69f0ae; }
.of-num.neg { color: #ff5252; }

/* Reason chips */
.of-reasons { display: flex; flex-wrap: wrap; gap: 2px; max-width: 240px; }
.of-reason {
    font-size: 8px; padding: 1px 5px; border-radius: 2px;
    background: rgba(0,229,255,0.06); color: #4ddfff;
    border: 1px solid rgba(0,229,255,0.12); white-space: nowrap;
}
.of-reason.warn {
    background: rgba(255,82,82,0.06); color: #ff8a65;
    border-color: rgba(255,82,82,0.14);
}

/* ── Heatmap ──────────────────────────────────────────── */
.of-heatmap {
    flex: 1; overflow-y: auto; padding: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 6px;
    align-content: start;
    background: #080808;
}
.of-hm-cell {
    border-radius: 3px; padding: 8px 10px; cursor: pointer;
    border: 1px solid rgba(255,255,255,0.05);
    background: rgba(255,255,255,0.02);
    transition: transform 0.15s, border-color 0.15s;
    display: flex; flex-direction: column; gap: 3px; min-height: 48px;
}
.of-hm-cell:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.18); }
.of-hm-sym { font-size: 11px; font-weight: 700; color: #fff; letter-spacing: 0.3px; }
.of-hm-meta {
    font-size: 9px; font-family: 'JetBrains Mono', monospace; color: #888;
    display: flex; justify-content: space-between;
}
.of-hm-bias-pill {
    font-size: 8px; font-weight: 700; padding: 1px 4px; border-radius: 2px;
    letter-spacing: 0.3px;
}
.of-hm-bias-pill.long  { background: rgba(0,230,118,0.20);  color: #00e676; }
.of-hm-bias-pill.short { background: rgba(255,23,68,0.20);  color: #ff1744; }
.of-hm-bias-pill.neutral { background: rgba(255,255,255,0.06); color: #777; }

/* Cells get tinted by direction × magnitude */
.of-hm-cell.tilt-bull-strong { background: rgba(0,230,118,0.18); border-color: rgba(0,230,118,0.40); }
.of-hm-cell.tilt-bull-mid    { background: rgba(0,230,118,0.10); border-color: rgba(0,230,118,0.22); }
.of-hm-cell.tilt-bear-strong { background: rgba(255,23,68,0.18); border-color: rgba(255,23,68,0.40); }
.of-hm-cell.tilt-bear-mid    { background: rgba(255,23,68,0.10); border-color: rgba(255,23,68,0.22); }

/* ── Leaderboard ──────────────────────────────────────── */
.of-lb-tabs { display: flex; gap: 2px; }
.of-lb-tab {
    background: transparent; border: 1px solid transparent;
    color: #888; font-size: 10px; font-weight: 600;
    padding: 3px 10px; border-radius: 3px; cursor: pointer;
}
.of-lb-tab:hover { background: rgba(255,255,255,0.04); color: #ccc; }
.of-lb-tab.active { background: rgba(0,229,255,0.08); color: #00e5ff; border-color: rgba(0,229,255,0.20); }

.of-lb-list {
    flex: 1; overflow-y: auto; padding: 8px 12px;
    display: flex; flex-direction: column; gap: 3px; background: #080808;
}
.of-lb-row {
    display: grid; grid-template-columns: 30px 1fr auto auto auto auto;
    gap: 10px; align-items: center;
    padding: 6px 8px; border-radius: 3px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    cursor: pointer; transition: background 0.12s;
}
.of-lb-row:hover { background: rgba(255,255,255,0.05); }
.of-lb-rank { font-size: 11px; font-weight: 700; color: #ffc400; font-family: 'JetBrains Mono', monospace; }
.of-lb-coin { font-weight: 700; color: #fff; font-size: 11px; }
.of-lb-coin .of-lb-ex { font-size: 8px; color: #444; margin-left: 4px; text-transform: uppercase; }
.of-lb-value { font-family: 'JetBrains Mono', monospace; font-size: 11px; min-width: 90px; text-align: right; }

/* Header row — same grid columns, lighter look, no hover/click */
.of-lb-row.of-lb-head {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    border-radius: 0;
    padding: 4px 8px;
    cursor: default;
    text-transform: uppercase;
    font-size: 9px;
    letter-spacing: 0.5px;
    color: #6a6a8a;
    font-weight: 600;
}
.of-lb-row.of-lb-head:hover { background: transparent; }
.of-lb-row.of-lb-head .of-lb-rank,
.of-lb-row.of-lb-head .of-lb-coin,
.of-lb-row.of-lb-head .of-lb-value { color: #6a6a8a; font-weight: 600; }

/* ── Squeeze alerts ───────────────────────────────────── */
.of-alerts {
    flex: 1; overflow-y: auto; padding: 8px 12px;
    display: flex; flex-direction: column; gap: 4px; background: #080808;
}
.of-alert {
    display: grid; grid-template-columns: auto 1fr auto auto auto;
    gap: 12px; align-items: center;
    padding: 8px 12px; border-radius: 3px;
    border-left: 3px solid;
    background: rgba(255,255,255,0.02);
    font-size: 11px;
}
.of-alert.side-long  { border-left-color: #ff1744; }
.of-alert.side-short { border-left-color: #00e676; }
.of-alert-time { font-family: 'JetBrains Mono', monospace; font-size: 9px; color: #555; }
.of-alert-coin { font-weight: 700; color: #fff; }
.of-alert-side {
    font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 2px; letter-spacing: 0.3px;
}
.of-alert-side.side-long  { background: rgba(255,23,68,0.10); color: #ff1744; }
.of-alert-side.side-short { background: rgba(0,230,118,0.10); color: #00e676; }
.of-alert-severity {
    font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700;
}
.of-alert-severity.high   { color: #ff5252; }
.of-alert-severity.medium { color: #ffb74d; }
.of-alert-volume {
    font-family: 'JetBrains Mono', monospace; font-size: 10px; color: #aaa;
}

/* Mobile */
@media (max-width: 768px) {
    .of-stats-bar .of-stat-item:nth-child(n+3) { display: none; }
    .of-table thead th:nth-child(n+8) { display: none; }
    .of-row td:nth-child(n+8) { display: none; }
}
