/* * DESIGN SYSTEM | FUNDEDNEXT INSPIRED */
:root {
    /* Premium Dark Theme Palette */
    --bg-body: #050505;       /* Pitch Black */
    --bg-panel: #101114;      /* Deep Panel */
    --bg-card: #16171B;       /* Card/Row Background */
    --bg-hover: #1C1E24;      /* Hover State */
    --bg-input: #0A0A0C;      /* Deep Input */
    
    --border-color: #262932;  /* Subtle Borders */
    --border-highlight: #3E4451; 

    /* Typography */
    --text-main: #EAECEF;
    --text-muted: #848C9E;
    --text-placeholder: #505560;
    
    /* Brand Colors */
    --primary: #6366F1;       /* Indigo */
    --primary-glow: rgba(99, 102, 241, 0.2);
    
    /* Trading Colors (Neon/Vibrant) */
    --success: #22C55E;       /* Bright Green */
    --success-bg: rgba(34, 197, 94, 0.1);
    --danger: #EF4444;        /* Bright Red */
    --danger-bg: rgba(239, 68, 68, 0.1);
    
    /* Modal Overlay */
    --bg-overlay: rgba(0, 0, 0, 0.7);
    --bg-modal: #15171C;
    
    /* Layout Dimensions */
    --header-height: 50px;
    --wl-width: 260px;        /* Watchlist Width */
    
    --radius-sm: 4px;
    --radius-md: 6px;
    
    --font-family: 'Inter', -apple-system, sans-serif;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* * RESET & BASE */
* { box-sizing: border-box; margin: 0; padding: 0; outline: none; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-main);
    /* REMOVED: height: 100vh and flex-direction logic, moved to #app-root */
    height: 100%;
    margin: 0;
    font-size: 13px;
    -webkit-font-smoothing: antialiased;
}

/* ----------------------------------------
   * APP LAYOUT WRAPPER (NEW) 
   ----------------------------------------
   This holds the Sidebar and Main Content side-by-side.
*/
#app-root {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

#sidebar-container {
    flex-shrink: 0;
    height: 100%;
    /* Width is handled by sidebar.css inside the imported component */
    z-index: 100;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0; /* Prevents flex items from overflowing horizontally */
    position: relative;
    background-color: var(--bg-body);
}

/* * HEADER */
header {
    height: var(--header-height);
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    flex-shrink: 0;
    z-index: 20;
}

.brand-group { display: flex; align-items: center; gap: 0.75rem; }
.brand {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}
.brand span { color: var(--primary); }

.header-actions { display: flex; align-items: center; gap: 0.75rem; }
.btn-icon {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    width: 28px; height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-main); }
.mobile-toggle { display: none; }

/* * MAIN LAYOUT GRID (Inside .main-content) */
.terminal-grid {
    flex: 1;
    display: grid;
    grid-template-columns: var(--wl-width) 1fr; 
    grid-template-rows: 40px 1fr auto;
    /* Adjusted height calculation to fit inside flex container */
    height: calc(100% - var(--header-height));
    overflow: hidden;
    position: relative;
}

/* * LEFT PANEL: WATCHLIST */
.watchlist-panel {
    grid-column: 1 / 2;
    grid-row: 1 / -1; 
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 15;
    transition: transform 0.3s ease;
}

.wl-header { padding: 0.75rem 0.75rem 0.5rem; }

.search-box { position: relative; margin-bottom: 0.5rem; }
.search-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 6px 10px 6px 30px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.75rem;
    font-family: inherit;
}
.search-input:focus { border-color: var(--primary); }
.search-icon {
    position: absolute;
    left: 8px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 12px; height: 12px;
}

.wl-tabs {
    display: flex; gap: 0.5rem; padding-bottom: 5px;
    border-bottom: 1px solid var(--border-color);
}
.wl-tab {
    font-size: 0.7rem; font-weight: 600;
    color: var(--text-muted); cursor: pointer;
    padding: 4px 6px;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}
.wl-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.wl-content { flex: 1; overflow-y: auto; }

