
        :root {
            --bg-primary: #06060A;
            --bg-secondary: #0C0C12;
            --bg-card: rgba(255, 255, 255, 0.025);
            --bg-card-hover: rgba(255, 255, 255, 0.05);
            --border-card: rgba(255, 255, 255, 0.06);
            --border-focus: rgba(139, 92, 246, 0.5);
            --accent: #8B5CF6;
            --accent-light: #A78BFA;
            --accent-glow: 0 0 20px rgba(139, 92, 246, 0.15);
            --neon-green: #00FF88;
            --neon-red: #FF3366;
            --neon-blue: #00D4FF;
            --neon-purple: #A855F7;
            --neon-yellow: #FFD700;
            --success: #10B981;
            --danger: #EF4444;
            --warning: #F59E0B;
            --text-primary: #F1F5F9;
            --text-secondary: #64748B;
            --text-muted: #3B3B4F;
            --radius: 14px;
            --radius-sm: 10px;
            --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
            --glass-bg: rgba(255, 255, 255, 0.03);
            --glass-border: rgba(255, 255, 255, 0.08);
        }

        :root.light-theme {
            --bg-primary: #F1F5F9;
            --bg-secondary: #FFFFFF;
            --bg-card: #FFFFFF;
            --bg-card-hover: #F8FAFC;
            --border-card: #E2E8F0;
            --border-focus: rgba(139, 92, 246, 0.5);
            --accent: #7C3AED;
            --accent-light: #8B5CF6;
            --accent-glow: 0 4px 15px rgba(139, 92, 246, 0.2);
            --neon-green: #059669;
            --neon-red: #E11D48;
            --neon-blue: #0284C7;
            --neon-purple: #9333EA;
            --neon-yellow: #D97706;
            --success: #10B981;
            --danger: #EF4444;
            --warning: #F59E0B;
            --text-primary: #0F172A;
            --text-secondary: #475569;
            --text-muted: #94A3B8;
            --glass-bg: rgba(255, 255, 255, 0.8);
            --glass-border: rgba(0, 0, 0, 0.05);
        }

        /* ── Efeitos Específicos do Light Theme ── */
        .light-theme .kpi-card {
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
            border: 1px solid var(--border-card);
        }

        .light-theme .panel {
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
            border: 1px solid var(--border-card);
        }

        .light-theme .sidebar-brand .caos {
            text-shadow: none;
            background: linear-gradient(135deg, var(--accent), #9333EA);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        /* ── Light theme: fullscreen chart ── */
        .light-theme .chart-main.chart-fullscreen {
            background: #F1F5F9 !important;
        }
        .light-theme #fs-info-panel {
            background: linear-gradient(180deg, rgba(255,255,255,0.97) 0%, rgba(248,250,252,0.98) 100%);
            border-left-color: rgba(139,92,246,0.2);
            box-shadow: -6px 0 24px rgba(0,0,0,0.08);
        }
        .light-theme #fs-info-panel .fs-section {
            border-bottom-color: rgba(0,0,0,0.06);
        }
        .light-theme #fs-clock {
            color: #0F172A;
            text-shadow: none;
        }
        .light-theme #fs-date { color: #64748B; }
        .light-theme #fs-asset-name { color: #64748B; }
        .light-theme #fs-price-big { color: #0F172A; }
        .light-theme .fs-ind-cell {
            background: rgba(0,0,0,0.03);
            border-color: rgba(0,0,0,0.07);
        }
        .light-theme .fs-ind-cell .fs-ind-label { color: #94A3B8; }
        .light-theme #fs-wl-list .fs-wl-row:hover { background: rgba(0,0,0,0.04); }
        .light-theme .fs-wl-price { color: #475569; }
        /* light theme: RSI/MACD watermark text already transparent, chart bg transparent so fine */

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
        }

        canvas,
        svg,
        img {
            max-width: 100%;
            height: auto;
        }

        body {
            font-family: 'Inter', -apple-system, sans-serif;
            background: var(--bg-primary);
            color: var(--text-primary);
            min-height: 100vh;
            display: flex;
            overflow: hidden
        }

        ::-webkit-scrollbar {
            width: 5px
        }

        ::-webkit-scrollbar-track {
            background: transparent
        }

        ::-webkit-scrollbar-thumb {
            background: var(--text-muted);
            border-radius: 3px
        }

        /* ── SIDEBAR ── */
        .sidebar {
            width: 220px;
            min-width: 220px;
            height: 100vh;
            background: var(--bg-secondary);
            border-right: 1px solid var(--border-card);
            display: flex;
            flex-direction: column
        }

        .sidebar-brand {
            padding: 20px 16px;
            border-bottom: 1px solid var(--border-card)
        }

        .sidebar-brand h1 {
            font-size: 18px;
            font-weight: 800;
            letter-spacing: -0.5px
        }

        .sidebar-brand .caos {
            background: linear-gradient(135deg, var(--accent), #C084FC);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent
        }

        .sidebar-brand .marada {
            color: var(--text-primary);
            font-weight: 300
        }

        .sidebar-brand p {
            font-size: 10px;
            color: var(--text-secondary);
            margin-top: 3px;
            letter-spacing: 1.5px;
            text-transform: uppercase
        }

        .sidebar-nav {
            flex: 1;
            padding: 10px 6px;
            display: flex;
            flex-direction: column;
            gap: 1px;
            overflow-y: auto
        }

        .nav-section {
            font-size: 9px;
            text-transform: uppercase;
            letter-spacing: 1.5px;
            color: var(--text-muted);
            padding: 14px 12px 6px;
            font-weight: 600
        }

        .nav-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 9px 12px;
            border-radius: var(--radius-sm);
            cursor: pointer;
            transition: all var(--transition);
            font-size: 12.5px;
            font-weight: 500;
            color: var(--text-secondary);
            text-decoration: none;
            position: relative
        }

        .nav-item:hover {
            background: var(--bg-card-hover);
            color: var(--text-primary)
        }

        @media (hover: none) and (pointer: coarse) {
            .nav-item:hover {
                background: transparent;
                color: var(--text-secondary);
            }

            .nav-item.active:hover {
                background: rgba(139, 92, 246, 0.1);
                color: var(--accent-light);
            }
        }

        .nav-item.active {
            background: rgba(139, 92, 246, 0.1);
            color: var(--accent-light)
        }

        .nav-item.active::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 3px;
            height: 18px;
            background: var(--accent);
            border-radius: 0 3px 3px 0
        }

        .nav-item .icon {
            font-size: 14px;
            width: 18px;
            text-align: center
        }

        .nav-item .badge {
            margin-left: auto;
            background: rgba(139, 92, 246, 0.15);
            color: var(--accent-light);
            font-size: 10px;
            padding: 2px 7px;
            border-radius: 8px;
            font-weight: 600
        }

        .sidebar-footer {
            padding: 12px 16px;
            border-top: 1px solid var(--border-card);
            text-align: center
        }

        .sidebar-footer p {
            font-size: 9px;
            color: var(--text-muted)
        }

        .status-dot {
            display: inline-block;
            width: 7px;
            height: 7px;
            border-radius: 50%;
            background: var(--success);
            margin-right: 5px;
            animation: pulse 2s ease-in-out infinite
        }

        @keyframes pulse {

            0%,
            100% {
                opacity: 1;
                box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4)
            }

            50% {
                opacity: .8;
                box-shadow: 0 0 0 5px rgba(16, 185, 129, 0)
            }
        }

        /* ── MAIN ── */
        .main {
            flex: 1;
            height: 100vh;
            overflow-y: auto;
            padding: 24px 28px
        }

        .page {
            display: none;
            animation: fadeIn 300ms ease
        }

        .page.active {
            display: block
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(6px)
            }

            to {
                opacity: 1;
                transform: translateY(0)
            }
        }

        .page-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 20px
        }

        .page-header h2 {
            font-size: 20px;
            font-weight: 700;
            letter-spacing: -0.3px
        }

        .page-header .subtitle {
            font-size: 11px;
            color: var(--text-secondary);
            margin-top: 2px
        }

        /* ── KPI STRIP ── */
        .kpi-strip {
            display: grid;
            grid-template-columns: repeat(6, 1fr);
            gap: 12px;
            margin-bottom: 20px
        }

        .kpi-card {
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius);
            padding: 14px 16px;
            cursor: pointer;
            transition: all var(--transition);
            position: relative;
            overflow: hidden;
            container-type: inline-size;
        }

        .kpi-card:hover {
            border-color: rgba(139, 92, 246, 0.3);
            box-shadow: var(--accent-glow);
            transform: translateY(-2px)
        }

        .kpi-card.selected {
            border-color: var(--accent);
            box-shadow: 0 0 25px rgba(139, 92, 246, 0.2)
        }

        .kpi-card .kpi-label {
            font-size: 0.625rem;
            /* 10px */
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            font-weight: 600
        }

        .kpi-card .kpi-price {
            font-size: 1.125rem;
            /* 18px */
            font-weight: 700;
            margin: 4px 0 2px;
            letter-spacing: -0.5px
        }

        .kpi-card .kpi-change {
            font-size: 11px;
            font-weight: 600
        }

        .kpi-card .kpi-change.up {
            color: var(--neon-green)
        }

        .kpi-card .kpi-change.down {
            color: var(--neon-red)
        }

        .kpi-card .kpi-sparkline {
            position: absolute;
            bottom: 0;
            right: 0;
            width: 80px;
            height: 30px;
            opacity: 0.4
        }

        /* ── CHART AREA ── */
        .chart-grid {
            display: block;
            margin-bottom: 0;
        }

        .chart-main {
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius);
            padding: 16px;
            min-height: 420px;
            container-type: inline-size;
        }

        /* ── Watchlist horizontal compact strip ── */
        .watchlist-compact {
            display: flex;
            gap: 6px;
            overflow-x: auto;
            padding: 10px 0 14px;
            scrollbar-width: thin;
            scrollbar-color: rgba(139,92,246,0.3) transparent;
        }
        .watchlist-compact::-webkit-scrollbar { height: 3px; }
        .watchlist-compact::-webkit-scrollbar-track { background: transparent; }
        .watchlist-compact::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.35); border-radius: 2px; }
        .wl-chip {
            flex-shrink: 0;
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            border-radius: 10px;
            padding: 7px 12px;
            cursor: pointer;
            transition: all 0.15s;
            display: flex;
            align-items: center;
            gap: 10px;
            min-width: 110px;
        }
        .wl-chip:hover { border-color: rgba(139,92,246,0.35); background: rgba(139,92,246,0.06); }
        .wl-chip.active { border-color: rgba(139,92,246,0.55); background: rgba(139,92,246,0.12); }
        .wl-chip-left .wl-chip-ticker { font-size: 11px; font-weight: 700; color: var(--text-primary); line-height: 1; }
        .wl-chip-left .wl-chip-name   { font-size: 9px; color: var(--text-muted); margin-top: 2px; max-width: 70px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .wl-chip-right { text-align: right; }
        .wl-chip-price  { font-size: 11px; font-weight: 600; font-family: 'JetBrains Mono', monospace; white-space: nowrap; }
        .wl-chip-change { font-size: 10px; font-weight: 600; }

        .chart-main .chart-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 12px
        }

        .chart-main .chart-title {
            font-size: 14px;
            font-weight: 600
        }

        .chart-main .chart-periods {
            display: flex;
            gap: 3px;
            align-items: center;
        }

        .chart-main .chart-periods button {
            background: var(--bg-card);
            border: 1px solid var(--border-card);
            color: var(--text-secondary);
            padding: 4px 8px;
            border-radius: 6px;
            font-size: 10px;
            cursor: pointer;
            font-family: inherit;
            font-weight: 500;
            transition: all var(--transition);
            white-space: nowrap;
        }

        .chart-main .chart-periods button.active,
        .chart-main .chart-periods button:hover {
            background: var(--accent);
            color: #fff;
            border-color: var(--accent);
        }

        .chart-main .chart-periods .period-sep {
            width: 1px;
            height: 16px;
            background: var(--border-card);
            margin: 0 2px;
            flex-shrink: 0;
        }

        #tv-chart-container {
            width: 100%;
            height: 540px;
            border-radius: 8px;
            overflow: hidden;
            transition: height 0.2s ease;
        }

        /* ── CHART FULLSCREEN (flex ROW: chart area + info panel) ── */
        body.fs-active .sidebar,
        body.fs-active .sidebar-overlay { display: none !important; }

        .chart-main.chart-fullscreen {
            position: fixed !important;
            top: 0; left: 0; right: 0; bottom: 0;
            z-index: 9999;
            background: #07071a;
            border-radius: 0 !important;
            display: flex !important;
            flex-direction: row !important;   /* KEY CHANGE: chart + info side by side */
            gap: 0;
            overflow: hidden;
            margin: 0 !important;
            border: none !important;
            padding: 0 !important;
        }
        /* Chart area: fills remaining space */
        .chart-main.chart-fullscreen #fs-chart-area {
            flex: 1;
            min-width: 0;
            display: flex;
            flex-direction: column;
            padding: 14px 16px 8px 16px;
            overflow: hidden;
            position: relative;
        }
        .chart-main.chart-fullscreen .chart-toolbar { flex-shrink: 0; margin-bottom: 8px; }
        .chart-main.chart-fullscreen #ohlc-legend { flex-shrink: 0; }
        .chart-main.chart-fullscreen #tv-chart-container { flex: 1; height: auto !important; min-height: 0 !important; border-radius: 4px; }
        .chart-main.chart-fullscreen #rsi-chart-container,
        .chart-main.chart-fullscreen #macd-chart-container { flex-shrink: 0; }

        /* ── CHART LOADING OVERLAY — desativado (atrapalha visualização) ── */
        #chart-loading-overlay { display: none !important; }

        /* ── RSI / MACD containers ── */
        #rsi-chart-container  { position: relative; height: 130px; }
        #macd-chart-container { position: relative; height: 130px; }

        /* ── FULLSCREEN INFO PANEL (command center) ── */
        #fs-info-panel {
            display: none;
            width: 360px;
            flex-shrink: 0;
            flex-direction: column;
            gap: 0;
            overflow: hidden;
            background: linear-gradient(180deg, rgba(7,7,26,0.95) 0%, rgba(10,10,32,0.98) 100%);
            backdrop-filter: blur(28px);
            border-left: 1px solid rgba(139,92,246,0.22);
            box-shadow: -12px 0 40px rgba(0,0,0,0.5);
        }
        .chart-main.chart-fullscreen #fs-info-panel { display: flex; }

        #fs-info-panel .fs-section {
            padding: 12px 14px;
            border-bottom: 1px solid rgba(255,255,255,0.05);
            flex-shrink: 0;
        }
        #fs-info-panel .fs-section.fs-scroll { flex: 1; overflow-y: auto; min-height: 0; flex-shrink: 1; }
        .fs-section-title {
            font-size: 9px; color: var(--text-muted);
            text-transform: uppercase; letter-spacing: 1.2px;
            margin-bottom: 8px; font-weight: 600;
        }
        /* ONNX snapshot cards */
        .fs-onnx-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; }
        .fs-onnx-card {
            background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07);
            border-radius: 7px; padding: 6px; text-align: center;
        }
        .fs-onnx-label { font-size: 9px; color: var(--text-muted); margin-bottom: 3px; }
        .fs-onnx-val   { font-size: 13px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
        .fs-onnx-chg   { font-size: 9px; font-weight: 600; }
        /* News items */
        .fs-news-item {
            padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
            cursor: pointer;
        }
        .fs-news-item:last-child { border-bottom: none; }
        .fs-news-title { font-size: 11px; color: rgba(255,255,255,0.82); line-height: 1.4; margin-bottom: 3px; }
        .fs-news-meta  { font-size: 9px; color: var(--text-muted); }

        #fs-clock {
            font-family: 'JetBrains Mono', monospace;
            font-size: 30px; font-weight: 700;
            color: rgba(255,255,255,0.92);
            letter-spacing: 2px; text-align: center;
            text-shadow: 0 0 20px rgba(139,92,246,0.5);
        }
        #fs-date {
            font-size: 11px; color: var(--text-muted);
            text-align: center; margin-top: 3px;
            text-transform: capitalize; letter-spacing: 0.3px;
        }
        #fs-asset-name {
            font-size: 11px; color: var(--text-muted);
            text-transform: uppercase; letter-spacing: 1px;
            text-align: center; margin-bottom: 4px;
        }
        #fs-price-big {
            font-family: 'JetBrains Mono', monospace;
            font-size: 28px; font-weight: 800;
            text-align: center; color: #fff;
            letter-spacing: -0.5px;
        }
        #fs-price-change-big {
            font-size: 16px; font-weight: 700;
            text-align: center; margin-top: 4px;
            letter-spacing: 0.5px;
        }
        .fs-ind-grid {
            display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
        }
        .fs-ind-cell {
            background: rgba(255,255,255,0.04);
            border: 1px solid rgba(255,255,255,0.06);
            border-radius: 8px; padding: 7px 6px; text-align: center;
        }
        .fs-ind-cell .fs-ind-label {
            font-size: 9px; color: var(--text-muted);
            text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 3px;
        }
        .fs-ind-cell .fs-ind-val {
            font-size: 17px; font-weight: 700;
            font-family: 'JetBrains Mono', monospace;
        }
        #fs-wl-list .fs-wl-row {
            display: flex; justify-content: space-between; align-items: center;
            padding: 5px 4px; border-radius: 6px;
            transition: background 0.15s;
        }
        #fs-wl-list .fs-wl-row:hover { background: rgba(255,255,255,0.04); }
        #fs-wl-row-active { background: rgba(139,92,246,0.12) !important; border: 1px solid rgba(139,92,246,0.25); }
        .fs-wl-ticker { font-size: 11px; font-weight: 700; width: 72px; }
        .fs-wl-price  { font-size: 10px; color: var(--text-secondary); font-family: 'JetBrains Mono', monospace; flex: 1; text-align: right; margin-right: 6px; }
        .fs-wl-chg    { font-size: 10px; font-weight: 600; width: 52px; text-align: right; font-family: 'JetBrains Mono', monospace; }
        #fs-regime-badge {
            display: inline-block; padding: 4px 10px; border-radius: 20px;
            font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
        }

        /* ── CHART ACTION BUTTONS ── */
        .chart-action-btn {
            background: rgba(255,255,255,0.05);
            border: 1px solid rgba(255,255,255,0.08);
            color: var(--text-secondary);
            border-radius: 6px;
            padding: 5px 9px;
            font-size: 14px;
            cursor: pointer;
            transition: background 0.15s, color 0.15s;
            line-height: 1;
        }
        .chart-action-btn:hover {
            background: rgba(139,92,246,0.2);
            color: #fff;
            border-color: rgba(139,92,246,0.4);
        }
        .chart-action-btn.active-btn {
            background: rgba(139,92,246,0.3);
            color: #fff;
            border-color: rgba(139,92,246,0.5);
        }

        /* ── WATCHLIST ── */
        .watchlist-panel {
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius);
            padding: 16px;
            max-height: 460px;
            overflow-y: auto
        }

        .watchlist-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 12px
        }

        .watchlist-header h3 {
            font-size: 13px;
            font-weight: 600
        }

        .watchlist-header button {
            background: none;
            border: none;
            color: var(--accent-light);
            font-size: 11px;
            cursor: pointer;
            font-family: inherit
        }

        .wl-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 8px;
            border-radius: 8px;
            cursor: pointer;
            transition: all var(--transition);
            border-bottom: 1px solid rgba(255, 255, 255, 0.02)
        }

        .wl-item:hover {
            background: var(--bg-card-hover)
        }

        .wl-item.active {
            background: rgba(139, 92, 246, 0.08)
        }

        .wl-item .wl-ticker {
            font-size: 12px;
            font-weight: 600
        }

        .wl-item .wl-name {
            font-size: 9px;
            color: var(--text-secondary)
        }

        .wl-item .wl-price {
            font-size: 12px;
            font-weight: 600;
            text-align: right
        }

        .wl-item .wl-change {
            font-size: 10px;
            font-weight: 600;
            text-align: right
        }

        /* ── INDICATORS ROW ── */
        .indicators-row {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 8px;
            margin-bottom: 16px;
        }

        .indicator-card {
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius);
            padding: 10px 12px;
            container-type: inline-size;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .indicator-card h4 {
            font-size: 10px;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 2px;
            font-weight: 600;
            white-space: nowrap;
        }

        .indicator-card .ind-value {
            font-size: 18px;
            font-weight: 700;
            letter-spacing: -0.5px
        }

        .indicator-card .ind-label {
            font-size: 10px;
            color: var(--text-secondary);
            margin-top: 2px
        }

        /* ── NEWS PANEL ── */
        .news-tab-btn {
            background: transparent;
            border: none;
            border-bottom: 2px solid transparent;
            color: var(--text-muted);
            padding: 8px 16px;
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
            transition: color .2s, border-color .2s;
            margin-bottom: -1px
        }
        .news-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent) }
        .news-tab-btn:hover { color: var(--text-primary) }

        .news-filter-btn {
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            color: var(--text-muted);
            padding: 3px 10px;
            border-radius: 20px;
            font-size: 11px;
            cursor: pointer;
            transition: all .15s
        }
        .news-filter-btn.active {
            background: rgba(0,212,255,.12);
            border-color: var(--accent);
            color: var(--accent)
        }

        /* ── PREMIUM NEWS ARTICLE CARDS ── */
        .news-article-card {
            background: rgba(255,255,255,0.025);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius);
            overflow: hidden;
            display: flex;
            flex-direction: column;
            cursor: pointer;
            transition: transform .22s ease, border-color .2s, box-shadow .25s;
            position: relative;
            color: inherit;
            text-decoration: none;
        }
        .news-article-card:hover {
            transform: translateY(-4px);
            border-color: rgba(139,92,246,.45);
            box-shadow: 0 12px 40px rgba(0,0,0,.28), 0 0 0 1px rgba(139,92,246,.12);
        }
        /* Image area */
        .nac-img-wrap {
            width: 100%;
            height: 155px;
            overflow: hidden;
            position: relative;
            flex-shrink: 0;
            background: rgba(139,92,246,.06);
        }
        .nac-img-wrap img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform .38s ease;
            display: block;
        }
        .news-article-card:hover .nac-img-wrap img { transform: scale(1.05) }
        .nac-img-gradient {
            position: absolute;
            bottom: 0; left: 0; right: 0;
            height: 65px;
            background: linear-gradient(transparent, rgba(6,6,10,.88));
            pointer-events: none;
        }
        .nac-img-placeholder {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100%;
        }
        /* Body */
        .nac-body {
            padding: 14px 15px 12px;
            display: flex;
            flex-direction: column;
            gap: 7px;
            flex: 1;
            min-height: 0;
        }
        .nac-meta {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 6px;
        }
        .nac-category {
            font-size: 9px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: .8px;
            color: var(--neon-blue);
            opacity: .75;
        }
        .nac-time {
            font-size: 9px;
            color: var(--text-muted);
            white-space: nowrap;
        }
        .nac-title {
            font-size: 13px;
            font-weight: 700;
            line-height: 1.45;
            color: var(--text-primary);
            display: -webkit-box;
            -webkit-line-clamp: 3;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
        .nac-summary {
            font-size: 11.5px;
            color: var(--text-secondary);
            line-height: 1.55;
            display: -webkit-box;
            -webkit-line-clamp: 3;
            -webkit-box-orient: vertical;
            overflow: hidden;
            flex: 1;
        }
        /* Footer */
        .nac-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 8px;
            padding-top: 10px;
            border-top: 1px solid var(--glass-border);
            margin-top: auto;
        }
        .nac-source {
            display: flex;
            align-items: center;
            gap: 5px;
            font-size: 9.5px;
            color: var(--text-muted);
            font-weight: 600;
            letter-spacing: .2px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
        .nac-source::before {
            content: '';
            width: 6px; height: 6px;
            border-radius: 50%;
            background: var(--neon-blue);
            flex-shrink: 0;
        }
        .nac-rel-badge {
            font-size: 9px;
            font-weight: 700;
            padding: 2px 8px;
            border-radius: 20px;
            white-space: nowrap;
            flex-shrink: 0;
        }
        .nac-rel-high { background: rgba(255,51,102,.12); color: #ff5577 }
        .nac-rel-mid  { background: rgba(255,170,0,.12);  color: #ffaa00 }
        .nac-rel-low  { background: rgba(0,255,136,.1);   color: #00cc66 }
        /* Keep old badge classes for backward compat */
        .news-rel-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 9px; font-weight: 700; letter-spacing: .5px }
        .badge-high { background: rgba(255,85,85,.15); color: #ff6666 }
        .badge-mid  { background: rgba(255,170,0,.15); color: #ffaa00 }
        .badge-low  { background: rgba(0,204,102,.15); color: #00cc66 }

        /* ── RESEARCH SEARCH PANEL ── */
        .research-search-wrap {
            display: flex;
            gap: 8px;
            margin-bottom: 20px;
            flex-wrap: wrap;
        }
        .research-search-input {
            flex: 1;
            min-width: 200px;
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm);
            color: var(--text-primary);
            padding: 10px 16px;
            font-size: 13px;
            font-family: inherit;
            outline: none;
            transition: border-color .2s, box-shadow .2s;
        }
        .research-search-input:focus {
            border-color: var(--border-focus);
            box-shadow: 0 0 0 3px rgba(139,92,246,.1);
        }
        .research-search-input::placeholder { color: var(--text-muted) }
        .research-type-btns {
            display: flex;
            gap: 4px;
            align-items: center;
        }
        .research-type-btn {
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            color: var(--text-muted);
            padding: 6px 12px;
            border-radius: 20px;
            font-size: 11px;
            font-weight: 600;
            cursor: pointer;
            transition: all .15s;
            white-space: nowrap;
        }
        .research-type-btn.active {
            background: rgba(139,92,246,.15);
            border-color: var(--accent);
            color: var(--accent);
        }
        .research-results-header {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 12px;
            flex-wrap: wrap;
        }
        .research-section-title {
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 1px;
            color: var(--text-muted);
        }
        .research-count-badge {
            background: rgba(139,92,246,.12);
            border: 1px solid rgba(139,92,246,.2);
            color: var(--accent-light);
            font-size: 10px;
            font-weight: 700;
            padding: 2px 8px;
            border-radius: 20px;
        }
        .research-card {
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius);
            padding: 16px;
            display: flex;
            flex-direction: column;
            gap: 8px;
            transition: border-color .2s, transform .15s, box-shadow .2s;
            position: relative;
            overflow: hidden;
        }
        .research-card::before {
            content: '';
            position: absolute;
            left: 0; top: 0; bottom: 0;
            width: 3px;
            background: linear-gradient(180deg, var(--accent), transparent);
            border-radius: 3px 0 0 3px;
            opacity: 0;
            transition: opacity .2s;
        }
        .research-card:hover {
            border-color: rgba(139,92,246,.35);
            transform: translateY(-2px);
            box-shadow: 0 8px 24px rgba(0,0,0,.15);
        }
        .research-card:hover::before { opacity: 1 }
        .research-card-news {
            border-left: 3px solid rgba(0,212,255,.3);
        }
        .research-card-news:hover { border-color: rgba(0,212,255,.5) }
        .research-card-news::before { background: linear-gradient(180deg, var(--neon-blue), transparent) }
        .research-card-title {
            font-size: 13px;
            font-weight: 600;
            color: var(--text-primary);
            line-height: 1.4;
        }
        .research-card-meta {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-wrap: wrap;
        }
        .research-source-badge {
            font-size: 9px;
            font-weight: 700;
            padding: 2px 7px;
            border-radius: 20px;
            letter-spacing: .4px;
            text-transform: uppercase;
        }
        .rsrc-arxiv    { background: rgba(183,110,0,.2);   color: #f59e0b }
        .rsrc-semantic { background: rgba(16,185,129,.15); color: #10b981 }
        .rsrc-pubmed   { background: rgba(0,149,246,.15);  color: #3b9cff }
        .rsrc-openalex { background: rgba(139,92,246,.15); color: var(--accent-light) }
        .rsrc-news     { background: rgba(0,212,255,.12);  color: var(--neon-blue) }
        .research-cit-badge {
            font-size: 9px;
            color: var(--text-secondary);
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            padding: 1px 7px;
            border-radius: 20px;
        }
        .research-year {
            font-size: 10px;
            color: var(--text-muted);
        }
        .research-authors {
            font-size: 10px;
            color: var(--text-secondary);
            font-style: italic;
        }
        .research-abstract {
            font-size: 11px;
            color: var(--text-secondary);
            line-height: 1.5;
        }
        .research-links {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
            margin-top: 2px;
        }
        .research-link {
            font-size: 10px;
            font-weight: 600;
            padding: 4px 10px;
            border-radius: 6px;
            text-decoration: none;
            transition: all .15s;
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }
        .research-link-main {
            background: rgba(139,92,246,.12);
            border: 1px solid rgba(139,92,246,.2);
            color: var(--accent-light);
        }
        .research-link-main:hover { background: rgba(139,92,246,.22); color: var(--accent-light) }
        .research-link-pdf {
            background: rgba(239,68,68,.1);
            border: 1px solid rgba(239,68,68,.2);
            color: #f87171;
        }
        .research-link-pdf:hover { background: rgba(239,68,68,.18) }
        .research-link-news {
            background: rgba(0,212,255,.1);
            border: 1px solid rgba(0,212,255,.2);
            color: var(--neon-blue);
        }
        .research-link-news:hover { background: rgba(0,212,255,.18) }
        .research-empty {
            text-align: center;
            padding: 50px 20px;
            color: var(--text-muted);
        }
        .research-empty .re-icon { font-size: 40px; margin-bottom: 12px }
        .research-empty p { font-size: 13px }
        .research-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 10px;
        }
        @media (min-width: 900px) {
            .research-grid { grid-template-columns: 1fr 1fr }
        }
        .research-news-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 8px;
        }
        @media (min-width: 700px) {
            .research-news-grid { grid-template-columns: 1fr 1fr }
        }
        .research-divider {
            border: none;
            border-top: 1px solid var(--glass-border);
            margin: 20px 0;
        }
        .research-src-summary {
            display: flex;
            gap: 6px;
            flex-wrap: wrap;
            margin-bottom: 12px;
        }
        .research-src-chip {
            font-size: 9px;
            font-weight: 700;
            padding: 2px 8px;
            border-radius: 20px;
            letter-spacing: .3px;
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            color: var(--text-secondary);
        }

        /* ── NEWS READER — LiquidGlass ── */
        #news-reader-overlay {
            position: fixed; inset: 0; z-index: 9999;
            background: rgba(0,0,0,.52);
            backdrop-filter: blur(10px) saturate(1.5);
            -webkit-backdrop-filter: blur(10px) saturate(1.5);
            display: none;
            align-items: center;
            justify-content: center;
            padding: 20px
        }
        #news-reader-panel {
            position: relative;
            width: min(860px, 96vw);
            max-height: 88vh;
            background: rgba(16,18,32,0.72);
            backdrop-filter: blur(48px) saturate(2.4) brightness(1.1);
            -webkit-backdrop-filter: blur(48px) saturate(2.4) brightness(1.1);
            border: 1px solid rgba(255,255,255,0.10);
            border-radius: 24px;
            overflow-y: auto; overflow-x: hidden;
            display: flex; flex-direction: column; gap: 0;
            box-shadow:
                0 0 0 1px rgba(255,255,255,0.04),
                0 32px 80px rgba(0,0,0,0.65),
                0 8px 24px rgba(0,0,0,0.45),
                inset 0 1px 0 rgba(255,255,255,0.08),
                inset 0 -1px 0 rgba(255,255,255,0.03);
            animation: nr-card-in 320ms cubic-bezier(.34,1.56,.64,1) both;
            scrollbar-width: thin;
            scrollbar-color: rgba(139,92,246,0.25) transparent
        }
        #news-reader-panel::-webkit-scrollbar { width: 4px }
        #news-reader-panel::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.25); border-radius: 2px }
        @keyframes nr-card-in {
            from { opacity: 0; transform: scale(.88) translateY(24px) }
            to   { opacity: 1; transform: scale(1) translateY(0) }
        }
        /* Specular highlight */
        #news-reader-panel::before {
            content: '';
            position: absolute; top: 0; left: 0; right: 0; height: 1px;
            background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.14) 40%, rgba(255,255,255,.08) 70%, transparent 100%);
            pointer-events: none; z-index: 1; border-radius: 24px 24px 0 0
        }
        /* Header fixo */
        #news-reader-header {
            position: sticky; top: 0; z-index: 10;
            display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
            padding: 20px 24px 16px;
            background: rgba(16,18,32,0.88);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border-bottom: 1px solid rgba(255,255,255,0.06);
            border-radius: 24px 24px 0 0
        }
        #news-reader-header-meta {
            display: flex; align-items: center; gap: 8px; margin-bottom: 6px
        }
        #news-reader-source {
            font-size: 10px; color: var(--neon-blue); font-weight: 700;
            letter-spacing: .5px; text-transform: uppercase
        }
        #news-reader-badge { font-size: 10px; color: var(--text-muted) }
        #news-reader-title {
            font-size: 16px; font-weight: 700; color: var(--text-primary);
            line-height: 1.35; margin: 0
        }
        #news-reader-close {
            width: 30px; height: 30px; border-radius: 50%;
            border: 1px solid rgba(255,255,255,0.12);
            background: rgba(255,255,255,0.05);
            color: var(--text-secondary); font-size: 13px; cursor: pointer;
            display: flex; align-items: center; justify-content: center; flex-shrink: 0;
            transition: background 150ms, color 150ms, transform 150ms
        }
        #news-reader-close:hover {
            background: rgba(255,80,80,0.2); color: #ff8080; transform: rotate(90deg)
        }
        /* Sub-header */
        #news-reader-subheader {
            padding: 8px 24px;
            display: flex; align-items: center; gap: 10px;
            border-bottom: 1px solid rgba(255,255,255,.05);
            flex-wrap: wrap
        }
        #news-reader-link {
            font-size: 11px; color: var(--text-muted); text-decoration: none;
            transition: color 150ms
        }
        #news-reader-link:hover { color: var(--neon-blue) }
        #news-reader-status { font-size: 11px; color: var(--text-muted); flex: 1 }
        #news-reader-pdf-btn {
            background: rgba(0,212,255,.1); border: 1px solid rgba(0,212,255,.3);
            color: var(--accent); font-size: 11px; font-weight: 600;
            padding: 4px 12px; border-radius: 6px; cursor: pointer; transition: background .15s
        }
        #news-reader-pdf-btn:hover { background: rgba(0,212,255,.2) }
        #news-reader-subtitle {
            padding: 14px 28px 0;
            font-size: 14px; color: var(--text-secondary); font-style: italic; line-height: 1.5
        }
        #news-reader-body {
            padding: 24px 28px 52px;
            font-size: 16px; line-height: 1.85;
            color: var(--text-primary); position: relative; z-index: 2
        }
        @media(max-width:600px){
            #news-reader-panel { border-radius: 18px }
            #news-reader-header { border-radius: 18px 18px 0 0 }
            #news-reader-body { padding: 16px 16px 40px; font-size: 15px }
        }
        #news-reader-body p   { margin: 0 0 18px }
        #news-reader-body h1,
        #news-reader-body h2  { font-size: 19px; font-weight: 700; margin: 26px 0 10px; color: var(--text-primary); line-height: 1.3 }
        #news-reader-body h3,
        #news-reader-body h4  { font-size: 15px; font-weight: 600; margin: 20px 0 8px; color: var(--accent-light) }
        #news-reader-body blockquote {
            border-left: 3px solid var(--accent); padding: 10px 18px;
            color: var(--text-secondary); font-style: italic; margin: 18px 0;
            background: rgba(139,92,246,.06); border-radius: 0 6px 6px 0
        }
        #news-reader-body ul,
        #news-reader-body ol  { padding-left: 22px; margin-bottom: 14px }
        #news-reader-body li  { margin-bottom: 6px; line-height: 1.7 }
        #news-reader-body a   { color: var(--neon-blue); text-decoration: underline; text-underline-offset: 3px }
        #news-reader-body strong, #news-reader-body b { color: var(--text-primary) }
        /* Fotos do artigo */
        #news-reader-body figure {
            margin: 22px -4px;
            border-radius: 10px;
            overflow: hidden;
            background: var(--glass-bg);
        }
        #news-reader-body figure img {
            width: 100%; max-width: 100%;
            display: block;
            border-radius: 10px 10px 0 0;
            object-fit: cover;
            max-height: 460px;
        }
        #news-reader-body figcaption {
            font-size: 11px; color: var(--text-muted);
            padding: 7px 12px; line-height: 1.4;
            border-top: 1px solid var(--glass-border);
            font-style: italic;
        }
        #news-reader-body img:not(figure img) {
            max-width: 100%; border-radius: 10px;
            margin: 18px 0; display: block;
            object-fit: cover; max-height: 400px;
        }

        .news-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 14px;
        }
        @media (max-width: 1100px) { .news-grid { grid-template-columns: 1fr 1fr } }
        @media (max-width: 640px)  { .news-grid { grid-template-columns: 1fr } }

        /* ── News search pills ── */
        .news-pill {
            padding: 3px 10px; border-radius: 99px;
            background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.22);
            color: var(--accent-light); font-size: 11px; cursor: pointer; transition: all 0.18s; white-space: nowrap;
        }
        .news-pill:hover, .news-pill.active {
            background: rgba(99,102,241,0.26); border-color: var(--accent); color: var(--accent);
        }
        /* Ticker mention pills */
        .news-mention-pill {
            padding: 3px 10px; border-radius: 99px;
            background: rgba(0,212,255,0.08); border: 1px solid rgba(0,212,255,0.18);
            color: #38bdf8; font-size: 11px; cursor: pointer; transition: all 0.18s;
        }
        .news-mention-pill:hover { background: rgba(0,212,255,0.18); }
        .news-mention-pill .mc { font-weight: 700; font-size: 10px; color: rgba(56,189,248,0.65); margin-left:3px; }
        /* Featured "Em Alta" card */
        .news-featured-card {
            display: grid; grid-template-columns: 1fr 1fr; gap: 0;
            background: var(--glass-bg); border: 1px solid var(--glass-border);
            border-radius: var(--radius); overflow: hidden; cursor: pointer;
            transition: all 0.22s; min-height: 200px;
        }
        .news-featured-card:hover { border-color: var(--accent); box-shadow: 0 4px 28px rgba(99,102,241,0.2); }
        .news-featured-img-wrap { position:relative; overflow:hidden; }
        .news-featured-img-wrap img { object-fit:cover; width:100%; height:100%; min-height:200px; display:block; transition: transform 0.3s; }
        .news-featured-card:hover .news-featured-img-wrap img { transform: scale(1.04); }
        .news-featured-placeholder { background:linear-gradient(135deg,rgba(99,102,241,0.1),rgba(0,212,255,0.06)); display:flex; align-items:center; justify-content:center; min-height:200px; }
        .news-featured-body { padding: 20px 22px; display:flex; flex-direction:column; }
        .news-featured-title { font-size:18px; font-weight:700; line-height:1.35; margin-bottom:10px; color:var(--text-primary); flex:1; }
        .news-featured-summary { font-size:12px; color:var(--text-secondary); line-height:1.5; margin-bottom:14px; }
        .news-featured-footer { display:flex; justify-content:space-between; align-items:center; font-size:11px; margin-top:auto; }
        @media (max-width:768px) { .news-featured-card { grid-template-columns:1fr; } .news-featured-img-wrap img,.news-featured-placeholder { min-height:150px; height:150px; } }

        /* ─── Phase 4 — Ctrl+K / Focus Mode / Notif Bell ─── */
        @keyframes cmdkIn {
            from { opacity:0; transform:translateY(-12px) scale(.97); }
            to   { opacity:1; transform:translateY(0)     scale(1);   }
        }
        /* cmdk-overlay display controlled via JS — no override needed */
        .cmdk-result-item {
            display:flex; align-items:center; gap:12px;
            padding:10px 18px; cursor:pointer;
            border-radius:0; transition:background .12s;
            font-size:13px; color:var(--text-primary);
        }
        .cmdk-result-item:hover, .cmdk-result-item.cmdk-active {
            background: rgba(139,92,246,.15);
        }
        .cmdk-result-icon { font-size:16px; width:22px; text-align:center; flex-shrink:0; }
        .cmdk-result-label { flex:1; font-weight:500; }
        .cmdk-result-sub { font-size:10px; color:var(--text-muted); white-space:nowrap; }
        .cmdk-group-label {
            padding:6px 18px 2px; font-size:9px; font-weight:700;
            letter-spacing:1px; text-transform:uppercase; color:var(--text-muted);
        }
        /* Focus drawer */
        #focus-drawer.open { transform: translateX(0) !important; }
        .focus-section { margin-bottom:18px; }
        .focus-section-title { font-size:9px; font-weight:700; letter-spacing:1px; text-transform:uppercase; color:var(--text-muted); margin-bottom:8px; }
        .focus-kpi-row { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
        .focus-kpi-card { background:var(--glass-bg); border:1px solid var(--glass-border); border-radius:8px; padding:10px; text-align:center; }
        .focus-kpi-val { font-size:16px; font-weight:700; }
        .focus-kpi-lbl { font-size:10px; color:var(--text-muted); margin-top:2px; }
        /* Notif dropdown item */
        .notif-item {
            display:flex; align-items:flex-start; gap:10px;
            padding:10px 14px; border-bottom:1px solid rgba(255,255,255,.04);
            cursor:pointer; transition:background .12s;
        }
        .notif-item:hover { background:rgba(255,255,255,.04); }
        .notif-item.unread { background:rgba(139,92,246,.07); }
        .notif-dot { width:7px; height:7px; border-radius:50%; flex-shrink:0; margin-top:4px; }
        .notif-text { flex:1; font-size:12px; color:var(--text-primary); line-height:1.4; }
        .notif-time { font-size:10px; color:var(--text-muted); white-space:nowrap; }

        .news-card {
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius);
            padding: 14px;
            transition: all var(--transition);
            cursor: pointer;
            text-decoration: none;
            color: inherit
        }

        .news-card:hover {
            border-color: rgba(0, 212, 255, 0.3);
            transform: translateY(-1px)
        }

        .news-card .news-ticker {
            font-size: 9px;
            color: var(--neon-blue);
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px
        }

        .news-card .news-title {
            font-size: 12px;
            font-weight: 500;
            margin: 6px 0 4px;
            line-height: 1.4
        }

        .news-card .news-meta {
            font-size: 9px;
            color: var(--text-muted)
        }

        /* ── PORTFOLIO PAGE ── */
        .portfolio-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 16px;
            margin-bottom: 20px
        }

        .portfolio-card {
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius);
            padding: 20px;
            container-type: inline-size;
        }

        .portfolio-card h3 {
            font-size: 13px;
            font-weight: 600;
            margin-bottom: 14px
        }

        .portfolio-card .chart-wrap {
            height: 260px;
            position: relative
        }

        .regime-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 8px 16px;
            border-radius: 20px;
            font-size: 13px;
            font-weight: 600;
            border: 1px solid
        }

        /* ── SHARED COMPONENTS ── */
        .panel {
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius);
            padding: 16px;
            margin-bottom: 16px;
            backdrop-filter: blur(20px);
            container-type: inline-size;
        }

        .panel-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 14px
        }

        .panel-header h3 {
            font-size: 14px;
            font-weight: 600
        }

        .cards-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 12px;
            margin-bottom: 20px
        }

        .stat-card {
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius);
            padding: 16px;
            backdrop-filter: blur(20px);
            transition: all var(--transition);
            container-type: inline-size;
        }

        .stat-card:hover {
            border-color: rgba(139, 92, 246, 0.2);
            box-shadow: var(--accent-glow)
        }

        .stat-card .label {
            font-size: 11px;
            color: var(--text-secondary);
            font-weight: 500;
            text-transform: uppercase;
            letter-spacing: 0.5px
        }

        .stat-card .value {
            font-size: 24px;
            font-weight: 700;
            margin-top: 6px;
            letter-spacing: -0.5px
        }

        .stat-card .value.accent {
            color: var(--accent-light)
        }

        .stat-card .value.success {
            color: var(--success)
        }

        .chart-container {
            height: 200px
        }

        .data-table {
            width: 100%;
            border-collapse: collapse
        }

        .data-table th {
            text-align: left;
            padding: 10px 14px;
            font-size: 10px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--text-secondary);
            border-bottom: 1px solid var(--border-card)
        }

        .data-table td {
            padding: 10px 14px;
            font-size: 12px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.02)
        }

        .btn {
            padding: 8px 16px;
            border-radius: var(--radius-sm);
            font-size: 12px;
            font-weight: 500;
            cursor: pointer;
            border: 1px solid transparent;
            font-family: inherit;
            transition: all var(--transition);
            min-height: 38px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .btn-primary {
            background: var(--accent);
            color: #fff;
            border-color: var(--accent)
        }

        .btn-primary:hover {
            background: #7C3AED;
            box-shadow: 0 0 20px rgba(139, 92, 246, 0.3)
        }

        .btn-secondary {
            background: var(--bg-card);
            color: var(--text-primary);
            border-color: var(--border-card)
        }

        .btn-danger {
            background: rgba(239, 68, 68, 0.1);
            color: var(--danger)
        }

        .btn-sm {
            padding: 5px 10px;
            font-size: 11px;
            min-height: 32px;
        }

        .form-group {
            margin-bottom: 14px
        }

        .form-group label {
            display: block;
            font-size: 11px;
            color: var(--text-secondary);
            margin-bottom: 5px;
            font-weight: 500
        }

        .form-input {
            width: 100%;
            padding: 9px 12px;
            background: var(--bg-primary);
            border: 1px solid var(--border-card);
            border-radius: var(--radius-sm);
            color: var(--text-primary);
            font-size: 12px;
            font-family: inherit;
            transition: border var(--transition)
        }

        .form-input:focus {
            outline: none;
            border-color: var(--border-focus)
        }

        .form-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 14px
        }

        .toggle-container {
            display: flex;
            align-items: center;
            gap: 10px
        }

        .toggle {
            position: relative;
            width: 42px;
            height: 22px;
            background: var(--text-muted);
            border-radius: 11px;
            cursor: pointer;
            transition: background var(--transition)
        }

        .toggle.active {
            background: var(--accent)
        }

        .toggle::after {
            content: '';
            position: absolute;
            top: 3px;
            left: 3px;
            width: 16px;
            height: 16px;
            background: #fff;
            border-radius: 50%;
            transition: transform var(--transition)
        }

        .toggle.active::after {
            transform: translateX(20px)
        }

        .toggle-label {
            font-size: 12px;
            color: var(--text-secondary)
        }

        .badge-active {
            background: rgba(16, 185, 129, 0.1);
            color: var(--success);
            padding: 3px 8px;
            border-radius: 6px;
            font-size: 10px;
            font-weight: 600
        }

        .badge-inactive {
            background: rgba(239, 68, 68, 0.1);
            color: var(--danger);
            padding: 3px 8px;
            border-radius: 6px;
            font-size: 10px;
            font-weight: 600
        }

        .badge-soon {
            background: rgba(245, 158, 11, 0.1);
            color: var(--warning);
            padding: 3px 8px;
            border-radius: 6px;
            font-size: 10px;
            font-weight: 600
        }

        .toast {
            position: fixed;
            bottom: 20px;
            right: 20px;
            background: var(--bg-secondary);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius);
            padding: 12px 20px;
            font-size: 12px;
            z-index: 9999;
            transform: translateY(80px);
            opacity: 0;
            transition: all 300ms ease
        }

        .toast.show {
            transform: translateY(0);
            opacity: 1
        }

        .empty-state {
            text-align: center;
            padding: 40px;
            color: var(--text-secondary)
        }

        .empty-state .empty-icon {
            font-size: 36px;
            margin-bottom: 10px;
            opacity: 0.5
        }

        .empty-state p {
            font-size: 12px
        }

        .restart-warning {
            display: none;
            background: rgba(245, 158, 11, 0.08);
            border: 1px solid rgba(245, 158, 11, 0.2);
            border-radius: var(--radius-sm);
            padding: 10px 14px;
            margin-bottom: 14px;
            font-size: 11px;
            color: var(--warning)
        }

        .integrations-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 12px
        }

        .integration-card {
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius);
            padding: 16px;
            text-align: center;
            transition: all var(--transition)
        }

        .integration-card:hover {
            border-color: rgba(139, 92, 246, 0.2)
        }

        .integration-card .int-icon {
            font-size: 28px;
            margin-bottom: 8px
        }

        .integration-card .int-name {
            font-size: 12px;
            font-weight: 600;
            margin-bottom: 4px
        }

        .integration-card .int-status {
            font-size: 10px
        }

        .activity-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 0;
            border-bottom: 1px solid rgba(255, 255, 255, 0.02);
            font-size: 12px
        }

        .activity-item .activity-time {
            font-size: 10px;
            color: var(--text-muted);
            min-width: 50px
        }

        /* ── MODAL ── */
        .modal-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.7);
            z-index: 1000;
            align-items: center;
            justify-content: center
        }

        .modal-overlay.show {
            display: flex
        }

        .modal {
            background: var(--bg-secondary);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius);
            padding: 24px;
            width: 480px;
            max-height: 80vh;
            overflow-y: auto
        }

        .modal h3 {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 16px
        }

        .wl-edit-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 6px 0
        }

        .wl-edit-item input[type=checkbox] {
            accent-color: var(--accent)
        }

        .wl-edit-item label {
            font-size: 12px
        }

        @media(max-width:1200px) {
            .kpi-strip {
                grid-template-columns: repeat(3, 1fr)
            }

            .chart-grid {
                grid-template-columns: 1fr
            }

            .indicators-row {
                grid-template-columns: 1fr 1fr
            }

            #indicators-row {
                grid-template-columns: repeat(3, 1fr) !important;
            }
        }

        @media(max-width:768px) {
            .mobile-header {
                display: flex !important;
            }

            .sidebar {
                position: fixed;
                left: -260px;
                top: 0;
                height: 100vh;
                z-index: 2000;
                transition: left 0.3s ease;
                display: flex;
                box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
            }

            .sidebar.open {
                left: 0;
            }

            .sidebar-overlay {
                display: none;
                position: fixed;
                inset: 0;
                background: rgba(0, 0, 0, 0.6);
                z-index: 1500;
                backdrop-filter: blur(2px);
            }

            .sidebar-overlay.open {
                display: block;
            }

            .main {
                padding: 16px;
                padding-top: 70px;
                padding-bottom: 80px;
                /* Safe space for bottom scrolling */
            }

            .kpi-strip {
                grid-template-columns: 1fr 1fr
            }

            .cards-grid {
                grid-template-columns: 1fr !important;
            }

            .news-grid {
                grid-template-columns: 1fr
            }

            .portfolio-grid {
                grid-template-columns: 1fr
            }

            #indicators-row {
                grid-template-columns: 1fr 1fr;
            }

            .page-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 12px;
            }

            .page-header>div:last-child {
                width: 100%;
                justify-content: space-between;
                flex-wrap: wrap;
            }

            .btn,
            button.btn-sm,
            .form-input {
                min-height: 44px;
                /* Touch target size */
            }

            .chart-periods button {
                min-height: 38px;
                padding: 8px 12px;
            }

            .chart-toolbar {
                flex-direction: column;
                align-items: flex-start !important;
                gap: 12px;
            }

            .chart-periods {
                width: 100%;
                justify-content: space-between;
            }

            /* Responsive tables within containers */
            .data-table {
                display: block;
                overflow-x: auto;
                white-space: nowrap;
            }

            /* Container Queries optimizations */
            @container (max-width: 400px) {
                .kpi-price {
                    font-size: 1.5rem !important;
                }

                .stat-card .value {
                    font-size: 1.8rem !important;
                }
            }
        }


        @media(max-width:550px) {
            .kpi-strip {
                grid-template-columns: 1fr !important;
            }

            #indicators-row,
            .indicators-row {
                grid-template-columns: 1fr !important;
            }
        }

        /* ── PDF Export Mode (layout only, no color overrides) ── */
        .pdf-capturing .btn,
        .pdf-capturing button:not(.chart-periods button) {
            display: none !important;
        }

        .pdf-capturing .panel {
            page-break-inside: avoid;
        }

        .pdf-capturing canvas {
            max-width: 100% !important;
        }

        /* ═══ PREMIUM LOGIN SCREEN ═══ */
        #login-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: #06060A;
            z-index: 99999;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            overflow: hidden;
            transition: opacity .6s cubic-bezier(.4, 0, .2, 1), visibility .6s;
        }

        #login-overlay.fade-out {
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
        }

        /* Animated background gradient orbs */
        #login-overlay::before,
        #login-overlay::after {
            content: '';
            position: absolute;
            border-radius: 50%;
            filter: blur(120px);
            opacity: 0.25;
            animation: loginOrb 8s ease-in-out infinite alternate;
        }

        #login-overlay::before {
            width: 500px;
            height: 500px;
            background: radial-gradient(circle, #8B5CF6 0%, transparent 70%);
            top: -10%;
            left: -5%;
        }

        #login-overlay::after {
            width: 400px;
            height: 400px;
            background: radial-gradient(circle, #00D4FF 0%, transparent 70%);
            bottom: -10%;
            right: -5%;
            animation-delay: -4s;
        }

        @keyframes loginOrb {
            0% {
                transform: translate(0, 0) scale(1);
            }

            100% {
                transform: translate(60px, -40px) scale(1.15);
            }
        }

        /* Floating particles */
        .login-particles {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            overflow: hidden;
        }

        .login-particle {
            position: absolute;
            width: 3px;
            height: 3px;
            background: rgba(139, 92, 246, 0.4);
            border-radius: 50%;
            animation: particleFloat linear infinite;
        }

        @keyframes particleFloat {
            0% {
                transform: translateY(100vh) scale(0);
                opacity: 0;
            }

            10% {
                opacity: 1;
            }

            90% {
                opacity: 1;
            }

            100% {
                transform: translateY(-10vh) scale(1);
                opacity: 0;
            }
        }

        /* Login card */
        .login-card {
            position: relative;
            z-index: 2;
            background: rgba(12, 12, 18, 0.75);
            backdrop-filter: blur(30px) saturate(1.5);
            -webkit-backdrop-filter: blur(30px) saturate(1.5);
            border: 1px solid rgba(139, 92, 246, 0.15);
            border-radius: 24px;
            padding: 48px 40px;
            width: 100%;
            max-width: 420px;
            text-align: center;
            box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6),
                0 0 80px rgba(139, 92, 246, 0.06),
                inset 0 1px 0 rgba(255, 255, 255, 0.04);
            animation: loginCardEntrance .8s cubic-bezier(.16, 1, .3, 1) forwards;
        }

        @keyframes loginCardEntrance {
            from {
                opacity: 0;
                transform: translateY(30px) scale(.97);
            }

            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        .login-card.shake {
            animation: loginShake .5s ease forwards;
        }

        @keyframes loginShake {

            0%,
            100% {
                transform: translateX(0);
                opacity: 1;
            }

            15% {
                transform: translateX(-12px) rotate(-1deg);
                opacity: 1;
            }

            30% {
                transform: translateX(10px) rotate(1deg);
                opacity: 1;
            }

            45% {
                transform: translateX(-8px);
                opacity: 1;
            }

            60% {
                transform: translateX(6px);
                opacity: 1;
            }

            75% {
                transform: translateX(-3px);
                opacity: 1;
            }
        }

        /* Logo animation */
        .login-logo {
            font-size: 36px;
            font-weight: 800;
            margin-bottom: 4px;
            letter-spacing: -1px;
        }

        .login-logo .caos {
            background: linear-gradient(135deg, #8B5CF6, #C084FC, #00D4FF);
            background-size: 200% 200%;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            animation: logoShimmer 4s ease infinite;
        }

        @keyframes logoShimmer {

            0%,
            100% {
                background-position: 0% 50%;
            }

            50% {
                background-position: 100% 50%;
            }
        }

        .login-logo .marada {
            color: var(--text-primary);
            -webkit-text-fill-color: var(--text-primary);
        }

        .login-subtitle {
            color: #64748B;
            font-size: 13px;
            font-weight: 400;
            margin-bottom: 36px;
            letter-spacing: 2px;
            text-transform: uppercase;
        }

        /* Inputs */
        .login-card .login-input-group {
            position: relative;
            margin-bottom: 18px;
        }

        .login-card .login-input-group .login-icon {
            position: absolute;
            left: 16px;
            top: 50%;
            transform: translateY(-50%);
            font-size: 16px;
            color: #64748B;
            pointer-events: none;
            transition: color .3s;
        }

        .login-card .login-input {
            width: 100%;
            padding: 14px 16px 14px 46px;
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid rgba(255, 255, 255, 0.08);
            border-radius: 12px;
            color: #F1F5F9;
            font-size: 14px;
            font-family: 'Inter', sans-serif;
            outline: none;
            transition: all .3s ease;
        }

        .login-card .login-input::placeholder {
            color: #4B5563;
        }

        .login-card .login-input:focus {
            border-color: rgba(139, 92, 246, 0.5);
            box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.08);
            background: rgba(255, 255, 255, 0.06);
        }

        .login-card .login-input:focus+.login-icon,
        .login-card .login-input-group:focus-within .login-icon {
            color: #A78BFA;
        }

        /* Submit button */
        .login-btn {
            width: 100%;
            padding: 14px;
            background: linear-gradient(135deg, #8B5CF6, #7C3AED);
            color: #fff;
            border: none;
            border-radius: 12px;
            font-size: 15px;
            font-weight: 600;
            font-family: 'Inter', sans-serif;
            cursor: pointer;
            position: relative;
            overflow: hidden;
            transition: all .3s ease;
            margin-top: 6px;
        }

        .login-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
            transition: left .6s ease;
        }

        .login-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(139, 92, 246, 0.35);
        }

        .login-btn:hover::before {
            left: 100%;
        }

        .login-btn:active {
            transform: translateY(0);
        }

        .login-btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            transform: none !important;
            box-shadow: none !important;
        }

        /* Spinner */
        .login-btn .spinner {
            display: inline-block;
            width: 18px;
            height: 18px;
            border: 2px solid rgba(255, 255, 255, 0.3);
            border-top-color: #fff;
            border-radius: 50%;
            animation: spin .6s linear infinite;
            vertical-align: middle;
            margin-right: 8px;
        }

        @keyframes spin {
            to {
                transform: rotate(360deg);
            }
        }

        /* Error toast popup */
        .login-toast {
            position: absolute;
            bottom: -60px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(239, 68, 68, 0.15);
            border: 1px solid rgba(239, 68, 68, 0.3);
            backdrop-filter: blur(12px);
            color: #FCA5A5;
            padding: 12px 24px;
            border-radius: 12px;
            font-size: 13px;
            font-weight: 500;
            white-space: nowrap;
            opacity: 0;
            pointer-events: none;
            transition: all .4s cubic-bezier(.16, 1, .3, 1);
        }

        .login-toast.show {
            bottom: -70px;
            opacity: 1;
        }

        .login-toast .toast-icon {
            margin-right: 8px;
        }

        /* Divider */
        .login-divider {
            display: flex;
            align-items: center;
            gap: 12px;
            margin: 24px 0 20px;
            color: #3B3B4F;
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .login-divider::before,
        .login-divider::after {
            content: '';
            flex: 1;
            height: 1px;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
        }

        /* Footer */
        .login-footer {
            margin-top: 28px;
            font-size: 11px;
            color: #3B3B4F;
        }

        .login-footer a {
            color: #8B5CF6;
            text-decoration: none;
        }

        /* Version badge */
        .login-version {
            position: absolute;
            bottom: 24px;
            font-size: 11px;
            color: #2A2A3A;
            letter-spacing: 1px;
            z-index: 2;
        }

        /* Role hiding & User profile badge */
        .admin-only.hidden,
        .owner-only.hidden,
        .premium-only.hidden {
            display: none !important;
        }

        [data-role="owner"].hidden {
            display: none !important;
        }

        /* Developer Portal tabs */
        .portal-tab {
            background: transparent;
            border: none;
            border-bottom: 2px solid transparent;
            color: var(--text-muted);
            font-size: 12px;
            font-weight: 600;
            padding: 8px 16px;
            cursor: pointer;
            transition: color 0.15s, border-color 0.15s;
            margin-bottom: -1px;
        }
        .portal-tab:hover { color: var(--text-primary); }
        .portal-tab.active {
            color: var(--accent);
            border-bottom-color: var(--accent);
        }
        .portal-tab-content { animation: fadeInUp 0.2s ease; }

        /* Language tabs */
        .lang-tab {
            background: rgba(255,255,255,0.04);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm);
            color: var(--text-muted);
            font-size: 12px;
            font-weight: 600;
            padding: 6px 14px;
            cursor: pointer;
            transition: background 0.15s, color 0.15s;
        }
        .lang-tab:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
        .lang-tab.active {
            background: rgba(139,92,246,0.15);
            border-color: rgba(139,92,246,0.4);
            color: #a855f7;
        }

        .user-profile-badge {
            margin-top: auto;
            padding: 20px 16px;
            border-top: 1px solid var(--border-card);
            font-size: 12px;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .user-profile-badge strong {
            color: var(--text-primary);
        }

        /* Password modal premium */
        .modal-premium-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(6, 6, 10, 0.85);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            z-index: 90000;
            display: none;
            justify-content: center;
            align-items: center;
        }

        .modal-premium-card {
            background: rgba(12, 12, 18, 0.92);
            backdrop-filter: blur(30px);
            -webkit-backdrop-filter: blur(30px);
            border: 1px solid rgba(139, 92, 246, 0.15);
            border-radius: 24px;
            padding: 40px;
            width: 100%;
            max-width: 420px;
            box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6),
                0 0 60px rgba(139, 92, 246, 0.05),
                inset 0 1px 0 rgba(255, 255, 255, 0.04);
            animation: loginCardEntrance .5s cubic-bezier(.16, 1, .3, 1) forwards;
        }

        .modal-premium-card .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 28px;
            padding-bottom: 20px;
            border-bottom: 1px solid rgba(139, 92, 246, 0.1);
        }

        .modal-premium-card .modal-title {
            font-size: 20px;
            font-weight: 700;
            color: #F1F5F9;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .modal-premium-card .modal-title .title-icon {
            width: 36px;
            height: 36px;
            border-radius: 10px;
            background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(0, 212, 255, 0.1));
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
        }

        .modal-premium-card .modal-close {
            width: 32px;
            height: 32px;
            border-radius: 8px;
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid rgba(255, 255, 255, 0.06);
            color: #64748B;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            transition: all .2s ease;
        }

        .modal-premium-card .modal-close:hover {
            background: rgba(239, 68, 68, 0.15);
            border-color: rgba(239, 68, 68, 0.3);
            color: #FCA5A5;
        }

        .modal-premium-card .modal-input-group {
            position: relative;
            margin-bottom: 16px;
        }

        .modal-premium-card .modal-input-icon {
            position: absolute;
            left: 14px;
            top: 50%;
            transform: translateY(-50%);
            font-size: 14px;
            color: #4B5563;
            pointer-events: none;
            transition: color .3s;
        }

        .modal-premium-card .modal-input {
            width: 100%;
            padding: 13px 14px 13px 42px;
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid rgba(255, 255, 255, 0.08);
            border-radius: 12px;
            color: #F1F5F9;
            font-size: 14px;
            font-family: 'Inter', sans-serif;
            outline: none;
            transition: all .3s ease;
        }

        .modal-premium-card .modal-input::placeholder {
            color: #4B5563;
        }

        .modal-premium-card .modal-input:focus {
            border-color: rgba(139, 92, 246, 0.5);
            box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.08);
            background: rgba(255, 255, 255, 0.06);
        }

        .modal-premium-card .modal-input:focus~.modal-input-icon {
            color: #A78BFA;
        }

        .modal-premium-card .cp-msg {
            font-size: 13px;
            margin: 14px 0 0;
            padding: 10px 14px;
            border-radius: 10px;
            display: none;
        }

        .modal-premium-card .cp-msg.error {
            background: rgba(239, 68, 68, 0.1);
            border: 1px solid rgba(239, 68, 68, 0.2);
            color: #FCA5A5;
        }

        .modal-premium-card .cp-msg.success {
            background: rgba(16, 185, 129, 0.1);
            border: 1px solid rgba(16, 185, 129, 0.2);
            color: #6EE7B7;
        }

        @media (max-width: 480px) {
            .modal-premium-card {
                margin: 0 16px;
                padding: 28px 20px;
            }
        }

        /* ══════ CHAT VOICE CALL PREMIUM ══════ */
        .voice-call-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(6, 6, 10, 0.85);
            backdrop-filter: blur(15px);
            z-index: 9999;
            display: none;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        .voice-call-overlay.active {
            display: flex;
            opacity: 1;
        }
        .voice-call-avatar {
            width: 120px;
            height: 120px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--accent), #C084FC);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 50px;
            box-shadow: 0 0 30px rgba(139, 92, 246, 0.4);
            position: relative;
            margin-bottom: 30px;
        }
        .voice-call-avatar.speaking {
            animation: pulse-speak 1s infinite alternate;
        }
        @keyframes pulse-speak {
            from { box-shadow: 0 0 20px rgba(139, 92, 246, 0.4); transform: scale(1); }
            to { box-shadow: 0 0 60px rgba(139, 92, 246, 0.8), 0 0 100px var(--neon-purple); transform: scale(1.05); }
        }
        .voice-call-status {
            font-size: 18px;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 10px;
            letter-spacing: 0.5px;
        }
        .voice-call-timer {
            font-size: 14px;
            color: var(--neon-green);
            margin-bottom: 40px;
            font-variant-numeric: tabular-nums;
        }
        .voice-call-visualizer {
            display: flex;
            gap: 4px;
            height: 40px;
            align-items: center;
            margin-bottom: 40px;
        }
        .voice-bd {
            width: 6px;
            height: 10px;
            background: var(--accent-light);
            border-radius: 3px;
            transition: height 0.1s ease;
        }
        .voice-call-actions {
            display: flex;
            gap: 20px;
        }
        .btn-end-call {
            background: var(--neon-red);
            color: white;
            width: 60px;
            height: 60px;
            border-radius: 50%;
            border: none;
            font-size: 24px;
            cursor: pointer;
            box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.2s;
        }
        .btn-end-call:hover {
            transform: scale(1.1);
            box-shadow: 0 0 30px rgba(239, 68, 68, 0.7);
        }
        .btn-mute-call {
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            color: white;
            width: 60px;
            height: 60px;
            border-radius: 50%;
            font-size: 20px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
        }
        .btn-mute-call.muted {
            background: rgba(239, 68, 68, 0.2);
            color: var(--neon-red);
            border-color: rgba(239, 68, 68, 0.4);
        }

        /* ══════ CHAT AI PREMIUM ══════ */
        .chat-container {
            display: flex;
            flex-direction: column;
            height: calc(100vh - 80px);
            max-height: calc(100vh - 80px);
            position: relative;
            overflow: hidden;
        }

        .chat-header {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 16px 20px;
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius) var(--radius) 0 0;
            backdrop-filter: blur(20px);
        }

        .chat-header .chat-avatar {
            width: 42px;
            height: 42px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--accent), #C084FC);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
            animation: avatarPulse 3s ease-in-out infinite;
        }

        @keyframes avatarPulse {

            0%,
            100% {
                box-shadow: 0 0 20px rgba(139, 92, 246, 0.3)
            }

            50% {
                box-shadow: 0 0 30px rgba(139, 92, 246, 0.5)
            }
        }

        .chat-header .chat-info h3 {
            font-size: 15px;
            font-weight: 700;
            letter-spacing: -0.3px;
        }

        .chat-header .chat-info p {
            font-size: 11px;
            color: var(--neon-green);
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .chat-header .chat-info p::before {
            content: '';
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: var(--neon-green);
            animation: pulse 2s infinite;
        }

        .chat-header-actions {
            margin-left: auto;
            display: flex;
            gap: 8px;
        }

        .chat-header-actions button {
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            color: var(--text-primary);
            padding: 6px 10px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 13px;
            transition: all var(--transition);
        }

        .chat-header-actions button:hover {
            border-color: var(--accent);
            background: rgba(139, 92, 246, 0.1);
        }

        .chat-messages {
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            padding: 20px;
            display: flex;
            flex-direction: column;
            gap: 16px;
            scroll-behavior: smooth;
        }

        .chat-messages::-webkit-scrollbar {
            width: 4px;
        }

        .chat-messages::-webkit-scrollbar-thumb {
            background: var(--text-muted);
            border-radius: 4px;
        }

        .chat-msg {
            display: flex;
            gap: 10px;
            animation: msgSlideIn 300ms ease;
            max-width: 85%;
            min-width: 0;
        }

        .chat-msg.user {
            align-self: flex-end;
            flex-direction: row-reverse;
        }

        @keyframes msgSlideIn {
            from {
                opacity: 0;
                transform: translateY(12px)
            }

            to {
                opacity: 1;
                transform: translateY(0)
            }
        }

        .chat-msg .msg-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
        }

        .chat-msg.ai .msg-avatar {
            background: linear-gradient(135deg, var(--accent), #C084FC);
        }

        .chat-msg.user .msg-avatar {
            background: linear-gradient(135deg, #00D4FF, #0EA5E9);
        }

        .chat-msg .msg-bubble {
            padding: 12px 16px;
            border-radius: 16px;
            font-size: 13.5px;
            line-height: 1.65;
            position: relative;
            word-wrap: break-word;
            overflow-wrap: anywhere;
            word-break: break-word;
            min-width: 0;
            max-width: 100%;
        }

        .chat-msg.ai .msg-bubble {
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            backdrop-filter: blur(16px);
            border-top-left-radius: 4px;
            color: var(--text-primary);
        }

        .chat-msg.user .msg-bubble {
            background: linear-gradient(135deg, var(--accent), rgba(139, 92, 246, 0.7));
            border: none;
            border-top-right-radius: 4px;
            color: #fff;
        }

        .chat-msg .msg-bubble .msg-time {
            display: block;
            font-size: 10px;
            margin-top: 6px;
            opacity: 0.5;
            text-align: right;
        }

        .chat-msg .msg-bubble pre {
            background: rgba(0, 0, 0, 0.3);
            border: 1px solid var(--glass-border);
            border-radius: 8px;
            padding: 12px;
            margin: 8px 0;
            overflow-x: auto;
            position: relative;
            font-size: 12px;
        }

        .chat-msg .msg-bubble pre code {
            font-family: 'JetBrains Mono', 'Fira Code', monospace;
            font-size: 12px;
        }

        .chat-msg .msg-bubble .code-copy-btn {
            position: absolute;
            top: 6px;
            right: 6px;
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            color: var(--text-secondary);
            padding: 2px 8px;
            border-radius: 6px;
            font-size: 10px;
            cursor: pointer;
            opacity: 0;
            transition: opacity 200ms;
        }

        .chat-msg .msg-bubble pre:hover .code-copy-btn {
            opacity: 1;
        }

        .chat-msg .msg-bubble strong {
            font-weight: 600;
        }

        .chat-msg .msg-bubble em {
            font-style: italic;
            opacity: 0.9;
        }

        .chat-msg .msg-bubble ul,
        .chat-msg .msg-bubble ol {
            padding-left: 20px;
            margin: 4px 0;
        }

        .chat-msg .msg-bubble a {
            color: var(--neon-blue);
            text-decoration: underline;
        }

        .chat-msg .msg-bubble img {
            max-width: 100%;
            border-radius: 8px;
            margin: 8px 0;
            cursor: pointer;
        }

        .chat-msg .msg-bubble .msg-audio {
            margin: 8px 0;
        }

        .chat-msg .msg-bubble .msg-audio audio {
            width: 100%;
            height: 36px;
            border-radius: 20px;
        }

        .chat-msg .msg-bubble .msg-tts-btn {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.15);
            color: var(--text-secondary);
            padding: 3px 10px;
            border-radius: 20px;
            font-size: 11px;
            cursor: pointer;
            margin-top: 6px;
            transition: all var(--transition);
        }

        .chat-msg .msg-bubble .msg-tts-btn:hover {
            background: rgba(139, 92, 246, 0.2);
            border-color: var(--accent);
            color: var(--text-primary);
        }

        .chat-msg .msg-file-card {
            display: flex;
            align-items: center;
            gap: 8px;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--glass-border);
            border-radius: 10px;
            padding: 10px 14px;
            margin: 6px 0;
            cursor: pointer;
            transition: all var(--transition);
        }

        .chat-msg .msg-file-card:hover {
            border-color: var(--accent);
        }

        .chat-msg .msg-file-card .file-icon {
            font-size: 24px;
        }

        .chat-msg .msg-file-card .file-info {
            font-size: 12px;
        }

        .chat-msg .msg-file-card .file-info .file-name {
            font-weight: 600;
            color: var(--text-primary);
        }

        .chat-msg .msg-file-card .file-info .file-size {
            color: var(--text-secondary);
        }

        .chat-typing {
            display: none;
            align-items: center;
            gap: 10px;
            padding: 0 20px;
        }

        .chat-typing.active {
            display: flex;
        }

        .chat-typing .typing-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--accent), #C084FC);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
        }

        .chat-typing .typing-dots {
            display: flex;
            gap: 4px;
            align-items: center;
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            padding: 10px 16px;
            border-radius: 16px;
            border-top-left-radius: 4px;
        }

        .chat-typing .typing-dots span {
            width: 7px;
            height: 7px;
            border-radius: 50%;
            background: var(--text-secondary);
            animation: typingBounce 1.4s ease-in-out infinite;
        }

        .chat-typing .typing-dots span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .chat-typing .typing-dots span:nth-child(3) {
            animation-delay: 0.4s;
        }

        .chat-typing .typing-status {
            font-size: 11px;
            color: var(--text-secondary);
            font-style: italic;
        }

        @keyframes typingBounce {

            0%,
            60%,
            100% {
                transform: translateY(0)
            }

            30% {
                transform: translateY(-6px)
            }
        }

        .chat-streaming-cursor::after {
            content: '▌';
            animation: blink 0.8s step-end infinite;
            color: var(--accent);
        }

        @keyframes blink {

            0%,
            100% {
                opacity: 1
            }

            50% {
                opacity: 0
            }
        }

        .chat-attach-preview {
            display: none;
            padding: 8px 20px;
            gap: 8px;
            flex-wrap: wrap;
            border-top: 1px solid var(--glass-border);
        }

        .chat-attach-preview.active {
            display: flex;
        }

        .chat-attach-preview .attach-item {
            position: relative;
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            border-radius: 10px;
            padding: 8px 12px;
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 12px;
            animation: msgSlideIn 200ms ease;
        }

        .chat-attach-preview .attach-item img {
            width: 48px;
            height: 48px;
            object-fit: cover;
            border-radius: 6px;
        }

        .chat-attach-preview .attach-remove {
            position: absolute;
            top: -6px;
            right: -6px;
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: var(--danger);
            color: #fff;
            border: none;
            font-size: 10px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .chat-input-area {
            display: flex;
            align-items: flex-end;
            gap: 8px;
            padding: 12px 16px;
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            border-top: none;
            border-radius: 0 0 var(--radius) var(--radius);
            backdrop-filter: blur(20px);
        }

        .chat-input-area .chat-btn {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            border: 1px solid var(--glass-border);
            background: var(--glass-bg);
            color: var(--text-primary);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
            transition: all var(--transition);
            flex-shrink: 0;
        }

        .chat-input-area .chat-btn:hover {
            border-color: var(--accent);
            background: rgba(139, 92, 246, 0.15);
            transform: scale(1.05);
        }

        .chat-input-area .chat-btn.recording {
            background: rgba(239, 68, 68, 0.2);
            border-color: var(--danger);
            animation: recordPulse 1.5s infinite;
        }

        @keyframes recordPulse {

            0%,
            100% {
                box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3)
            }

            50% {
                box-shadow: 0 0 0 8px rgba(239, 68, 68, 0)
            }
        }

        .chat-input-area .chat-btn.send-btn {
            background: linear-gradient(135deg, var(--accent), #C084FC);
            border: none;
            color: #fff;
        }

        .chat-input-area .chat-btn.send-btn:hover {
            transform: scale(1.1);
            box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
        }

        .chat-input-area textarea {
            flex: 1;
            background: transparent;
            border: none;
            color: var(--text-primary);
            font-family: inherit;
            font-size: 13.5px;
            resize: none;
            outline: none;
            max-height: 120px;
            min-height: 40px;
            line-height: 1.5;
            padding: 8px 0;
        }

        .chat-input-area textarea::placeholder {
            color: var(--text-muted);
        }

        .chat-drop-overlay {
            position: absolute;
            inset: 0;
            background: rgba(139, 92, 246, 0.1);
            backdrop-filter: blur(8px);
            border: 3px dashed var(--accent);
            border-radius: var(--radius);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 100;
        }

        .chat-drop-overlay.active {
            display: flex;
        }

        .chat-drop-overlay .drop-text {
            font-size: 18px;
            font-weight: 700;
            color: var(--accent);
            text-align: center;
        }

        .chat-scroll-fab {
            position: absolute;
            bottom: 80px;
            right: 20px;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: var(--accent);
            color: #fff;
            border: none;
            cursor: pointer;
            display: none;
            align-items: center;
            justify-content: center;
            font-size: 16px;
            box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
            z-index: 10;
            transition: all var(--transition);
        }

        .chat-scroll-fab.visible {
            display: flex;
        }

        .chat-scroll-fab:hover {
            transform: scale(1.1);
        }

        /* Chat Popup Mode */
        .chat-popup-container {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 420px;
            height: 600px;
            z-index: 9999;
            display: none;
            flex-direction: column;
            border-radius: var(--radius);
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
            background: rgba(15, 23, 42, 0.85);
            backdrop-filter: blur(16px);
            border: 1px solid var(--glass-border);
            overflow: hidden;
        }

        .chat-popup-container.active {
            display: flex;
            animation: popupSlideIn 300ms ease;
        }

        @keyframes popupSlideIn {
            from {
                opacity: 0;
                transform: translateY(20px) scale(0.95)
            }

            to {
                opacity: 1;
                transform: translateY(0) scale(1)
            }
        }

        .chat-popup-fab {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 56px;
            height: 56px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--accent), #C084FC);
            color: #fff;
            border: none;
            cursor: pointer;
            font-size: 24px;
            z-index: 9998;
            display: none;
            align-items: center;
            justify-content: center;
            box-shadow: 0 8px 30px rgba(139, 92, 246, 0.4);
            transition: all 300ms ease;
        }

        .chat-popup-fab:hover {
            transform: scale(1.1) rotate(10deg);
        }

        .chat-popup-fab.visible {
            display: flex;
        }

        @media (max-width: 768px) {
            .chat-container {
                height: calc(100vh - 70px);
            }

            .chat-msg {
                max-width: 92%;
            }

            .chat-popup-container {
                width: 100vw;
                height: 100vh;
                bottom: 0;
                right: 0;
                border-radius: 0;
            }
        }

        /* ══════ PREDICTIONS TAB — PREMIUM MOBILE SYSTEM ══════ */

        /* ── Stat Sections ── */
        .pred-section-title {
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 1.2px;
            text-transform: uppercase;
            color: var(--neon-blue);
            opacity: 0.8;
            margin: 24px 0 12px;
            padding-left: 2px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .pred-section-title::after {
            content: '';
            flex: 1;
            height: 1px;
            background: linear-gradient(to right, rgba(0,212,255,0.3), transparent);
        }

        /* ── Tracker Period Pills ── */
        .tracker-period-pill {
            background: transparent;
            border: none;
            color: var(--text-muted);
            font-size: 11px;
            font-weight: 600;
            padding: 4px 10px;
            border-radius: 5px;
            cursor: pointer;
            transition: background 0.15s, color 0.15s;
            letter-spacing: 0.3px;
        }
        .tracker-period-pill:hover {
            background: rgba(0,212,255,0.08);
            color: var(--text-primary);
        }
        .tracker-period-pill.active {
            background: rgba(0,212,255,0.15);
            color: var(--neon-blue);
        }

        /* ── Horizon Breakdown Cards ── */
        .horizon-breakdown-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 12px;
            margin-bottom: 20px;
        }
        .horizon-card {
            background: var(--bg-card);
            border: 1px solid rgba(255,255,255,0.06);
            border-radius: 14px;
            padding: 16px;
            position: relative;
            overflow: hidden;
            transition: border-color 0.2s;
        }
        .horizon-card::before {
            content: '';
            position: absolute;
            top: 0; left: 0; right: 0;
            height: 2px;
        }
        .horizon-card.h1d::before { background: linear-gradient(to right, #00D4FF, #0099BB); }
        .horizon-card.h3d::before { background: linear-gradient(to right, #8B5CF6, #6D28D9); }
        .horizon-card.h7d::before { background: linear-gradient(to right, #FF6B35, #CC4400); }
        .horizon-card-label {
            font-size: 10px;
            font-weight: 700;
            letter-spacing: 0.8px;
            text-transform: uppercase;
            color: var(--text-muted);
            margin-bottom: 10px;
        }
        .horizon-card-metric {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 6px;
        }
        .horizon-card-metric-name {
            font-size: 10px;
            color: var(--text-muted);
        }
        .horizon-card-metric-value {
            font-size: 13px;
            font-weight: 700;
        }
        .horizon-progress {
            height: 3px;
            background: rgba(255,255,255,0.06);
            border-radius: 99px;
            margin-top: 2px;
            overflow: hidden;
        }
        .horizon-progress-bar {
            height: 100%;
            border-radius: 99px;
            transition: width 0.6s ease;
        }

        /* ── Deep Stats Grid ── */
        .deep-stats-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 16px;
            margin-bottom: 20px;
        }

        /* ── Ticker Heatmap Table ── */
        .ticker-perf-table {
            width: 100%;
            border-collapse: collapse;
        }
        .ticker-perf-table th {
            font-size: 9px;
            font-weight: 700;
            letter-spacing: 0.8px;
            text-transform: uppercase;
            color: var(--text-muted);
            padding: 6px 10px;
            text-align: right;
            border-bottom: 1px solid rgba(255,255,255,0.06);
        }
        .ticker-perf-table th:first-child { text-align: left; }
        .ticker-perf-table td {
            padding: 8px 10px;
            font-size: 11px;
            text-align: right;
            border-bottom: 1px solid rgba(255,255,255,0.04);
        }
        .ticker-perf-table td:first-child { text-align: left; font-weight: 600; }
        .ticker-perf-table tr:hover td { background: rgba(255,255,255,0.025); }
        .heat-cell {
            display: inline-block;
            padding: 2px 7px;
            border-radius: 5px;
            font-weight: 700;
            font-size: 11px;
        }
        .heat-great  { background: rgba(0,255,136,0.15);  color: #00FF88; }
        .heat-good   { background: rgba(0,212,255,0.12);  color: #00D4FF; }
        .heat-ok     { background: rgba(255,215,0,0.12);  color: #FFD700; }
        .heat-poor   { background: rgba(255,51,102,0.12); color: #FF3366; }

        /* ── Calibration Pills ── */
        .calibration-strip {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
            margin-top: 4px;
        }
        .cal-pill {
            flex: 1;
            min-width: 70px;
            text-align: center;
            padding: 10px 6px;
            border-radius: 10px;
            border: 1px solid rgba(255,255,255,0.07);
        }
        .cal-pill-val {
            font-size: 18px;
            font-weight: 800;
            letter-spacing: -0.5px;
            display: block;
        }
        .cal-pill-label {
            font-size: 9px;
            text-transform: uppercase;
            letter-spacing: 0.6px;
            color: var(--text-muted);
            margin-top: 3px;
            display: block;
        }
        .cal-ultra { border-color: rgba(0,255,136,0.3);  background: rgba(0,255,136,0.06); }
        .cal-ultra .cal-pill-val { color: #00FF88; }
        .cal-precise { border-color: rgba(0,212,255,0.25); background: rgba(0,212,255,0.06); }
        .cal-precise .cal-pill-val { color: #00D4FF; }
        .cal-ok { border-color: rgba(255,215,0,0.2); background: rgba(255,215,0,0.05); }
        .cal-ok .cal-pill-val { color: #FFD700; }
        .cal-poor { border-color: rgba(255,51,102,0.2); background: rgba(255,51,102,0.05); }
        .cal-poor .cal-pill-val { color: #FF3366; }

        /* ── History Cards (mobile) ── */
        .pred-history-cards { display: none; }
        .pred-history-card {
            background: var(--bg-card);
            border: 1px solid rgba(255,255,255,0.06);
            border-radius: 12px;
            padding: 14px 16px;
            margin-bottom: 10px;
            display: flex;
            flex-direction: column;
            gap: 8px;
            position: relative;
            overflow: hidden;
        }
        .pred-history-card::before {
            content: '';
            position: absolute;
            left: 0; top: 0; bottom: 0;
            width: 3px;
        }
        .pred-history-card.card-hit::before   { background: #00FF88; }
        .pred-history-card.card-miss::before  { background: #FF3366; }
        .pred-history-card.card-pending::before { background: #FFD700; }
        .pred-history-card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .pred-history-card-ticker {
            font-weight: 700;
            font-size: 14px;
        }
        .pred-history-card-badge {
            font-size: 11px;
            font-weight: 700;
            padding: 3px 10px;
            border-radius: 6px;
        }
        .pred-history-card-row {
            display: flex;
            justify-content: space-between;
            font-size: 11px;
        }
        .pred-history-card-key { color: var(--text-muted); }
        .pred-history-card-val { font-weight: 600; }

        /* ── Percentile Stat Box ── */
        .percentile-grid {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 8px;
            margin-top: 8px;
        }
        .percentile-box {
            background: rgba(255,255,255,0.03);
            border: 1px solid rgba(255,255,255,0.07);
            border-radius: 8px;
            padding: 8px 4px;
            text-align: center;
        }
        .percentile-box-label {
            font-size: 9px;
            font-weight: 700;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.6px;
        }
        .percentile-box-val {
            font-size: 14px;
            font-weight: 800;
            color: var(--neon-blue);
            margin-top: 4px;
        }

        /* ── Day of Week Bars ── */
        .dow-grid {
            display: flex;
            align-items: flex-end;
            gap: 8px;
            height: 90px;
            padding-top: 10px;
        }
        .dow-col {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
        }
        .dow-bar-wrap {
            width: 100%;
            flex: 1;
            display: flex;
            align-items: flex-end;
        }
        .dow-bar {
            width: 100%;
            border-radius: 4px 4px 0 0;
            transition: height 0.5s ease;
            min-height: 2px;
        }
        .dow-label {
            font-size: 9px;
            font-weight: 700;
            color: var(--text-muted);
            text-transform: uppercase;
        }
        .dow-val {
            font-size: 9px;
            font-weight: 700;
            color: var(--text-primary);
        }

        /* ── Sharpe/Sortino badges ── */
        .ratio-badge {
            display: inline-flex;
            flex-direction: column;
            align-items: center;
            background: rgba(255,255,255,0.04);
            border: 1px solid rgba(255,255,255,0.08);
            border-radius: 10px;
            padding: 10px 16px;
            min-width: 80px;
        }
        .ratio-badge-val {
            font-size: 20px;
            font-weight: 800;
            letter-spacing: -0.5px;
        }
        .ratio-badge-label {
            font-size: 9px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.8px;
            color: var(--text-muted);
            margin-top: 3px;
        }

        /* ═══════════════════════════════════════════
           RESPONSIVE — PREDICTIONS PAGE (MOBILE)
           ═══════════════════════════════════════════ */
        @media (max-width: 768px) {
            /* Header */
            #page-predictions .page-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 12px;
            }
            #page-predictions .page-header > div:last-child {
                width: 100%;
                flex-wrap: wrap;
                gap: 8px;
            }
            #page-predictions .page-header select,
            #page-predictions .page-header button {
                flex: 1;
                min-width: 120px;
            }

            /* KPI cards — 2 colunas no mobile */
            #pred-kpi-cards {
                grid-template-columns: repeat(2, 1fr) !important;
            }

            /* Chart principal — empilha verticalmente */
            #page-predictions > div:nth-child(3) {
                grid-template-columns: 1fr !important;
            }
            #pred-chart-container {
                height: 260px !important;
            }
            #xai-wrapper {
                height: 260px !important;
            }

            /* Tracker header */
            #page-predictions .page-header + * .page-header {
                flex-direction: column;
                gap: 10px;
            }

            /* Scorecard — 2 colunas */
            #tracker-scorecard {
                grid-template-columns: repeat(2, 1fr) !important;
            }
            #tracker-scorecard .kpi-card:last-child {
                grid-column: 1 / -1;
            }

            /* Premium metrics */
            #page-predictions .kpi-strip {
                grid-template-columns: 1fr !important;
            }

            /* Horizon breakdown — 1 coluna */
            .horizon-breakdown-grid {
                grid-template-columns: 1fr !important;
            }

            /* Deep stats — 1 coluna */
            .deep-stats-grid {
                grid-template-columns: 1fr !important;
            }

            /* History: esconde tabela, mostra cards */
            .pred-history-table-wrap { display: none !important; }
            .pred-history-cards { display: block !important; }

            /* Bottom grid (historico + evolução) — empilha */
            #page-predictions > div > div[style*="grid-template-columns: 2fr 1fr"] {
                grid-template-columns: 1fr !important;
            }

            /* Calibration strip — 2 por linha */
            .calibration-strip .cal-pill {
                min-width: calc(50% - 8px);
            }

            /* Percentile grid — scroll */
            .percentile-grid {
                grid-template-columns: repeat(3, 1fr);
            }

            /* Ratios */
            .ratio-badge {
                padding: 8px 10px;
                min-width: 60px;
            }
        }
        @media (max-width: 480px) {
            #pred-kpi-cards {
                grid-template-columns: 1fr 1fr !important;
                gap: 8px;
            }
            .horizon-breakdown-grid {
                gap: 8px;
            }
            .horizon-card { padding: 12px; }
            .percentile-grid { grid-template-columns: repeat(2, 1fr); }
        }

        /* ══════ INFO TOOLTIP SYSTEM ══════ */
        .info-tip {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 15px;
            height: 15px;
            border-radius: 50%;
            font-size: 9px;
            font-weight: 700;
            font-style: normal;
            color: var(--accent-light);
            border: 1px solid rgba(139, 92, 246, 0.25);
            cursor: help;
            opacity: 0.4;
            transition: all 0.3s ease;
            vertical-align: middle;
            margin-left: 5px;
            flex-shrink: 0;
            position: relative;
            user-select: none;
            line-height: 1;
        }

        .info-tip:hover,
        .info-tip.active {
            opacity: 1;
            background: rgba(139, 92, 246, 0.15);
            border-color: var(--accent-light);
            box-shadow: 0 0 8px rgba(139, 92, 246, 0.2);
            transform: scale(1.15);
        }

        .info-tip .tip-text {
            display: none;
        }

        #global-tooltip {
            position: fixed;
            min-width: 220px;
            max-width: 300px;
            padding: 12px 14px;
            background: #0d0d16;
            border: 1px solid rgba(139, 92, 246, 0.45);
            border-radius: 12px;
            color: #e8ecf4;
            font-size: 11.5px;
            font-weight: 400;
            line-height: 1.55;
            text-align: left;
            z-index: 2147483647;
            pointer-events: none;
            box-shadow: 0 16px 50px rgba(0, 0, 0, 0.85), 0 0 30px rgba(139, 92, 246, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.06);
            visibility: hidden;
            opacity: 0;
            transform: translateY(6px);
            transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
            top: -9999px;
            left: -9999px;
        }

        #global-tooltip.visible {
            visibility: visible;
            opacity: 1;
            transform: translateY(0);
        }

        #global-tooltip::after {
            content: '';
            position: absolute;
            top: 100%;
            left: var(--arrow-left, 50%);
            transform: translateX(-50%);
            border: 6px solid transparent;
            border-top-color: rgba(139, 92, 246, 0.4);
        }

        #global-tooltip.below::after {
            top: auto;
            bottom: 100%;
            border-top-color: transparent;
            border-bottom-color: rgba(139, 92, 246, 0.4);
        }

        /* Light theme */
        .light-theme #global-tooltip {
            background: #fefeff;
            border-color: rgba(139, 92, 246, 0.2);
            color: #1E293B;
            box-shadow: 0 16px 50px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
        }

        .light-theme #global-tooltip::after {
            border-top-color: rgba(139, 92, 246, 0.2);
        }

        .light-theme #global-tooltip.below::after {
            border-top-color: transparent;
            border-bottom-color: rgba(139, 92, 246, 0.2);
        }

        .light-theme .info-tip {
            color: var(--accent);
            border-color: rgba(139, 92, 246, 0.2);
        }

        /* ── MOBILE RESPONSIVENESS (Responsive Layouts) ── */

        @media (max-width: 768px) {

            /* General */
            body {
                overflow-x: hidden;
            }

            .mobile-header {
                display: flex !important;
            }

            /* Main Content Adjustments */
            .main {
                margin-left: 0;
                padding: 15px;
                padding-top: 70px;
                width: 100vw;
            }

            /* Sidebar mobile CSS is handled at ~line 1064 (.open class) */

            #close-sidebar-btn {
                display: block !important;
            }

            /* Topbar Tweaks */
            header.topbar {
                left: 0;
                width: 100%;
                padding: 10px 15px;
                display: none;
            }

            /* ═══════════════════════════════════════════════ */
            /*  PREMIUM MOBILE CHAT IA — Full-Screen Design   */
            /* ═══════════════════════════════════════════════ */

            /* Hide the page header on chat page to maximize space */
            #page-chat>.page-header {
                display: none !important;
            }

            /* Make chat page fill the entire screen */
            #page-chat {
                position: fixed !important;
                top: 55px;
                /* Below mobile header */
                left: 0;
                right: 0;
                bottom: 58px; /* acima da bottom-nav (58px) */
                margin: 0 !important;
                padding: 0 !important;
                z-index: 50;
                overflow: hidden;
            }

            #page-chat #chat-wrapper {
                height: 100%;
                display: flex;
                flex-direction: column;
                overflow: hidden;
            }

            #page-chat .chat-container {
                height: 100% !important;
                display: flex;
                flex-direction: column;
                border-radius: 0;
                border: none;
                background: var(--bg-primary);
            }

            /* Compact chat header — like WhatsApp */
            #page-chat .chat-header {
                padding: 10px 16px;
                border-radius: 0;
                gap: 10px;
                background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
                border-bottom: 1px solid var(--border-card);
                flex-shrink: 0;
            }

            #page-chat .chat-header .chat-avatar {
                width: 36px;
                height: 36px;
                font-size: 18px;
            }

            #page-chat .chat-header h3 {
                font-size: 14px;
            }

            #page-chat .chat-header p {
                font-size: 10px;
            }

            /* Messages area — fills remaining space */
            #page-chat .chat-messages {
                flex: 1;
                padding: 12px 12px 8px;
                overflow-y: auto;
                overflow-x: hidden;
                -webkit-overflow-scrolling: touch;
            }

            /* Messages take more width on mobile */
            #page-chat .chat-msg {
                max-width: 92%;
            }

            #page-chat .chat-msg .msg-bubble {
                font-size: 14px;
                line-height: 1.5;
                padding: 10px 14px;
            }

            /* Input area — pinned to bottom, premium glass effect */
            #page-chat .chat-input-area {
                flex-shrink: 0;
                padding: 10px 12px;
                padding-bottom: max(10px, env(safe-area-inset-bottom));
                background: rgba(12, 12, 18, 0.95);
                backdrop-filter: blur(20px);
                -webkit-backdrop-filter: blur(20px);
                border-top: 1px solid rgba(139, 92, 246, 0.15);
                border-radius: 0;
                gap: 6px;
            }

            /* Prevent iOS zoom on focus — critical */
            #page-chat .chat-input-area textarea {
                font-size: 16px !important;
                min-height: 36px;
                max-height: 100px;
                padding: 6px 0;
            }

            /* Slightly smaller buttons on mobile */
            #page-chat .chat-input-area .chat-btn {
                width: 36px;
                height: 36px;
                font-size: 15px;
            }

            /* Scroll-to-bottom FAB offset */
            #page-chat .chat-scroll-fab {
                bottom: 70px;
                right: 12px;
            }

            /* ═══════════════════════════════════════════════ */
            /*  PREMIUM MOBILE CHAT POPUP — Full-Screen       */
            /* ═══════════════════════════════════════════════ */
            .chat-popup-container {
                width: 100vw !important;
                height: calc(100vh - 55px) !important;
                max-height: none !important;
                bottom: 0 !important;
                right: 0 !important;
                border-radius: 0 !important;
                border: none !important;
            }

            .chat-popup-container .chat-header {
                border-radius: 0;
            }

            .chat-popup-container .chat-input-area {
                padding-bottom: max(10px, env(safe-area-inset-bottom));
                border-radius: 0;
            }

            .chat-popup-container .chat-input-area textarea {
                font-size: 16px !important;
            }

            /* Popup FAB — make it more visible on mobile */
            .chat-popup-fab {
                bottom: 20px !important;
                right: 16px !important;
                width: 52px !important;
                height: 52px !important;
                font-size: 22px;
            }

            /* Prevents iOS zooming in when tapping ALL inputs */
            .login-input,
            .modal-input,
            textarea,
            input[type="text"],
            input[type="password"] {
                font-size: 16px !important;
            }

            /* Modal Adjustments */
            .modal-premium-card {
                width: 95%;
                margin: 10% auto;
                padding: 25px 20px;
            }
        }

        /* ── DRAWING TOOLBAR ── */
        #drawing-toolbar {
            position: absolute;
            left: 6px;
            top: 50%;
            transform: translateY(-50%);
            z-index: 25;
            display: flex;
            flex-direction: column;
            gap: 2px;
            background: rgba(7,7,26,0.88);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border: 1px solid rgba(139,92,246,0.22);
            border-radius: 10px;
            padding: 6px 4px;
            box-shadow: 2px 0 20px rgba(0,0,0,0.4);
        }
        .draw-tool-btn {
            width: 28px;
            height: 28px;
            background: none;
            border: none;
            color: rgba(255,255,255,0.45);
            border-radius: 6px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.15s, color 0.15s;
            padding: 0;
            font-family: inherit;
        }
        .draw-tool-btn:hover {
            background: rgba(139,92,246,0.22);
            color: #c4b5fd;
        }
        .draw-tool-btn.active {
            background: rgba(139,92,246,0.35);
            color: #8b5cf6;
            box-shadow: 0 0 8px rgba(139,92,246,0.3);
        }
        .draw-sep {
            width: 18px;
            height: 1px;
            background: rgba(255,255,255,0.07);
            margin: 2px auto;
        }
        .draw-color-picker {
            width: 22px;
            height: 22px;
            border: 1px solid rgba(255,255,255,0.12);
            border-radius: 50%;
            padding: 0;
            cursor: pointer;
            background: none;
            margin: 0 auto;
            display: block;
            overflow: hidden;
        }

        /* ── Botão de Ajuda Contextual (?) ─────────────────────────────── */
        .page-help-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 26px;
            height: 26px;
            border-radius: 50%;
            border: 1px solid var(--glass-border);
            background: rgba(139, 92, 246, 0.12);
            color: var(--accent-light, #c4b5fd);
            font-size: 13px;
            font-weight: 700;
            cursor: pointer;
            transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
            flex-shrink: 0;
            margin-left: 8px;
            vertical-align: middle;
            line-height: 1;
        }

        .page-help-btn:hover {
            transform: scale(1.18);
            background: rgba(139, 92, 246, 0.28);
            box-shadow: 0 0 10px rgba(139, 92, 246, 0.35);
        }

        .page-help-btn:focus-visible {
            outline: 2px solid var(--accent);
            outline-offset: 2px;
        }

        @media (max-width: 600px) {
            .page-help-btn {
                width: 22px;
                height: 22px;
                font-size: 11px;
            }
        }

    </style>
