:root {
    /* White theme for navigation and overall light theme */
    --bg: #eef0f3;
    --panel: #ffffff;
    --panel-alt: #f6f7f9;
    --panel-sunken: #eceef1;
    --border: #dfe3e8;
    --text: #1a1d23;
    --text-dim: #5c6470;
    --text-faint: #939aa6;
    --brand: #ff6a00;        /* Forex Factory orange — logo / links / active nav */
    --brand-dim: #cc5500;
    --accent: #26a69a;       /* TradingView "up" teal-green — buy / positive */
    --sell: #ef5350;         /* TradingView "down" red — sell / negative */
    --warn: #f0b90b;
    --info: #2196f3;
    --nav-bg: #ffffff;       /* White theme for navigation */
    --nav-border: #dfe3e8;
    --nav-text: #5c6470;
    --nav-text-strong: #1a1d23;
    --shadow-sm: 0 1px 2px rgba(19, 23, 34, 0.06);
    --shadow-md: 0 8px 24px rgba(19, 23, 34, 0.14);
    --font-ui: 'Inter', Arial, -apple-system, sans-serif;
    --font-data: 'JetBrains Mono', 'SF Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    height: 100%;
}

a { color: inherit; text-decoration: none; }
code { background: var(--panel-sunken); padding: 1px 5px; border-radius: 4px; font-family: var(--font-data); font-size: 0.9em; }

/* ---------- header / nav (Forex-Factory-style dark bar) ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    height: 40px;
    border-bottom: 1px solid var(--nav-border);
    background: var(--nav-bg);
    gap: 12px;
}

.symbol-selectors {
    display: flex;
    gap: 8px;
    align-items: center;
}

.symbol-selector {
    position: relative;
}

.symbol-dropdown {
    background: #2a2e39;
    color: #d1d4dc;
    border: 1px solid #363a45;
    border-radius: 4px;
    padding: 6px 12px;
    font-family: var(--font-ui);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    appearance: none;
    min-width: 100px;
}

.symbol-dropdown:hover {
    background: #363a45;
    border-color: #434651;
}

.symbol-dropdown:focus {
    outline: none;
    border-color: var(--brand);
}

.symbol-dropdown option {
    background: #2a2e39;
    color: #d1d4dc;
}

.timeframe-selector .symbol-dropdown {
    min-width: 80px;
}

.indicators-selector .symbol-dropdown {
    min-width: 120px;
}

.symbol-dropdown:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

.symbol-dropdown:focus {
    outline: none;
    border-color: var(--brand);
}

.symbol-dropdown option {
    background: var(--nav-bg);
    color: var(--nav-text-strong);
}

/* Mobile: Fix navigation at top */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        background: transparent;
        border: none;
        color: var(--nav-text-strong);
        cursor: pointer;
        border-radius: 4px;
        transition: background 0.15s;
    }
    
    .mobile-menu-btn:hover {
        background: rgba(255, 255, 255, 0.06);
    }
    
    .topbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 2000;
        padding: 0 14px;
        gap: 10px;
        height: 50px;
        flex-wrap: nowrap;
        background: var(--nav-bg);
        border-bottom: 1px solid var(--nav-border);
    }
    
    .deriv-ticker-container,
    .tradingview-widget-container {
        display: none !important;
    }
    
    .brand {
        font-size: 13px;
        flex-shrink: 0;
        margin-left: auto;
    }
    
    .brand-logo {
        width: 24px;
        height: 24px;
    }
    
    .brand-text {
        font-size: 13px;
        font-weight: 800;
    }
    
    .main-nav {
        position: fixed;
        top: 50px;
        left: 0;
        right: 0;
        bottom: 0;
        width: min(300px, 84vw);
        background: var(--nav-bg);
        flex-direction: column;
        gap: 0;
        padding: 8px 0 24px;
        transform: translateX(-105%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 2005;
        overflow-y: auto;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.16);
        border-right: 1px solid var(--nav-border);
    }
    
    .main-nav.open {
        transform: translateX(0);
    }
    
    .main-nav a {
        padding: 15px 18px;
        min-height: 48px;
        font-size: 15px;
        font-weight: 600;
        border-bottom: 1px solid var(--nav-border);
        white-space: nowrap;
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        box-sizing: border-box;
        color: var(--nav-text);
        transition: background 0.15s, color 0.15s;
    }
    
    .main-nav a:last-child {
        border-bottom: none;
    }
    
    .main-nav a::after {
        content: '›';
        font-size: 20px;
        color: var(--nav-text-dim);
        font-weight: 400;
    }
    
    .main-nav a.active {
        background: rgba(255, 106, 0, 0.08);
        color: var(--brand);
    }
    
    .main-nav a.active::after {
        color: var(--brand);
    }
    
    .mobile-auth-links {
        display: block;
        margin-top: 8px;
        border-top: 2px solid var(--nav-border);
    }
    
    .topbar .auth-status {
        display: none !important;
    }
    
    .conn-status {
        display: none;
    }
    
    /* Add padding to body to account for fixed header */
    body {
        padding-top: 50px;
    }
    
    /* Overlay when menu is open */
    .mobile-menu-overlay {
        position: fixed;
        top: 50px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.45);
        backdrop-filter: blur(2px);
        z-index: 2004;
        display: none;
    }
    
    .mobile-menu-overlay.open {
        display: block;
    }
    
    /* Make all pages scrollable on mobile */
    .layout {
        height: auto;
        min-height: calc(100vh - 52px - 32px);
    }
    
    .chart-col {
        height: auto;
        min-height: 60vh;
    }
    
    .analysis-layout-split {
        height: auto;
        grid-template-columns: 1fr;
        gap: 1px;
    }
    
    .analysis-col {
        height: auto;
        min-height: 400px;
        overflow: visible;
    }
    
    .ai-strategy-layout {
        height: auto;
        grid-template-columns: 1fr;
        gap: 1px;
    }
    
    .ai-strategy-col {
        height: auto;
        min-height: 400px;
        overflow: visible;
    }
    
    .performance-layout {
        height: auto;
        overflow: visible;
    }
    
    .performance-col {
        height: auto;
        overflow: visible;
    }
    
    .terminal-layout {
        height: auto;
        overflow: visible;
    }
    
    .terminal-top-row {
        height: auto;
        min-height: 50vh;
        overflow: visible;
    }
    
    .terminal-bottom-row {
        height: auto;
        min-height: 50vh;
        overflow: visible;
    }
}



/* Desktop: Hide mobile auth links to avoid repetition */
.mobile-auth-links {
    display: none;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: 0.03em;
    white-space: nowrap;
    color: var(--nav-text-strong);
}

.brand-logo {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    filter: drop-shadow(0 2px 4px rgba(255, 106, 0, 0.3));
    transition: transform 0.2s ease, filter 0.2s ease;
}

/* Strategy Analysis Mode Selector */
.strategy-mode-selector {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 3px 6px 3px 10px;
    background: #f8fafc;
    border: 1px solid #dfe3e8;
    border-radius: 18px;
    flex-shrink: 0;
    white-space: nowrap;
}

.strategy-mode-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.strategy-mode-buttons {
    display: inline-flex;
    gap: 3px;
    align-items: center;
    flex-wrap: nowrap;
}

.strategy-mode-btn {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid transparent;
    background: transparent;
    color: #475569;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.strategy-mode-btn:hover {
    background: #ffffff;
    color: #0f172a;
    border-color: #cbd5e1;
}

.strategy-mode-btn.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.strategy-mode-btn.active:hover {
    background: #1d4ed8;
    color: #ffffff;
}


.brand:hover .brand-logo {
    transform: scale(1.05);
    filter: drop-shadow(0 4px 8px rgba(255, 106, 0, 0.4));
}

.brand-text {
    color: #000000;
    transition: opacity 0.2s ease;
}

.brand:hover .brand-text {
    opacity: 0.9;
}

.brand-mark {
    width: 9px;
    height: 9px;
    border-radius: 2px;
    background: var(--brand);
    box-shadow: 0 0 8px rgba(255, 106, 0, 0.45);
}

.main-nav {
    display: flex;
    gap: 4px;
    flex: 1;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.main-nav a {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--nav-text);
    transition: background 0.15s, color 0.15s;
}
.main-nav a:hover { background: rgba(255, 255, 255, 0.06); color: var(--nav-text-strong); }
.main-nav a.active { background: rgba(255, 106, 0, 0.14); color: var(--brand); }

.conn-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-data);
    font-size: 12px;
    color: var(--nav-text);
    white-space: nowrap;
}

.conn-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-faint);
}
.conn-dot.live { background: var(--accent); box-shadow: 0 0 6px rgba(38, 166, 154, 0.6); animation: breathe 2.4s ease-in-out infinite; }
.conn-dot.down { background: var(--sell); }

.auth-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-info {
    font-size: 12px;
    color: var(--nav-text);
    font-family: var(--font-data);
}

.login-btn,
.logout-btn,
.signup-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    background: var(--brand);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-ui);
    transition: background 0.2s ease;
}

.login-btn:hover,
.logout-btn:hover,
.signup-btn:hover {
    background: var(--brand-hover);
}

@keyframes breathe {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

/* ---------- TradingView Ticker Widget ---------- */
.tradingview-widget-container {
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    height: 44px;
    overflow: hidden;
}

.tradingview-widget-container__widget {
    height: 100%;
    width: 100%;
}


@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ---------- layout ---------- */
.layout {
    display: grid;
    grid-template-columns: 1fr;
    background: var(--nav-bg);
    height: calc(100vh - 52px - 36px);
}

.chart-col {
    background: #1e222d;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ---------- symbol picker ---------- */
.symbol-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
}

.symbol-bar select {
    background: var(--panel-alt);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-family: var(--font-ui);
    font-size: 13px;
}

.price-readout {
    font-family: var(--font-data);
    font-size: 20px;
    font-weight: 600;
    margin-left: auto;
    color: var(--text);
}
.price-readout.up { color: var(--accent); }
.price-readout.down { color: var(--sell); }

.ask-ai-btn {
    background: linear-gradient(135deg, #26a69a, #ff6a00);
    color: #fff;
    border: none;
    border-radius: 25px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-ui);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(38, 166, 154, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.ask-ai-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}
.ask-ai-btn:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 6px 20px rgba(38, 166, 154, 0.4);
}
.ask-ai-btn:hover::before {
    left: 100%;
}
.ask-ai-btn:active {
    transform: translateY(0);
}
.ask-ai-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

#chart-container {
    flex: 1;
    min-height: 400px;
    position: relative;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #1e222d;
    border-bottom: 1px solid #2a2e39;
    font-family: var(--font-data);
    font-size: 12px;
    color: #d1d4dc;
}

.symbol-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.symbol-name {
    font-weight: 700;
    font-size: 14px;
    color: #d1d4dc;
}

.symbol-timeframe {
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    color: #787b86;
}

.symbol-source {
    color: #787b86;
    font-size: 11px;
}

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

.price-label {
    color: #787b86;
    font-size: 11px;
    font-weight: 600;
}

.price-value {
    color: #d1d4dc;
    font-weight: 600;
    min-width: 60px;
    text-align: right;
}

.price-change {
    font-weight: 600;
    min-width: 80px;
    text-align: right;
}

.price-change.positive {
    color: var(--accent);
}

.price-change.negative {
    color: var(--sell);
}

.brain-icon-overlay {
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 106, 0, 0.2);
    border: 1px solid var(--brand);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand);
    z-index: 10;
    cursor: pointer;
    transition: all 0.2s;
}

.brain-icon-overlay:hover {
    background: rgba(255, 106, 0, 0.3);
    transform: translateX(-50%) scale(1.1);
}

.tradingview-logo {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(19, 23, 34, 0.8);
    border-radius: 4px;
    padding: 4px 8px;
    z-index: 10;
}

.tv-logo {
    font-size: 10px;
    font-weight: 700;
    color: var(--nav-text);
    letter-spacing: 0.05em;
}

/* ---------- analysis page ---------- */
.analysis-layout { grid-template-columns: 1fr; }
.analysis-layout-split {
    grid-template-columns: 340px 1fr;
    gap: 1px;
    height: calc(100vh - 49px); /* Subtract header height */
    display: grid;
}
.analysis-col {
    background: var(--panel);
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    height: 100%;
    overflow: hidden;
}