.wl-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}
.wl-item:hover { background-color: var(--bg-hover); }
.wl-item.active {
    background: linear-gradient(90deg, rgba(99,102,241,0.1) 0%, transparent 100%);
    border-left: 2px solid var(--primary);
    padding-left: calc(0.75rem - 2px);
}

.wl-symbol { font-size: 0.8rem; font-weight: 600; color: var(--text-main); }
.wl-exch { font-size: 0.65rem; color: var(--text-muted); }
.wl-price { font-size: 0.8rem; font-weight: 500; color: var(--text-main); font-variant-numeric: tabular-nums; }
.wl-change { font-size: 0.65rem; margin-top: 1px; }

.text-green { color: var(--success); }
.text-red { color: var(--danger); }
.wl-action-btn { display: none; } 

/* * TOOLBAR (Top Right) */
.toolbar {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center;
    padding: 0 1rem; gap: 1rem;
}

.active-symbol-display { font-weight: 700; font-size: 0.9rem; color: var(--text-main); }
.divider { width: 1px; height: 16px; background: var(--border-color); }

.time-btn {
    background: transparent; border: none;
    color: var(--text-muted); font-size: 0.75rem; font-weight: 500;
    padding: 2px 8px; border-radius: 2px; cursor: pointer;
}
.time-btn:hover { color: var(--text-main); background: var(--bg-hover); }
.time-btn.active { color: var(--primary); background: rgba(99, 102, 241, 0.1); }

/* * CHART AREA (Middle Right) */
.chart-container {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    background-color: var(--bg-body);
    position: relative;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}

.chart-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-image: linear-gradient(var(--border-color) 1px, transparent 1px), linear-gradient(90deg, var(--border-color) 1px, transparent 1px);
    background-size: 80px 80px; opacity: 0.3; z-index: 0;
}

.chart-placeholder {
    z-index: 1; text-align: center; padding: 2rem;
    border: 1px dashed var(--border-color); border-radius: var(--radius-md);
    background: rgba(16, 17, 20, 0.5); backdrop-filter: blur(2px);
}
.chart-placeholder h3 { color: var(--text-main); margin-bottom: 0.5rem; }
.chart-placeholder p { color: var(--text-muted); font-size: 0.8rem; }

.trade-overlay {
    position: absolute; top: 1rem; left: 1rem;
    background: rgba(22, 23, 27, 0.8); backdrop-filter: blur(6px);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem; border-radius: var(--radius-md);
    display: flex; align-items: center; gap: 1rem; z-index: 2;
}
.chart-header-info { display:flex; flex-direction:column; }
#overlaySymbol { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
#overlayPrice { font-size: 0.95rem; font-weight: 700; color: var(--text-main); font-variant-numeric: tabular-nums; }

