/* ════════════════════════════════════════════════
   The Elite Terminal — Component Styles
   Chart, Panels, Order Book, Trades, Flow, News
   ════════════════════════════════════════════════ */


/* ════════════════════════════════
   Chart Header
   ════════════════════════════════ */

.chart-header {
    height: var(--chart-header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px 0 10px;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 8px;
}

.chart-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.chart-asset {
    display: flex;
    align-items: center;
    gap: 7px;
}
.chart-asset-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: var(--bg-3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-3);
}
.chart-asset-icon img { width: 100%; height: 100%; padding: 3px; object-fit: contain; border-radius: 3px; }
.chart-asset-info {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.chart-pair {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-1);
    line-height: 1.2;
}
.chart-tag {
    font-size: 9px;
    color: var(--text-4);
    font-weight: 500;
}

.chart-price-group {
    display: flex;
    align-items: center;
    gap: 6px;
}
.chart-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-1);
    font-family: 'JetBrains Mono', monospace;
}
.chart-change {
    font-size: 11px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    padding: 1px 5px;
    border-radius: 3px;
}
.chart-change.positive { color: var(--green); background: var(--green-dim); }
.chart-change.negative { color: var(--red); background: var(--red-dim); }
.chart-change-abs {
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-4);
}

.chart-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.header-divider {
    width: 1px;
    height: 18px;
    background: var(--border);
}

/* Timeframe Chips */
.tf-group {
    display: flex;
    gap: 1px;
    background: var(--bg-2);
    border-radius: 5px;
    padding: 2px;
}
.tf-chip {
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-4);
    border-radius: 3px;
    transition: all .12s;
    font-family: 'JetBrains Mono', monospace;
}
.tf-chip:hover { color: var(--text-2); }
.tf-chip.active {
    color: var(--text-1);
    background: var(--bg-4);
}

/* Chart Tools */
.chart-tools {
    display: flex;
    align-items: center;
    gap: 2px;
}
.tool-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 7px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    color: var(--text-3);
    transition: all .12s;
}
.tool-btn:hover { background: var(--bg-3); color: var(--text-1); }
.tool-btn.active { background: var(--amber-dim); color: var(--amber); }
.tool-btn svg { flex-shrink: 0; }
.tool-btn span { font-weight: 500; }


/* ════════════════════════════════
   Chart Row (Chart + Right Panel)
   ════════════════════════════════ */

.chart-row {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}


/* ════════════════════════════════
   Drawing Tools (Vertical)
   ════════════════════════════════ */

.drawing-tools {
    width: var(--draw-tools-w);
    background: var(--bg-1);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 0;
    gap: 2px;
    flex-shrink: 0;
    position: relative;
}
.draw-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    color: var(--text-4);
    transition: all .15s ease;
    position: relative;
    cursor: pointer;
    border: 1px solid transparent;
}
.draw-btn:hover {
    background: var(--bg-3);
    color: var(--text-1);
    border-color: var(--border);
}
.draw-btn.active {
    background: var(--amber-dim);
    color: var(--amber);
    border-color: rgba(245,158,11,0.25);
    box-shadow: 0 0 8px rgba(245,158,11,0.1);
}
.draw-btn-danger:hover {
    background: rgba(255,71,87,0.1);
    color: #ff4757;
    border-color: rgba(255,71,87,0.25);
}
.draw-divider {
    width: 18px;
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}
.draw-count-badge {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--amber);
    color: #000;
    font-size: 9px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    line-height: 1;
}

/* Drawing status indicator */
.drawing-status {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(245,158,11,0.95);
    color: #000;
    padding: 5px 16px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    z-index: 20;
    display: none;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 12px rgba(245,158,11,0.25);
    animation: drawStatusIn .15s ease;
}
@keyframes drawStatusIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}


/* ════════════════════════════════
   Chart Container
   ════════════════════════════════ */

.chart-container-wrap {
    flex: 1;
    position: relative;
    background: var(--bg-0);
    overflow: hidden;
    min-width: 0;
    contain: layout style;
}

.chart-container {
    width: 100%;
    height: 100%;
    contain: strict;
}

/* Auto-Fit Button (mobile only) */
.chart-autofit-btn {
    display: none;
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 12;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-1);
    color: var(--text-3);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transition: background .15s, color .15s, border-color .15s;
}
.chart-autofit-btn:active {
    background: var(--gold);
    color: #000;
    border-color: var(--gold);
}

/* OHLC Overlay */
.ohlc-overlay {
    position: absolute;
    top: 6px;
    left: 8px;
    display: flex;
    gap: 10px;
    z-index: 10;
    pointer-events: none;
}
.ohlc-item {
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-4);
}
.ohlc-item span { color: var(--text-2); font-weight: 500; }
.ohlc-item.vwap span { color: var(--purple); }