/* ---------- AI Strategy page ---------- */
.ai-strategy-layout {
    grid-template-columns: 340px 1fr;
    gap: 1px;
    height: calc(100vh - 49px);
    display: grid;
}

.ai-insights-col {
    background: var(--panel);
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    height: 100%;
    overflow: hidden;
}

.youtube-section {
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}

.live-news-section {
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}

.mn-kpis {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.mn-kpi {
    font-size: 11px;
    color: var(--text-dim);
    background: var(--panel-sunken);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 8px;
}

.mn-kpi strong {
    color: var(--text);
}

.mn-kpi--hi {
    border-color: rgba(255, 77, 77, 0.35);
    color: #fecaca;
    background: rgba(127, 29, 29, 0.22);
}

.mn-filter {
    margin: 12px 0 8px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.mn-filter label {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.mn-filter select,
.mn-filter input {
    background: var(--panel-sunken);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    min-width: 120px;
    font-size: 12px;
}

.mn-filter input {
    min-width: 150px;
}

.mn-filter button {
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 6px;
    padding: 6px 10px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
}

.mn-filter button:hover {
    opacity: 0.9;
}

.mn-feed-wrap {
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--panel-alt);
}

.mn-feed-head {
    display: grid;
    grid-template-columns: 70px 80px minmax(0, 1fr) 120px;
    gap: 8px;
    padding: 8px 10px;
    background: var(--panel-sunken);
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.mn-grid {
    display: block;
    margin-top: 0;
}

.mn-row {
    display: grid;
    grid-template-columns: 70px 80px minmax(0, 1fr) 120px;
    gap: 8px;
    align-items: start;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
}

.mn-row:hover {
    background: var(--panel-alt);
}

.mn-row.is-high-impact {
    box-shadow: inset 3px 0 0 rgba(255, 77, 77, 0.85);
}

.mn-row:last-child {
    border-bottom: 0;
}

.mn-col--time {
    color: var(--text-dim);
    font-size: 10px;
    font-family: var(--font-data);
}

.mn-col--impact {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mn-impact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    border-radius: 999px;
    padding: 2px 6px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.05em;
    border: 1px solid transparent;
}

.mn-impact--high {
    color: #fff;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    border-color: #ff6b6b;
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.4);
}

.mn-impact--medium {
    color: #fff;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-color: #f59e0b;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.mn-impact--low {
    color: #fff;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: #3b82f6;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.mn-time-window {
    color: #86efac;
    font-size: 9px;
}

.mn-col--headline {
    min-width: 0;
}

.mn-main {
    min-width: 0;
}

.mn-meta {
    color: var(--text-dim);
    font-size: 9px;
    margin: 0 0 3px;
}

.mn-card-title {
    margin: 0 0 3px;
    font-size: 11px;
    line-height: 1.25;
}

.mn-card-title a {
    color: var(--text);
    text-decoration: none;
}

.mn-card-title a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.mn-col--market {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-content: flex-start;
}

.mn-badge {
    border-radius: 999px;
    padding: 2px 6px;
    font-size: 8px;
    border: 1px solid transparent;
}

.mn-badge--market {
    color: var(--text-dim);
    background: rgba(30, 41, 59, 0.45);
    border-color: rgba(100, 116, 139, 0.35);
}

.mn-line {
    margin: 0 0 3px;
    color: var(--text-dim);
    font-size: 9px;
    line-height: 1.35;
}

.mn-line strong {
    color: var(--text);
    font-weight: 600;
}

.mn-loading,
.mn-empty {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-dim);
    font-size: 11px;
}

.mn-empty {
    border: 1px dashed var(--border);
    border-radius: 8px;
}

.ai-insights-panel {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.ai-strategy-col {
    background: var(--panel);
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    height: 100%;
    overflow: hidden;
}

.ai-split-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}

.ai-split-col {
    background: var(--panel);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.ai-split-col.live-news-section {
    max-height: none;
    overflow-y: auto;
}

.ai-split-col.ai-news-section {
    overflow-y: auto;
}

.ai-strategy-header {
    border-bottom: 2px solid var(--accent);
    flex-shrink: 0;
}

.ai-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-secondary {
    padding: 6px 12px;
    background: var(--panel-sunken);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--border);
}

.ai-news-section {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.ai-news-table-container {
    margin-top: 12px;
    overflow-x: auto;
}

.ai-news-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.ai-news-table thead th {
    background: var(--panel-alt);
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 10px;
    font-weight: 600;
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.ai-news-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--panel-sunken);
    color: var(--text);
    vertical-align: top;
}

.ai-news-row:hover {
    background: var(--panel-alt);
}

.ai-news-row.positive {
    background: rgba(0, 167, 158, 0.05);
}

.ai-news-row.negative {
    background: rgba(255, 77, 77, 0.05);
}

.ai-news-row.neutral {
    background: transparent;
}

.sentiment-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.sentiment-badge.positive {
    background: rgba(0, 167, 158, 0.1);
    color: #00a79e;
}

.sentiment-badge.negative {
    background: rgba(255, 77, 77, 0.1);
    color: #ff4d4d;
}

.sentiment-badge.neutral {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
}

.ai-news-title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.ai-news-url {
    font-size: 11px;
}

.ai-news-url a {
    color: var(--accent);
    text-decoration: none;
}

.ai-news-url a:hover {
    text-decoration: underline;
}

.ai-news-description {
    max-width: 300px;
    color: var(--text-dim);
    line-height: 1.4;
}

.ai-news-analysis {
    max-width: 400px;
    color: var(--text-dim);
    line-height: 1.4;
    font-size: 11px;
}

.ai-news-time {
    white-space: nowrap;
    color: var(--text-dim);
    font-size: 11px;
}

.ai-loading-row {
    background: transparent;
}

.ai-loading-row td {
    padding: 40px 20px;
}

.ai-signals-section {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

.ai-signals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.ai-signal-card {
    background: var(--panel-sunken);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    transition: all 0.2s ease;
}

.ai-signal-card:hover {
    border-color: var(--accent);
}

.ai-signal-card.buy {
    border-left: 3px solid #00a79e;
}

.ai-signal-card.sell {
    border-left: 3px solid #ff4d4d;
}

.ai-signal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ai-signal-market {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.ai-signal-direction {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
}

.ai-signal-direction.buy {
    background: rgba(0, 167, 158, 0.1);
    color: #00a79e;
}

.ai-signal-direction.sell {
    background: rgba(255, 77, 77, 0.1);
    color: #ff4d4d;
}

.ai-signal-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.ai-signal-metric {
    display: flex;
    flex-direction: column;
}

.ai-signal-metric .metric-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.ai-signal-metric .metric-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.ai-signal-insight {
    font-size: 11px;
    color: var(--text-dim);
    line-height: 1.4;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.ai-insight-card {
    background: var(--panel-sunken);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.ai-insight-card:hover {
    border-color: var(--accent);
}

.ai-insight-card.positive {
    border-left: 3px solid #00a79e;
}

.ai-insight-card.negative {
    border-left: 3px solid #ff4d4d;
}

.ai-insight-card.neutral {
    border-left: 3px solid var(--text-dim);
}

.ai-insight-card.conflict {
    border-left: 3px solid #ff9800;
    background: rgba(255, 152, 0, 0.05);
}

.ai-insight-card.conflict:hover {
    border-color: #ff9800;
}

.conflict-badge {
    background: rgba(255, 152, 0, 0.2);
    color: #ff9800;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
}

.conflict-warning {
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 4px;
    padding: 8px;
    margin-top: 8px;
    font-size: 11px;
    color: #ff9800;
    line-height: 1.4;
}

.conflict-warning strong {
    color: #ff9800;
}

.ai-insight-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.ai-insight-market {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.ai-insight-sentiment {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
}

.ai-insight-card.positive .ai-insight-sentiment {
    background: rgba(0, 167, 158, 0.1);
    color: #00a79e;
}

.ai-insight-card.negative .ai-insight-sentiment {
    background: rgba(255, 77, 77, 0.1);
    color: #ff4d4d;
}

.ai-insight-card.neutral .ai-insight-sentiment {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
}

.ai-insight-content {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.4;
    margin-bottom: 8px;
}

.ai-insight-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-faint);
}

.ai-sentiment-badge {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.ai-sentiment-badge.positive {
    background: rgba(0, 167, 158, 0.1);
    color: #00a79e;
}

.ai-sentiment-badge.negative {
    background: rgba(255, 77, 77, 0.1);
    color: #ff4d4d;
}

.ai-sentiment-badge.neutral {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
}

.ai-loading,
.ai-empty,
.ai-error {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
    font-size: 13px;
}

.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 980px) {
    .ai-strategy-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    .ai-strategy-layout .ai-strategy-col {
        height: 60vh;
    }
}

.news-col {
    background: var(--panel);
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    height: 100%;
    overflow: hidden;
}

@media (max-width: 980px) {
    .analysis-layout-split { grid-template-columns: 1fr; height: auto; }
    .analysis-layout-split .analysis-col { height: 60vh; }
}

.analysis-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}
.analysis-controls select {
    background: var(--panel-alt);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 9px;
    font-family: var(--font-ui);
    font-size: 12.5px;
}

.signal-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-data);
    font-size: 12.5px;
}
.signal-table thead th {
    position: sticky;
    top: 0;
    background: var(--panel-alt);
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 10.5px;
    font-weight: 600;
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.signal-table tbody td {
    padding: 7px 12px;
    border-bottom: 1px solid var(--panel-sunken);
    white-space: nowrap;
    color: var(--text);
}
.pnl-tp {
    color: #2196F3; /* Blue for TP hit */
    font-weight: 600;
}
.pnl-sl {
    color: #F44336; /* Red for SL hit */
    font-weight: 600;
}
.signal-table tbody tr:hover { background: var(--panel-alt); }
.signal-table tbody tr.new-signal {
    background: rgba(38, 166, 154, 0.08);
    animation: flashNew 1s ease-out;
}
@keyframes flashNew {
    0% { background: rgba(38, 166, 154, 0.3); }
    100% { background: rgba(38, 166, 154, 0.08); }
}
.new-badge {
    display: inline-block;
    background: var(--accent);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 6px;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
.market-name {
    font-weight: 600;
    color: var(--text);
    font-size: 12.5px;
}
.market-analysis {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}
.market-timeframe {
    font-size: 10px;
    color: var(--text-faint);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.confirmation-badge {
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
}

.confirmation-badge.confirmed {
    background: rgba(0, 167, 158, 0.2);
    color: #00a79e;
}

.confirmation-badge.analyzing {
    background: rgba(255, 165, 0, 0.2);
    color: #ffa500;
}
/* ---------- Live Signals Panel ---------- */
.live-signals-header {
    border-bottom: 2px solid var(--accent);
    flex-shrink: 0;
}
.live-signals-panel {
    flex: 1;
    overflow-y: auto;
    border-bottom: 1px solid var(--border);
    min-height: 0;
}
.live-signals-table {
    font-size: 12px;
    width: 100%;
    border-collapse: collapse;
}
.live-signals-table thead th {
    background: var(--panel-alt);
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 10px;
    font-weight: 600;
    text-align: left;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.live-signals-table thead th:first-child {
    width: 25%;
}

.live-signals-table thead th:nth-child(2) {
    width: 12%;
}

.live-signals-table thead th:nth-child(3) {
    width: 8%;
}

.live-signals-table thead th:nth-child(4) {
    width: 7%;
}

.live-signals-table thead th:nth-child(5),
.live-signals-table thead th:nth-child(6),
.live-signals-table thead th:nth-child(7) {
    width: 10%;
}

.live-signals-table thead th:nth-child(8) {
    width: 6%;
}

.live-signals-table thead th:nth-child(9) {
    width: 12%;
}
.live-signals-table tbody td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--panel-sunken);
    white-space: nowrap;
    color: var(--text);
    width: auto;
}

.live-signals-table tbody td.signal-market {
    width: 25%;
}

.live-signals-table tbody td.signal-price {
    width: 12%;
}

.live-signals-table tbody td.signal-direction {
    width: 8%;
}

.live-signals-table tbody td.signal-strength {
    width: 7%;
}

.live-signals-table tbody td.signal-entry,
.live-signals-table tbody td.signal-sl,
.live-signals-table tbody td.signal-tp {
    width: 10%;
}

.live-signals-table tbody td.signal-rr {
    width: 6%;
}

.live-signals-table tbody td.signal-htf {
    width: 12%;
}

.live-signals-table tbody tr:hover {
    background: var(--panel-alt);
}

.live-signals-table tbody tr.buy {
    background: rgba(0, 200, 83, 0.05);
}

.live-signals-table tbody tr.sell {
    background: rgba(255, 61, 0, 0.05);
}

.live-signals-table tbody tr.buy:hover {
    background: rgba(0, 200, 83, 0.1);
}

.live-signals-table tbody tr.sell:hover {
    background: rgba(255, 61, 0, 0.1);
}

.signal-direction.buy {
    color: #00C853;
    font-weight: 600;
}

.signal-direction.sell {
    color: #FF3D00;
    font-weight: 600;
}

.price-up {
    color: #00a79e;
}

.price-down {
    color: #ff4d4d;
}

/* Performance page */
.performance-layout {
    padding: 16px 20px 24px;
    height: calc(100vh - var(--topbar-height, 56px) - var(--ticker-height));
    overflow: hidden;
}

.performance-col {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.performance-header {
    flex-shrink: 0;
}

.performance-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin: 12px 0 16px;
    flex-shrink: 0;
}

.perf-stat-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.perf-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
}

.perf-stat-value {
    font-family: var(--font-data);
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
}

.perf-stat-win { color: #00C853; }
.perf-stat-loss { color: #FF3D00; }

/* Mobile: Fix stat cards for better visibility */
@media (max-width: 768px) {
    .performance-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .perf-stat-card {
        padding: 12px;
    }
    
    .perf-stat-label {
        font-size: 10px;
    }
    
    .perf-stat-value {
        font-size: 16px;
    }
}

.performance-panel {
    flex: 1;
    min-height: 0;
    overflow: auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.performance-table {
    width: 100%;
}

.performance-table thead th {
    position: sticky;
    top: 0;
    background: var(--panel-sunken);
    z-index: 1;
}

.performance-filters {
    display: flex;
    gap: 12px;
    margin: 16px 0;
    flex-wrap: wrap;
    align-items: center;
}

.performance-filters input,
.performance-filters select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel-alt);
    color: var(--text);
    font-size: 13px;
}

.performance-filters input {
    flex: 1;
    min-width: 200px;
}

.performance-filters select {
    min-width: 120px;
}

.history-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-dim);
}

.stat-positive {
    color: #00C853;
}

.stat-negative {
    color: #FF3D00;
}

.result-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.result-tp {
    background: rgba(0, 200, 83, 0.15);
    color: #00C853;
}

.result-sl {
    background: rgba(255, 61, 0, 0.15);
    color: #FF3D00;
}

.pnl-positive { color: #00C853; font-weight: 600; }
.pnl-negative { color: #FF3D00; font-weight: 600; }

.perf-closed-at {
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
}

/* HTF Badge Styling */
.htf-cell {
    text-align: center;
    font-weight: 600;
}
.htf-badge {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
}
.htf-aligned {
    background: rgba(0, 200, 83, 0.2);
    color: #00C853;
    border: 1px solid #00C853;
}
.htf-misaligned {
    background: rgba(255, 61, 0, 0.2);
    color: #FF3D00;
    border: 1px solid #FF3D00;
}

/* MT5 Badge Styling */
.mt5-cell {
    text-align: center;
    font-weight: 600;
}
.mt5-badge {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
}
.mt5-valid {
    background: rgba(38, 166, 154, 0.2);
    color: #26A69A;
    border: 1px solid #26A69A;
}
.mt5-invalid {
    background: rgba(255, 61, 0, 0.2);
    color: #FF3D00;
    border: 1px solid #FF3D00;
}

/* Live price color coding */
.live-price {
    font-family: var(--font-data);
    font-weight: 600;
    transition: color 0.2s ease;
}

.live-price.price-up {
    color: #00a79e;
}

.live-price.price-down {
    color: #ff4d4d;
}

.live-price.price-favorable {
    color: #00a79e;
}

.live-price.price-unfavorable {
    color: #ff4d4d;
}

/* SL and TP color coding based on signal direction */
.sl-red {
    color: #ff4d4d;
}

.sl-green {
    color: #00a79e;
}

.tp-green {
    color: #00a79e;
}

.tp-red {
    color: #ff4d4d;
}

/* Hit badge styling */
.hit-badge {
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 4px;
}

.hit-badge.tp-hit {
    background: rgba(0, 167, 158, 0.2);
    color: #00a79e;
}

.hit-badge.sl-hit {
    background: rgba(255, 77, 77, 0.2);
    color: #ff4d4d;
}

/* Row-level coloring for TP/SL hits */
.row-tp-hit {
    background: rgba(0, 200, 83, 0.15);
    border-left: 3px solid #00C853;
}

.row-sl-hit {
    background: rgba(255, 61, 0, 0.15);
    border-left: 3px solid #FF3D00;
}

.hit-badge {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 6px;
}

.hit-badge.tp-hit {
    background: #00C853;
    color: white;
}

.hit-badge.sl-hit {
    background: #FF3D00;
    color: white;
}

/* ---------- Market Watch Panel ---------- */
.market-watch-col {
    width: 340px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100%;
    background: linear-gradient(180deg, var(--panel) 0%, var(--panel-alt) 100%);
}
.market-watch-panel {
    overflow-y: auto;
    min-height: 0;
}
.market-watch-panel::-webkit-scrollbar {
    width: 6px;
}
.market-watch-panel::-webkit-scrollbar-track {
    background: var(--panel-sunken);
}
.market-watch-panel::-webkit-scrollbar-thumb {
    background: var(--text-faint);
    border-radius: 3px;
}
.market-watch-panel::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}
.market-watch-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-data);
    font-size: 11px;
    table-layout: fixed;
}
.market-watch-table thead th {
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, var(--panel-alt) 0%, var(--panel) 100%);
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 9px;
    font-weight: 700;
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    z-index: 10;
}
.market-watch-table thead th:nth-child(1) { width: 35%; } /* Market */
.market-watch-table thead th:nth-child(2) { width: 20%; } /* Price */
.market-watch-table thead th:nth-child(3) { width: 45%; } /* Status */
.market-watch-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--panel-sunken);
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.15s ease;
}
.market-watch-table tbody tr {
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}
.market-watch-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(38, 166, 154, 0.08) 0%, rgba(38, 166, 154, 0.02) 100%);
    border-left: 3px solid var(--accent);
    transform: translateX(2px);
}
.market-watch-table tbody tr.signal-row {
    background: linear-gradient(90deg, rgba(38, 166, 154, 0.12) 0%, rgba(38, 166, 154, 0.04) 100%);
    border-left: 3px solid var(--accent);
}
.market-watch-table tbody tr.signal-row:hover {
    background: linear-gradient(90deg, rgba(38, 166, 154, 0.18) 0%, rgba(38, 166, 154, 0.08) 100%);
}
.market-watch-empty td {
    color: var(--text-faint);
    font-family: var(--font-ui);
    text-align: center;
    padding: 32px 12px;
    font-size: 13px;
}
.market-name {
    font-weight: 600;
    color: var(--text);
    font-size: 12px;
    letter-spacing: 0.01em;
}
.market-symbol {
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 500;
    margin-top: 2px;
}
.market-price {
    font-weight: 700;
    font-family: var(--font-data);
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--panel-sunken);
    transition: all 0.2s ease;
}
.market-row.up .market-price {
    color: var(--accent);
    background: rgba(38, 166, 154, 0.1);
    box-shadow: 0 0 8px rgba(38, 166, 154, 0.2);
}
.market-row.down .market-price {
    color: var(--sell);
    background: rgba(239, 83, 80, 0.1);
    box-shadow: 0 0 8px rgba(239, 83, 80, 0.2);
}
.market-status {
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    text-align: center;
    white-space: nowrap;
    display: inline-block;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    transition: all 0.2s ease;
}
.market-status.waiting {
    color: var(--text-dim);
    background: var(--panel-sunken);
    border: 1px solid var(--border);
}
.market-status.analyzing {
    color: var(--warn);
    background: rgba(240, 185, 11, 0.1);
    border: 1px solid rgba(240, 185, 11, 0.3);
    animation: pulse-glow 2s ease-in-out infinite;
}
.market-status.signal-active {
    color: white;
    background: linear-gradient(135deg, var(--accent) 0%, #1c7f74 100%);
    border: 1px solid var(--accent);
    box-shadow: 0 2px 8px rgba(38, 166, 154, 0.4);
    animation: signal-pulse 2s ease-in-out infinite;
}
.market-status.signal-strong {
    color: white;
    background: linear-gradient(135deg, #00c853 0%, #00a79e 100%);
    border: 1px solid #00c853;
    box-shadow: 0 2px 12px rgba(0, 200, 83, 0.5);
    animation: signal-pulse 1.5s ease-in-out infinite;
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 4px rgba(240, 185, 11, 0.3); }
    50% { box-shadow: 0 0 12px rgba(240, 185, 11, 0.5); }
}
@keyframes signal-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 2px 8px rgba(38, 166, 154, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 4px 16px rgba(38, 166, 154, 0.6); }
}