.trade-btn {
    border: none; padding: 0.4rem 1rem; border-radius: 4px;
    font-weight: 600; font-size: 0.75rem; color: white; cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.btn-buy { background: var(--success); }
.btn-sell { background: var(--danger); }

/* * BOTTOM PANEL (Collapsible) */
.info-panel {
    grid-column: 2 / 3;
    grid-row: 3 / 4;
    background-color: var(--bg-panel);
    border-top: 1px solid var(--border-color);
    border-left: none;
    display: flex; flex-direction: column;
    overflow: hidden; 
    z-index: 10;
    height: 280px; /* Default Expanded Height */
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.info-panel.collapsed {
    height: 36px; /* Collapsed Height (Tabs only) */
}

.panel-tabs {
    display: flex;
    justify-content: space-between; /* Space for Toggle Button */
    background: var(--bg-body);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1rem;
    height: 36px;
    align-items: center;
}

.panel-tab {
    font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
    color: var(--text-muted); cursor: pointer;
    background: transparent; border: none; height: 100%;
    padding: 0 1rem;
    border-bottom: 2px solid transparent; transition: var(--transition);
}
.panel-tab:hover { color: var(--text-main); }
.panel-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.panel-toggle-btn {
    background: transparent; border: none; color: var(--text-muted);
    cursor: pointer; display: flex; align-items: center;
    transition: var(--transition);
}
.panel-toggle-btn:hover { color: var(--text-main); }

.panel-body-container { flex: 1; overflow-y: auto; background: var(--bg-panel); }
.panel-content { display: none; padding: 0; }
.panel-content.active { display: block; }

/* * DATA ROW STYLES (Positions & History) */
.pos-card, .hist-card {
    display: grid;
    align-items: center;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
    transition: background 0.1s;
}
.pos-card:hover, .hist-card:hover { background-color: var(--bg-hover); }

/* Positions Grid Definition */
.pos-card {
    grid-template-columns: 150px 80px 1fr 1fr 1fr 1fr 100px;
}

/* History Grid Definition */
.hist-card {
    grid-template-columns: 120px 120px 80px 80px 1fr 1fr 1fr 80px;
    color: var(--text-muted);
}

.pos-symbol, .hist-symbol { font-weight: 700; color: var(--text-main); }
.pos-side, .hist-side {
    justify-self: start;
    font-size: 0.6rem; font-weight: 700; text-transform: uppercase;
    padding: 2px 6px; border-radius: 3px;
}
.pos-side.buy, .hist-side.buy { color: var(--success); background: var(--success-bg); }
.pos-side.sell, .hist-side.sell { color: var(--danger); background: var(--danger-bg); }

.pos-stats-grid { display: contents; }
.stat-col { display: flex; align-items: center; gap: 8px; }
.stat-label { display: none; }
.stat-val, .hist-val { font-weight: 500; color: var(--text-main); font-variant-numeric: tabular-nums; }

.pos-footer { display: contents; }
.pos-pnl, .hist-pnl { font-weight: 700; font-variant-numeric: tabular-nums; justify-self: end; padding-right: 1rem;}
.hist-status { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); justify-self: end; }

.btn-sq-off {
    justify-self: end;
    background: transparent; border: 1px solid var(--border-color);
    color: var(--text-muted); padding: 4px 8px; border-radius: 4px;
    font-size: 0.7rem; cursor: pointer;
}
.btn-sq-off:hover { border-color: var(--danger); color: var(--danger); }

/* Summary Horizontal Layout */
#tab-summary { display: none; }
#tab-summary.active {
    display: flex; align-items: center; padding: 0 1rem;
    height: 100%; gap: 2rem; background: var(--bg-panel);
}
.summary-row { display: flex; flex-direction: column; border: none; padding: 0; }
.sum-label { font-size: 0.7rem; margin-bottom: 2px; }
.sum-val { font-size: 1rem; font-weight: 700; }

/* * MODAL (Glassmorphism) */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg-overlay); backdrop-filter: blur(4px);
    z-index: 1000; opacity: 0; visibility: hidden;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.2s, visibility 0.2s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-container {
    background-color: var(--bg-modal); width: 90%; max-width: 360px;
    border-radius: var(--radius-md); border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
    transform: scale(0.95); transition: transform 0.2s;
}
.modal-overlay.active .modal-container { transform: scale(1); }

.modal-header { padding: 1rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.symbol-name { font-size: 1rem; font-weight: 700; color: var(--text-main); }
.symbol-price { font-size: 0.8rem; color: var(--text-muted); }
.close-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; }
.close-btn:hover { color: var(--text-main); }

.trade-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 0.5rem; gap: 0.5rem; background: var(--bg-body); }
.tab-btn { padding: 8px; background: transparent; border: 1px solid transparent; color: var(--text-muted); border-radius: 4px; cursor: pointer; font-weight: 600; font-size: 0.8rem; }
.modal-container[data-side="buy"] .tab-buy { background: var(--success-bg); color: var(--success); border-color: rgba(34,197,94,0.3); }
.modal-container[data-side="sell"] .tab-sell { background: var(--danger-bg); color: var(--danger); border-color: rgba(239,68,68,0.3); }

