/* ═══════════════════════════════════════════════════════════════
   INVESTIZO Terminal — TradingView Dark Theme
   #131722 bg · #1e222d panels · #26a69a green · #ef5350 red
   ═══════════════════════════════════════════════════════════════ */

:root {
    --bg:       #131722;
    --panel:    #1e222d;
    --border:   #2a2e39;
    --text:     #d1d4dc;
    --dim:      #787b86;
    --green:    #26a69a;
    --red:      #ef5350;
    --blue:     #2196f3;
    --orange:   #ff9800;
    --gold:     #f0b90b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--bg);
    overflow: hidden;
    font-family: 'Inter', -apple-system, sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ── Canvas ────────────────────────────────────────────────────── */

#gpu-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
}

/* ── Flash ─────────────────────────────────────────────────────── */

#flash-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 70% 50%, rgba(38, 166, 154, 0.4), transparent 45%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.06s;
    z-index: 10;
}

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

#chart-header {
    position: fixed;
    top: 0; left: 0; right: 220px;
    z-index: 20;
    background: rgba(19, 23, 34, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    padding: 8px 14px;
    pointer-events: none;
}

.header-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.header-row.sub {
    margin-top: 4px;
    gap: 8px;
}

.logo {
    height: 18px;
    width: auto;
}

.sep {
    color: var(--border);
    font-size: 12px;
}

/* ── Asset & TF Selectors ─────────────────────────────────── */
.selector {
    display: flex;
    gap: 2px;
    pointer-events: auto;
}
.sel-btn {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 3px;
    border: 1px solid transparent;
    cursor: pointer;
    background: rgba(255,255,255,0.04);
    color: var(--dim);
    transition: all 0.12s;
}
.sel-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text);
}
.sel-btn.active {
    background: rgba(38,166,154,0.15);
    color: var(--green);
    border-color: rgba(38,166,154,0.3);
}

/* ── Regime Badge ─────────────────────────────────────────── */
.regime-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 2px 10px;
    border-radius: 3px;
    pointer-events: none;
}
.regime-badge.up {
    background: rgba(38,166,154,0.15);
    color: var(--green);
    border: 1px solid rgba(38,166,154,0.3);
}
.regime-badge.dn {
    background: rgba(239,83,80,0.15);
    color: var(--red);
    border: 1px solid rgba(239,83,80,0.3);
}

.val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    font-weight: 700;
}
.val.bull { color: var(--green); }
.val.bear { color: var(--red); }

.change {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 500;
}
.change.bull { color: var(--green); }
.change.bear { color: var(--red); }

.ohlc {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    color: var(--dim);
    letter-spacing: 0.3px;
}

.ind-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.ind-label.sma { color: var(--blue); }
.ind-label.ema { color: var(--orange); }
.ind-label.rsi-label { color: var(--dim); }

.ind-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    color: var(--dim);
    margin-right: 6px;
}
.ind-val.bull { color: var(--green); }
.ind-val.bear { color: var(--red); }

/* ── Price Axis (right side, TradingView style) ───────────────── */

#price-axis {
    position: fixed;
    top: 0;
    right: 0;
    width: 78px;
    height: 100vh;
    z-index: 19;
    background: rgba(19, 23, 34, 0.95);
    border-left: 1px solid var(--border);
    pointer-events: none;
}

.price-label {
    position: absolute;
    right: 8px;
    transform: translateY(-50%);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    color: var(--dim);
    white-space: nowrap;
}

/* Thin horizontal line extending from label into chart */
.price-label::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    width: 6px;
    height: 1px;
    background: var(--border);
}

/* ── Stats Bar ─────────────────────────────────────────────────── */

#stats-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 30px;
    z-index: 20;
    background: rgba(19, 23, 34, 0.92);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    pointer-events: none;
}

.stats-left, .stats-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-item {
    font-size: 10px;
    font-weight: 500;
    color: var(--dim);
}

.stat-num {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--text);
}
.stat-num.gold { color: var(--gold); }

.tech-text {
    font-size: 10px;
    color: var(--dim);
    font-weight: 500;
}
.tech-sep {
    font-size: 10px;
    color: var(--border);
}

/* ── Orderbook — Full-height right sidebar (Hyperliquid style) ── */