/* ---------- panels ---------- */
.panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.panel-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-clear {
    padding: 6px 12px;
    background: #ff4d4d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.btn-clear:hover {
    background: #e64545;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--panel);
    margin: 10% auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    color: var(--text-dim);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 20px;
}

.signal-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.signal-detail-row:last-child {
    border-bottom: none;
}

.signal-detail-label {
    color: var(--text-dim);
    font-size: 13px;
}

.signal-detail-value {
    font-weight: 500;
    font-size: 14px;
}

.signal-row-clickable {
    cursor: pointer;
}

.signal-row-clickable:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #007bff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.panel-header h2 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin: 0;
    font-weight: 600;
}

.panel-header .count {
    font-family: var(--font-data);
    font-size: 12px;
    color: var(--text-faint);
}

.scroll-panel {
    overflow-y: auto;
    overflow-x: auto;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.dir-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.03em;
}
.dir-badge.buy { background: rgba(38, 166, 154, 0.14); color: #1c7f74; }
.dir-badge.sell { background: rgba(236, 63, 63, 0.1); color: var(--sell); }
.dir-badge.neutral { background: rgba(107, 114, 128, 0.1); color: var(--text-dim); }

.risk-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 5px; }
.risk-dot.low { background: var(--accent); }
.risk-dot.normal { background: var(--warn); }
.risk-dot.high { background: var(--sell); }

.empty-state {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-faint);
    font-size: 12.5px;
}

/* ---------- AI insight card (lives inside the brain panel) ---------- */
.ai-insight-panel {
    padding: 10px 12px 20px;
}
.ai-insight-card {
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 11px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
}
.ai-insight-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}
.ai-insight-headline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 12.5px;
    margin-bottom: 7px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.ai-insight-headline .dir-badge {
    padding: 2px 7px;
    font-size: 10px;
    border-radius: 4px;
}
.ai-insight-headline .ai-updated { margin-left: auto; font-size: 10px; color: var(--text-dim); }
.ai-metric-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 6px;
}
.ai-metric {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 5px 7px;
    background: var(--panel-sunken);
    border-radius: 5px;
    border: 1px solid var(--border);
    transition: all 0.15s ease;
}
.ai-metric:hover {
    background: var(--panel);
    border-color: var(--accent);
}
.ai-metric-label {
    font-size: 8.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-faint);
    font-weight: 600;
}
.ai-metric-value {
    font-family: var(--font-data);
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ai-insight-note {
    display: none;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-faint);
    padding: 8px 10px;
    background: var(--panel-sunken);
    border-radius: 6px;
    border-left: 3px solid var(--warn);
}
.ai-disclaimer {
    margin-top: 8px;
    font-size: 10px;
    color: var(--text-faint);
    line-height: 1.4;
}
.ai-insight-panel .ask-ai-btn {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 7px 12px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 6px;
    text-align: center;
    background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
}
.ai-insight-panel .ask-ai-btn:hover { opacity: 0.92; }