.modal-body { padding: 1rem; }
.order-types { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.type-pill { padding: 4px 10px; font-size: 0.75rem; border: 1px solid var(--border-color); border-radius: 4px; color: var(--text-muted); background: transparent; cursor: pointer; }
.type-pill.active { background: var(--bg-hover); color: var(--text-main); border-color: var(--primary); }

.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 0.75rem; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 0.7rem; color: var(--text-muted); }
.form-input { width: 100%; background: var(--bg-input); border: 1px solid var(--border-color); padding: 8px; border-radius: 4px; color: var(--text-main); }
.form-input:focus { border-color: var(--primary); }
.modal-container[data-side="buy"] .form-input:focus { border-color: var(--success); }
.modal-container[data-side="sell"] .form-input:focus { border-color: var(--danger); }

.margin-info { display: flex; justify-content: space-between; font-size: 0.75rem; padding: 0.5rem; background: var(--bg-body); border-radius: 4px; margin-top: 0.5rem; }
.warning-text { font-size: 0.65rem; color: var(--text-muted); text-align: center; margin-top: 1rem; opacity: 0.7; }

.modal-footer { padding: 0.75rem 1rem; display: flex; gap: 0.75rem; border-top: 1px solid var(--border-color); }
.btn { flex: 1; padding: 10px; border-radius: 4px; border: none; font-weight: 600; cursor: pointer; font-size: 0.85rem; }
.btn-cancel { background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); }
.btn-cancel:hover { background: var(--bg-hover); color: var(--text-main); }
.btn-submit { color: white; }
.modal-container[data-side="buy"] .btn-submit { background: var(--success); }
.modal-container[data-side="sell"] .btn-submit { background: var(--danger); }