#orderbook {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 30px;
    width: 220px;
    z-index: 20;
    background: rgba(19, 23, 34, 0.96);
    backdrop-filter: blur(8px);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    font-size: 10px;
}

.ob-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 10px;
    font-weight: 700;
    color: var(--dim);
    min-height: 30px;
}

.ob-spread-label {
    font-weight: 500;
    color: var(--dim);
    font-size: 9px;
}

.ob-spread-label span { color: var(--text); font-weight: 700; }

.ob-col-headers {
    display: flex;
    padding: 3px 8px;
    font-size: 8px;
    font-weight: 600;
    color: rgba(120, 123, 134, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.ob-col-headers span { flex: 1; }
.ob-col-headers span:first-child { text-align: left; }
.ob-col-headers span:nth-child(2) { text-align: right; }
.ob-col-headers span:last-child { text-align: right; }

.ob-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ob-row {
    display: flex;
    align-items: center;
    padding: 0 8px;
    position: relative;
    height: 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
}

.ob-row .ob-bar {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    opacity: 0.10;
    z-index: 0;
}

.ob-row.ask .ob-bar { background: var(--red); }
.ob-row.bid .ob-bar { background: var(--green); }

.ob-row .ob-price,
.ob-row .ob-size,
.ob-row .ob-total {
    position: relative;
    z-index: 1;
    flex: 1;
}

.ob-row .ob-price { font-weight: 600; text-align: left; }
.ob-row .ob-size { text-align: right; color: var(--dim); }
.ob-row .ob-total { text-align: right; color: rgba(120,123,134,0.5); }

.ob-row.ask .ob-price { color: var(--red); }
.ob-row.bid .ob-price { color: var(--green); }

.ob-mid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.ob-mid.up { color: var(--green); }
.ob-mid.down { color: var(--red); }

.ob-mid .ob-spread-info {
    font-size: 9px;
    font-weight: 500;
    color: var(--dim);
}

/* ── Trade Buttons (BUY/SELL) ─────────────────────────────────── */

#trade-buttons {
    position: fixed;
    bottom: 46px;
    right: 232px;
    z-index: 30;
    display: flex;
    gap: 4px;
}

.trade-btn {
    width: 98px;
    height: 52px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: all 0.15s ease;
    touch-action: manipulation;
    outline: none;
}

.trade-btn.buy {
    background: var(--green);
    box-shadow: 0 2px 12px rgba(38, 166, 154, 0.25);
}

.trade-btn.sell {
    background: var(--red);
    box-shadow: 0 2px 12px rgba(239, 83, 80, 0.25);
}

.trade-btn.buy:hover { background: #2bbd9e; transform: translateY(-1px); }
.trade-btn.sell:hover { background: #f44336; transform: translateY(-1px); }

.trade-btn:active, .trade-btn.pressed {
    transform: translateY(1px) scale(0.97);
}

.tb-label {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 1.5px;
}

.tb-price {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
}

/* ── Volume Selector ──────────────────────────────────────────── */

#vol-selector {
    position: fixed;
    bottom: 104px;
    right: 232px;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 3px;
}

.vol-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--dim);
    margin-right: 3px;
}

.vol-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 2px 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 600;
    color: var(--dim);
    cursor: pointer;
    transition: all 0.1s;
    outline: none;
}

.vol-btn:hover { border-color: var(--dim); color: var(--text); }
.vol-btn.active {
    background: rgba(33, 150, 243, 0.12);
    border-color: var(--blue);
    color: var(--blue);
}

/* ── Command Palette ──────────────────────────────────────────── */

.cmd-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 20vh;
    backdrop-filter: blur(4px);
}

.cmd-overlay.hidden { display: none; }

.cmd-palette {
    width: 420px;
    max-height: 380px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

#cmd-input {
    width: 100%;
    padding: 14px 18px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    outline: none;
}

#cmd-input::placeholder { color: var(--dim); }

.cmd-list {
    max-height: 280px;
    overflow-y: auto;
    padding: 6px 0;
}

.cmd-item {
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 13px;
    color: var(--text);
}

.cmd-item:hover, .cmd-item.active {
    background: rgba(33, 150, 243, 0.08);
}

.cmd-item .cmd-key {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--dim);
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 6px;
    margin-left: auto;
}

.cmd-item .cmd-icon {
    font-size: 15px;
    width: 20px;
    text-align: center;
}