</head>

<body>

    <!-- ═══ PREMIUM LOGIN OVERLAY ═══ -->
    <div id="login-overlay">
        <!-- Floating particles -->
        <div class="login-particles" id="login-particles"></div>

        <!-- Login Card -->
        <div class="login-card" id="login-card">
            <div class="login-logo">
                <span class="caos">CAOS</span><span class="marada">marada</span>
            </div>
            <div class="login-subtitle">Financial Command Center</div>

            <form id="login-form" onsubmit="doLogin(event)" autocomplete="on">
                <div class="login-input-group">
                    <input type="text" id="login-id" class="login-input" placeholder="Telegram ID ou N° sem DDI"
                        required autocomplete="username">
                    <span class="login-icon">👤</span>
                </div>
                <div class="login-input-group">
                    <input type="password" id="login-password" class="login-input" placeholder="Senha" required
                        autocomplete="current-password">
                    <span class="login-icon">🔒</span>
                </div>
                <button type="submit" class="login-btn" id="login-btn">
                    Acessar Dashboard
                </button>
            </form>

            <div class="login-divider">acesso seguro</div>
            <div class="login-footer">Protegido por JWT &bull; bcrypt &bull; HttpOnly Cookie</div>

            <!-- Error toast popup (slides up from bottom of card) -->
            <div class="login-toast" id="login-toast">
                <span class="toast-icon">⚠️</span>
                <span id="login-toast-text">Credenciais inválidas.</span>
            </div>
        </div>

        <div class="login-version">v5.5 &mdash; Multi-Agent AI Platform</div>
    </div>

    <!-- ═══ PASSWORD CHANGE MODAL ═══ -->
    <div id="password-modal" class="modal-premium-overlay">
        <div class="modal-premium-card">
            <div class="modal-header">
                <div class="modal-title">
                    <div class="title-icon">🔐</div>
                    <span>Alterar Senha</span>
                </div>
                <button class="modal-close"
                    onclick="document.getElementById('password-modal').style.display='none'">✕</button>
            </div>
            <form id="change-password-form" onsubmit="doChangePassword(event)">
                <div class="modal-input-group">
                    <input type="password" id="cp-old" class="modal-input" placeholder="Senha Atual" required>
                    <span class="modal-input-icon">🔒</span>
                </div>
                <div class="modal-input-group">
                    <input type="password" id="cp-new" class="modal-input" placeholder="Nova Senha (mín. 6 caracteres)"
                        required>
                    <span class="modal-input-icon">✨</span>
                </div>
                <div class="modal-input-group">
                    <input type="password" id="cp-confirm" class="modal-input" placeholder="Confirmar Nova Senha"
                        required>
                    <span class="modal-input-icon">✅</span>
                </div>
                <div id="cp-error" class="cp-msg error"></div>
                <div id="cp-success" class="cp-msg success">✅ Senha alterada com sucesso!</div>
                <button type="submit" class="login-btn" style="margin-top:20px">Confirmar Alteração</button>
            </form>
        </div>
    </div>

    <!-- ═══ MOBILE HEADER & OVERLAY ═══ -->
    <div class="mobile-header"
        style="display:none; position:fixed; top:0; left:0; width:100%; height:55px; background:var(--bg-secondary); border-bottom:1px solid var(--border-card); z-index:1000; align-items:center; padding:0 16px; justify-content:space-between; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
        <h1 style="font-size:18px; margin:0; font-weight:800; letter-spacing:-0.5px;"><span class="caos"
                style="background: linear-gradient(135deg, var(--accent), #C084FC); -webkit-background-clip: text; -webkit-text-fill-color: transparent;">CAOS</span><span
                class="marada" style="color:var(--text-primary); font-weight:300;">marada</span></h1>