/* Chart Loading */
.chart-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-0);
    z-index: 15;
}
.chart-loading-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border);
    border-top-color: var(--amber);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* VPVR Container */
.vpvr-container {
    position: absolute;
    top: 0;
    right: 60px;
    width: 90px;
    height: 100%;
    z-index: 8;
    pointer-events: none;
    opacity: 0.85;
    transition: opacity .2s;
}

/* Heatmap Canvas */
#heatmap-canvas {
    image-rendering: optimizeSpeed;
}


/* ════════════════════════════════
   Right Panel
   ════════════════════════════════ */

/* Mobile Panel Header — only visible on mobile */
.mobile-panel-header {
    display: none;
}

.right-panel {
    width: var(--panel-w);
    background: var(--bg-1);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

/* Panel Tabs */
.panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.panel-tab {
    flex: 1;
    padding: 7px 0;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-4);
    text-align: center;
    transition: all .12s;
    border-bottom: 2px solid transparent;
    letter-spacing: 0.02em;
}
.panel-tab:hover { color: var(--text-2); }
.panel-tab.active {
    color: var(--text-1);
    border-bottom-color: var(--amber);
}

/* Panel Content */
.panel-content {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
    contain: layout style;
    will-change: contents;
}
.panel-content.active { display: flex; }


/* ════════════════════════════════
   Order Book
   ════════════════════════════════ */

.orderbook {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    contain: content;
}
.ob-col-header {
    display: flex;
    justify-content: space-between;
    padding: 5px 8px;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-5);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.ob-asks, .ob-bids {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
}
.ob-asks { justify-content: flex-end; }

.ob-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1px 8px;
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    position: relative;
    line-height: 1.6;
}
.ob-row .depth-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    pointer-events: none;
    opacity: 0.08;
}
.ob-row.ask .depth-bar { background: var(--red); }
.ob-row.bid .depth-bar { background: var(--green); }
.ob-row.ask .ob-price { color: var(--red); }
.ob-row.bid .ob-price { color: var(--green); }
.ob-row .ob-size { color: var(--text-2); }
.ob-row .ob-total { color: var(--text-4); }

/* Spread */
.ob-spread {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 5px 8px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--bg-2);
    flex-shrink: 0;
}
.spread-price {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-1);
    font-family: 'JetBrains Mono', monospace;
}
.spread-pct {
    font-size: 9px;
    color: var(--text-4);
    font-family: 'JetBrains Mono', monospace;
}

/* Buy/Sell Pressure Bar */
.pressure-bar {
    display: flex;
    height: 18px;
    flex-shrink: 0;
    overflow: hidden;
}
.pressure-buy, .pressure-sell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    transition: width .4s ease;
}
.pressure-buy { background: var(--green-bg); color: var(--green); }
.pressure-sell { background: var(--red-bg); color: var(--red); }


/* ════════════════════════════════
   Trades
   ════════════════════════════════ */

.trades-col-header {
    display: flex;
    justify-content: space-between;
    padding: 5px 8px;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-5);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.trades-list {
    flex: 1;
    overflow-y: auto;
    contain: content;
    -webkit-overflow-scrolling: touch;
}
.trade-row {
    display: flex;
    justify-content: space-between;
    padding: 1px 8px;
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.7;
    transition: background .1s;
}
.trade-row:hover { background: var(--bg-2); }
.trade-row.buy .t-price { color: var(--green); }
.trade-row.sell .t-price { color: var(--red); }
.trade-row .t-size { color: var(--text-2); }
.trade-row .t-time { color: var(--text-4); }


/* ════════════════════════════════
   Order Flow
   ════════════════════════════════ */

.flow-section {
    padding: 10px 10px 8px;
    border-bottom: 1px solid var(--border);
}
.flow-section:last-child { border-bottom: none; }
.flow-title {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-4);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.flow-bar-track {
    height: 6px;
    background: var(--red-dim);
    border-radius: 3px;
    overflow: hidden;
}
.flow-bar.buy {
    height: 100%;
    background: var(--green);
    border-radius: 3px 0 0 3px;
    transition: width .4s ease;
}
.flow-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 10px;
}
.fl-buy { color: var(--green); }
.fl-sell { color: var(--red); }
.fl-buy strong, .fl-sell strong {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
}

.flow-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
    border-bottom: 1px solid var(--border);
}
.flow-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px;
    background: var(--bg-1);
}
.fm-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-4);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.fm-value {
    font-size: 12px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-1);
}

/* Large Orders */
.large-orders {
    max-height: 120px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.lo-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
}
.lo-row.buy { background: var(--green-bg); }
.lo-row.sell { background: var(--red-bg); }
.lo-side { font-weight: 600; font-size: 9px; }
.lo-row.buy .lo-side { color: var(--green); }
.lo-row.sell .lo-side { color: var(--red); }
.lo-val { color: var(--text-2); }
.lo-time { color: var(--text-4); font-size: 9px; }