/* ── Hint ──────────────────────────────────────────────────────── */

#hint {
    position: fixed;
    bottom: 38px;
    right: 232px;
    z-index: 20;
    font-size: 10px;
    color: var(--dim);
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.5s;
}
#hint.hidden { opacity: 0; }
#hint kbd {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: var(--dim);
}

/* ── PnL popup ─────────────────────────────────────────────────── */

.pnl-popup {
    position: fixed;
    z-index: 40;
    pointer-events: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 700;
    color: var(--green);
    text-shadow: 0 0 12px rgba(38, 166, 154, 0.5);
    animation: pnl-rise 2s ease-out forwards;
}
@keyframes pnl-rise {
    0%   { opacity: 0; transform: translate(0, 0) scale(0.7); }
    12%  { opacity: 1; transform: translate(-5px, -12px) scale(1.05); }
    100% { opacity: 0; transform: translate(-15px, -80px) scale(0.85); }
}

/* ── Trades Panel (MT5 mobile style) ───────────────────────────── */

#trades-panel {
    position: fixed;
    left: 14px;
    bottom: 42px;
    width: 280px;
    max-height: 380px;
    z-index: 25;
    background: rgba(19, 23, 34, 0.94);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-size: 11px;
}

.tp-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding: 0;
}

.tp-tab {
    flex: 1;
    text-align: center;
    padding: 7px 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--dim);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.tp-tab.active {
    color: var(--text);
    border-bottom-color: var(--blue);
}

.tp-list {
    flex: 1;
    overflow-y: auto;
    max-height: 240px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.tp-list::-webkit-scrollbar { width: 4px; }
.tp-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Individual trade card */
.trade-card {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(42, 46, 57, 0.5);
    animation: trade-slide-in 0.3s ease-out;
}

@keyframes trade-slide-in {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.trade-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.trade-pair {
    font-weight: 700;
    color: var(--text);
    font-size: 11px;
}

.trade-type {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 2px;
    letter-spacing: 0.5px;
}

.trade-type.buy {
    background: rgba(38, 166, 154, 0.15);
    color: var(--green);
}

.trade-type.sell {
    background: rgba(239, 83, 80, 0.15);
    color: var(--red);
}

.trade-vol {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    color: var(--dim);
}

.trade-mid {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--dim);
    margin-bottom: 2px;
}

.trade-arrow { color: var(--dim); margin: 0 3px; }

.trade-pnl {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    text-align: right;
}
.trade-pnl.profit { color: var(--green); }
.trade-pnl.loss { color: var(--red); }

/* Summary footer */
.tp-summary {
    border-top: 1px solid var(--border);
    padding: 8px 12px;
    background: rgba(30, 34, 45, 0.5);
}

.tp-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
}

.tp-label {
    font-size: 11px;
    color: var(--dim);
}

.tp-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text);
}

.tp-val.profit { color: var(--green); }
.tp-val.loss { color: var(--red); }
.tp-val.bold { font-weight: 700; }

/* ── Crosshair ────────────────────────────────────────────────── */

#gpu-canvas { cursor: crosshair; }

.crosshair-line {
    position: fixed;
    pointer-events: none;
    z-index: 15;
    display: none;
}

.cross-h {
    height: 1px;
    background: repeating-linear-gradient(
        90deg,
        rgba(120, 123, 134, 0.5) 0px,
        rgba(120, 123, 134, 0.5) 4px,
        transparent 4px,
        transparent 8px
    );
}

.cross-v {
    width: 1px;
    background: repeating-linear-gradient(
        0deg,
        rgba(120, 123, 134, 0.5) 0px,
        rgba(120, 123, 134, 0.5) 4px,
        transparent 4px,
        transparent 8px
    );
}

.crosshair-label {
    position: fixed;
    pointer-events: none;
    z-index: 16;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 2px;
    display: none;
    white-space: nowrap;
}

.cross-price {
    right: 220px;
    width: auto;
    text-align: left;
    padding: 2px 8px;
    transform: translateY(-50%);
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
}

.cross-time {
    bottom: 30px;
    transform: translateX(-50%);
    background: var(--panel);
    color: var(--dim);
    border: 1px solid var(--border);
}

/* ── Current Price Label ──────────────────────────────────────── */