/* ---------- news-affecting-signal panel (Analysis page + brain panel) ---------- */
.ai-news-card {
    margin-top: 8px;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 11px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
}
.ai-news-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}
.ai-news-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 7px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border);
}
.ai-news-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: var(--text-dim);
}

.ai-news-context {
    font-size: 11px;
    color: var(--text-faint);
    padding: 0 0 10px;
}

.ai-news-list { display: flex; flex-direction: column; gap: 8px; }
.ai-news-list-full { padding: 8px 16px 16px; }

.ai-news-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 9px 10px;
    border-radius: 8px;
    background: var(--panel);
    border: 1px solid var(--border);
}
.ai-news-item .impact-dot { margin-top: 5px; flex-shrink: 0; }
.ai-news-item.ai-news-upcoming { border-left: 3px solid var(--warn); }
.ai-news-item.ai-news-released { border-left: 3px solid var(--border); }

.ai-news-body { flex: 1; min-width: 0; }
.ai-news-title-row { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.ai-news-currency {
    font-family: var(--font-data);
    font-size: 11px;
    font-weight: 700;
    color: var(--brand);
    flex-shrink: 0;
}
.ai-news-headline { font-size: 12.5px; color: var(--text); line-height: 1.4; }
.ai-news-figures { display: flex; gap: 10px; margin-top: 4px; }
.ai-news-figure { font-family: var(--font-data); font-size: 11px; color: var(--text-dim); }

.ai-news-when {
    font-family: var(--font-data);
    font-size: 10.5px;
    color: var(--text-faint);
    white-space: nowrap;
    flex-shrink: 0;
    padding-top: 1px;
}
.ai-news-when.upcoming { color: var(--warn); font-weight: 600; }

.ai-news-empty {
    padding: 16px 10px;
    text-align: center;
    color: var(--text-faint);
    font-size: 12px;
}

.ai-news-markets {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-news-markets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}

.ai-news-market-btn {
    padding: 8px 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 11px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    text-align: center;
}

.ai-news-market-btn:hover {
    background: var(--panel-alt);
    border-color: var(--brand);
}

.ai-news-sentiment {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 4px;
}

.ai-news-back-btn {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 11px;
    padding: 6px 12px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: background 0.2s, border-color 0.2s;
}

.ai-news-back-btn:hover {
    background: var(--panel-alt);
    border-color: var(--brand);
}

/* ---------- floating AI brain widget ---------- */
.brain-fab {
    position: fixed;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
    transition: transform 0.2s, filter 0.2s;
}
.brain-fab-icon {
    width: 44px;
    height: 44px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
    pointer-events: none;
}
.brain-fab:hover { transform: translateY(-50%) scale(1.08); }
.brain-fab-disabled { background: transparent; cursor: pointer; }
.brain-fab-disabled .brain-fab-icon { opacity: 1; filter: none; }
.brain-fab.shake { animation: brain-shake 0.4s; }
@keyframes brain-shake {
    0%, 100% { transform: translateY(-50%); }
    25% { transform: translateY(-50%) translateX(-4px); }
    75% { transform: translateY(-50%) translateX(4px); }
}

/* ---------- AI Scanner Widget ---------- */
.scanner-fab {
    position: fixed;
    right: 50%;
    top: 50%;
    transform: translate(50%, -50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: transform 0.2s, box-shadow 0.2s;
}

.scanner-fab-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(255, 106, 0, 0.75));
}

@keyframes lightning-glow {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(255, 106, 0, 0.5)); }
    50% { filter: drop-shadow(0 0 20px rgba(255, 106, 0, 0.8)) drop-shadow(0 0 40px rgba(255, 106, 0, 0.5)); }
}

.scanner-lightning-effect {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 106, 0, 0.25) 0%, transparent 70%);
    animation: lightning-pulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes lightning-pulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.3); opacity: 0.5; }
}

.scanner-fab:hover { transform: translate(50%, -50%) scale(1.1); }

.scanner-fab.scanning {
    animation: scanner-scan 2s ease-in-out infinite;
}

@keyframes scanner-scan {
    0%, 100% { transform: translate(50%, -50%) scale(1); }
    50% { transform: translate(50%, -50%) scale(1.05); }
}

.scanner-beam {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    opacity: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        transparent 40%, 
        rgba(0, 102, 255, 0.5) 48%, 
        rgba(0, 102, 255, 0.8) 50%, 
        rgba(0, 102, 255, 0.5) 52%, 
        transparent 60%, 
        transparent 100%
    );
}

.scanner-beam.scanning {
    opacity: 1;
    animation: beam-scan 3s linear infinite;
}

@keyframes beam-scan {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(0%); }
}

/* Chart Loader */
.chart-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.chart-loader.active {
    opacity: 1;
    pointer-events: auto;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(38, 166, 154, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dim);
}

/* Scanner Wave Animation */
.scanner-wave-container {
    position: relative;
    width: 100%;
    height: 60px;
    background: rgba(0, 102, 255, 0.05);
    border-radius: 8px;
    overflow: hidden;
    margin: 15px 0;
    border: 1px solid rgba(0, 102, 255, 0.2);
}

.scanner-wave {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent 0%,
        transparent 30%,
        rgba(0, 102, 255, 0.3) 45%,
        rgba(0, 102, 255, 0.6) 50%,
        rgba(0, 102, 255, 0.3) 55%,
        transparent 70%,
        transparent 100%
    );
    animation: wave-scan 2s ease-in-out infinite;
}

@keyframes wave-scan {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.scanner-wave::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, rgba(0, 102, 255, 0.8) 0%, transparent 70%);
    border-radius: 50%;
    animation: wave-pulse 1s ease-in-out infinite;
}

@keyframes wave-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    50% { transform: translate(-50%, -50%) scale(1.5); opacity: 0.4; }
}

/* ==========================================================================
   AI Pattern Scanner - White & Orange Edition (Black Text, Color-Coded Prices)
   ========================================================================== */

.scanner-modal {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.scanner-modal.open {
    opacity: 1;
    pointer-events: auto;
}

.scanner-modal-backdrop {
    position: absolute;
    inset: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: opacity 0.28s ease;
}

.scanner-modal-content {
    position: relative;
    width: min(480px, calc(100vw - 28px));
    max-height: min(86vh, 760px);
    background: #ffffff;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    box-shadow: 
        0 24px 60px -10px rgba(0, 0, 0, 0.15),
        0 4px 16px rgba(0, 0, 0, 0.05);
    color: #111827;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.96) translateY(10px);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.scanner-modal.open .scanner-modal-content {
    transform: scale(1) translateY(0);
}

/* Subtle laser progress line */
.scanner-laser-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #2563eb, #60a5fa, #2563eb, transparent);
    box-shadow: 0 0 8px rgba(37, 99, 235, 0.4);
    opacity: 0;
    z-index: 20;
    pointer-events: none;
}

.scanner-modal.is-scanning .scanner-laser-bar {
    opacity: 1;
    animation: scannerLaserSweep 1.6s ease-in-out infinite;
}

@keyframes scannerLaserSweep {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(0%); }
    100% { transform: translateX(100%); }
}

/* Header */
.scanner-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
    position: relative;
}

.scanner-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 750;
    letter-spacing: -0.01em;
    color: #111827;
}

