        :root {
            --bg-main: #050505;
            --bg-panel: #0E0E12;
            --bg-hover: #1A1A24;
            --border-color: #1F2229;
            --text-primary: #F1F5F9;
            --text-secondary: #94A3B8;
            --text-muted: #8B9AB5;
            --accent-blue: #3B82F6;
            --accent-purple: #8B5CF6;
            --color-buy: #10B981;
            --color-sell: #EF4444;
            --color-hold: #EAB308;
            --glow-buy: rgba(16, 185, 129, 0.4);
            --glow-sell: rgba(239, 68, 68, 0.4);
            --glow-hold: rgba(234, 179, 8, 0.4);
        }
        
        * { box-sizing: border-box; margin: 0; padding: 0; }
        
        body { 
            background-color: var(--bg-main);
            color: var(--text-primary); 
            font-family: 'Inter', sans-serif; 
            min-height: 100vh;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
        }

        /* Top Navbar */
        .navbar {
            height: 60px;
            background-color: var(--bg-panel);
            border-bottom: 1px solid var(--border-color);
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 24px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.4);
            z-index: 10;
        }

        .brand {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .brand-logo {
            width: 32px; height: 32px;
            background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
            border-radius: 8px;
            display: flex; align-items: center; justify-content: center;
            font-weight: 700; font-size: 16px;
            box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
        }

        .brand-title {
            font-size: 18px; font-weight: 600; letter-spacing: 0.5px;
        }
        .brand-subtitle {
            font-size: 12px; color: var(--text-muted); margin-left: 8px;
            padding: 2px 6px; background: rgba(255,255,255,0.05); border-radius: 4px;
        }

        .sys-status-bar {
            display: flex;
            gap: 16px;
            font-size: 12px;
            color: var(--text-secondary);
        }
        .status-badge {
            display: flex; align-items: center; gap: 6px;
            background: rgba(0,0,0,0.2); padding: 4px 10px; border-radius: 6px;
            border: 1px solid rgba(255,255,255,0.05);
        }
        .status-dot {
            width: 8px; height: 8px; border-radius: 50%;
            background-color: var(--color-buy);
            box-shadow: 0 0 8px var(--color-buy);
            animation: pulse 2s infinite;
        }
        @keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } }

        /* Main Layout */
        .layout {
            display: flex;
            flex: 1; min-height: 600px; min-width: 0; overflow: hidden;
            background-color: var(--border-color);
            gap: 1px;
        }

        /* Sidebars */
        .sidebar {
            width: 500px;
            min-width: 350px;
            background-color: var(--bg-main);
            border-right: none;
            border-left: none;
            display: flex;
            flex-direction: column;
            overflow-y: auto;
            overflow-x: hidden;
            resize: horizontal;
            min-height: 0;
        }

        /* Center Content (Charts) */
        .center-content {
            flex-grow: 1;
            display: flex;
            flex-direction: column;
            background-color: var(--bg-main);
            position: relative;
            min-height: 0;
            min-width: 0;
            overflow: hidden;
        }

        .chart-grid {
            flex-grow: 1;
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
            gap: 1px;
            background-color: var(--border-color);
            padding: 16px;
            overflow-y: auto;
            min-height: 0;
            min-width: 0;
        }

        /* Panels / Cards */
        .panel {
            background-color: var(--bg-panel);
            margin: 0;
            border-radius: 4px;
            border: none;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            min-height: 0;
        }
        details.panel summary { cursor: pointer; list-style: none; }
        details.panel summary::-webkit-details-marker { display: none; }
        
        .panel-header {
            padding: 14px 16px;
            font-size: 13px; font-weight: 600; text-transform: uppercase;
            color: var(--text-secondary);
            border-bottom: 1px solid var(--border-color);
            background: rgba(255,255,255,0.02);
            display: flex; justify-content: space-between; align-items: center;
        }
        .panel-body {
            padding: 16px;
            flex: 1;
            min-height: 0;
            min-width: 0;
            overflow-y: auto;
            overscroll-behavior: contain;
        }

        /* Chart Cards */
        .chart-card {
            background-color: var(--bg-panel);
            border: none;
            border-radius: 4px;
            display: flex; flex-direction: column;
            min-height: 350px;
            height: 100%;
            overflow: hidden;
            flex-grow: 1;
        }
        .chart-card.maximized {
            position: fixed;
            top: 60px; left: 0; right: 0; bottom: 0;
            z-index: 9999;
            background-color: var(--bg-main);
            border: none;
            border-radius: 0;
            height: auto !important;
            min-height: 0;
        }
        .chart-card-header {
            padding: 12px 16px;
            display: flex; justify-content: space-between; align-items: center;
            border-bottom: 1px solid var(--border-color);
        }
        .chart-title { font-weight: 600; font-size: 16px; }
        .chart-container { flex-grow: 1; position: relative; width: 100%; height: 100%; min-height: 0; }


        /* Typography & Data */
        .data-row { display: flex; justify-content: space-between; margin-bottom: 12px; align-items: center; }
        .data-label { color: var(--text-secondary); font-size: 13px; }
        .data-value { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
        .data-value.large { font-size: 24px; font-weight: 700; color: #fff; }
        
        .mono { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }

        /* Signals */
        .signal-badge {
            padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; letter-spacing: 0.5px;
            display: inline-flex; align-items: center; gap: 6px;
        }
        .signal-buy { color: var(--color-buy); background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); box-shadow: 0 0 10px var(--glow-buy); }
        .signal-sell { color: var(--color-sell); background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); box-shadow: 0 0 10px var(--glow-sell); }
        .signal-hold { color: var(--color-hold); background: rgba(234, 179, 8, 0.1); border: 1px solid rgba(234, 179, 8, 0.3); box-shadow: 0 0 10px var(--glow-hold); }

        /* Tables / Lists */
        .table-wrapper { overflow-x: auto; min-height: 0; width: 100%; margin-bottom: 10px; -webkit-overflow-scrolling: touch; }
        .data-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; table-layout: fixed; }
        .data-table th { text-align: left; padding: 8px; color: var(--text-muted); font-weight: 500; border-bottom: 1px solid var(--border-color); white-space: nowrap; }
        .data-table td { padding: 8px; border-bottom: 1px solid rgba(255,255,255,0.02); white-space: nowrap; }
        .empty-state { text-align: center; color: var(--text-muted); padding: 20px; font-size: 13px; font-style: italic; }

        /* Sentiment Bar */
        .sentiment-bar-bg { height: 6px; background: rgba(255,255,255,0.1); border-radius: 4px; margin: 12px 0; overflow: hidden; }
        .sentiment-bar-fill { height: 100%; background: var(--accent-blue); width: 50%; transition: width 0.5s, background-color 0.5s; }
        .sentiment-reason { font-size: 12px; color: var(--text-secondary); line-height: 1.5; background: rgba(0,0,0,0.2); padding: 10px; border-radius: 8px; }

        /* Terminal */
        .terminal {
            height: 150px; min-height: 150px; flex-shrink: 0;
            background: #000; border-top: 1px solid var(--border-color);
            padding: 10px; font-family: 'JetBrains Mono', monospace; font-size: 11px;
            overflow-y: auto; color: #a9b7c6;
        }
        .log-entry { margin-bottom: 4px; }
        .log-time { color: #629755; margin-right: 8px; }
        .log-info { color: #6897bb; }
        .log-success { color: #6a8759; }
        .log-warn { color: #bbb529; }
        .log-error { color: #cc666e; }

        /* Custom Scrollbar */
        ::-webkit-scrollbar { width: 6px; height: 6px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
        ::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

        .chart-layout { display: flex; flex-grow: 1; min-height: 0; }

        @keyframes pulse-anim {
            0% { transform: scale(0.95); opacity: 0.7; }
            50% { transform: scale(1.05); opacity: 1; text-shadow: 0 0 10px rgba(255,255,255,0.5); }
            100% { transform: scale(0.95); opacity: 0.7; }
        }
        .pulse-anim {
            animation: pulse-anim 1.5s infinite ease-in-out;
        }
        @keyframes progress-indeterminate {
            0% { transform: translateX(-100%); }
            100% { transform: translateX(200%); }
        }

        /* Tabs */
        .tabs-bar {
            display: flex; gap: 12px; padding: 12px 24px; background: var(--bg-main); border-bottom: 1px solid var(--border-color);
            flex-shrink: 0;
        }
        .tab-btn {
            background: transparent; border: 1px solid transparent; color: var(--text-secondary);
            padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600;
            transition: all 0.2s;
        }
        .tab-btn.active {
            background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.3); color: var(--accent-blue);
        }
        .tab-btn:hover:not(.active) {
            background: rgba(255, 255, 255, 0.05); color: var(--text-primary);
        }
        /* ============================================= */
        /* RESPONSIVE BREAKPOINTS                         */
        /* ============================================= */

        /* 1101-1400px: Compact sidebars, smaller text */
        @media (max-width: 1400px) and (min-width: 1101px) {
            .sidebar {
                width: 380px !important;
                min-width: 300px !important;
            }
            .portfolio-ticker {
                gap: 16px !important;
                padding: 8px 16px !important;
                font-size: 11px;
            }
            .chart-grid {
                grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
                padding: 8px;
            }
            .chart-card { min-height: 250px; }
            .navbar { padding: 0 12px; }
            .data-table { font-size: 11px; }
            .data-table th, .data-table td { padding: 4px 6px; }
        }

        /* 769-1100px: Left sidebar on top, center + right below */
        @media (max-width: 1100px) and (min-width: 769px) {
            .layout {
                flex-wrap: wrap !important;
            }
            /* Left sidebar becomes a horizontal strip at top */
            .sidebar:first-of-type {
                width: 100% !important;
                min-width: 100% !important;
                max-height: 220px;
                flex-direction: row !important;
                flex-wrap: wrap;
                overflow-y: auto;
                flex-shrink: 0;
                border-bottom: 1px solid var(--border-color);
                border-right: none !important;
            }
            .sidebar:first-of-type .panel {
                flex: 1 1 200px;
                min-width: 180px;
                max-height: 180px;
            }
            /* Right sidebar stays vertical, compact */
            .sidebar:last-of-type {
                width: 300px !important;
                min-width: 250px !important;
                flex-shrink: 0;
            }
            .center-content {
                flex: 1 1 300px;
                min-width: 250px;
            }
            .portfolio-ticker {
                flex-wrap: wrap;
                gap: 6px !important;
                padding: 6px 10px !important;
            }
            .portfolio-ticker > div[style*="width: 1px"] {
                display: none !important;
            }
            .portfolio-ticker > div {
                flex: 1 1 auto;
                min-width: 80px;
            }
            .chart-grid {
                grid-template-columns: 1fr;
                padding: 6px;
            }
            .chart-card { min-height: 200px; }
            .navbar { padding: 0 8px; height: 48px; }
            .navbar .brand-subtitle { display: none; }
            .tabs-bar { padding: 6px 10px; }
            .tab-btn { padding: 5px 10px; font-size: 11px; }
            .data-table { font-size: 10px; }
            .data-table th, .data-table td { padding: 2px 4px; }
            .data-value.large { font-size: 17px; }
        }

        /* <= 768px: Column layout, mobile-first */
        @media (max-width: 768px) {
            body {
                overflow-y: auto !important;
                height: auto;
                min-height: 100vh;
            }
            .layout {
                flex-direction: column !important;
                overflow-y: visible !important;
            }
            .sidebar {
                width: 100% !important;
                min-width: 100% !important;
                max-height: none !important;
                height: auto !important;
            }
            .center-content {
                min-height: 400px;
            }
            .navbar {
                flex-direction: column;
                height: auto;
                padding: 10px;
                gap: 8px;
            }
            .brand-subtitle { display: none; }
            .portfolio-ticker {
                flex-wrap: wrap;
                gap: 6px !important;
                padding: 8px !important;
                margin: 0 !important;
                width: 100%;
                font-size: 10px;
            }
            .portfolio-ticker > div[style*="width: 1px"] {
                display: none !important;
            }
            .portfolio-ticker > div {
                flex: 1 1 45%;
                align-items: center !important;
                text-align: center;
                min-width: 100px;
            }
            .sys-status-bar {
                flex-wrap: wrap;
                justify-content: center;
                gap: 4px;
                font-size: 10px;
            }
            .tabs-bar { flex-wrap: wrap; justify-content: center; padding: 6px; gap: 4px; }
            .tab-btn { padding: 6px 10px; font-size: 11px; }
            .chart-grid { grid-template-columns: 1fr !important; padding: 6px; }
            .chart-card { min-height: 200px; }
            .table-wrapper { overflow-x: auto; max-width: 100%; }
            .data-table { font-size: 10px; }
            .data-table th, .data-table td { padding: 3px 4px; }
            .panel-body { padding: 8px; }
            .panel-header { padding: 8px 10px; font-size: 11px; }
            .terminal { height: 100px; min-height: 100px; font-size: 10px; }
            .data-value.large { font-size: 16px; }
            .sentiment-reason { font-size: 11px; padding: 6px; }
            #equity-chart-container { height: 120px !important; min-height: 100px !important; }
        }
        /* Clip removed old broken responsive rules */
        .risk-matrix { 
            display: grid; 
            gap: 2px; 
            margin-top: 8px;
            background: var(--border-color);
            padding: 2px;
            border-radius: 4px;
        }
        .risk-cell { 
            aspect-ratio: 1; 
            display: flex; 
            align-items: center; 
            justify-content: center; 
            font-size: 9px; 
            font-weight: bold;
            color: #fff;
            border-radius: 2px;
            cursor: default;
        }
        .risk-header-cell {
            font-size: 8px;
            color: var(--text-muted);
            text-align: center;
            padding: 2px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .risk-warning-item {
            padding: 6px 10px;
            background: rgba(239, 68, 68, 0.1);
            border: 1px solid rgba(239, 68, 68, 0.2);
            border-radius: 4px;
            color: var(--color-sell);
            font-size: 11px;
            margin-bottom: 6px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .risk-status-badge {
            padding: 4px 10px;
            border-radius: 4px;
            font-weight: bold;
            font-size: 11px;
            text-transform: uppercase;
        }
        .risk-active { background: rgba(16, 185, 129, 0.2); color: var(--color-buy); border: 1px solid var(--color-buy); }
        .risk-halted { background: rgba(239, 68, 68, 0.2); color: var(--color-sell); border: 1px solid var(--color-sell); animation: blink 1s infinite; }
        @keyframes blink { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

        /* === Accessibility === */
        *:focus-visible {
            outline: 2px solid var(--accent-blue);
            outline-offset: 2px;
            border-radius: 2px;
        }
        button:focus-visible, .tab-btn:focus-visible {
            outline: 2px solid var(--accent-blue);
            outline-offset: 2px;
            box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3);
        }
        .signal-badge:focus-visible {
            outline: 2px solid var(--accent-blue);
        }
        details.panel summary:focus-visible {
            outline: 2px solid var(--accent-blue);
            outline-offset: 2px;
        }

        /* Screen reader only */
        .sr-only {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border: 0;
        }

        /* Keyboard navigation skip link */
        .skip-link {
            position: absolute;
            top: -40px;
            left: 0;
            background: var(--accent-blue);
            color: white;
            padding: 8px 16px;
            z-index: 100;
            text-decoration: none;
            font-weight: bold;
        }
        .skip-link:focus {
            top: 0;
        }