.current-price-label {
    position: fixed;
    right: 220px;
    width: auto;
    text-align: left;
    padding: 3px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    transform: translateY(-50%);
    z-index: 21;
    pointer-events: none;
    border-radius: 2px 0 0 2px;
}

.current-price-label.bull {
    background: var(--green);
    color: #fff;
}

.current-price-label.bear {
    background: var(--red);
    color: #fff;
}

/* ── Camera Shake ─────────────────────────────────────────────── */

#gpu-canvas.shaking {
    transition: none;
}

/* ── Combo / Streak ───────────────────────────────────────────── */

.combo-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    pointer-events: none;
    font-family: 'Inter', sans-serif;
    font-weight: 900;
    font-size: 36px;
    letter-spacing: 3px;
    text-transform: uppercase;
    opacity: 0;
    transition: transform 0.2s ease-out, opacity 0.3s;
}

.combo-display.show {
    opacity: 1;
    color: var(--gold);
    text-shadow:
        0 0 20px rgba(240, 185, 11, 0.6),
        0 0 40px rgba(240, 185, 11, 0.3),
        0 4px 10px rgba(0, 0, 0, 0.5);
    animation: combo-pulse 0.4s ease-out;
}

.combo-display.broken {
    opacity: 1;
    color: var(--red);
    text-shadow:
        0 0 20px rgba(239, 83, 80, 0.6),
        0 4px 10px rgba(0, 0, 0, 0.5);
    font-size: 24px;
    animation: combo-break 1.5s ease-out forwards;
}

@keyframes combo-pulse {
    0% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
    40% { transform: translate(-50%, -50%) scale(0.95); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes combo-break {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    20% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
}

/* ── Big Move Alert ───────────────────────────────────────────── */

.move-alert {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    pointer-events: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 6px 16px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.move-alert.up {
    opacity: 1;
    color: var(--green);
    background: rgba(38, 166, 154, 0.12);
    border: 1px solid rgba(38, 166, 154, 0.3);
    animation: alert-flash 2s ease-out forwards;
}

.move-alert.down {
    opacity: 1;
    color: var(--red);
    background: rgba(239, 83, 80, 0.12);
    border: 1px solid rgba(239, 83, 80, 0.3);
    animation: alert-flash 2s ease-out forwards;
}

@keyframes alert-flash {
    0% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    70% { opacity: 1; }
    100% { opacity: 0; transform: translateX(-50%) translateY(-5px); }
}

/* ── Profit confetti overlay ──────────────────────────────────── */

.confetti-particle {
    position: fixed;
    pointer-events: none;
    z-index: 45;
    width: 6px;
    height: 6px;
    border-radius: 1px;
    animation: confetti-fall 1.5s ease-out forwards;
}

@keyframes confetti-fall {
    0% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
    100% { opacity: 0; transform: translateY(120px) rotate(720deg) scale(0.3); }
}

/* ── Vignette Overlay (volatility-reactive) ───────────────────── */

.vignette-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(38, 166, 154, 0.03) 100%);
    transition: background 1s ease;
}

/* ── Animated Number Transitions ──────────────────────────────── */

.val, .tb-price, .trade-pnl, .tp-val, .stat-num {
    transition: color 0.2s ease;
    font-variant-numeric: tabular-nums;
}

.price-tick-up {
    animation: tick-up 0.3s ease-out;
}

.price-tick-down {
    animation: tick-down 0.3s ease-out;
}

@keyframes tick-up {
    0% { color: var(--green); transform: translateY(2px); }
    50% { transform: translateY(-1px); }
    100% { transform: translateY(0); }
}

@keyframes tick-down {
    0% { color: var(--red); transform: translateY(-2px); }
    50% { transform: translateY(1px); }
    100% { transform: translateY(0); }
}

/* ── Mouse Parallax transition ────────────────────────────────── */

#chart-header, #stats-bar, #trades-panel, #orderbook {
    transition: transform 0.15s ease-out;
}

/* ── Keyboard hints ───────────────────────────────────────────── */

.hint-keys {
    opacity: 0.5;
    font-size: 9px;
}

/* ── Toast Notifications ──────────────────────────────────────── */

.toast-container {
    position: fixed;
    top: 70px;
    right: 232px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
}

.toast {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    backdrop-filter: blur(12px);
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease;
    pointer-events: auto;
}

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