/* Live beacon dot */
.scanner-beacon {
    position: relative;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scanner-beacon-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.scanner-beacon-ping {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid #10b981;
    animation: scannerPing 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes scannerPing {
    0% { transform: scale(0.6); opacity: 0.9; }
    80%, 100% { transform: scale(1.6); opacity: 0; }
}

.scanner-symbol-badge {
    display: inline-block;
    padding: 2px 9px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #111827;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.scanner-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    color: #4b5563;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.scanner-close:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #111827;
    transform: scale(1.05);
}

/* Modal Body */
.scanner-modal-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Controls */
.scanner-controls {
    padding: 16px 20px 14px;
    border-bottom: 1px solid #e5e7eb;
    background: #fafafa;
}

/* Mode Switcher */
.scanner-mode-switch {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.scanner-mode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 2px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    color: #4b5563;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.scanner-mode-btn:hover {
    color: #111827;
    background: #e5e7eb;
}

.scanner-mode-btn.active {
    background: #111827;
    border-color: #111827;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.scanner-mode-btn-tf {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.scanner-mode-btn.active .scanner-mode-btn-tf {
    color: #ffffff;
}

.scanner-mode-label {
    font-size: 12px;
    color: #4b5563;
    margin: 10px 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

/* Action Buttons */
.scanner-actions {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 10px;
}

.scan-btn {
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

/* Primary Scan Button (Clean Orange Accent CTA) */
.scan-btn.primary {
    background: #ff6a00;
    color: #ffffff;
    border: 1px solid #e55e00;
    box-shadow: 0 2px 8px rgba(255, 106, 0, 0.25);
}

.scan-btn.primary:hover:not(:disabled) {
    background: #f06000;
    box-shadow: 0 4px 12px rgba(255, 106, 0, 0.35);
}

.scan-btn.primary:active:not(:disabled) {
    transform: translateY(0);
}

.scan-btn.primary.is-scanning .scan-icon-radar {
    animation: radarSpin 1.4s linear infinite;
}

@keyframes radarSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Auto Scan Toggle (Neutral) */
.scan-btn.auto {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #374151;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.scan-btn.auto:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #111827;
}

.auto-indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    transition: all 0.2s ease;
}

.scan-btn.auto.active {
    background: #111827;
    border-color: #111827;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.scan-btn.auto.active .auto-indicator-dot {
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2), 0 0 6px #10b981;
}

.scanner-note {
    font-size: 11px;
    color: #6b7280;
    margin-top: 10px;
    line-height: 1.45;
    display: block;
}

/* Results Section */
.scanner-results {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Status Bar */
.scanner-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    font-size: 12px;
    color: #111827;
    font-weight: 500;
    line-height: 1.4;
}

.scanner-status-icon {
    font-size: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2563eb;
}

.scanner-mini-spin {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    border-top-color: #2563eb;
    animation: radarSpin 0.8s linear infinite;
    display: inline-block;
}

/* Summary HUD Card */
.scanner-summary {
    display: none;
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.25s ease;
}

.scanner-summary-empty {
    padding: 18px 14px;
    background: #f9fafb;
    border: 1px dashed #e5e7eb;
    text-align: center;
}

.scanner-empty-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.scanner-empty-icon {
    color: #9ca3af;
    margin-bottom: 2px;
}

.scanner-empty-title {
    font-size: 13px;
    font-weight: 750;
    color: #111827;
}

.scanner-empty-desc {
    font-size: 11.5px;
    color: #6b7280;
    max-width: 320px;
    line-height: 1.45;
}

/* Directional HUD Cards (Clean White with Green/Red/Blue/Orange prices) */
.scanner-hud-card {
    padding: 14px;
    border-radius: 14px;
    position: relative;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.scanner-hud-card.buy {
    border-color: #16a34a;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.1);
}

.scanner-hud-card.sell {
    border-color: #dc2626;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.1);
}

.scanner-hud-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.scanner-hud-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.scanner-dir-chip {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
}

/* BUY is green */
.scanner-dir-chip.buy {
    background: #16a34a;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
}

/* SELL is red */
.scanner-dir-chip.sell {
    background: #dc2626;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
}

.scanner-pattern-name {
    font-size: 13px;
    font-weight: 750;
    color: #111827;
}

.scanner-hud-symbol {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #374151;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 2px 7px;
    border-radius: 5px;
    font-weight: 700;
}

/* 4-Column Metric Tiles */
.scanner-hud-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.scanner-hud-metric {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    padding: 8px 4px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.scanner-hud-metric .hud-lbl {
    font-size: 9px;
    font-weight: 750;
    letter-spacing: 0.05em;
    color: #6b7280;
    text-transform: uppercase;
}

.scanner-hud-metric .hud-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    font-weight: 800;
}

/* Prices: Blue Entry, Green TP, Red SL, Orange RR */
.scanner-hud-metric.entry .hud-val { color: #2563eb; }
.scanner-hud-metric.tp .hud-val { color: #16a34a; }
.scanner-hud-metric.sl .hud-val { color: #dc2626; }
.scanner-hud-metric.rr .hud-val { color: #ea580c; }

/* Setup Cards */
.scanner-entries {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.scanner-entry {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    border-radius: 12px;
    padding: 12px 14px;
    transition: all 0.2s ease;
}

/* Active Setup Card (Interactive) */
button.scanner-active-card {
    width: 100%;
    cursor: pointer;
    text-align: left;
    background: #ffffff;
    border: 1.5px solid #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

button.scanner-active-card:hover {
    transform: translateY(-2px);
    border-color: #9ca3af;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    background: #ffffff;
}

.scanner-entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.scanner-entry-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.scanner-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 4px;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.scanner-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.7);
    animation: autoGlow 1.4s ease-in-out infinite;
}

.scanner-entry-type {
    font-size: 13px;
    font-weight: 750;
    color: #111827;
}

.scanner-entry-type.buy { color: #16a34a; }
.scanner-entry-type.sell { color: #dc2626; }

.scanner-plot-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 700;
    color: #4b5563;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 2px 7px;
    border-radius: 5px;
}

.scanner-entry-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #374151;
    font-family: 'JetBrains Mono', monospace;
}

.scanner-entry-details strong {
    font-weight: 800;
}

/* Specific Price Colors: Blue, Green, Red, Orange */
.price-blue { color: #2563eb !important; }
.price-green { color: #16a34a !important; }
.price-red { color: #dc2626 !important; }
.price-orange { color: #ea580c !important; }

.scanner-entry-hint {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

button.scanner-active-card:hover .scanner-entry-hint {
    color: #4b5563;
}

/* History List */
.scanner-history-heading {
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.08em;
    color: #6b7280;
    margin-top: 6px;
    padding-left: 2px;
}

.scanner-history-entry {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    padding: 10px 12px;
}

.scanner-hist-dir {
    font-size: 10.5px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 4px;
}

.scanner-hist-dir.buy { background: #16a34a; color: #ffffff; }
.scanner-hist-dir.sell { background: #dc2626; color: #ffffff; }

.scanner-outcome-badge {
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 4px;
}

.scanner-outcome-badge.tp {
    background: rgba(22, 163, 74, 0.12);
    color: #16a34a;
    border: 1px solid #16a34a;
}

.scanner-outcome-badge.sl {
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
    border: 1px solid #dc2626;
}

.scanner-outcome-badge.neutral {
    background: rgba(0, 0, 0, 0.06);
    color: #6b7280;
}

.scanner-history-details {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: #4b5563;
    font-family: 'JetBrains Mono', monospace;
    margin-top: 5px;
}

.scanner-history-details strong {
    font-weight: 800;
}

@media (max-width: 480px) {
    .scanner-modal-content {
        width: calc(100vw - 20px);
        max-height: 90vh;
        border-radius: 16px;
    }
    .scanner-controls { padding: 14px 14px 12px; }
    .scanner-results { padding: 14px 14px 16px; }
    .scanner-actions { grid-template-columns: 1fr; }
    .scanner-hud-grid { grid-template-columns: repeat(2, 1fr); }
    .scanner-mode-switch {
        gap: 3px;
        padding: 3px;
    }
    .scanner-mode-btn {
        padding: 7px 1px;
    }
    .scanner-mode-btn-tf {
        font-size: 10px;
    }
}

.brain-panel {
    position: fixed;
    top: 40px;
    right: -320px;
    width: 320px;
    height: calc(100vh - 40px);
    background: var(--panel);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.25);
    z-index: 61;
    display: flex;
    flex-direction: column;
    transition: right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-top-left-radius: 8px;
}
.brain-panel.open { right: 0; }
.page-dashboard .brain-panel {
    top: 84px;
    height: calc(100vh - 84px);
}
.page-stocks .brain-panel {
    top: 76px;
    height: calc(100vh - 76px);
}
.brain-panel.voice-mode-open .brain-tabs,
.brain-panel.voice-mode-open > .brain-tab-panel,
.brain-panel.voice-mode-open .brain-panel-sub { display: none !important; }
.brain-voice-mode { 
    flex: 1; 
    min-height: 0; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    gap: 12px; 
    padding: 20px 14px; 
    text-align: center; 
    background: radial-gradient(circle at 50% 44%, rgba(14, 165, 233, 0.08) 0%, rgba(15, 23, 42, 0.02) 55%, transparent 80%), var(--panel); 
}
.brain-voice-mode[hidden] { display: none !important; }
.brain-voice-orb-container {
    position: relative;
    width: 190px;
    height: 190px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 6px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.brain-voice-canvas {
    width: 190px;
    height: 190px;
    display: block;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 0 24px rgba(56, 189, 248, 0.45)) drop-shadow(0 0 48px rgba(99, 102, 241, 0.28));
    transition: filter 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.brain-voice-orb-container.is-speaking .brain-voice-canvas {
    filter: drop-shadow(0 0 32px rgba(14, 165, 233, 0.75)) drop-shadow(0 0 64px rgba(244, 63, 94, 0.45));
}
.brain-voice-orb-container.is-listening .brain-voice-canvas {
    filter: drop-shadow(0 0 32px rgba(20, 184, 166, 0.8)) drop-shadow(0 0 60px rgba(56, 189, 248, 0.5));
}
.brain-voice-orb-container.is-thinking .brain-voice-canvas {
    filter: drop-shadow(0 0 36px rgba(168, 85, 247, 0.75)) drop-shadow(0 0 68px rgba(99, 102, 241, 0.6));
}
.brain-voice-orb-ambient {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 220px;
    height: 220px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.16) 0%, rgba(99, 102, 241, 0.08) 45%, transparent 72%);
    pointer-events: none;
    z-index: 1;
    animation: brain-orb-ambient-breathe 4.5s ease-in-out infinite alternate;
    transition: background 0.45s ease;
}
.brain-voice-orb-container.is-listening .brain-voice-orb-ambient {
    background: radial-gradient(circle, rgba(20, 184, 166, 0.22) 0%, rgba(56, 189, 248, 0.1) 45%, transparent 72%);
}
.brain-voice-orb-container.is-speaking .brain-voice-orb-ambient {
    background: radial-gradient(circle, rgba(14, 165, 233, 0.25) 0%, rgba(244, 63, 94, 0.12) 48%, transparent 72%);
}
.brain-voice-orb-container.is-thinking .brain-voice-orb-ambient {
    background: radial-gradient(circle, rgba(168, 85, 247, 0.25) 0%, rgba(99, 102, 241, 0.14) 48%, transparent 72%);
}
@keyframes brain-orb-ambient-breathe {
    0% { transform: translate(-50%, -50%) scale(0.94); opacity: 0.55; }
    100% { transform: translate(-50%, -50%) scale(1.15); opacity: 0.95; }
}

.brain-voice-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 24px;
    margin: 4px auto 10px;
    opacity: 0.9;
    transition: all 0.3s ease;
}
.brain-voice-dots span {
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #38bdf8;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.7);
    animation: voice-dot-bounce 1.3s ease-in-out infinite both;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}
.brain-voice-dots span:nth-child(1) { animation-delay: -0.32s; }
.brain-voice-dots span:nth-child(2) { animation-delay: -0.16s; }
.brain-voice-dots span:nth-child(3) { animation-delay: 0s; }

.brain-voice-mode.is-speaking .brain-voice-dots span {
    background: #0ea5e9;
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.9), 0 0 20px rgba(244, 63, 94, 0.5);
    animation-duration: 0.9s;
}

.brain-voice-mode.is-listening .brain-voice-dots span {
    background: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.9), 0 0 20px rgba(52, 211, 153, 0.5);
    animation-duration: 0.8s;
}

.brain-voice-mode.is-thinking .brain-voice-dots span {
    background: #a855f7;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.85), 0 0 20px rgba(99, 102, 241, 0.5);
    animation-duration: 0.7s;
}

@keyframes voice-dot-bounce {
    0%, 80%, 100% {
        transform: scale(0.65);
        opacity: 0.35;
    }
    40% {
        transform: scale(1.35) translateY(-5px);
        opacity: 1;
        box-shadow: 0 0 14px rgba(0, 242, 255, 0.95), 0 0 28px rgba(0, 242, 255, 0.6);
    }
}

.brain-voice-mode-status {
    min-height: 18px;
    color: var(--warn, #ef5350);
    font-size: 12px;
    font-weight: 500;
    margin-top: -4px;
    margin-bottom: 4px;
}
.brain-voice-mode-status[hidden] {
    display: none !important;
}

.brain-voice-mode-mic {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--panel-alt);
    color: var(--text);
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}
.brain-voice-mode-mic svg {
    width: 22px;
    height: 22px;
    transition: transform 0.2s ease;
}
.brain-voice-mode-mic:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: scale(1.08);
    box-shadow: 0 0 18px rgba(38, 166, 154, 0.4);
}
.brain-voice-mode-mic.is-recording {
    background: var(--sell, #ef5350);
    border-color: var(--sell, #ef5350);
    color: #fff;
    box-shadow: 0 0 20px rgba(239, 83, 80, 0.6);
    animation: brain-voice-mic-pulse 1.4s ease-in-out infinite;
}
@keyframes brain-voice-mic-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); box-shadow: 0 0 25px rgba(239, 83, 80, 0.85); }
}

.brain-voice-transcript {
    display: none !important;
}

.brain-voice-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 4px;
}

.brain-voice-history-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 242, 255, 0.08);
    border: 1px solid rgba(0, 242, 255, 0.25);
    color: #00f2ff;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 20px;
    transition: all 0.2s ease;
}
.brain-voice-history-btn:hover {
    background: rgba(0, 242, 255, 0.18);
    border-color: rgba(0, 242, 255, 0.5);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 0 12px rgba(0, 242, 255, 0.3);
}

.brain-voice-mode-close {
    border: 0;
    background: none;
    color: var(--text-dim);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}
.brain-voice-mode-close:hover {
    color: var(--text);
    background: var(--panel-alt);
}

.brain-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--panel) 0%, var(--panel-alt) 100%);
    flex-shrink: 0;
}
.brain-panel-title { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12px; letter-spacing: -0.01em; color: var(--text); }
.brain-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 6px rgba(38, 166, 154, 0.8); animation: brain-pulse 2s ease-in-out infinite; }
@keyframes brain-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.7; transform: scale(1.1); } }
.brain-close { background: none; border: none; font-size: 18px; line-height: 1; color: var(--text-dim); cursor: pointer; padding: 2px 6px; border-radius: 4px; transition: all 0.15s; }
.brain-close:hover { color: var(--text); background: var(--panel-sunken); }

.brain-panel-sub {
    padding: 5px 12px;
    font-size: 11px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    background: var(--panel-alt);
    font-weight: 500;
    flex-shrink: 0;
}

.brain-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--panel);
}
.brain-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 7px 0;
    font-family: var(--font-ui);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-faint);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
    position: relative;
}
.brain-tab:hover { color: var(--text-dim); background: var(--panel-alt); }
.brain-tab.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--panel-sunken); }

.brain-tab-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    position: relative;
}
.brain-tab-panel .ai-insight-panel { flex: 1; overflow-y: auto; }
.brain-tab-panel[hidden] { display: none !important; }
.brain-tab-panel:not([hidden]) { display: flex !important; }

.ai-analysis-panel {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-gaps-panel {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gap-table-container {
    overflow-x: auto;
    margin-top: 12px;
}

.gap-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel-sunken);
    border-radius: 6px;
    overflow: hidden;
}