/* Liquidation Levels */
.liq-levels {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* Zone headers */
.liq-zone-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px 3px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.liq-zone-header.short-zone-header { color: var(--red); }
.liq-zone-header.long-zone-header { color: var(--green); }
.liq-zone-icon { font-size: 8px; }
.liq-zone-sub {
    font-size: 8px;
    font-weight: 400;
    color: var(--text-4);
    letter-spacing: 0;
    text-transform: none;
    margin-left: auto;
}

/* Current price marker */
.liq-current-price {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px;
    margin: 4px 0;
}
.liq-cp-line {
    flex: 1;
    height: 1px;
    background: var(--text-3);
    opacity: 0.4;
}
.liq-cp-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-1);
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    letter-spacing: 0.05em;
}

/* Liq level row */
.liq-level {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
}
.liq-level.long-liq {
    background: var(--green-bg);
    border: 1px solid rgba(0,220,130,0.08);
}
.liq-level.short-liq {
    background: var(--red-bg);
    border: 1px solid rgba(255,71,87,0.08);
}

/* Leverage badge */
.liq-leverage-badge {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-3);
    min-width: 28px;
    text-align: center;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(255,255,255,0.04);
    flex-shrink: 0;
}
.liq-price { font-weight: 600; color: var(--text-1); flex: 1; }
.liq-dist {
    font-size: 9px;
    font-weight: 600;
    min-width: 48px;
    text-align: right;
    flex-shrink: 0;
}
.short-liq .liq-dist { color: var(--red); }
.long-liq .liq-dist { color: var(--green); }
.liq-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.liq-vol { font-size: 8px; color: var(--text-3); min-width: 32px; text-align: right; }
.liq-density-bar {
    width: 40px; height: 4px; border-radius: 2px;
    background: var(--bg-3); overflow: hidden; flex-shrink: 0;
}
.liq-density-fill { height: 100%; border-radius: 2px; transition: width .3s; }
.long-liq .liq-density-fill { background: var(--green); }
.short-liq .liq-density-fill { background: var(--red); }

/* Liquidation Heatmap */
.liq-heatmap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 0;
}
.liq-heat-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 9px;
    font-family: 'JetBrains Mono', monospace;
    padding: 3px 8px;
    border-radius: 3px;
}
.liq-heat-label {
    width: 60px;
    color: var(--text-3);
    flex-shrink: 0;
}
.liq-heat-bar-wrap {
    flex: 1;
    height: 10px;
    background: var(--bg-2);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}
.liq-heat-bar {
    height: 100%;
    border-radius: 2px;
    transition: width .4s ease;
    min-width: 2px;
}
.liq-heat-bar.long-bar { background: linear-gradient(90deg, rgba(0,220,130,0.3), var(--green)); }
.liq-heat-bar.short-bar { background: linear-gradient(90deg, rgba(255,71,87,0.3), var(--red)); }
.liq-heat-val {
    width: 50px; text-align: right;
    font-weight: 600; color: var(--text-2);
    flex-shrink: 0;
}

/* Liquidation Stats */
.liq-stats {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.liq-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    border-radius: 4px;
    background: var(--bg-2);
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
}
.liq-stat-label { color: var(--text-3); font-weight: 500; }
.liq-stat-value { font-weight: 700; color: var(--text-1); }
.liq-stat-value.long-val { color: var(--green); }
.liq-stat-value.short-val { color: var(--red); }


/* ════════════════════════════════
   News
   ════════════════════════════════ */

.news-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
    -webkit-overflow-scrolling: touch;
    contain: content;
}
.news-item {
    padding: 8px;
    border-radius: 5px;
    margin-bottom: 3px;
    transition: background .12s;
    cursor: default;
    border-bottom: 1px solid var(--border);
}
.news-item:hover { background: var(--bg-2); }
.news-item:last-child { border-bottom: none; }
.news-headline {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-1);
    line-height: 1.4;
    margin-bottom: 4px;
}
.news-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 9px;
}
.news-source { color: var(--text-3); font-weight: 500; }
.news-time { color: var(--text-5); }
.news-tag {
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.05em;
}
.news-tag.bullish { background: var(--green-dim); color: var(--green); }
.news-tag.bearish { background: var(--red-dim); color: var(--red); }
.news-tag.neutral { background: var(--bg-4); color: var(--text-3); }


/* ════════════════════════════════
   Bottom Stats Bar
   ════════════════════════════════ */

.bottom-stats {
    height: var(--stats-h);
    display: flex;
    align-items: stretch;
    border-top: 1px solid var(--border);
    background: var(--bg-1);
    flex-shrink: 0;
    overflow-x: auto;
}
.bottom-stats::-webkit-scrollbar { height: 0; }