.toast-info {
    background: rgba(33, 150, 243, 0.15);
    border: 1px solid rgba(33, 150, 243, 0.3);
    color: var(--blue);
}

.toast-success {
    background: rgba(38, 166, 154, 0.15);
    border: 1px solid rgba(38, 166, 154, 0.3);
    color: var(--green);
}

.toast-error {
    background: rgba(239, 83, 80, 0.15);
    border: 1px solid rgba(239, 83, 80, 0.3);
    color: var(--red);
}

/* ── Error ─────────────────────────────────────────────────────── */

#error {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg);
    color: var(--red);
    font-size: 16px;
    font-weight: 600;
    z-index: 100;
    padding: 40px;
    text-align: center;
}
#error.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Responsive ────────────────────────────────────────────────── */

@media (max-width: 768px) {
    #chart-header { padding: 6px 10px; right: 60px; }
    .val { font-size: 13px; }
    .header-row.sub { display: none; }
    #price-axis { width: 60px; }
    .price-label { font-size: 9px; right: 5px; }
    #trade-buttons { right: 68px; bottom: 36px; }
    .trade-btn { width: 72px; height: 42px; }
    .tb-label { font-size: 11px; }
    #orderbook { right: 68px; width: 170px; bottom: 100px; }
    #vol-selector { right: 68px; bottom: 84px; }
    .cmd-palette { width: 90vw; }
    #trades-panel { width: 220px; max-height: 280px; left: 8px; bottom: 36px; }
    .hint-keys { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   POLYQUANT DERBY V2 DASHBOARD — Full Screen Strategy Grid
   ═══════════════════════════════════════════════════════════════ */

#dd {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #0b0e17;
    display: flex;
    flex-direction: column;
    font-family: 'JetBrains Mono', 'Inter', monospace;
    color: #d1d4dc;
    overflow: hidden;
}

/* Brand accent gradient line at top */
#dd::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #26a69a, #00e5ff, #ffd740, #ef5350, #26a69a);
    background-size: 200% 100%;
    animation: gradientShift 8s linear infinite;
    z-index: 200;
}