.gap-table th {
    background: var(--panel-alt);
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.gap-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.gap-table tr:hover {
    background: var(--panel);
}

.gap-type.gap_up {
    color: var(--buy);
    font-weight: 600;
}

.gap-type.gap_down {
    color: var(--sell);
    font-weight: 600;
}

.gap-status.filled {
    color: var(--buy);
    font-weight: 600;
}

.gap-status.unfilled {
    color: var(--warn);
    font-weight: 600;
}

.positive {
    color: var(--buy);
    font-weight: 600;
}

.negative {
    color: var(--sell);
    font-weight: 600;
}

.stock-analysis-details {
    margin-top: 16px;
    padding: 12px;
    background: var(--panel-sunken);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.stock-analysis-details p {
    margin: 8px 0;
    font-size: 12px;
    color: var(--text);
    line-height: 1.4;
}

.stock-analysis-details p:first-child {
    margin-top: 0;
}

.stock-analysis-details p:last-child {
    margin-bottom: 0;
}
.ai-analysis-status {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.4;
}
.ai-analysis-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 11px;
    background: var(--panel-alt);
}
.ai-analysis-summary,
.ai-analysis-setup,
.ai-analysis-risks {
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--text);
    margin: 6px 0 0;
}
.ai-analysis-risks { color: var(--text-dim); }

.brain-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    overflow-x: hidden;
    background: linear-gradient(180deg, var(--panel) 0%, var(--panel-alt) 100%);
}

.brain-msg {
    position: relative;
    max-width: 92%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    animation: brain-msg-appear 0.2s ease;
}
.brain-msg-speak {
    position: absolute;
    bottom: 4px;
    right: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.15s ease;
    opacity: 0.6;
    padding: 0;
}
.brain-msg-speak:hover {
    background: var(--accent);
    color: #fff;
    opacity: 1;
    transform: scale(1.08);
}
@keyframes brain-msg-appear {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
.brain-msg-ai { 
    align-self: flex-start; 
    background: var(--panel-alt); 
    color: var(--text); 
    border: 1px solid var(--border);
    border-bottom-left-radius: 3px;
}
.brain-msg-user { 
    align-self: flex-end; 
    background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%); 
    color: #fff;
    border-bottom-right-radius: 3px;
}
.brain-msg-thinking { 
    opacity: 0.7; 
    font-style: italic;
    background: var(--panel-sunken);
    border: 1px dashed var(--border);
    position: relative;
    padding: 10px 14px;
}
.thinking-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}
.thinking-indicator span {
    width: 6px;
    height: 6px;
    background: var(--text-dim);
    border-radius: 50%;
    animation: thinking-bounce 1.4s infinite ease-in-out both;
}
.thinking-indicator span:nth-child(1) { animation-delay: -0.32s; }
.thinking-indicator span:nth-child(2) { animation-delay: -0.16s; }
.thinking-indicator span:nth-child(3) { animation-delay: 0s; }
@keyframes thinking-bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.brain-input-row {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    border-top: 1px solid var(--border);
    background: var(--panel);
    align-items: center;
    flex-shrink: 0;
}
.brain-input-row input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 6px 12px;
    font-size: 12px;
    font-family: var(--font-ui);
    background: var(--panel-alt);
    color: var(--text);
    transition: all 0.2s ease;
}
.brain-input-row input:focus { 
    outline: none; 
    border-color: var(--accent); 
    box-shadow: 0 0 0 2px rgba(38, 166, 154, 0.15);
}
.brain-send {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(38, 166, 154, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}
.brain-send:hover {
    transform: scale(1.06);
    box-shadow: 0 3px 8px rgba(38, 166, 154, 0.4);
}
.brain-send:active {
    transform: scale(0.95);
}
.brain-voice {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--panel-sunken);
    color: var(--text-dim);
    cursor: pointer;
    display: grid;
    place-items: center;
    position: relative;
    transition: all 0.2s ease;
}
.brain-voice svg { width: 15px; height: 15px; }
.brain-voice:hover { border-color: var(--accent); color: var(--accent); transform: scale(1.05); }
.brain-voice.is-recording { color: var(--sell); border-color: var(--sell); animation: brain-voice-pulse 1.2s ease-in-out infinite; }
.brain-voice.is-recording::after {
    content: '●';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--sell);
    border-radius: 50%;
    animation: brain-recording-dot 1s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(255, 77, 77, 0.6);
}
.brain-voice-mode-toggle {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    position: relative;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(38, 166, 154, 0.3);
}
.brain-voice-mode-toggle svg { width: 15px; height: 15px; }
.brain-voice-mode-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 8px rgba(38, 166, 154, 0.4);
}
.brain-voice-mode-toggle:active {
    transform: scale(0.95);
}
.brain-voice-mode-toggle.is-active {
    background: linear-gradient(135deg, var(--accent) 0%, var(--brand) 100%);
    box-shadow: 0 0 0 2px rgba(38, 166, 154, 0.3);
}
.brain-voice-status { padding: 4px 6px 0; color: var(--text-dim); font-size: 10px; font-weight: 500; }

.news-input-row .brain-voice {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s ease;
}
.news-input-row .brain-voice svg { 
    width: 20px; 
    height: 20px; 
    display: block;
}
.news-input-row .brain-voice:hover { 
    color: #1a1a1a;
    background: #f3f4f6;
}
.news-input-row .brain-voice.is-recording { 
    color: #ef4444;
    background: #fef2f2;
}
.news-input-row .brain-voice.is-recording::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    animation: recording-pulse 1.5s ease-in-out infinite;
}
@keyframes recording-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
}

.news-input-row .brain-attach {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.news-input-row .brain-attach svg {
    width: 20px;
    height: 20px;
    display: block;
}
.news-input-row .brain-attach:hover {
    color: #1a1a1a;
    background: #f3f4f6;
}

.ai-news-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.news-input-row {
    padding: 14px 18px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 24px;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    align-items: center;
}
.news-input-row input {
    flex: 1;
    border: none;
    padding: 0;
    font-size: 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: transparent;
    color: #1a1a1a;
    outline: none;
}
.news-input-row input::placeholder {
    color: #9ca3af;
}
.news-input-row .brain-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #10a37f;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.news-input-row .brain-send:hover {
    background: #0d8a6a;
    transform: scale(1.05);
}
.news-input-row .brain-send:active {
    transform: scale(0.95);
}
@keyframes brain-voice-pulse { 50% { opacity: .45; } }

/* ---------- news page (Forex Factory theme) ---------- */
.news-page { padding: 24px 32px; max-width: 1100px; margin: 0 auto; padding-bottom: 80px; }
.news-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; flex-wrap: wrap; gap: 8px; }
.news-header h1 { font-size: 20px; margin: 0; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; }
.news-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); font-family: var(--font-data); }

.news-filters {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.filter-select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--panel-bg);
    color: var(--text);
    font-size: 13px;
    font-family: var(--font-ui);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.filter-select:hover {
    border-color: var(--border-hover);
}

.filter-select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 2px rgba(255, 106, 0, 0.1);
}

@media (max-width: 720px) {
    .news-page {
        padding: 16px;
        padding-bottom: 80px;
    }
    
    .news-filters {
        flex-direction: column;
        gap: 8px;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-select {
        flex: 1;
    }
    
    .news-ai-panel {
        width: 100vw;
        right: -100vw;
    }
    
    .news-ai-fab {
        right: 16px;
    }
    
    .news-ai-footer {
        padding: 10px 12px 12px;
    }
    
    .news-ai-input {
        min-height: 60px;
        max-height: 100px;
    }
}

.news-legend { display: flex; gap: 18px; margin: 14px 0 18px; font-size: 12px; color: var(--text-dim); flex-wrap: wrap; }
.news-legend span { display: flex; align-items: center; gap: 6px; }

.impact-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.impact-dot.impact-high { background: var(--sell); }
.impact-dot.impact-medium { background: var(--brand); }
.impact-dot.impact-low { background: var(--warn); }
.impact-dot.impact-holiday { background: #b0b7c1; }

.ff-calendar {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--panel);
    box-shadow: var(--shadow-sm);
}

.ff-head-row {
    display: grid;
    grid-template-columns: 70px 90px 60px 1fr 90px 90px 90px;
    background: var(--nav-bg);
    color: var(--nav-text-strong);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}
.ff-head-row .ff-col { padding: 9px 12px; }

.ff-day-row {
    background: var(--panel-sunken);
    color: var(--text);
    font-weight: 700;
    font-size: 12px;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    border-left: 3px solid var(--brand);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ff-row {
    display: grid;
    grid-template-columns: 70px 90px 60px 1fr 90px 90px 90px;
    font-size: 12.5px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.ff-row:hover { background: var(--panel-alt); }
.ff-row:nth-child(even) { background: rgba(0,0,0,0.012); }
.ff-row .ff-col { padding: 8px 12px; display: flex; align-items: center; }

.ff-col-time { color: var(--text-faint); font-family: var(--font-data); }
.ff-currency {
    font-family: var(--font-data);
    font-weight: 700;
    font-size: 11px;
    background: var(--panel-sunken);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
}
.ff-col-num { font-family: var(--font-data); color: var(--text-dim); justify-content: flex-end; text-align: right; }
.ff-actual { color: var(--text); font-weight: 600; }

.ff-empty { padding: 30px 16px; text-align: center; color: var(--text-faint); font-size: 13px; }

@media (max-width: 720px) {
    .ff-head-row, .ff-row { grid-template-columns: 55px 70px 40px 1fr; }
    .ff-head-row .ff-col:nth-child(n+5), .ff-row .ff-col-num { display: none; }
    .news-page { padding: 16px; }
    .brain-panel { width: 100vw; right: -100vw; }
    .brain-panel.open { right: 0; }
    .page-stocks .brain-panel { top: 50px; height: calc(100dvh - 50px); }
    .ai-metric-grid { grid-template-columns: 1fr; }
    .brain-messages { padding: 12px 14px; }
    .brain-input-row { padding: 12px 14px; }
}

@media (max-width: 480px) {
    .brain-panel-title { font-size: 12px; }
    .brain-tab { font-size: 12px; padding: 10px 0; }
    .ai-insight-card { padding: 14px; }
    .ai-metric-grid { gap: 10px 12px; }
    .brain-msg { font-size: 13px; padding: 10px 14px; }
}

/* scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ---------- Boomerang Terminal ---------- */
.boomerang-terminal {
    padding: 20px;
    max-width: 1600px;
    margin: 0 auto;
}

.boomerang-header {
    margin-bottom: 24px;
    text-align: center;
}

.boomerang-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 8px 0;
}

.boomerang-header .subtitle {
    font-size: 14px;
    color: var(--text-dim);
    margin: 0;
}

.boomerang-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.boomerang-section {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--panel-alt);
}

.section-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.youtube-controls,
.market-controls,
.signal-controls,
.news-controls,
.analysis-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-input {
    padding: 6px 12px;
    background: var(--panel-sunken);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 12px;
    font-family: var(--font-data);
    min-width: 150px;
}

.search-input::placeholder {
    color: var(--text-dim);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
}

.channel-select,
.category-select,
.news-select,
.analysis-select {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--panel);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
}

.date-filter {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--panel);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
}

.btn-secondary {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--panel);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-secondary:hover {
    background: var(--panel-sunken);
}

/* Yahoo Finance Section */
.yahoo-finance-section {
    grid-column: span 2;
}

.yahoo-finance-container {
    width: 100%;
    height: 600px;
    overflow: hidden;
}

.yahoo-finance-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* YouTube Section */
.youtube-section {
    grid-column: span 2;
}

.youtube-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.youtube-placeholder {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-faint);
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.youtube-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
}

.youtube-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.youtube-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.youtube-thumbnail {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.youtube-info {
    padding: 12px;
}

.youtube-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.youtube-channel {
    font-size: 12px;
    color: var(--text-dim);
    margin: 0 0 4px 0;
}

.youtube-date {
    font-size: 11px;
    color: var(--text-faint);
    margin: 0;
}

/* Live News Section */
.news-section {
    grid-column: span 2;
}

.news-container {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.news-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-faint);
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.news-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid var(--text-dim);
}

.news-card.high-impact {
    border-left-color: var(--sell);
}

.news-card.medium-impact {
    border-left-color: var(--warn);
}

.news-card.low-impact {
    border-left-color: var(--info);
}

.news-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.news-country {
    font-weight: 600;
    color: var(--text);
}