.stat-card {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 10px;
    border-right: 1px solid var(--border);
    min-width: fit-content;
    white-space: nowrap;
}
.stat-card:last-child { border-right: none; }

.stat-label {
    font-size: 9px;
    font-weight: 500;
    color: var(--text-4);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.stat-value {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-1);
    font-family: 'JetBrains Mono', monospace;
}


/* ════════════════════════════════
   Mobile Overrides
   ════════════════════════════════ */

@media (max-width: 768px) {
    .tf-group {
        overflow-x: auto;
        max-width: 180px;
        -webkit-overflow-scrolling: touch;
    }
    .chart-tools .tool-btn:not(#indicators-btn):not(#fullscreen-btn) {
        display: none;
    }
    .stat-card {
        flex: 0 0 auto;
        min-width: auto;
        padding: 0 8px;
        gap: 4px;
    }
    .stat-label { font-size: 8px; }
    .stat-value { font-size: 10px; }
    .chart-price { font-size: 14px; }
    .ohlc-overlay { font-size: 9px; gap: 6px; }

    /* Auto-fit button visible on mobile */
    .chart-autofit-btn { display: flex; }

    /* Mobile panel header */
    .mobile-panel-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 12px;
        background: var(--bg-1);
        border-bottom: 1px solid var(--border);
        flex-shrink: 0;
    }
    .mph-asset {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .mph-icon {
        width: 24px;
        height: 24px;
        border-radius: 6px;
        background: var(--bg-3);
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        font-size: 10px;
        font-weight: 700;
        color: var(--text-3);
    }
    .mph-icon img { width: 100%; height: 100%; padding: 3px; }
    .mph-pair {
        font-size: 13px;
        font-weight: 600;
        color: var(--text-1);
        font-family: 'JetBrains Mono', monospace;
    }
    .mph-price-group {
        display: flex;
        align-items: center;
        gap: 6px;
    }
    .mph-price {
        font-size: 15px;
        font-weight: 700;
        color: var(--text-1);
        font-family: 'JetBrains Mono', monospace;
    }
    .mph-change {
        font-size: 11px;
        font-weight: 600;
        font-family: 'JetBrains Mono', monospace;
        padding: 2px 6px;
        border-radius: 4px;
    }
    .mph-change.positive { color: var(--green); background: var(--green-dim); }
    .mph-change.negative { color: var(--red); background: var(--red-dim); }

    /* ── RIGHT PANEL: full-screen overlay (must be in terminal.css to win cascade) ── */
    .right-panel {
        position: fixed;
        top: var(--topbar-h);
        left: 0;
        right: 0;
        bottom: var(--mobile-nav-h);
        width: 100%;
        max-width: 100%;
        z-index: 80;
        display: flex;
        flex-direction: column;
        opacity: 0;
        visibility: hidden;
        transition: opacity .2s ease, visibility .2s ease;
        background: var(--bg-0);
        border-left: none;
        overflow: hidden;
    }
    .right-panel.mobile-visible {
        opacity: 1;
        visibility: visible;
    }
    .right-panel .panel-tabs {
        display: none;
    }
    .right-panel .panel-content {
        flex: 1;
        min-height: 0;
        overflow: hidden;
        contain: none;
        will-change: auto;
    }
    .right-panel .panel-content.active {
        display: flex;
    }
    /* Book: internal scroll in .ob-asks / .ob-bids */
    .right-panel #panel-orderbook .orderbook { flex: 1; min-height: 0; contain: none; }
    /* Trades: internal scroll in .trades-list */
    .right-panel #panel-trades .trades-list { flex: 1; min-height: 0; }
    /* Flow: block layout, whole panel scrolls */
    .right-panel #panel-orderflow.panel-content.active {
        display: block;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
    }
    /* News: internal scroll in .news-list */
    .right-panel #panel-news .news-list { flex: 1; min-height: 0; }

    /* Large orders get more space on full page */
    .large-orders {
        max-height: 200px;
    }
}

@media (max-width: 480px) {
    .chart-header { padding: 0 6px; gap: 4px; }
    .chart-price-group { gap: 4px; }
    .chart-price { font-size: 13px; }
    .tf-chip { padding: 3px 6px; font-size: 9px; }
    .bottom-stats { height: 28px; }
    .stat-card {
        min-width: auto;
        padding: 0 8px;
        gap: 3px;
        border-right: none;
    }
    .stat-card::after {
        content: '';
        width: 3px;
        height: 3px;
        border-radius: 50%;
        background: var(--border);
        flex-shrink: 0;
        margin-left: 5px;
    }
    .stat-card:last-child::after { display: none; }
    .stat-label { font-size: 7.5px; letter-spacing: 0.04em; }
    .stat-value { font-size: 9.5px; }
}