@keyframes gradientShift {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

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

.dd-hdr {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: #111520;
    border-bottom: 1px solid #1e2433;
    flex-shrink: 0;
    height: 42px;
}

.dd-brand {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 2px;
    color: #d1d4dc;
}
.dd-accent { color: #26a69a; }

.dd-sep {
    width: 1px;
    height: 20px;
    background: #1e2433;
}

.dd-tag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #00e5ff;
    background: rgba(0,229,255,0.08);
    padding: 2px 10px;
    border-radius: 3px;
    border: 1px solid rgba(0,229,255,0.15);
}

.dd-kpi {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}
.dd-kpi-label {
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #555b6e;
    text-transform: uppercase;
}
.dd-kpi-val {
    font-size: 13px;
    font-weight: 700;
    color: #d1d4dc;
}
.dd-kpi-val.pos { color: #26a69a; }
.dd-kpi-val.neg { color: #ef5350; }

.dd-regime {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    padding: 3px 12px;
    border-radius: 4px;
}
.dd-regime.up {
    background: rgba(38,166,154,0.12);
    color: #26a69a;
    border: 1px solid rgba(38,166,154,0.25);
}
.dd-regime.dn {
    background: rgba(239,83,80,0.12);
    color: #ef5350;
    border: 1px solid rgba(239,83,80,0.25);
}

/* ── Slot Countdown ────────────────────────────────────────── */

.dd-countdown {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 100px;
    background: rgba(255,255,255,0.02);
    padding: 2px 12px;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.04);
}
.dd-cd-label {
    font-size: 7px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: #555b6e;
}
.dd-cd-timer {
    font-family: 'JetBrains Mono', monospace;
    font-size: 22px;
    font-weight: 800;
    color: #d1d4dc;
    letter-spacing: 2px;
    text-shadow: 0 0 8px rgba(255,255,255,0.05);
}
.dd-cd-bar {
    width: 90px;
    height: 3px;
    background: rgba(255,255,255,0.04);
    border-radius: 2px;
    overflow: hidden;
}
.dd-cd-fill {
    height: 100%;
    background: #26a69a;
    border-radius: 2px;
    transition: width 1s linear, background 0.5s;
}
.dd-cd-pulse .dd-cd-timer {
    animation: cdPulse 1s infinite;
}
@keyframes cdPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.dd-grow { flex: 1; }

.dd-filters {
    display: flex;
    gap: 3px;
}
.dd-fbtn {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 3px 10px;
    border-radius: 3px;
    border: 1px solid transparent;
    cursor: pointer;
    background: rgba(255,255,255,0.03);
    color: #555b6e;
    transition: all 0.12s;
}
.dd-fbtn:hover {
    background: rgba(255,255,255,0.06);
    color: #d1d4dc;
}
.dd-fbtn.active {
    background: rgba(38,166,154,0.12);
    color: #26a69a;
    border-color: rgba(38,166,154,0.25);
}

.dd-live {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 2px 8px;
    border-radius: 3px;
}
.dd-live.on {
    background: rgba(38,166,154,0.12);
    color: #26a69a;
}
.dd-live.off {
    background: rgba(239,83,80,0.12);
    color: #ef5350;
}

/* ── Equity ────────────────────────────────────────────────────── */

.dd-equity {
    flex-shrink: 0;
    padding: 0 16px;
    background: #0d1019;
    border-bottom: 1px solid #1a1f2e;
}

.dd-equity canvas {
    display: block;
    width: 100%;
}

/* ── Main: Grid + Feed ─────────────────────────────────────────── */

.dd-main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* ── Card Grid ─────────────────────────────────────────────────── */

.dd-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 6px;
    padding: 8px;
    overflow-y: auto;
    align-content: start;
    background-image:
        linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
    background-size: 40px 40px;
}

.dd-card {
    background: #111520;
    border: 1px solid #1a1f2e;
    border-radius: 6px;
    padding: 8px 10px 6px;
    transition: border-color 0.2s, background 0.2s, transform 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
    position: relative;
}
.dd-card:hover {
    border-color: #2a3040;
    background: #141825;
    transform: scale(1.015) translateY(-1px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.dd-card.pos {
    border-left: 3px solid rgba(38,166,154,0.5);
}
.dd-card.pos:hover {
    box-shadow: 0 4px 20px rgba(38,166,154,0.12);
}
.dd-card.neg {
    border-left: 3px solid rgba(239,83,80,0.4);
}
.dd-card.neg:hover {
    box-shadow: 0 4px 20px rgba(239,83,80,0.1);
}
/* Gradient border for turbo strategies */
.dd-card.turbo-card {
    border: 1px solid transparent;
    background-clip: padding-box;
    position: relative;
}
.dd-card.turbo-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 7px;
    background: linear-gradient(135deg, rgba(0,229,255,0.3), rgba(0,229,255,0.05), rgba(255,215,64,0.15));
    z-index: -1;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.dd-card.turbo-card:hover::before {
    opacity: 1;
}

/* ── Card internals ────────────────────────────────────────── */

.dd-c-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2px;
}
.dd-c-name-row {
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
}
.dd-c-name {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: capitalize;
}
.dd-c-fam {
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.8px;
    opacity: 0.5;
}
.dd-c-badge {
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 1px;
    padding: 2px 7px;
    border-radius: 3px;
    flex-shrink: 0;
}
.dd-c-badge.btc { color: #f7931a; background: rgba(247,147,26,0.10); border: 1px solid rgba(247,147,26,0.15); }
.dd-c-badge.eth { color: #627eea; background: rgba(98,126,234,0.10); border: 1px solid rgba(98,126,234,0.15); }
.dd-c-badge.sol { color: #00ffa3; background: rgba(0,255,163,0.10); border: 1px solid rgba(0,255,163,0.15); }
.dd-c-badge.all { color: #787b86; background: rgba(255,255,255,0.04); }

.dd-c-spark {
    display: block;
    width: 100%;
    height: 52px;
    margin: 3px 0;
    border-radius: 3px;
}

.dd-c-mid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2px 0;
}
.dd-c-pnl {
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.3px;
}
.dd-c-pnl.pos { color: #26a69a; }
.dd-c-pnl.neg { color: #ef5350; }
.dd-c-side {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.dd-c-side.up { color: #26a69a; }
.dd-c-side.dn { color: #ef5350; }

.dd-c-bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 3px 0;
}
.dd-c-wr-bar {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.04);
    border-radius: 2px;
    overflow: hidden;
}
.dd-c-wr-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}
.dd-c-wr-fill.pos { background: linear-gradient(90deg, rgba(38,166,154,0.3), #26a69a); }
.dd-c-wr-fill.neg { background: linear-gradient(90deg, rgba(239,83,80,0.3), #ef5350); }
.dd-c-wr-text {
    font-size: 10px;
    font-weight: 700;
    color: #d1d4dc;
    min-width: 30px;
    text-align: right;
}

.dd-c-bot {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 9px;
    margin-top: 2px;
}
.dd-c-meta { color: #555b6e; }
.dd-c-regime-split { margin-left: auto; display: flex; gap: 6px; }
.dd-c-up-wr { color: #26a69a; font-weight: 600; }
.dd-c-dn-wr { color: #ef5350; font-weight: 600; }

/* ── Feed ──────────────────────────────────────────────────────── */

.dd-feed {
    width: 280px;
    flex-shrink: 0;
    background: #0d1019;
    border-left: 1px solid #1a1f2e;
    overflow-y: auto;
    padding: 0;
}

.dd-feed-title {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #555b6e;
    padding: 8px 10px 4px;
    border-bottom: 1px solid #1a1f2e;
    position: sticky;
    top: 0;
    background: #0d1019;
    z-index: 1;
}

.dd-fr {
    display: flex;
    gap: 6px;
    padding: 3px 10px;
    font-size: 10px;
    border-bottom: 1px solid rgba(30,36,51,0.5);
    transition: background 0.1s;
}
.dd-fr:hover { background: rgba(255,255,255,0.02); }
.dd-fr.w { border-left: 2px solid rgba(38,166,154,0.5); }
.dd-fr.l { border-left: 2px solid rgba(239,83,80,0.4); }

.dd-fr-t { color: #555b6e; width: 55px; flex-shrink: 0; }
.dd-fr-s { color: #d1d4dc; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-fr-side { color: #787b86; width: 20px; }
.dd-fr-r { font-weight: 700; width: 12px; }
.dd-fr.w .dd-fr-r { color: #26a69a; }
.dd-fr.l .dd-fr-r { color: #ef5350; }
.dd-fr-p { font-weight: 600; width: 50px; text-align: right; }
.dd-fr.w .dd-fr-p { color: #26a69a; }
.dd-fr.l .dd-fr-p { color: #ef5350; }

/* ── Scrollbar ─────────────────────────────────────────────────── */

.dd-grid, .dd-feed {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.dd-grid::-webkit-scrollbar,
.dd-feed::-webkit-scrollbar { width: 4px; }
.dd-grid::-webkit-scrollbar-track,
.dd-feed::-webkit-scrollbar-track { background: transparent; }
.dd-grid::-webkit-scrollbar-thumb,
.dd-feed::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Responsive ────────────────────────────────────────────────── */

@media (max-width: 1200px) {
    .dd-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
    .dd-feed { width: 240px; }
}
@media (max-width: 800px) {
    .dd-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
    .dd-feed { display: none; }
}

/* ── Last Updated Indicator ───────────────────────────────────── */

.dd-last-updated {
    font-size: 8px;
    font-weight: 500;
    color: #555b6e;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* ── Empty State ──────────────────────────────────────────────── */

.dd-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    gap: 16px;
}
.dd-empty-icon {
    font-size: 48px;
    opacity: 0.3;
    animation: emptyPulse 2s ease-in-out infinite;
}
.dd-empty-title {
    font-size: 16px;
    font-weight: 700;
    color: #555b6e;
    letter-spacing: 1px;
}
.dd-empty-sub {
    font-size: 11px;
    color: #3a3f50;
    max-width: 320px;
    line-height: 1.5;
}
@keyframes emptyPulse {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.05); }
}

/* ── Card Tooltip ─────────────────────────────────────────────── */

.dd-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1f2e;
    border: 1px solid #2a3040;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 10px;
    line-height: 1.6;
    color: #d1d4dc;
    white-space: nowrap;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.dd-card:hover .dd-tooltip {
    opacity: 1;
}
.dd-tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}
.dd-tooltip-label {
    color: #555b6e;
}
.dd-tooltip-val {
    font-weight: 700;
}
.dd-tooltip-val.pos { color: #26a69a; }
.dd-tooltip-val.neg { color: #ef5350; }