.news-impact {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.news-impact.high-impact {
    background: rgba(239, 83, 80, 0.1);
    color: var(--sell);
}

.news-impact.medium-impact {
    background: rgba(240, 185, 11, 0.1);
    color: var(--warn);
}

.news-impact.low-impact {
    background: rgba(33, 150, 243, 0.1);
    color: var(--info);
}

.news-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 8px 0;
}

.news-details {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-dim);
}

.news-time {
    font-family: var(--font-data);
}

.news-actual,
.news-forecast {
    font-family: var(--font-data);
    font-weight: 600;
}

/* Analysis Panel Section */
.analysis-panel-section {
    grid-column: span 2;
}

.analysis-container {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.analysis-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-faint);
}

.analysis-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.analysis-card.geopolitical {
    border-left: 4px solid var(--warn);
}

.analysis-card.employment {
    border-left: 4px solid var(--info);
}

.analysis-card.rate-logistics {
    border-left: 4px solid var(--buy);
}

.analysis-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.analysis-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.analysis-region {
    font-size: 12px;
    color: var(--text-dim);
    padding: 2px 8px;
    background: var(--panel-alt);
    border-radius: 4px;
}

.analysis-body {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
}

.analysis-metric {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.metric-label {
    font-size: 12px;
    color: var(--text-faint);
}

.metric-value {
    font-size: 12px;
    font-family: var(--font-data);
    font-weight: 600;
    color: var(--text);
}

.metric-value.positive {
    color: var(--buy);
}

.metric-value.negative {
    color: var(--sell);
}

/* Market Data Section */
.market-table-container {
    overflow-x: auto;
}

.market-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.market-table th {
    background: var(--panel-sunken);
    color: var(--text-dim);
    font-weight: 600;
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.market-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.market-row:hover {
    background: var(--panel-alt);
}

.market-symbol {
    font-family: var(--font-data);
    font-weight: 600;
    color: var(--text);
}

.market-bid,
.market-ask {
    font-family: var(--font-data);
    color: var(--text);
}

.market-spread {
    font-family: var(--font-data);
    color: var(--text-dim);
}

.market-change.positive,
.market-change-percent.positive {
    color: var(--accent);
}

.market-change.negative,
.market-change-percent.negative {
    color: var(--sell);
}

.loading-row,
.error-row {
    text-align: center;
    color: var(--text-dim);
    padding: 20px;
}

/* Signals Section */
.signals-container {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.signals-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-faint);
}

.signal-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid var(--text-dim);
}

.signal-card.buy {
    border-left-color: var(--accent);
}

.signal-card.sell {
    border-left-color: var(--sell);
}

.signal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.signal-symbol {
    font-weight: 600;
    color: var(--text);
}

.signal-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.signal-detail {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.signal-detail .label {
    color: var(--text-dim);
}

.signal-detail .value {
    font-family: var(--font-data);
    color: var(--text);
}

.signal-detail .value.tp {
    color: var(--accent);
}

.signal-detail .value.sl {
    color: var(--sell);
}

/* News Section */
.news-container {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.news-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-faint);
}

.news-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid var(--text-dim);
}

.news-card.high-impact {
    border-left-color: var(--sell);
}

.news-card.medium-impact {
    border-left-color: var(--warn);
}

.news-card.low-impact {
    border-left-color: var(--info);
}

.news-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.news-country {
    font-weight: 600;
    color: var(--text);
}

.news-impact {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.news-impact.high-impact {
    background: rgba(239, 83, 80, 0.1);
    color: var(--sell);
}

.news-impact.medium-impact {
    background: rgba(240, 185, 11, 0.1);
    color: var(--warn);
}

.news-impact.low-impact {
    background: rgba(33, 150, 243, 0.1);
    color: var(--info);
}

.news-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 8px 0;
}

.news-details {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-dim);
}

.news-time {
    font-family: var(--font-data);
}

.news-actual,
.news-forecast {
    font-family: var(--font-data);
    font-weight: 600;
}

.loading-spinner-text {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
}

.loading-text {
    color: var(--text-dim);
    font-size: 14px;
}

/* Signal History Panel */
.signal-history-panel {
    flex: 1;
    overflow-y: auto;
    background: var(--panel-sunken);
    border-radius: 0 0 8px 8px;
}

.signal-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
}

.signal-history-table {
    width: 100%;
    border-collapse: collapse;
}

.signal-exit {
    font-family: var(--font-data);
    font-weight: 600;
}

.signal-result {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
}

.result-win {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.result-loss {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.signal-pnl {
    font-family: var(--font-data);
    font-weight: 600;
}

.pnl-positive {
    color: #22c55e;
}

.pnl-negative {
    color: #ef4444;
}

.history-row {
    transition: background-color 0.2s ease;
}

.history-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* HTF Column Styling */
.signal-htf {
    font-size: 13px;
    font-weight: 600;
}

.htf-good {
    color: #22c55e;
}

.htf-warning {
    color: #f59e0b;
}

@media (max-width: 1200px) {
    .boomerang-grid {
        grid-template-columns: 1fr;
    }
    
    .youtube-section {
        grid-column: span 1;
    }
}


/* ---------- Terminal Redesign page (/terminal/) ---------- */
.terminal-redesign-layout {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--border);
    height: calc(100vh - 49px);
    overflow: hidden;
}

.terminal-top-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
    flex: 0 0 auto;
    height: 50vh;
    overflow: hidden;
}

.terminal-bottom-row {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.terminal-section {
    background: var(--panel);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--panel-alt);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.section-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.status-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-badge.live {
    background: rgba(38, 166, 154, 0.2);
    color: var(--accent);
}

.status-badge.paused {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-dim);
}

.section-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-controls input[type="text"],
.section-controls select {
    background: var(--panel-alt);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-family: var(--font-ui);
    font-size: 12.5px;
}

.btn-toggle {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.signal-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
}

/* Market Overview Section */
.market-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
}

.stat-card {
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    font-family: var(--font-data);
}

.stat-value.buy {
    color: var(--buy);
}

.stat-value.sell {
    color: var(--sell);
}

.market-watchlist {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.watchlist-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--panel-alt);
}

.watchlist-header h3 {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
}

.watchlist-items {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.watchlist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--panel-alt);
    border-radius: 6px;
    margin-bottom: 8px;
}

.watchlist-item:last-child {
    margin-bottom: 0;
}

.watchlist-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.watchlist-item-change {
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-data);
}

.watchlist-item-change.positive {
    color: var(--buy);
}

.watchlist-item-change.negative {
    color: var(--sell);
}

/* Signals Section */
.signals-table-container {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.signals-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.signals-table thead th {
    position: sticky;
    top: 0;
    background: var(--panel-alt);
    padding: 12px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    z-index: 10;
}

.signals-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

.signals-table tbody tr:hover {
    background: var(--panel-alt);
}

.signals-empty {
    text-align: center;
    color: var(--text-dim);
}

@media (max-width: 1200px) {
    .terminal-top-row {
        grid-template-columns: 1fr;
        max-height: none;
    }
    
    .market-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.ai-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--panel-alt);
    flex-shrink: 0;
}

.ai-section-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ai-status-indicator {
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ai-status-indicator.live {
    background: rgba(38, 166, 154, 0.2);
    color: var(--accent);
}

.ai-status-indicator:not(.live) {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-dim);
}

/* Live News Section */
.channel-tabs {
    display: flex;
    gap: 2px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
    flex-shrink: 0;
    overflow-x: auto;
}

.channel-tab {
    padding: 8px 12px;
    background: var(--panel-alt);
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.channel-tab:hover {
    background: var(--border);
}

.channel-tab.active {
    background: var(--sell);
    color: white;
}

.live-news-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 1px;
    background: var(--border);
    min-height: 0;
    overflow: hidden;
}

.main-video-area {
    background: #000;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.main-video-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 0;
    width: 100%;
}

.main-video-container iframe,
.main-video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
}

.breaking-news-ticker {
    height: 36px;
    background: var(--nav-bg);
    border-top: 1px solid var(--border);
    overflow: hidden;
    flex-shrink: 0;
}

.breaking-news-ticker .ticker-track {
    display: flex;
    align-items: center;
    height: 100%;
    animation: ticker-scroll 30s linear infinite;
}

.breaking-news-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    font-family: var(--font-ui);
    font-size: 12px;
    border-right: 1px solid var(--nav-border);
    color: var(--nav-text);
    white-space: nowrap;
}

.breaking-news-item .breaking-label {
    background: var(--sell);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 2px;
}

.side-videos {
    background: var(--panel);
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
}

.side-video-item {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #1a1d23;
}

.side-video-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    z-index: 10;
}

.side-video-container {
    width: 100%;
    height: 100%;
}

.side-video-container iframe,
.side-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
}

/* Live Webcams Section */
.webcam-filter-tabs {
    display: flex;
    gap: 2px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
    flex-shrink: 0;
    overflow-x: auto;
}

.filter-tab {
    padding: 8px 12px;
    background: var(--panel-alt);
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.filter-tab:hover {
    background: var(--border);
}

.filter-tab.active {
    background: var(--sell);
    color: white;
}

.webcam-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: var(--border);
    overflow-y: auto;
    padding: 1px;
    min-height: 0;
}

.webcam-item {
    background: #1a1d23;
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.webcam-item iframe,
.webcam-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    position: absolute;
    top: 0;
    left: 0;
}

.webcam-placeholder {
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 500;
}

.webcam-empty {
    grid-column: span 2;
    padding: 32px;
    text-align: center;
    color: var(--text-dim);
    font-size: 14px;
}

.webcam-label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    z-index: 10;
}

.webcam-timestamp {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--accent);
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: var(--font-data);
    z-index: 10;
}

/* AI Insights Section */
.insights-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    overflow-y: auto;
    min-height: 0;
}

.world-brief-panel {
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    flex-shrink: 0;
}

.strategic-posture-panel {
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    flex: 1;
    min-height: 0;
}

.insights-subheader {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
}

.new-indicator {
    background: var(--accent);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
}

.world-brief-text {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
}

.posture-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.posture-card {
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.posture-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.posture-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.posture-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.posture-tag.crit {
    background: rgba(239, 83, 80, 0.2);
    color: var(--sell);
}

.posture-card-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.posture-metric {
    text-align: center;
}

.posture-metric-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.posture-metric-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    font-family: var(--font-data);
}

.posture-arrow {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--accent);
}

.posture-status {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
}
.terminal-controls select,
.terminal-controls input[type="text"] {
    background: var(--panel-alt);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-family: var(--font-ui);
    font-size: 12.5px;
}
.terminal-controls input[type="text"] { width: 160px; }

.terminal-panel { background: var(--panel); }
.terminal-table {
    font-size: 14px;
}
.terminal-table thead th {
    font-size: 11px;
    padding: 10px 14px;
}
.terminal-table tbody td {
    padding: 12px 14px;
}
.terminal-table .market-name { font-size: 14px; font-weight: 600; }
.terminal-table .market-analysis { font-size: 11.5px; }

/* ---------- Live News Grid (Terminal page) ---------- */
.terminal-layout {
    grid-template-rows: auto 1fr;
    grid-template-columns: 1fr;
    gap: 1px;
    background: var(--border);
}

.news-col {
    background: var(--panel);
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 450px;
}

.news-header {
    flex-shrink: 0;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.news-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.news-grid {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    min-height: 0;
}

.news-grid-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #1a1d23;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.news-grid-item iframe,
.news-grid-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    display: block;
}

.news-grid-item:hover {
    border-color: var(--accent);
}

.news-grid-item .news-channel-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    font-weight: 700;
    color: var(--text-dim);
}

.news-grid-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 12px;
    pointer-events: none;
}