/* * RESPONSIVE */
@media (max-width: 1024px) {
    .terminal-grid { 
        grid-template-columns: 0 1fr; 
        grid-template-rows: 40px 1fr 200px;
    }
    .watchlist-panel { 
        position: absolute; left: 0; top: 0; bottom: 0; width: 260px;
        transform: translateX(-100%); box-shadow: 10px 0 20px rgba(0,0,0,0.5);
    }
    .watchlist-panel.active { transform: translateX(0); }
    .mobile-toggle { display: flex; }

    @media (max-width: 768px) {
        .terminal-grid { grid-template-rows: 40px 1fr auto; }
        .info-panel { height: auto; max-height: 40vh; }
        .info-panel.collapsed { height: 36px; }
        
        .pos-card, .hist-card { 
            display: flex; flex-direction: column; align-items: stretch; gap: 0.5rem; 
        }
        .pos-header, .pos-stats-grid, .pos-footer { display: flex; justify-content: space-between; width: 100%; }
        .stat-col { flex-direction: row; justify-content: space-between; width: 100%; }
        .stat-label { display: block; } 
        .pos-pnl { padding-right: 0; }
        
        /* Mobile History Card */
        .hist-card { border-bottom: 2px solid var(--border-color); }
        .hist-time, .hist-status { font-size: 0.7rem; color: var(--text-muted); }
        .hist-symbol { font-size: 0.9rem; margin: 4px 0; }
        .hist-val { display: flex; justify-content: space-between; width: 100%; font-size: 0.8rem; }
        .hist-val::before { content: "Val"; color: var(--text-muted); font-size: 0.7rem; } /* Simplified label */

        #tab-summary.active { flex-direction: column; align-items: stretch; padding: 1rem; gap: 0.5rem; }
        .summary-row { flex-direction: row; justify-content: space-between; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
    }
}

        /* --- LAYOUT & COLLAPSIBLE SIDEBAR STYLES --- */
        #app-root {
            display: grid;
            grid-template-columns: 280px 1fr; 
            height: 100vh;
            overflow: hidden;
            transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        body.sidebar-collapsed #app-root {
            grid-template-columns: 70px 1fr;
        }

        #sidebar-container {
            border-right: 1px solid var(--border-color, #2a2e39);
            background: var(--bg-secondary, #1e222d);
            overflow-x: hidden;
            transition: width 0.3s ease;
        }

        body.sidebar-collapsed #sidebar-container span, 
        body.sidebar-collapsed #sidebar-container .nav-label,
        body.sidebar-collapsed #sidebar-container .user-profile-info {
            opacity: 0; pointer-events: none; display: none;
        }
        body.sidebar-collapsed #sidebar-container .nav-link,
        body.sidebar-collapsed #sidebar-container .brand {
            justify-content: center; padding: 0;
        }
        body.sidebar-collapsed #sidebar-container .brand span { display: none; }
        
        .desktop-toggle { margin-right: 1rem; cursor: pointer; color: var(--text-muted); }
        .desktop-toggle:hover { color: var(--text-main); }
        @media (max-width: 768px) {
            #app-root { grid-template-columns: 1fr; }
            .desktop-toggle { display: none; }
        }

        /* --- WATCHLIST ACTION BUTTONS --- */
        .wl-item {
            display: flex;
            flex-direction: column; 
            gap: 5px;
            padding: 10px 12px;
            border-bottom: 1px solid var(--border-color);
            cursor: pointer;
            transition: background 0.2s;
        }
        
        .wl-row-main {
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
        }

        .wl-actions {
            display: flex;
            gap: 8px;
            margin-top: 4px;
            opacity: 0; 
            height: 0;
            overflow: hidden;
            transition: all 0.2s ease;
        }

        .wl-item:hover .wl-actions, .wl-item.active .wl-actions {
            opacity: 1;
            height: 28px; 
        }

        .btn-wl-action {
            border: none;
            border-radius: 4px;
            padding: 2px 10px;
            font-size: 0.75rem;
            font-weight: 600;
            cursor: pointer;
            color: #fff;
        }

        .btn-wl-buy { background-color: var(--buy-color, #26a69a); }
        .btn-wl-buy:hover { background-color: #1a9d55; }

        .btn-wl-sell { background-color: var(--sell-color, #ef5350); }
        .btn-wl-sell:hover { background-color: #d13e3e; }

        .btn-wl-del { 
            background-color: transparent; 
            border: 1px solid var(--text-muted); 
            color: var(--text-muted);
            padding: 2px 6px;
        }
        .btn-wl-del:hover { border-color: var(--text-red); color: var(--text-red); }

        .wl-tabs {
            display: grid;
            grid-template-columns: repeat(4, 1fr); 
            gap: 2px;
            padding: 0 5px;
            margin-bottom: 10px;
        }
        .wl-tab {
            font-size: 0.7rem;
            padding: 6px 2px;
            text-align: center;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            cursor: pointer;
        }
        .wl-tab.active {
            border-bottom: 2px solid var(--accent-color, #2962ff);
            color: var(--text-main, #fff);
        }

        /* --- CHART SPECIFIC STYLES --- */
        .chart-container {
            position: relative;
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            background-color: #131722; /* Chart BG match */
            overflow: hidden;
        }

        #tv-chart-container {
            width: 100%;
            flex-grow: 1; /* Takes remaining height */
            position: relative;
        }
        
        /* Floating overlay for Buy/Sell buttons on chart */
        .trade-overlay {
            position: absolute;
            top: 20px;
            left: 20px;
            z-index: 20;
            background: rgba(30, 34, 45, 0.8);
            border: 1px solid var(--border-color);
            border-radius: 4px;
            padding: 8px;
            backdrop-filter: blur(4px);
            display: flex;
            gap: 10px;
            align-items: center;
        }

        .trade-btn {
            padding: 6px 16px;
            border: none;
            border-radius: 4px;
            color: #fff;
            font-weight: 600;
            cursor: pointer;
            font-size: 0.8rem;
        }
        .btn-buy { background: var(--buy-color, #26a69a); }
        .btn-sell { background: var(--sell-color, #ef5350); }

        .chart-header-info {
            display: flex;
            flex-direction: column;
            margin-right: 10px;
        }
        /* --- CRITICAL: CSS VARIABLES FOR COLORS --- */
        :root {
            --buy-color: #26a69a;
            --sell-color: #ef5350;
            --text-main: #d1d4dc;
            --text-muted: #787b86;
            --border-color: #2a2e39;
            --bg-secondary: #1e222d;
            --accent-color: #2962ff;
        }

        /* --- LAYOUT & COLLAPSIBLE SIDEBAR STYLES --- */
        body {
            background-color: #131722;
            color: var(--text-main);
            margin: 0;
            font-family: 'Inter', sans-serif;
        }

        #app-root {
            display: grid;
            grid-template-columns: 280px 1fr;
            height: 100vh;
            overflow: hidden;
            transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        body.sidebar-collapsed #app-root {
            grid-template-columns: 70px 1fr;
        }

        #sidebar-container {
            border-right: 1px solid var(--border-color);
            background: var(--bg-secondary);
            overflow-x: hidden;
            transition: width 0.3s ease;
        }

        /* --- WATCHLIST STYLES --- */
        .wl-item {
            display: flex;
            flex-direction: column;
            gap: 5px;
            padding: 10px 12px;
            border-bottom: 1px solid var(--border-color);
            cursor: pointer;
            transition: background 0.2s;
        }
        
        .wl-item.active, .wl-item:hover {
            background-color: #2a2e39;
        }

        .wl-row-main {
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
        }

        .wl-actions {
            display: flex;
            gap: 8px;
            margin-top: 4px;
            opacity: 0; 
            height: 0;
            overflow: hidden;
            transition: all 0.2s ease;
        }

        .wl-item:hover .wl-actions, .wl-item.active .wl-actions {
            opacity: 1;
            height: 28px;
        }

        .btn-wl-action {
            border: none;
            border-radius: 4px;
            padding: 2px 10px;
            font-size: 0.75rem;
            font-weight: 600;
            cursor: pointer;
            color: #fff;
        }

        .btn-wl-buy { background-color: var(--buy-color); }
        .btn-wl-buy:hover { background-color: #1a9d55; }
        .btn-wl-sell { background-color: var(--sell-color); }
        .btn-wl-sell:hover { background-color: #d13e3e; }

        .wl-tabs {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 2px;
            padding: 0 5px;
            margin-bottom: 10px;
        }
        .wl-tab {
            font-size: 0.7rem;
            padding: 6px 2px;
            text-align: center;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            cursor: pointer;
        }
        .wl-tab.active {
            border-bottom: 2px solid var(--accent-color);
            color: var(--text-main);
            font-weight: 600;
        }

        /* --- POSITIONS TABLE STYLES --- */
        .pos-table-header {
            display: grid;
            grid-template-columns: 2fr 1fr 1fr 1.5fr 1.5fr 1.5fr;
            padding: 8px 15px;
            background-color: rgba(255,255,255,0.03);
            font-size: 0.75rem;
            color: var(--text-muted);
            border-bottom: 1px solid var(--border-color);
        }
        
        .pos-row {
            display: grid;
            grid-template-columns: 2fr 1fr 1fr 1.5fr 1.5fr 1.5fr;
            padding: 10px 15px;
            border-bottom: 1px solid var(--border-color);
            font-size: 0.85rem;
            align-items: center;
            color: var(--text-main);
        }
        .pos-row:hover { background-color: rgba(255,255,255,0.02); }

        .pos-side.buy { color: var(--buy-color); background: rgba(38, 166, 154, 0.1); padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; justify-self: start;}
        .pos-side.sell { color: var(--sell-color); background: rgba(239, 83, 80, 0.1); padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; justify-self: start;}
        
        /* Force colors with !important to override any defaults */
        .text-green { color: var(--buy-color) !important; }
        .text-red { color: var(--sell-color) !important; }

        /* --- CHART & LAYOUT --- */
        .chart-container {
            position: relative;
            width: 100%;
            height: 100%;
            background-color: #131722; 
            overflow: hidden;
        }
        #tv-chart-container {
            width: 100%;
            height: 100%;
            position: absolute;
            top: 0; left: 0; z-index: 1; 
        }
        .trade-overlay {
            z-index: 10; 
            position: absolute;
            top: 1rem; left: 1rem;
            pointer-events: none; 
        }
        .trade-overlay button { pointer-events: auto; }
        
        .summary-bar {
            display: flex;
            gap: 20px;
            padding: 0 15px;
            align-items: center;
            height: 100%;
            border-right: 1px solid var(--border-color);
            margin-right: auto;
        }
        .sum-item { display: flex; flex-direction: column; font-size: 0.75rem; }
        .sum-val { font-weight: 600; font-size: 0.9rem; }
    
    