.news-grid-name {
    color: white;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-grid-region {
    color: var(--text-faint);
    font-size: 11px;
    margin-top: 2px;
}

/* Terminal page ticker - positioned below navigation */
.terminal-layout .news-ticker {
    height: 36px;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

.terminal-layout .news-ticker .ticker-track {
    display: flex;
    align-items: center;
    height: 100%;
    animation: ticker-scroll 42s linear infinite;
}

.terminal-layout .news-ticker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    font-family: var(--font-ui);
    font-size: 12px;
    border-right: 1px solid var(--nav-border);
    color: var(--nav-text);
    white-space: nowrap;
}

.terminal-layout .news-ticker-item .news-ticker-time {
    color: var(--accent);
    font-weight: 600;
}

.terminal-layout .news-ticker-item .news-ticker-headline {
    color: var(--nav-text-strong);
    font-weight: 500;
}

.news-grid {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.news-channel-card {
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    position: relative;
}

.news-channel-card:hover {
    border-color: var(--brand);
    box-shadow: var(--shadow-sm);
}

.news-channel-thumbnail {
    position: relative;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #1a1d23 0%, #2d3138 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.news-channel-icon {
    font-size: 24px;
    font-weight: 700;
    color: var(--nav-text);
    letter-spacing: 0.05em;
}

.news-channel-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 106, 0, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: transform 0.15s, background 0.15s;
    z-index: 2;
}

.news-channel-play-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
    background: var(--brand);
}

.news-channel-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(19, 23, 34, 0.8);
    color: var(--nav-text-strong);
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.news-channel-live-indicator {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--sell, #ef5350);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.03em;
    animation: news-live-pulse 2s ease-in-out infinite;
}

@keyframes news-live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

.news-channel-info {
    padding: 10px 12px;
}

.news-channel-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-channel-handle {
    font-size: 11px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-channel-player {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 10;
}

.news-channel-player iframe,
.news-channel-player video {
    width: 100%;
    height: 100%;
}

.news-loading,
.news-error,
.news-empty {
    grid-column: 1 / -1;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
}

.news-error {
    color: var(--sell);
}

@media (max-width: 1100px) {
    .terminal-layout {
        grid-template-rows: auto 1fr;
        grid-template-columns: 1fr;
    }

    .news-col {
        display: none;
    }
}

/* ---------- responsive page refinements ---------- */
/* The terminal currently has a single top section, so it should fill the row. */
.terminal-top-row { grid-template-columns: 1fr; }
.live-news-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    flex: 1;
    min-height: 0;
    background: var(--border);
    gap: 1px;
    overflow: hidden;
}

@media (max-width: 768px) {
    /* Reserve space for fixed navigation bar */
    body { padding-top: 52px; }

    .layout {
        min-height: calc(100dvh - 52px);
    }

    .chart-col,
    #chart-container {
        min-height: calc(100dvh - 52px);
    }

    /* Keep every page vertically scrollable; desktop sizing remains unchanged. */
    .ai-strategy-layout,
    .terminal-redesign-layout,
    .performance-layout {
        height: auto;
        min-height: calc(100dvh - 52px);
        overflow: visible;
    }

    .ai-insights-col,
    .ai-strategy-col,
    .ai-split-col,
    .terminal-section {
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .ai-insights-panel,
    .ai-split-col.live-news-section,
    .ai-split-col.ai-news-section {
        overflow: visible;
    }

    .ai-split-section {
        grid-template-columns: 1fr;
    }

    .ai-news-section {
        padding: 12px;
    }

    .mn-filter {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .mn-filter input,
    .mn-filter select,
    .mn-filter button {
        width: 100%;
        min-height: 40px;
    }

    .performance-layout {
        padding: 12px;
    }

    .performance-header .analysis-controls {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .performance-header .search-input {
        grid-column: 1 / -1;
    }

    .performance-header .analysis-controls input,
    .performance-header .analysis-controls select {
        width: 100%;
        min-width: 0;
        min-height: 38px;
        margin: 0;
    }

    .performance-panel,
    .ai-news-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .ai-news-table { min-width: 680px; }

    .performance-table,
    .performance-table tbody,
    .performance-table tr,
    .performance-table td {
        display: block;
        width: 100%;
    }

    .performance-table { min-width: 0; }
    .performance-table thead { display: none; }
    .performance-table tbody tr {
        position: relative;
        margin: 8px;
        padding: 10px 12px;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: var(--panel);
    }

    .performance-table tbody td {
        position: relative;
        min-height: 28px;
        padding: 5px 0 5px 46%;
        border: 0;
        text-align: right;
        overflow-wrap: anywhere;
    }

    .performance-table tbody td::before {
        position: absolute;
        left: 0;
        width: 42%;
        color: var(--text-dim);
        font-family: var(--font-ui);
        font-size: 10px;
        font-weight: 600;
        letter-spacing: .04em;
        text-align: left;
        text-transform: uppercase;
    }

    .performance-table td:nth-child(1)::before { content: "Market"; }
    .performance-table td:nth-child(2)::before { content: "Direction"; }
    .performance-table td:nth-child(3)::before { content: "Entry"; }
    .performance-table td:nth-child(4)::before { content: "Exit"; }
    .performance-table td:nth-child(5)::before { content: "Stop loss"; }
    .performance-table td:nth-child(6)::before { content: "Take profit"; }
    .performance-table td:nth-child(7)::before { content: "Result"; }
    .performance-table td:nth-child(8)::before { content: "PnL"; }
    .performance-table td:nth-child(9)::before { content: "Risk / reward"; }
    .performance-table td:nth-child(10)::before { content: "Closed"; }
    .performance-table .signal-history-empty {
        padding: 18px 12px;
        text-align: center;
    }
    .performance-table .signal-history-empty::before { display: none; }

    .terminal-top-row {
        height: auto;
        min-height: 0;
    }

    .live-news-grid {
        grid-template-columns: 1fr;
        overflow: visible;
    }

    .main-video-area {
        aspect-ratio: 16 / 9;
        min-height: 0;
    }

    .side-videos {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: visible;
    }

    .side-video-item {
        aspect-ratio: 16 / 9;
    }
}

@media (max-width: 480px) {
    .performance-stats { grid-template-columns: 1fr 1fr; }
    .news-header h1 { font-size: 18px; }
    .ff-head-row, .ff-row { grid-template-columns: 55px 40px minmax(0, 1fr); }
    .ff-head-row .ff-col:nth-child(2), .ff-row .ff-col-cur { display: none; }
    
    /* Hide TradingView chart header elements on mobile */
    .chart-col .tv-header-toolbar,
    .chart-col .tv-symbol-search-dialog,
    .chart-col .tv-toolbar {
        display: none !important;
    }
    
    /* Hide market ticker on mobile */
    .market-ticker,
    .tradingview-widget-container {
        display: none !important;
    }
    
    /* Improve chart container on mobile */
    .chart-col {
        padding: 0;
        height: calc(100vh - 52px);
    }
    
    #chart-container {
        height: 100%;
    }
}

/* ==========================================================================
   Comprehensive Whole-Site Mobile Responsiveness Baseline
   ========================================================================== */
@media (max-width: 768px) {
    html {
        overflow-x: hidden;
        -webkit-text-size-adjust: 100%;
    }
    body {
        min-width: 320px;
        padding-top: 50px !important;
        overflow-x: hidden;
        -webkit-font-smoothing: antialiased;
    }

    /* Fixed top navigation bar */
    .topbar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 50px !important;
        z-index: 2000 !important;
        background: var(--nav-bg) !important;
        border-bottom: 1px solid var(--nav-border) !important;
        padding: 0 14px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .mobile-menu-btn {
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 8px;
        cursor: pointer;
        background: transparent;
        color: var(--nav-text-strong);
    }

    .brand {
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 0;
    }
    .brand-logo { width: 24px; height: 24px; }
    .brand-text { font-size: 13px; font-weight: 800; letter-spacing: 0.03em; }

    /* Hide desktop-only tickers and status strips on mobile */
    .market-ticker,
    .tradingview-widget-container,
    .deriv-ticker-container,
    .conn-status,
    .topbar .auth-status {
        display: none !important;
    }

    /* Off-canvas mobile navigation drawer */
    .main-nav {
        position: fixed !important;
        top: 50px !important;
        left: 0 !important;
        bottom: 0 !important;
        width: min(300px, 84vw) !important;
        background: var(--nav-bg) !important;
        flex-direction: column !important;
        gap: 0 !important;
        padding: 8px 0 24px !important;
        transform: translateX(-105%) !important;
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 2005 !important;
        overflow-y: auto !important;
        box-shadow: 6px 0 24px rgba(0, 0, 0, 0.16) !important;
        border-right: 1px solid var(--nav-border) !important;
    }

    .main-nav.open {
        transform: translateX(0) !important;
    }

    .main-nav a {
        min-height: 48px;
        padding: 14px 18px;
        font-size: 15px;
        font-weight: 600;
        border-bottom: 1px solid var(--nav-border);
        color: var(--nav-text);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .main-nav a::after {
        content: '›';
        font-size: 18px;
        color: var(--text-faint);
    }
    .main-nav a.active {
        background: rgba(255, 106, 0, 0.08);
        color: var(--brand);
    }

    .mobile-menu-overlay {
        position: fixed !important;
        top: 50px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: rgba(15, 23, 42, 0.45) !important;
        backdrop-filter: blur(2px);
        z-index: 2004 !important;
    }

    /* Full-screen and layout wrappers */
    .layout,
    .layout-full {
        height: auto !important;
        min-height: calc(100vh - 50px);
        min-height: calc(100dvh - 50px);
        width: 100% !important;
        overflow-x: hidden;
    }

    /* Chart page on mobile */
    .chart-col {
        padding: 0 !important;
        width: 100% !important;
        height: calc(100vh - 50px) !important;
        height: calc(100dvh - 50px) !important;
        min-height: 440px !important;
        position: relative;
    }

    #chart-container {
        width: 100% !important;
        height: 100% !important;
    }

    /* Mobile Floating Action Buttons (Thumb safe-zones) */
    .scanner-fab {
        position: fixed !important;
        right: 18px !important;
        bottom: 22px !important;
        top: auto !important;
        transform: none !important;
        width: 50px !important;
        height: 50px !important;
        z-index: 1000 !important;
        box-shadow: 0 4px 16px rgba(255, 106, 0, 0.4);
    }
    .scanner-fab-icon { width: 30px !important; height: 30px !important; }

    .brain-icon-overlay {
        position: fixed !important;
        left: 18px !important;
        bottom: 22px !important;
        top: auto !important;
        z-index: 1000 !important;
        width: 44px !important;
        height: 44px !important;
        border-radius: 50%;
        background: #ffffff;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* AI Slide-out Drawers on mobile (Full width, no cutoff) */
    .brain-panel,
    .news-ai-panel {
        top: 50px !important;
        height: calc(100vh - 50px) !important;
        height: calc(100dvh - 50px) !important;
        width: 100vw !important;
        max-width: 100% !important;
        right: -100vw !important;
        z-index: 2010 !important;
    }
    .brain-panel.open,
    .news-ai-panel.open {
        right: 0 !important;
    }

    /* AI Scanner Modal on mobile */
    .scanner-modal-content {
        width: calc(100vw - 16px) !important;
        max-width: 460px !important;
        max-height: calc(100dvh - 30px) !important;
        margin: 0 auto !important;
        border-radius: 16px !important;
        z-index: 2020 !important;
    }

    /* Performance Page on mobile */
    .performance-col {
        padding: 16px 12px 32px !important;
        width: 100%;
        box-sizing: border-box;
    }

    .performance-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        margin: 12px 0 16px !important;
    }

    .perf-stat-card {
        padding: 10px 12px !important;
    }
    .perf-stat-value {
        font-size: 18px !important;
    }

    .performance-filters {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }
    .performance-filters input,
    .performance-filters select {
        width: 100% !important;
        min-width: 0 !important;
    }

    .performance-panel {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Stocks Page on mobile */
    .stocks-page {
        min-height: calc(100dvh - 50px) !important;
        padding: 12px 10px 32px !important;
        box-sizing: border-box;
    }
    .stocks-content {
        width: 100% !important;
    }
    .gap-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        display: grid !important;
        gap: 8px !important;
    }
    .gap-table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        border-radius: 10px !important;
    }
    /* Signals Page on mobile */
    .signals-col {
        padding: 12px 10px 36px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }
    .signals-cards-container {
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .signals-table-container {
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* General touch accessibility */
    button, select, input, textarea {
        font-size: 15px;
    }
    .btn, button, .login-btn, .signup-btn, .logout-btn {
        min-height: 42px;
    }
}
