/* ============================================================
   ADVANCED ANALYSIS — advanced-analysis.css v2.0
   AlphaVault AI — Gemini Intelligence Edition
   Light mode default · Dark mode via body.dark-mode
   100% responsive PC/Mobile · Architecture: crm-dashboard.css
   ============================================================ */

/* ════════════════════════════════════════════════════════════
   §1. CSS VARIABLES — LIGHT MODE (default)
════════════════════════════════════════════════════════════ */
:root {
    /* ── Backgrounds ──────────────────────────────────────── */
    --aa-bg:             #f1f5f9;
    --aa-sidebar-bg:     #ffffff;
    --aa-header-bg:      rgba(255, 255, 255, 0.97);
    --aa-surface:        #ffffff;
    --aa-surface-hover:  #f8fafc;
    --aa-input-bg:       rgba(0, 0, 0, 0.04);
    --aa-card:           #ffffff;

    /* ── Borders ──────────────────────────────────────────── */
    --aa-border:         rgba(0, 0, 0, 0.08);
    --aa-border-hover:   rgba(0, 0, 0, 0.15);

    /* ── Text ─────────────────────────────────────────────── */
    --aa-text:           #1e293b;
    --aa-text-muted:     #475569;
    --aa-text-faint:     #94a3b8;

    /* ── Brand Colors ─────────────────────────────────────── */
    --aa-primary:        #667eea;
    --aa-primary-dark:   #764ba2;
    --aa-green:          #28a745;
    --aa-amber:          #ffc107;
    --aa-red:            #dc3545;
    --aa-purple:         #8b5cf6;
    --aa-cyan:           #17a2b8;
    --aa-orange:         #fd7e14;
    --aa-teal:           #20c997;
    --aa-indigo:         #6610f2;
    --aa-pink:           #d63384;

    /* ── Radius ───────────────────────────────────────────── */
    --aa-radius:         10px;
    --aa-radius-lg:      16px;
    --aa-radius-xl:      24px;

    /* ── Shadows ──────────────────────────────────────────── */
    --aa-shadow:         0 4px 24px rgba(0, 0, 0, 0.08);
    --aa-shadow-lg:      0 10px 50px rgba(0, 0, 0, 0.15);
    --aa-shadow-xl:      0 20px 60px rgba(0, 0, 0, 0.18);

    /* ── Layout ───────────────────────────────────────────── */
    --aa-sidebar-w:      260px;
    --aa-header-h:       58px;
    --aa-transition:     all 0.2s ease;
}

/* ── Dark Mode Overrides ────────────────────────────────── */
body.dark-mode {
    --aa-bg:             #0b1120;
    --aa-sidebar-bg:     #0f172a;
    --aa-header-bg:      rgba(11, 17, 32, 0.97);
    --aa-surface:        rgba(30, 41, 59, 0.92);
    --aa-surface-hover:  rgba(51, 65, 85, 0.9);
    --aa-input-bg:       rgba(255, 255, 255, 0.06);
    --aa-card:           rgba(30, 41, 59, 0.92);
    --aa-border:         rgba(255, 255, 255, 0.08);
    --aa-border-hover:   rgba(255, 255, 255, 0.15);
    --aa-text:           #f0f4f8;
    --aa-text-muted:     #cbd5e1;
    --aa-text-faint:     #94a3b8;
    --aa-shadow:         0 4px 24px rgba(0, 0, 0, 0.35);
    --aa-shadow-lg:      0 10px 50px rgba(0, 0, 0, 0.55);
    --aa-shadow-xl:      0 20px 60px rgba(0, 0, 0, 0.70);
}

/* ════════════════════════════════════════════════════════════
   §2. RESET & BASE
════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; overflow: hidden; }

body.avd-page {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--aa-bg);
    color: var(--aa-text);
    font-size: 13px;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

a      { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
select option { background: var(--aa-surface); color: var(--aa-text); }

.hidden { display: none !important; }

/* ════════════════════════════════════════════════════════════
   §3. APP LAYOUT
════════════════════════════════════════════════════════════ */
#avDriveApp {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* ════════════════════════════════════════════════════════════
   §4. SIDEBAR
════════════════════════════════════════════════════════════ */
#avdSidebar {
    width: var(--aa-sidebar-w);
    flex-shrink: 0;
    background: var(--aa-sidebar-bg);
    border-right: 1px solid var(--aa-border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: visible;
    position: relative;
    z-index: 200;
    transition: width 0.25s ease, transform 0.3s ease;
}

body:not(.dark-mode) #avdSidebar {
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.06);
}

/* ── Collapsed ──────────────────────────────────────────── */
#avdSidebar.collapsed { width: 64px; }

#avdSidebar.collapsed .avd-nav-item-text,
#avdSidebar.collapsed .avd-nav-label,
#avdSidebar.collapsed .avd-platform-section,
#avdSidebar.collapsed .avd-platform-divider,
#avdSidebar.collapsed .avd-nav-bottom,
#avdSidebar.collapsed .avd-trigger-info,
#avdSidebar.collapsed .avd-trigger-plan,
#avdSidebar.collapsed .avd-trigger-chevron  { display: none; }

#avdSidebar.collapsed .avd-nav-item {
    justify-content: center;
    padding: 10px;
}

#avdSidebar.collapsed .avd-nav-item-icon { margin: 0; }

#avdSidebar.collapsed .avd-sidebar-footer { display: none; }

/* ── Logo Wrap ──────────────────────────────────────────── */
.avd-sidebar-logo-wrap {
    display: flex;
    align-items: center;
    padding: 14px 14px 12px;
    min-height: 62px;
    text-decoration: none;
    border-bottom: 1px solid var(--aa-border);
    margin-bottom: 6px;
    flex-shrink: 0;
    transition: var(--aa-transition);
}

.avd-sidebar-logo-wrap:hover { opacity: 0.85; }

.avd-sidebar-logo-text {
    display: block;
    height: 36px;
    max-width: 175px;
    object-fit: contain;
}

.avd-sidebar-logo-icon {
    display: none;
    height: 34px;
    width: 34px;
    object-fit: contain;
}

#avdSidebar.collapsed .avd-sidebar-logo-text { display: none; }

#avdSidebar.collapsed .avd-sidebar-logo-wrap {
    justify-content: center;
    padding: 12px 0;
}

#avdSidebar.collapsed .avd-sidebar-logo-icon {
    display: block;
    margin: 0 auto;
}

/* ── Scroll Area ────────────────────────────────────────── */
.avd-sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.avd-sidebar-scroll::-webkit-scrollbar { width: 3px; }
.avd-sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}
body.dark-mode .avd-sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
}

/* ── Divider ────────────────────────────────────────────── */
.avd-platform-divider {
    border: none;
    border-top: 1px solid var(--aa-border);
    margin: 6px 10px;
}

/* ── Mobile Close ───────────────────────────────────────── */
.avd-mobile-close-btn {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.06);
    border: 1px solid var(--aa-border);
    color: var(--aa-text-muted);
    font-size: 14px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: var(--aa-transition);
}

body.dark-mode .avd-mobile-close-btn {
    background: rgba(255, 255, 255, 0.08);
}

.avd-mobile-close-btn:hover {
    background: rgba(220, 53, 69, 0.12);
    color: var(--aa-red);
    border-color: rgba(220, 53, 69, 0.3);
}

/* ════════════════════════════════════════════════════════════
   §5. SIDEBAR TOGGLE BUTTON
════════════════════════════════════════════════════════════ */
.avd-sidebar-toggle {
    position: absolute;
    right: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--aa-surface);
    border: 1px solid var(--aa-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--aa-text-muted);
    font-size: 10px;
    z-index: 300;
    transition: var(--aa-transition);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    flex-shrink: 0;
    user-select: none;
}

.avd-sidebar-toggle:hover {
    background: var(--aa-primary);
    color: #fff;
    border-color: var(--aa-primary);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.5);
    transform: translateY(-50%) scale(1.1);
}

/* ════════════════════════════════════════════════════════════
   §6. MAIN CONTENT
════════════════════════════════════════════════════════════ */
#avdMain {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    min-width: 0;
    transition: margin-left 0.25s ease;
}

/* ════════════════════════════════════════════════════════════
   §7. HEADER
════════════════════════════════════════════════════════════ */
#avDriveHeader {
    height: var(--aa-header-h);
    background: var(--aa-header-bg);
    border-bottom: 1px solid var(--aa-border);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    flex-shrink: 0;
    backdrop-filter: blur(20px);
    position: relative;
    z-index: 100;
}

/* ── Breadcrumb ─────────────────────────────────────────── */
.avd-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.avd-breadcrumb-item {
    font-size: 12px;
    font-weight: 700;
    color: var(--aa-text-faint);
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s;
}

.avd-breadcrumb-item:hover           { color: var(--aa-text-muted); }
.avd-breadcrumb-item.active          { color: var(--aa-text); cursor: default; }
.avd-breadcrumb-item-muted           { color: var(--aa-text-faint) !important; cursor: default !important; }

.avd-breadcrumb-sep {
    display: flex;
    align-items: center;
}

.avd-breadcrumb-sep-icon             { font-size: 9px; color: var(--aa-text-faint); }
.avd-breadcrumb-icon                 { margin-right: 5px; font-size: 11px; }
.avd-breadcrumb-icon-accent          { color: var(--aa-primary); }

/* ── Last Update ────────────────────────────────────────── */
.avd-header-last-update {
    font-size: 10px;
    color: var(--aa-text-faint);
    font-weight: 600;
    white-space: nowrap;
}

/* ── Header Controls ────────────────────────────────────── */
.avd-header-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

/* ── Mobile Menu Button ─────────────────────────────────── */
.avd-mobile-menu-btn {
    display: none;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius);
    font-size: 13px;
    color: var(--aa-text-muted);
    cursor: pointer;
    transition: var(--aa-transition);
    flex-shrink: 0;
}

.avd-header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius);
    font-size: 13px;
    color: var(--aa-text-muted);
    cursor: pointer;
    transition: var(--aa-transition);
    flex-shrink: 0;
}

.avd-header-btn:hover,
.avd-mobile-menu-btn:hover {
    background: rgba(0, 0, 0, 0.07);
    color: var(--aa-text);
    border-color: var(--aa-border-hover);
}

body.dark-mode .avd-header-btn:hover,
body.dark-mode .avd-mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ── Theme Toggle ───────────────────────────────────────── */
.avd-theme-toggle {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius);
    cursor: pointer;
    color: var(--aa-text-muted);
    font-size: 14px;
    transition: var(--aa-transition);
    flex-shrink: 0;
}

.avd-theme-toggle:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--aa-primary);
    border-color: rgba(102, 126, 234, 0.2);
}

body.dark-mode .avd-theme-toggle:hover {
    background: rgba(255, 193, 7, 0.12);
    color: var(--aa-amber);
    border-color: rgba(255, 193, 7, 0.3);
}

/* ── Status Dot ─────────────────────────────────────────── */
.avd-header-status-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 4px;
}

.avd-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--aa-text-faint);
    flex-shrink: 0;
}

.avd-status-dot.connected {
    background: var(--aa-green);
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.5);
    animation: aaPulse 2s ease-in-out infinite;
}

/* ── User Avatar ────────────────────────────────────────── */
.avd-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    transition: var(--aa-transition);
    flex-shrink: 0;
}

.avd-user-avatar:hover { transform: scale(1.08); }

.avd-user-avatar-fallback {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    user-select: none;
}

/* ════════════════════════════════════════════════════════════
   §8. SIDEBAR NAVIGATION
════════════════════════════════════════════════════════════ */
.avd-platform-nav { padding: 0 8px; }

.avd-nav-label {
    padding: 10px 10px 5px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: var(--aa-text-faint);
}

/* Platform Sections */
.avd-platform-section { margin-bottom: 1px; }

.avd-platform-folder {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--aa-text-muted);
    cursor: pointer;
    border-radius: var(--aa-radius);
    margin: 0 2px;
    transition: var(--aa-transition);
    background: none;
    border: none;
    width: calc(100% - 4px);
    text-align: left;
}

.avd-platform-folder:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--aa-text);
}

body.dark-mode .avd-platform-folder:hover {
    background: rgba(255, 255, 255, 0.05);
}

.avd-platform-folder i:first-child {
    font-size: 13px;
    width: 16px;
    text-align: center;
}

/* Arrow animation */
.arrow { margin-left: auto; font-size: 9px; transition: transform 0.2s; }
.avd-platform-folder.open .arrow { transform: rotate(180deg); }

/* Submenus */
.avd-platform-submenu { display: none; padding: 2px 0; }
.avd-platform-submenu.open { display: block; }

.avd-platform-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 32px;
    font-size: 11px;
    font-weight: 600;
    color: var(--aa-text-faint);
    text-decoration: none;
    border-radius: 8px;
    margin: 0 2px;
    transition: var(--aa-transition);
}

.avd-platform-link:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--aa-text-muted);
}

body.dark-mode .avd-platform-link:hover {
    background: rgba(255, 255, 255, 0.04);
}

.avd-platform-link.active {
    background: rgba(102, 126, 234, 0.12);
    color: var(--aa-primary);
    font-weight: 700;
}

.avd-platform-link i { font-size: 11px; width: 14px; text-align: center; }

/* Simple Nav Items (Drive link) */
.avd-nav         { padding: 4px 8px; }
.avd-nav-bottom  { padding-bottom: 8px; }
.avd-nav-section { margin-bottom: 4px; }

.avd-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--aa-radius);
    cursor: pointer;
    transition: var(--aa-transition);
    color: var(--aa-text-muted);
    text-decoration: none;
    margin-bottom: 2px;
}

.avd-nav-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--aa-text);
}

body.dark-mode .avd-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.avd-nav-item-icon {
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.avd-nav-item-text {
    flex: 1;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ════════════════════════════════════════════════════════════
   §9. SIDEBAR FOOTER
════════════════════════════════════════════════════════════ */
.avd-sidebar-footer {
    border-top: 1px solid var(--aa-border);
    position: relative;
    flex-shrink: 0;
}

/* ── User Dropdown ──────────────────────────────────────── */
.avd-sidebar-user-dropdown {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--aa-surface);
    border: 1px solid var(--aa-border);
    border-radius: 14px;
    padding: 8px;
    margin: 0 8px 6px;
    box-shadow: var(--aa-shadow-lg);
    z-index: 1000;
    animation: aaFadeIn 0.15s ease;
}

.avd-sidebar-user-dropdown.open { display: block; }

.avd-sidebar-dropdown-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--aa-border);
    margin-bottom: 6px;
}

.avd-dropdown-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avd-dropdown-info { flex: 1; min-width: 0; }

.avd-dropdown-name {
    font-size: 13px;
    font-weight: 800;
    color: var(--aa-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.avd-dropdown-email {
    font-size: 10px;
    color: var(--aa-text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.avd-sidebar-dropdown-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: var(--aa-text-muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    transition: var(--aa-transition);
}

.avd-sidebar-dropdown-link:hover {
    background: var(--aa-input-bg);
    color: var(--aa-text);
}

.avd-sidebar-dropdown-link i {
    font-size: 13px;
    width: 16px;
    text-align: center;
}

.avd-sidebar-dropdown-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: var(--aa-red);
    font-size: 12px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--aa-transition);
    background: none;
    border: none;
    border-top: 1px solid var(--aa-border);
    width: 100%;
    text-align: left;
    margin-top: 4px;
}

.avd-sidebar-dropdown-logout:hover { background: rgba(220, 53, 69, 0.08); }

/* ── User Trigger ───────────────────────────────────────── */
.avd-sidebar-user-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    transition: var(--aa-transition);
}

.avd-sidebar-user-trigger:hover { background: var(--aa-input-bg); }

.avd-trigger-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avd-trigger-info { flex: 1; min-width: 0; }

.avd-trigger-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--aa-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.avd-trigger-email {
    font-size: 10px;
    color: var(--aa-text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.avd-trigger-plan {
    font-size: 9px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 20px;
    background: rgba(102, 126, 234, 0.12);
    color: var(--aa-primary);
    flex-shrink: 0;
    border: 1px solid rgba(102, 126, 234, 0.18);
}

.avd-trigger-chevron {
    font-size: 9px;
    color: var(--aa-text-faint);
    transition: transform 0.2s;
    flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════
   §10. CONTENT AREA
════════════════════════════════════════════════════════════ */
#avDriveContent {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 22px 26px;
    -webkit-overflow-scrolling: touch;
}

#avDriveContent::-webkit-scrollbar { width: 5px; }
#avDriveContent::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}
body.dark-mode #avDriveContent::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

/* Admin Ghost */
.avd-admin-ghost {
    display: none;
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    pointer-events: none;
}

/* Mobile Backdrop */
.avd-mobile-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 999;
}

.avd-mobile-backdrop.active { display: block; }

/* ════════════════════════════════════════════════════════════
   §11. FAVORITES SECTION
════════════════════════════════════════════════════════════ */
.my-favorites-section {
    background: var(--aa-surface);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius-lg);
    margin-bottom: 20px;
    overflow: hidden;
}

body:not(.dark-mode) .my-favorites-section {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.my-favorites-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--aa-border);
    transition: background 0.15s;
}

.my-favorites-header:hover { background: var(--aa-input-bg); }

.my-favorites-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 800;
    color: var(--aa-text);
}

.my-favorites-title .fa-star { color: var(--aa-amber); }

.fav-count-badge {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(255, 193, 7, 0.12);
    color: var(--aa-amber);
    border: 1px solid rgba(255, 193, 7, 0.2);
}

.my-favorites-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.my-favorites-manage-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    color: var(--aa-text-muted);
    cursor: pointer;
    transition: var(--aa-transition);
}

.my-favorites-manage-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--aa-primary);
    border-color: rgba(102, 126, 234, 0.25);
}

.my-favorites-toggle-icon {
    font-size: 11px;
    color: var(--aa-text-faint);
    transition: transform 0.2s;
}

.my-favorites-body { padding: 14px 16px; display: none; }
.my-favorites-body.open { display: block; }

/* Favorites Loader */
.avd-fav-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px;
    gap: 10px;
}

.avd-fav-loader-text {
    font-size: 12px;
    font-weight: 700;
    color: var(--aa-text-faint);
}

.fav-loader-ring {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 2px solid rgba(102, 126, 234, 0.15);
    border-top-color: var(--aa-primary);
    border-radius: 50%;
    animation: aaSpin 0.7s linear infinite;
}

/* Favorites View Controls */
.fav-lists-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.fav-view-toggle-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 10px;
    flex-wrap: wrap;
}

.fav-view-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--aa-text-muted);
}

.fav-view-btns { display: flex; gap: 4px; }

.fav-view-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    color: var(--aa-text-muted);
    cursor: pointer;
    transition: var(--aa-transition);
}

.fav-view-btn:hover,
.fav-view-btn.active {
    background: rgba(102, 126, 234, 0.12);
    color: var(--aa-primary);
    border-color: rgba(102, 126, 234, 0.25);
}

.fav-logos-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.fav-cards-grid { display: flex; flex-direction: column; gap: 8px; }

/* ════════════════════════════════════════════════════════════
   §12. SEARCH PANEL
════════════════════════════════════════════════════════════ */
.search-panel {
    background: var(--aa-surface);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius-lg);
    padding: 22px 24px;
    margin-bottom: 20px;
}

body:not(.dark-mode) .search-panel {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.panel-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--aa-text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-title .fa-search { color: var(--aa-primary); }

.search-container { display: flex; flex-direction: column; gap: 14px; }

/* ── Search Input Wrapper ───────────────────────────────── */
.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

#symbolInput {
    flex: 1;
    background: var(--aa-input-bg);
    border: 1.5px solid var(--aa-border);
    border-radius: var(--aa-radius);
    padding: 11px 16px;
    font-family: inherit;
    font-size: 13px;
    color: var(--aa-text);
    outline: none;
    transition: var(--aa-transition);
}

#symbolInput::placeholder { color: var(--aa-text-faint); }

#symbolInput:focus {
    border-color: var(--aa-primary);
    background: rgba(102, 126, 234, 0.05);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.btn-analyze {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 11px 22px;
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-primary-dark));
    border: none;
    border-radius: var(--aa-radius);
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    cursor: pointer;
    transition: var(--aa-transition);
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.35);
}

.btn-analyze:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(102, 126, 234, 0.5);
}

/* ── Search Suggestions ─────────────────────────────────── */
.search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--aa-surface);
    border: 1px solid var(--aa-border);
    border-radius: 14px;
    max-height: 360px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--aa-shadow-lg);
    display: none;
}

.search-suggestions.active { display: block; }

.suggestion-category {
    padding: 8px 14px 5px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--aa-text-faint);
    display: flex;
    align-items: center;
    gap: 5px;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    cursor: pointer;
    transition: var(--aa-transition);
    border-radius: 8px;
    margin: 0 4px;
}

.suggestion-item:hover,
.suggestion-item.selected { background: var(--aa-input-bg); }

.suggestion-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.suggestion-icon.tech       { background: linear-gradient(135deg, #667eea, #764ba2); }
.suggestion-icon.finance     { background: linear-gradient(135deg, #10b981, #059669); }
.suggestion-icon.etf         { background: linear-gradient(135deg, #f59e0b, #d97706); }
.suggestion-icon.crypto      { background: linear-gradient(135deg, #f97316, #ea580c); }
.suggestion-icon.industrial  { background: linear-gradient(135deg, #6b7280, #4b5563); }

.suggestion-info { flex: 1; min-width: 0; }

.suggestion-symbol {
    font-size: 12px;
    font-weight: 800;
    color: var(--aa-text);
    margin-bottom: 1px;
}

.suggestion-name {
    font-size: 10px;
    color: var(--aa-text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-exchange {
    font-size: 9px;
    font-weight: 700;
    color: var(--aa-text-faint);
    flex-shrink: 0;
    background: var(--aa-input-bg);
    padding: 2px 6px;
    border-radius: 4px;
}

.suggestion-match { color: var(--aa-primary); font-weight: 800; }

.suggestion-loading {
    padding: 14px;
    font-size: 12px;
    color: var(--aa-text-faint);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.no-results {
    padding: 20px;
    text-align: center;
    color: var(--aa-text-faint);
    font-size: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.no-results i    { font-size: 24px; margin-bottom: 4px; }
.no-results p    { margin: 0; line-height: 1.5; }

/* ── Popular Stocks ─────────────────────────────────────── */
.popular-stocks {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--aa-text-faint);
    white-space: nowrap;
}

.symbol-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    border-radius: 20px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    color: var(--aa-text-muted);
    cursor: pointer;
    transition: var(--aa-transition);
    white-space: nowrap;
}

.symbol-chip:hover {
    background: rgba(102, 126, 234, 0.12);
    border-color: rgba(102, 126, 234, 0.25);
    color: var(--aa-primary);
    transform: translateY(-1px);
}

/* ── Period Settings ────────────────────────────────────── */
.prediction-settings { display: flex; gap: 16px; flex-wrap: wrap; }

.setting-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.setting-group label {
    font-size: 12px;
    font-weight: 700;
    color: var(--aa-text-muted);
    white-space: nowrap;
}

.horizon-btn {
    padding: 6px 14px;
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    border-radius: 20px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    color: var(--aa-text-muted);
    cursor: pointer;
    transition: var(--aa-transition);
}

.horizon-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--aa-primary);
    border-color: rgba(102, 126, 234, 0.25);
}

.horizon-btn.active {
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-primary-dark));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.35);
}

/* ── Export Buttons ─────────────────────────────────────── */
.export-buttons-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--aa-radius);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--aa-transition);
    border: 1.5px solid var(--aa-border);
    background: var(--aa-input-bg);
    color: var(--aa-text-muted);
}

.export-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--aa-shadow);
}

.export-csv:hover {
    background: rgba(40, 167, 69, 0.08);
    border-color: rgba(40, 167, 69, 0.3);
    color: var(--aa-green);
}

.export-pdf:hover {
    background: rgba(220, 53, 69, 0.08);
    border-color: rgba(220, 53, 69, 0.3);
    color: var(--aa-red);
}

/* ════════════════════════════════════════════════════════════
   §13. LOADING INDICATOR
════════════════════════════════════════════════════════════ */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 28px;
    background: var(--aa-surface);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius-lg);
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--aa-text-muted);
    animation: aaFadeIn 0.3s ease;
}

.loading-indicator .fa-spinner {
    color: var(--aa-primary);
    font-size: 18px;
}

/* ════════════════════════════════════════════════════════════
   §14. STOCK HEADER
════════════════════════════════════════════════════════════ */
.stock-header {
    background: var(--aa-surface);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius-lg);
    padding: 16px 20px;
    margin-bottom: 16px;
    animation: aaFadeIn 0.35s ease;
}

body:not(.dark-mode) .stock-header {
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.15);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.stock-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.stock-info h2 {
    font-size: 22px;
    font-weight: 900;
    color: var(--aa-primary);
    letter-spacing: -0.5px;
}

.stock-name {
    font-size: 13px;
    color: var(--aa-text-muted);
    font-weight: 600;
}

/* Stock Logo */
.stock-logo-container {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stock-logo { width: 100%; height: 100%; object-fit: contain; }

.logo-initials {
    font-size: 13px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stock-price { text-align: right; }

.stock-price .price {
    font-size: 16px;
    font-weight: 800;
    color: var(--aa-text);
    margin-bottom: 3px;
}

.stock-price .change {
    font-size: 12px;
    font-weight: 700;
    color: var(--aa-text-faint);
}

.stock-price .change.positive { color: var(--aa-green); }
.stock-price .change.negative { color: var(--aa-red); }
.stock-price .change.neutral  { color: var(--aa-text-muted); }

/* ════════════════════════════════════════════════════════════
   §15. NEWS TICKER
════════════════════════════════════════════════════════════ */
.news-ticker-section {
    background: var(--aa-surface);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius-lg);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    overflow: hidden;
    height: 44px;
}

.news-ticker-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #fff;
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-primary-dark));
    height: 100%;
    flex-shrink: 0;
    white-space: nowrap;
}

.news-ticker-wrapper {
    flex: 1;
    overflow: hidden;
    height: 100%;
    display: flex;
    align-items: center;
}

.news-ticker-track {
    display: flex;
    align-items: center;
    animation: newsTickerScroll 60s linear infinite;
    white-space: nowrap;
}

#newsTickerTrack.paused { animation-play-state: paused !important; }

.news-ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    font-size: 11px;
    color: var(--aa-text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s;
}

.news-ticker-item:hover { color: var(--aa-primary); }

.news-ticker-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--aa-primary);
    flex-shrink: 0;
}

.news-ticker-source {
    font-weight: 800;
    color: var(--aa-primary);
    font-size: 10px;
}

.news-ticker-headline { color: var(--aa-text-muted); font-size: 11px; }
.news-ticker-time     { color: var(--aa-text-faint); font-size: 10px; flex-shrink: 0; }

.news-ticker-separator {
    color: var(--aa-border-hover);
    font-size: 10px;
    padding: 0 8px;
}

.news-ticker-controls {
    display: flex;
    align-items: center;
    padding: 0 10px;
    flex-shrink: 0;
}

.ticker-control-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    color: var(--aa-text-faint);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--aa-transition);
}

.ticker-control-btn:hover,
.ticker-control-btn.is-paused {
    background: rgba(102, 126, 234, 0.12);
    color: var(--aa-primary);
    border-color: rgba(102, 126, 234, 0.25);
}

.news-ticker-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    font-size: 11px;
    color: var(--aa-text-faint);
    font-weight: 600;
}

/* ════════════════════════════════════════════════════════════
   §16. ANIMATIONS
════════════════════════════════════════════════════════════ */
@keyframes aaSpin {
    to { transform: rotate(360deg); }
}
@keyframes aaFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0);   }
}
@keyframes aaSlideIn {
    from { transform: translateX(12px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
@keyframes aaSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
@keyframes aaPulse {
    0%, 100% { opacity: 1;   }
    50%       { opacity: 0.4; }
}
@keyframes aaGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(102,126,234,0.4); }
    50%       { box-shadow: 0 0 0 8px rgba(102,126,234,0); }
}
@keyframes newsTickerScroll {
    0%   { transform: translateX(0);    }
    100% { transform: translateX(-50%); }
}
@keyframes aaSkeletonPulse {
    0%, 100% { opacity: 1;   }
    50%       { opacity: 0.5; }
}
@keyframes aaThinkingDots {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%            { transform: scale(1.0); opacity: 1.0; }
}

.aa-fade-in  { animation: aaFadeIn  0.35s ease forwards; }
.aa-slide-in { animation: aaSlideIn 0.3s  ease forwards; }
.aa-slide-up { animation: aaSlideUp 0.4s  cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.aa-pulse    { animation: aaPulse   2s    ease-in-out infinite; }
.aa-glow     { animation: aaGlow    2s    ease-in-out infinite; }

/* ════════════════════════════════════════════════════════════
   §17. SCROLLBARS
════════════════════════════════════════════════════════════ */
* { scrollbar-width: thin; scrollbar-color: rgba(0,0,0,0.1) transparent; }
body.dark-mode * { scrollbar-color: rgba(255,255,255,0.08) transparent; }
*::-webkit-scrollbar { width: 4px; height: 4px; }
*::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 4px; }
body.dark-mode *::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }

/* ════════════════════════════════════════════════════════════
   END PART 1/2 — advanced-analysis.css
   Part 2 : Results Panel · AI Sections · Charts · Modals
            Dark Mode · Responsive · Utilities
   © AlphaVault AI — All rights reserved
════════════════════════════════════════════════════════════ */

/* ============================================================
   ADVANCED ANALYSIS — advanced-analysis.css v2.0
   PART 2/2 — Results Panel · AI · Charts · Modals · Responsive
   © AlphaVault AI — All rights reserved
   ============================================================ */

/* ════════════════════════════════════════════════════════════
   §18. RESULTS PANEL BASE
════════════════════════════════════════════════════════════ */
.results-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: aaFadeIn 0.4s ease;
}

/* Shared Widget Base (cards dans le results panel) */
.signals-section,
.ai-recommendation-section,
.category-scorecard,
.ai-text-summary,
.divergence-section,
.oscillator-card,
.chart-section {
    background: var(--aa-surface);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius-lg);
    padding: 22px 24px;
}

body:not(.dark-mode) .signals-section,
body:not(.dark-mode) .ai-recommendation-section,
body:not(.dark-mode) .category-scorecard,
body:not(.dark-mode) .ai-text-summary,
body:not(.dark-mode) .divergence-section,
body:not(.dark-mode) .oscillator-card,
body:not(.dark-mode) .chart-section {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

/* Section Titles */
.section-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--aa-text);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.section-title i { color: var(--aa-primary); }

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.1);
    color: var(--aa-primary);
    font-size: 10px;
    cursor: pointer;
    transition: var(--aa-transition);
    margin-left: auto;
    flex-shrink: 0;
}

.help-icon::after { content: '?'; font-weight: 800; }

.help-icon:hover {
    background: var(--aa-primary);
    color: #fff;
    transform: scale(1.15);
}

/* ════════════════════════════════════════════════════════════
   §19. CONSOLIDATED SIGNALS & GAUGE
════════════════════════════════════════════════════════════ */
.signal-gauge {
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius);
    padding: 16px 20px;
    margin-bottom: 16px;
}

.gauge-header h4 {
    font-size: 12px;
    font-weight: 700;
    color: var(--aa-text-muted);
    margin-bottom: 10px;
}

.gauge-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.gauge-bar {
    flex: 1;
    height: 10px;
    background: rgba(0, 0, 0, 0.07);
    border-radius: 10px;
    overflow: hidden;
}

body.dark-mode .gauge-bar {
    background: rgba(255, 255, 255, 0.07);
}

.gauge-fill {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--aa-red) 0%, var(--aa-amber) 40%, var(--aa-green) 80%);
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 4px;
}

.gauge-value {
    font-size: 13px;
    font-weight: 800;
    min-width: 90px;
    text-align: right;
    white-space: nowrap;
}

/* Signal Breakdown */
.signals-breakdown {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.signal-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--aa-radius);
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    transition: var(--aa-transition);
}

.signal-row:hover {
    border-color: var(--aa-border-hover);
    transform: translateX(2px);
}

.signal-indicator-name {
    flex: 1;
    font-size: 12px;
    font-weight: 700;
    color: var(--aa-text);
}

.signal-indicator-value {
    font-size: 11px;
    color: var(--aa-text-faint);
    font-weight: 600;
    min-width: 60px;
    text-align: right;
}

.signal-badge {
    font-size: 9px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    min-width: 50px;
    text-align: center;
    flex-shrink: 0;
}

.signal-badge.buy {
    background: rgba(40, 167, 69, 0.12);
    color: var(--aa-green);
    border: 1px solid rgba(40, 167, 69, 0.2);
}

.signal-badge.sell {
    background: rgba(220, 53, 69, 0.12);
    color: var(--aa-red);
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.signal-badge.neutral {
    background: rgba(148, 163, 184, 0.12);
    color: var(--aa-text-faint);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

/* Gauge Value Colors */
.gauge-value.strong-buy  { color: #16a34a; }
.gauge-value.buy         { color: var(--aa-green); }
.gauge-value.neutral     { color: var(--aa-amber); }
.gauge-value.sell        { color: var(--aa-red); }
.gauge-value.strong-sell { color: #b91c1c; }

/* ════════════════════════════════════════════════════════════
   §20. AI RECOMMENDATION SECTION
════════════════════════════════════════════════════════════ */
.ai-recommendation-section {
    background: linear-gradient(135deg,
        rgba(102, 126, 234, 0.03) 0%,
        rgba(118, 75, 162, 0.03) 100%);
    border-color: rgba(102, 126, 234, 0.15);
}

/* AI Header */
.ai-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

/* AI Logo Ring */
.ai-logo-container { flex-shrink: 0; }

.ai-logo-ring {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.4);
    animation: aaGlow 3s ease-in-out infinite;
}

.ai-logo-core {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
}

/* AI Header Text */
.ai-header-text { flex: 1; min-width: 0; }

.ai-title {
    font-size: 14px;
    font-weight: 900;
    color: var(--aa-text);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    letter-spacing: 0.3px;
}

.ai-badge {
    font-size: 8px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-primary-dark));
    color: #fff;
    letter-spacing: 0.8px;
    flex-shrink: 0;
}

.ai-subtitle {
    font-size: 12px;
    color: var(--aa-text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ai-indicators-count {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(102, 126, 234, 0.1);
    color: var(--aa-primary);
    border: 1px solid rgba(102, 126, 234, 0.15);
}

/* ════════════════════════════════════════════════════════════
   §21. AI SCORE & QUICK STATS
════════════════════════════════════════════════════════════ */
.ai-score-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 20px;
    margin-bottom: 28px;
    align-items: center;
}

.ai-score-card {
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius-lg);
    padding: 20px;
    text-align: center;
}

.ai-score-label {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--aa-text-faint);
    margin-bottom: 10px;
}

.ai-score-value {
    font-size: 40px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
    margin-bottom: 10px;
}

.ai-score-bar {
    height: 8px;
    background: rgba(0, 0, 0, 0.07);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}

body.dark-mode .ai-score-bar {
    background: rgba(255, 255, 255, 0.07);
}

.ai-score-fill {
    height: 100%;
    border-radius: 8px;
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 4px;
}

/* Score Rating Classes */
.ai-score-rating {
    font-size: 11px;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
}

.ai-score-rating.very-bullish,
.ai-score-fill.very-bullish { background: linear-gradient(135deg, #16a34a, #15803d); color: #fff; }

.ai-score-rating.bullish,
.ai-score-fill.bullish { background: linear-gradient(135deg, var(--aa-green), #16a34a); color: #fff; }

.ai-score-rating.moderately-bullish,
.ai-score-fill.moderately-bullish { background: linear-gradient(135deg, #86efac, #4ade80); color: #14532d; }

.ai-score-rating.neutral,
.ai-score-fill.neutral { background: linear-gradient(135deg, var(--aa-amber), #f59e0b); color: #78350f; }

.ai-score-rating.moderately-bearish,
.ai-score-fill.moderately-bearish { background: linear-gradient(135deg, #fca5a5, #f87171); color: #7f1d1d; }

.ai-score-rating.bearish,
.ai-score-fill.bearish { background: linear-gradient(135deg, var(--aa-red), #b91c1c); color: #fff; }

.ai-score-rating.very-bearish,
.ai-score-fill.very-bearish { background: linear-gradient(135deg, #b91c1c, #7f1d1d); color: #fff; }

/* Quick Stats */
.ai-quick-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius);
}

.ai-stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.ai-stat-icon.bullish { background: rgba(40, 167, 69, 0.12);  color: var(--aa-green);  }
.ai-stat-icon.neutral { background: rgba(148, 163, 184, 0.12); color: var(--aa-text-faint); }
.ai-stat-icon.bearish { background: rgba(220, 53, 69, 0.12);  color: var(--aa-red);    }

.ai-stat-content { flex: 1; min-width: 0; }

.ai-stat-value {
    font-size: 20px;
    font-weight: 900;
    color: var(--aa-text);
    line-height: 1.2;
}

.ai-stat-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--aa-text-faint);
    margin-top: 1px;
}

/* ════════════════════════════════════════════════════════════
   §22. AI HORIZON CARDS
════════════════════════════════════════════════════════════ */
.ai-horizons-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.ai-horizon-card {
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius-lg);
    padding: 18px;
    transition: var(--aa-transition);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ai-horizon-card:hover {
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
    box-shadow: var(--aa-shadow);
}

.ai-horizon-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-horizon-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.ai-horizon-title h3 {
    font-size: 13px;
    font-weight: 800;
    color: var(--aa-text);
    margin-bottom: 2px;
}

.ai-horizon-title p {
    font-size: 10px;
    color: var(--aa-text-faint);
    font-weight: 500;
}

/* Recommendation Badge */
.ai-horizon-recommendation {
    display: flex;
    justify-content: center;
}

.ai-rec-badge {
    font-size: 12px;
    font-weight: 900;
    padding: 8px 24px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
}

.ai-rec-badge.strong-buy  { background: linear-gradient(135deg,#16a34a,#15803d); color:#fff; box-shadow: 0 4px 14px rgba(22,163,74,0.35); }
.ai-rec-badge.buy         { background: linear-gradient(135deg,var(--aa-green),#16a34a); color:#fff; box-shadow: 0 4px 14px rgba(40,167,69,0.3); }
.ai-rec-badge.accumulate  { background: linear-gradient(135deg,#0d9488,#0f766e); color:#fff; }
.ai-rec-badge.hold        { background: linear-gradient(135deg,var(--aa-amber),#f59e0b); color:#78350f; }
.ai-rec-badge.reduce      { background: linear-gradient(135deg,var(--aa-orange),#ea580c); color:#fff; }
.ai-rec-badge.sell        { background: linear-gradient(135deg,var(--aa-red),#b91c1c); color:#fff; box-shadow: 0 4px 14px rgba(220,53,69,0.3); }
.ai-rec-badge.strong-sell { background: linear-gradient(135deg,#b91c1c,#7f1d1d); color:#fff; box-shadow: 0 4px 14px rgba(185,28,28,0.35); }
.ai-rec-badge.neutral     { background: rgba(148,163,184,0.15); color:var(--aa-text-muted); border: 1px solid var(--aa-border); }

/* Dip Badge */
.dip-badge {
    font-size: 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 1px 6px;
}

/* Horizon Details */
.ai-horizon-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.ai-detail-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--aa-text-faint);
}

.ai-detail-value {
    font-size: 12px;
    font-weight: 800;
    color: var(--aa-text);
}

.ai-confidence-bar {
    flex: 1;
    height: 6px;
    background: rgba(0, 0, 0, 0.07);
    border-radius: 6px;
    overflow: hidden;
}

body.dark-mode .ai-confidence-bar {
    background: rgba(255, 255, 255, 0.07);
}

.ai-confidence-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.6s ease;
    min-width: 3px;
}

.ai-confidence-fill.buy,
.ai-confidence-fill.strong-buy,
.ai-confidence-fill.accumulate { background: linear-gradient(90deg, var(--aa-green), #16a34a); }
.ai-confidence-fill.hold       { background: linear-gradient(90deg, var(--aa-amber), #f59e0b); }
.ai-confidence-fill.sell,
.ai-confidence-fill.strong-sell { background: linear-gradient(90deg, var(--aa-red), #b91c1c); }
.ai-confidence-fill.neutral     { background: var(--aa-text-faint); }

/* Horizon Drivers */
.ai-horizon-drivers { flex: 1; }

.ai-drivers-label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--aa-text-faint);
    margin-bottom: 8px;
}

.ai-drivers-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ai-driver-item {
    font-size: 11px;
    color: var(--aa-text-muted);
    display: flex;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.5;
    padding: 5px 8px;
    background: rgba(102, 126, 234, 0.04);
    border-left: 2px solid rgba(102, 126, 234, 0.25);
    border-radius: 0 6px 6px 0;
}

.ai-driver-item i { color: var(--aa-primary); flex-shrink: 0; margin-top: 1px; }

/* ════════════════════════════════════════════════════════════
   §23. AI DISCLAIMER
════════════════════════════════════════════════════════════ */
.ai-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.12);
    border-radius: var(--aa-radius);
    font-size: 11px;
    color: var(--aa-text-faint);
    line-height: 1.6;
}

.ai-disclaimer i {
    color: var(--aa-primary);
    flex-shrink: 0;
    margin-top: 1px;
}

.ai-disclaimer strong { color: var(--aa-text-muted); }

/* ════════════════════════════════════════════════════════════
   §24. GEMINI AI NARRATIVE WIDGET
════════════════════════════════════════════════════════════ */
.aa-gemini-narrative-wrapper {
    min-height: 0;
    animation: aaFadeIn 0.4s ease;
}

/* Narrative Card (injected by AAChatWidget) */
.aa-narrative-card {
    background: linear-gradient(135deg,
        rgba(102, 126, 234, 0.06),
        rgba(118, 75, 162, 0.06));
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: var(--aa-radius-lg);
    padding: 22px 24px;
    position: relative;
    overflow: hidden;
}

.aa-narrative-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.aa-narrative-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-primary-dark));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 15px;
    flex-shrink: 0;
}

.aa-narrative-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--aa-text);
}

.aa-narrative-subtitle {
    font-size: 11px;
    color: var(--aa-text-faint);
    margin-top: 1px;
}

.aa-narrative-badge {
    margin-left: auto;
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-primary-dark));
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    flex-shrink: 0;
}

.aa-narrative-body {
    font-size: 13px;
    line-height: 1.8;
    color: var(--aa-text-muted);
}

.aa-narrative-footer {
    margin-top: 12px;
    font-size: 10px;
    color: var(--aa-text-faint);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.aa-narrative-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    font-size: 12px;
    color: var(--aa-text-faint);
}

/* Narrative Tab Buttons */
.aa-narrative-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(102, 126, 234, 0.1);
}

.aa-narrative-tab-btn {
    padding: 5px 12px;
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--aa-primary);
    font-family: inherit;
    transition: var(--aa-transition);
}

.aa-narrative-tab-btn.active,
.aa-narrative-tab-btn:hover {
    background: var(--aa-primary);
    color: #fff;
    border-color: var(--aa-primary);
}

/* ════════════════════════════════════════════════════════════
   §25. CATEGORY SCORECARD
════════════════════════════════════════════════════════════ */
.scorecard-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.scorecard-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    flex-shrink: 0;
}

.scorecard-header-text h3 {
    font-size: 14px;
    font-weight: 800;
    color: var(--aa-text);
    margin-bottom: 3px;
}

.scorecard-header-text p {
    font-size: 11px;
    color: var(--aa-text-faint);
}

.scorecard-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.scorecard-category {
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius);
    padding: 14px;
    text-align: center;
    transition: var(--aa-transition);
}

.scorecard-category:hover {
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
    box-shadow: var(--aa-shadow);
}

.scorecard-cat-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--aa-text-faint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.scorecard-cat-score {
    font-size: 28px;
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 4px;
}

.scorecard-cat-score.score-bullish { color: var(--aa-green);      }
.scorecard-cat-score.score-neutral { color: var(--aa-amber);      }
.scorecard-cat-score.score-bearish { color: var(--aa-red);        }

.scorecard-cat-verdict {
    font-size: 10px;
    font-weight: 700;
    margin-bottom: 8px;
}

.scorecard-cat-verdict.bullish { color: var(--aa-green);      }
.scorecard-cat-verdict.neutral { color: var(--aa-amber);      }
.scorecard-cat-verdict.bearish { color: var(--aa-red);        }

.scorecard-cat-bar {
    height: 4px;
    background: rgba(0, 0, 0, 0.07);
    border-radius: 4px;
    overflow: hidden;
}

body.dark-mode .scorecard-cat-bar {
    background: rgba(255, 255, 255, 0.07);
}

.scorecard-cat-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 3px;
}

.fill-bullish { background: linear-gradient(90deg, var(--aa-green), #16a34a); }
.fill-neutral { background: linear-gradient(90deg, var(--aa-amber), #f59e0b); }
.fill-bearish { background: linear-gradient(90deg, var(--aa-red),   #b91c1c); }

/* ════════════════════════════════════════════════════════════
   §26. AI TEXT SUMMARY
════════════════════════════════════════════════════════════ */
.ai-text-summary { padding: 0; overflow: hidden; }

.ai-summary-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--aa-border);
    background: linear-gradient(135deg,
        rgba(102, 126, 234, 0.04),
        rgba(118, 75, 162, 0.04));
    flex-wrap: wrap;
}

.ai-summary-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    flex-shrink: 0;
}

.ai-summary-header-text h3 {
    font-size: 14px;
    font-weight: 800;
    color: var(--aa-text);
    margin-bottom: 2px;
}

.ai-summary-header-text p {
    font-size: 11px;
    color: var(--aa-text-faint);
}

.summary-timestamp {
    margin-left: auto;
    font-size: 10px;
    color: var(--aa-text-faint);
    font-weight: 600;
    white-space: nowrap;
}

.ai-summary-body {
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Summary Sections */
.summary-section {
    border-radius: var(--aa-radius);
    border: 1px solid var(--aa-border);
    overflow: hidden;
}

.summary-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--aa-input-bg);
    border-bottom: 1px solid var(--aa-border);
}

.summary-section-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    flex-shrink: 0;
}

.overview-icon    { background: linear-gradient(135deg, var(--aa-primary), var(--aa-primary-dark)); }
.momentum-icon    { background: linear-gradient(135deg, var(--aa-amber),   #f59e0b); }
.trend-icon       { background: linear-gradient(135deg, var(--aa-green),   #16a34a); }
.volume-icon      { background: linear-gradient(135deg, var(--aa-cyan),    #0891b2); }
.volatility-icon  { background: linear-gradient(135deg, var(--aa-orange),  #ea580c); }
.probability-icon { background: linear-gradient(135deg, var(--aa-purple),  #7c3aed); }
.conclusion-icon  { background: linear-gradient(135deg, #1e293b, #334155); }

.summary-section-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--aa-text);
}

.summary-section-body {
    padding: 14px 16px;
}

.summary-section-body ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 12px;
}

.summary-section-body ul li {
    font-size: 12px;
    color: var(--aa-text-muted);
    line-height: 1.6;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--aa-border);
}

.summary-section-body ul li:last-child { border-bottom: none; }

.summary-section-body ul li::before {
    content: '›';
    color: var(--aa-primary);
    font-weight: 900;
    font-size: 14px;
    line-height: 1.4;
    flex-shrink: 0;
}

/* Overview Stats Row */
.overview-stats-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.overview-stat-chip {
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    border-radius: 8px;
    padding: 8px 12px;
    text-align: center;
    flex: 1;
    min-width: 80px;
}

.chip-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--aa-text-faint);
    margin-bottom: 4px;
}

.chip-value {
    font-size: 13px;
    font-weight: 800;
    color: var(--aa-text);
}

.chip-value.chip-bullish { color: var(--aa-green);      }
.chip-value.chip-bearish { color: var(--aa-red);        }
.chip-value.chip-neutral { color: var(--aa-amber);      }

/* Highlight Classes */
.hl-bullish { color: var(--aa-green);       font-weight: 700; }
.hl-bearish { color: var(--aa-red);         font-weight: 700; }
.hl-neutral { color: var(--aa-amber);       font-weight: 700; }
.hl-info    { color: var(--aa-cyan);        font-weight: 700; }
.hl-purple  { color: var(--aa-purple);      font-weight: 700; }

.bullish-text { color: var(--aa-green) !important; }
.bearish-text { color: var(--aa-red)   !important; }

/* Indicator Pills */
.indicator-pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.indicator-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.pill-bullish {
    background: rgba(40, 167, 69, 0.1);
    color: var(--aa-green);
    border: 1px solid rgba(40, 167, 69, 0.2);
}

.pill-bearish {
    background: rgba(220, 53, 69, 0.1);
    color: var(--aa-red);
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.pill-neutral {
    background: rgba(148, 163, 184, 0.1);
    color: var(--aa-text-faint);
    border: 1px solid rgba(148, 163, 184, 0.15);
}

/* Probability Bars */
.probability-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.probability-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.probability-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 600;
    color: var(--aa-text-muted);
    min-width: 170px;
    white-space: nowrap;
}

.prob-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.prob-dot.bullish-dot { background: var(--aa-green); }
.prob-dot.neutral-dot { background: var(--aa-amber); }
.prob-dot.bearish-dot { background: var(--aa-red);   }

.probability-bar-track {
    flex: 1;
    height: 8px;
    background: rgba(0, 0, 0, 0.07);
    border-radius: 8px;
    overflow: hidden;
}

body.dark-mode .probability-bar-track {
    background: rgba(255, 255, 255, 0.07);
}

.probability-bar-fill {
    height: 100%;
    border-radius: 8px;
    transition: width 0.6s ease;
    min-width: 3px;
}

.bullish-fill { background: linear-gradient(90deg, var(--aa-green), #16a34a); }
.neutral-fill { background: linear-gradient(90deg, var(--aa-amber), #f59e0b); }
.bearish-fill { background: linear-gradient(90deg, var(--aa-red),   #b91c1c); }

.probability-pct {
    font-size: 12px;
    font-weight: 800;
    min-width: 34px;
    text-align: right;
}

.probability-pct.bullish { color: var(--aa-green); }
.probability-pct.neutral { color: var(--aa-amber); }
.probability-pct.bearish { color: var(--aa-red);   }

.prob-disclaimer {
    margin-top: 10px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 10px;
    color: var(--aa-text-faint);
    line-height: 1.5;
    font-style: italic;
}

.prob-disclaimer i { color: var(--aa-primary); flex-shrink: 0; margin-top: 1px; }

/* Conclusion Box */
.conclusion-box {
    background: linear-gradient(135deg,
        rgba(102, 126, 234, 0.05),
        rgba(118, 75, 162, 0.05));
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: var(--aa-radius);
    padding: 14px 16px;
    font-size: 12px;
    color: var(--aa-text-muted);
    line-height: 1.7;
}

/* ════════════════════════════════════════════════════════════
   §27. DIVERGENCE SECTION
════════════════════════════════════════════════════════════ */
.divergence-section { padding: 0; overflow: hidden; }

.divergence-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    gap: 14px;
    flex-wrap: wrap;
}

.divergence-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.divergence-header-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--aa-amber), #f59e0b);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.divergence-header-text h3 {
    font-size: 14px;
    font-weight: 800;
    color: var(--aa-text);
    margin-bottom: 2px;
}

.divergence-header-text p {
    font-size: 11px;
    color: var(--aa-text-faint);
}

.divergence-count-badge {
    font-size: 11px;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--aa-input-bg);
    color: var(--aa-text-faint);
    border: 1px solid var(--aa-border);
    flex-shrink: 0;
}

.divergence-count-badge.has-bullish { background: rgba(40,167,69,0.1);  color: var(--aa-green); border-color: rgba(40,167,69,0.2); }
.divergence-count-badge.has-bearish { background: rgba(220,53,69,0.1);  color: var(--aa-red);   border-color: rgba(220,53,69,0.2); }
.divergence-count-badge.has-mixed   { background: rgba(255,193,7,0.1);  color: var(--aa-amber); border-color: rgba(255,193,7,0.2); }

.divergence-body {
    padding: 0 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.divergence-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border-radius: var(--aa-radius);
    border: 1px solid;
    animation: aaFadeIn 0.3s ease;
}

.bullish-divergence {
    background: rgba(40, 167, 69, 0.06);
    border-color: rgba(40, 167, 69, 0.2);
}

.bearish-divergence {
    background: rgba(220, 53, 69, 0.06);
    border-color: rgba(220, 53, 69, 0.2);
}

.divergence-alert-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #fff;
    flex-shrink: 0;
}

.bullish-divergence .divergence-alert-icon { background: var(--aa-green); }
.bearish-divergence .divergence-alert-icon { background: var(--aa-red);   }

.divergence-alert-content { flex: 1; min-width: 0; }

.divergence-alert-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--aa-text);
    margin-bottom: 5px;
}

.divergence-alert-desc {
    font-size: 11px;
    color: var(--aa-text-muted);
    line-height: 1.6;
}

.divergence-strength-badge {
    font-size: 9px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 20px;
    background: var(--aa-input-bg);
    color: var(--aa-text-faint);
    border: 1px solid var(--aa-border);
    flex-shrink: 0;
    white-space: nowrap;
    align-self: flex-start;
}

.divergence-no-signal {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px;
    text-align: center;
    gap: 8px;
    color: var(--aa-text-faint);
    font-size: 12px;
}

.divergence-no-signal i { font-size: 28px; color: var(--aa-green); margin-bottom: 4px; }

/* ════════════════════════════════════════════════════════════
   §28. OSCILLATOR CARDS & CHARTS
════════════════════════════════════════════════════════════ */
.oscillators-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.oscillator-card { padding: 20px 22px; }

.chart-section { padding: 20px 22px; }

.chart {
    width: 100%;
    min-height: 380px;
    border-radius: var(--aa-radius);
    overflow: hidden;
    margin-bottom: 14px;
    background: var(--aa-input-bg);
}

/* Signal Boxes */
.signal-box {
    padding: 10px 14px;
    border-radius: var(--aa-radius);
    font-size: 12px;
    font-weight: 600;
    color: var(--aa-text-muted);
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    line-height: 1.5;
    transition: var(--aa-transition);
}

.signal-box.bullish {
    background: rgba(40, 167, 69, 0.08);
    border-color: rgba(40, 167, 69, 0.25);
    color: #166534;
}

body.dark-mode .signal-box.bullish { color: #86efac; }

.signal-box.bearish {
    background: rgba(220, 53, 69, 0.08);
    border-color: rgba(220, 53, 69, 0.25);
    color: #991b1b;
}

body.dark-mode .signal-box.bearish { color: #fca5a5; }

.signal-box.neutral {
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.2);
    color: var(--aa-text-muted);
}

/* ════════════════════════════════════════════════════════════
   §29. INDICATOR MODALS
════════════════════════════════════════════════════════════ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: aaFadeIn 0.15s ease;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--aa-surface);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius-xl);
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--aa-shadow-xl);
    animation: aaSlideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--aa-border);
    background: linear-gradient(135deg,
        rgba(102, 126, 234, 0.04),
        rgba(118, 75, 162, 0.04));
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 15px;
    font-weight: 800;
    color: var(--aa-text);
    flex: 1;
}

.close-modal {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    color: var(--aa-text-muted);
    transition: var(--aa-transition);
    line-height: 1;
    flex-shrink: 0;
}

.close-modal:hover {
    background: rgba(220, 53, 69, 0.1);
    color: var(--aa-red);
    border-color: rgba(220, 53, 69, 0.25);
}

.modal-body {
    padding: 20px 22px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
}

.modal-body h3 {
    font-size: 13px;
    font-weight: 800;
    color: var(--aa-text);
    margin: 16px 0 8px;
}

.modal-body h3:first-child { margin-top: 0; }

.modal-body h4 {
    font-size: 12px;
    font-weight: 700;
    color: var(--aa-text-muted);
    margin: 12px 0 6px;
}

.modal-body p {
    font-size: 12px;
    color: var(--aa-text-muted);
    line-height: 1.7;
    margin-bottom: 8px;
}

.modal-body ul, .modal-body ol {
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 12px;
}

.modal-body li {
    font-size: 12px;
    color: var(--aa-text-muted);
    line-height: 1.6;
}

.modal-body strong { color: var(--aa-text); font-weight: 700; }

.key-term {
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.formula-box {
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    border-left: 3px solid var(--aa-primary);
    border-radius: var(--aa-radius);
    padding: 12px 16px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: var(--aa-text-muted);
    line-height: 1.8;
    margin: 10px 0;
    white-space: pre-wrap;
}

.tip-box {
    background: rgba(40, 167, 69, 0.06);
    border: 1px solid rgba(40, 167, 69, 0.2);
    border-left: 3px solid var(--aa-green);
    border-radius: var(--aa-radius);
    padding: 12px 16px;
    font-size: 12px;
    color: var(--aa-text-muted);
    line-height: 1.6;
    margin: 10px 0;
}

.warning-box {
    background: rgba(220, 53, 69, 0.06);
    border: 1px solid rgba(220, 53, 69, 0.2);
    border-left: 3px solid var(--aa-red);
    border-radius: var(--aa-radius);
    padding: 12px 16px;
    font-size: 12px;
    color: var(--aa-text-muted);
    line-height: 1.6;
    margin: 10px 0;
}

/* ════════════════════════════════════════════════════════════
   §30. FAVORITES MODAL
════════════════════════════════════════════════════════════ */
.favorites-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: 9000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.favorites-modal-overlay.active { display: flex; }

.favorites-modal-box {
    background: var(--aa-surface);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius-xl);
    max-width: 540px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--aa-shadow-xl);
    animation: aaSlideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ════════════════════════════════════════════════════════════
   §31. DETAILED ANALYSIS MODAL
════════════════════════════════════════════════════════════ */
.detailed-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.detailed-modal-overlay.active { display: flex; }

.detailed-modal-container {
    background: var(--aa-surface);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius-xl);
    max-width: 820px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--aa-shadow-xl);
    animation: aaSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.detailed-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--aa-border);
    background: linear-gradient(135deg,
        rgba(102, 126, 234, 0.05),
        rgba(118, 75, 162, 0.05));
    flex-shrink: 0;
}

.modal-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.modal-icon {
    font-size: 22px;
    color: var(--aa-primary);
}

.detailed-modal-header h2 {
    font-size: 16px;
    font-weight: 900;
    color: var(--aa-text);
    margin-bottom: 2px;
}

.detailed-modal-header p {
    font-size: 11px;
    color: var(--aa-text-faint);
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    color: var(--aa-text-muted);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--aa-transition);
}

.modal-close-btn:hover {
    background: rgba(220, 53, 69, 0.1);
    color: var(--aa-red);
    border-color: rgba(220, 53, 69, 0.25);
}

.detailed-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.modal-section { display: flex; flex-direction: column; gap: 14px; }

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 800;
    color: var(--aa-text);
}

.section-header i { color: var(--aa-primary); }

.detailed-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 24px;
    border-top: 1px solid var(--aa-border);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: var(--aa-radius);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--aa-transition);
    border: 1px solid var(--aa-border);
}

.modal-btn.primary {
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-primary-dark));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.35);
}

.modal-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(102, 126, 234, 0.5);
}

.modal-btn.secondary {
    background: var(--aa-input-bg);
    color: var(--aa-text-muted);
}

.modal-btn.secondary:hover {
    background: rgba(0, 0, 0, 0.07);
    color: var(--aa-text);
}

/* Modal Indicator Tabs */
.indicator-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.indicator-tab {
    padding: 6px 14px;
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    border-radius: 20px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    color: var(--aa-text-muted);
    cursor: pointer;
    transition: var(--aa-transition);
}

.indicator-tab.active,
.indicator-tab:hover {
    background: rgba(102, 126, 234, 0.12);
    color: var(--aa-primary);
    border-color: rgba(102, 126, 234, 0.25);
}

/* Indicator Cards */
.indicator-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.indicator-card {
    background: var(--aa-input-bg);
    border: 1px solid;
    border-radius: var(--aa-radius);
    padding: 14px;
    transition: var(--aa-transition);
}

.indicator-card.bullish { border-color: rgba(40, 167, 69, 0.25); }
.indicator-card.bearish { border-color: rgba(220, 53, 69, 0.25); }
.indicator-card.neutral { border-color: var(--aa-border);        }

.indicator-card:hover { transform: translateY(-1px); box-shadow: var(--aa-shadow); }

.indicator-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}

.indicator-name {
    font-size: 12px;
    font-weight: 800;
    color: var(--aa-text);
    display: flex;
    align-items: center;
    gap: 5px;
}

.indicator-signal {
    font-size: 9px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.indicator-signal.bullish { background: rgba(40,167,69,0.12);  color: var(--aa-green); }
.indicator-signal.bearish { background: rgba(220,53,69,0.12);  color: var(--aa-red);   }
.indicator-signal.neutral { background: rgba(148,163,184,0.12); color: var(--aa-text-faint); }

.indicator-body {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.indicator-value,
.indicator-weight,
.indicator-strength {
    font-size: 11px;
    color: var(--aa-text-muted);
}

.indicator-description {
    font-size: 10px;
    color: var(--aa-text-faint);
    line-height: 1.5;
    padding-top: 8px;
    border-top: 1px solid var(--aa-border);
}

/* Regime Grid (in modal) */
.regime-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.regime-card {
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius);
    padding: 16px;
    text-align: center;
}

.regime-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    margin: 0 auto 10px;
}

.regime-label  { font-size: 9px;  font-weight: 700; color: var(--aa-text-faint); text-transform: uppercase; margin-bottom: 4px; }
.regime-value  { font-size: 13px; font-weight: 800; color: var(--aa-text); margin-bottom: 3px; }
.regime-confidence { font-size: 10px; color: var(--aa-text-faint); }

/* Horizon Detail Cards (in modal) */
.horizon-detail-card {
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius-lg);
    padding: 16px;
}

.horizon-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 10px;
}

.horizon-header h4 {
    font-size: 13px;
    font-weight: 800;
    color: var(--aa-text);
}

.horizon-rec-badge {
    font-size: 11px;
    font-weight: 800;
    padding: 5px 16px;
    border-radius: 20px;
}

.horizon-rec-badge.buy         { background: rgba(40,167,69,0.12);  color: var(--aa-green); }
.horizon-rec-badge.sell        { background: rgba(220,53,69,0.12);  color: var(--aa-red);   }
.horizon-rec-badge.hold        { background: rgba(255,193,7,0.12);  color: #92400e;         }
.horizon-rec-badge.strong-buy  { background: var(--aa-green);       color: #fff;            }
.horizon-rec-badge.strong-sell { background: var(--aa-red);         color: #fff;            }

.horizon-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.horizon-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.horizon-stat span {
    font-size: 10px;
    font-weight: 600;
    color: var(--aa-text-faint);
}

.horizon-stat strong {
    font-size: 13px;
    font-weight: 800;
    color: var(--aa-text);
}

.horizon-stat strong.bullish { color: var(--aa-green); }
.horizon-stat strong.bearish { color: var(--aa-red);   }

.horizon-drivers h5 {
    font-size: 11px;
    font-weight: 700;
    color: var(--aa-text-faint);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.horizon-driver {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--aa-border);
    font-size: 11px;
    color: var(--aa-text-muted);
    line-height: 1.5;
}

.horizon-driver:last-child { border-bottom: none; }

.driver-number {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.12);
    color: var(--aa-primary);
    font-size: 9px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Score Card Large (in modal) */
.score-card-large {
    background: var(--aa-input-bg);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius-lg);
    padding: 24px;
    text-align: center;
}

.score-gauge {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;
}

.score-value {
    font-size: 52px;
    font-weight: 900;
    line-height: 1;
}

.score-value.very-bullish { color: #16a34a; }
.score-value.bullish      { color: var(--aa-green); }
.score-value.neutral      { color: var(--aa-amber); }
.score-value.bearish      { color: var(--aa-red);   }
.score-value.very-bearish { color: #b91c1c; }

.score-label {
    font-size: 22px;
    font-weight: 700;
    color: var(--aa-text-faint);
    margin-bottom: 12px;
}

.score-rating {
    font-size: 14px;
    font-weight: 800;
    padding: 6px 18px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 16px;
}

.score-breakdown {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
}

.breakdown-item.bullish { color: var(--aa-green); }
.breakdown-item.neutral { color: var(--aa-text-faint); }
.breakdown-item.bearish { color: var(--aa-red); }

.modal-disclaimer {
    display: flex;
    gap: 10px;
    padding: 14px 16px;
    background: rgba(255, 193, 7, 0.06);
    border: 1px solid rgba(255, 193, 7, 0.2);
    border-radius: var(--aa-radius);
    font-size: 11px;
    color: var(--aa-text-muted);
    line-height: 1.6;
}

.modal-disclaimer i { color: var(--aa-amber); flex-shrink: 0; margin-top: 1px; }

.no-indicators {
    padding: 24px;
    text-align: center;
    color: var(--aa-text-faint);
    font-size: 12px;
}

/* ════════════════════════════════════════════════════════════
   §32. DARK MODE ADJUSTMENTS
════════════════════════════════════════════════════════════ */
body.dark-mode .signals-section,
body.dark-mode .ai-recommendation-section,
body.dark-mode .category-scorecard,
body.dark-mode .ai-text-summary,
body.dark-mode .divergence-section,
body.dark-mode .oscillator-card,
body.dark-mode .chart-section       { background: rgba(30, 41, 59, 0.85); }

body.dark-mode .search-panel,
body.dark-mode .my-favorites-section,
body.dark-mode .loading-indicator,
body.dark-mode .stock-header         { background: rgba(30, 41, 59, 0.85); }

body.dark-mode .chart                { background: rgba(255, 255, 255, 0.02); }

body.dark-mode .modal-content,
body.dark-mode .detailed-modal-container,
body.dark-mode .favorites-modal-box  { background: #1a2235; border-color: rgba(255, 255, 255, 0.1); }

body.dark-mode .ai-horizon-card      { background: rgba(255, 255, 255, 0.03); }

body.dark-mode .ai-score-card,
body.dark-mode .signal-row,
body.dark-mode .ai-stat-item,
body.dark-mode .scorecard-category,
body.dark-mode .overview-stat-chip,
body.dark-mode .indicator-card,
body.dark-mode .regime-card,
body.dark-mode .horizon-detail-card,
body.dark-mode .score-card-large,
body.dark-mode .horizon-driver       { background: rgba(255, 255, 255, 0.04); }

body.dark-mode .tip-box              { background: rgba(40, 167, 69, 0.08);  }
body.dark-mode .warning-box          { background: rgba(220, 53, 69, 0.08);  }
body.dark-mode .formula-box          { background: rgba(255, 255, 255, 0.04); }

body.dark-mode .conclusion-box,
body.dark-mode .ai-disclaimer        { background: rgba(102, 126, 234, 0.06); }

body.dark-mode .divergence-alert.bullish-divergence { background: rgba(40, 167, 69, 0.08);  }
body.dark-mode .divergence-alert.bearish-divergence { background: rgba(220, 53, 69, 0.08);  }

body.dark-mode .summary-section      { background: rgba(255, 255, 255, 0.02); }
body.dark-mode .summary-section-header { background: rgba(255, 255, 255, 0.04); }

body.dark-mode .news-ticker-section  { background: rgba(30, 41, 59, 0.85); }

body.dark-mode .aa-narrative-card {
    background: rgba(102, 126, 234, 0.08);
    border-color: rgba(102, 126, 234, 0.2);
}

body.dark-mode .signal-box.bullish { background: rgba(40, 167, 69, 0.12); }
body.dark-mode .signal-box.bearish { background: rgba(220, 53, 69, 0.12); }

/* ════════════════════════════════════════════════════════════
   §33. LIGHT MODE POLISH
════════════════════════════════════════════════════════════ */
body:not(.dark-mode) .ai-horizon-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
body:not(.dark-mode) .oscillator-card       { box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
body:not(.dark-mode) .modal-content         { box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
body:not(.dark-mode) .detailed-modal-container { box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
body:not(.dark-mode) .ai-score-card         { box-shadow: inset 0 1px 0 rgba(255,255,255,0.8); }
body:not(.dark-mode) .scorecard-category:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }

/* ════════════════════════════════════════════════════════════
   §34. RESPONSIVE — LARGE (≤ 1400px)
════════════════════════════════════════════════════════════ */
@media (max-width: 1400px) {
    .scorecard-grid         { grid-template-columns: repeat(5, 1fr); }
    .ai-horizons-grid       { grid-template-columns: repeat(3, 1fr); }
}

/* ════════════════════════════════════════════════════════════
   §35. RESPONSIVE — TABLET (≤ 1200px)
════════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
    :root { --aa-sidebar-w: 240px; }

    .ai-score-container { grid-template-columns: 200px 1fr; }

    .scorecard-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .oscillators-grid { grid-template-columns: 1fr 1fr; }

    .regime-grid { grid-template-columns: 1fr 1fr 1fr; }

    .ai-horizons-grid { grid-template-columns: 1fr 1fr 1fr; }

    .indicator-content {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* ════════════════════════════════════════════════════════════
   §36. RESPONSIVE — MOBILE (≤ 768px)
════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    html, body { overflow: hidden; }

    /* Sidebar */
    #avdSidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        z-index: 1000;
        transform: translateX(-100%);
        width: var(--aa-sidebar-w) !important;
        overflow-y: auto;
        overflow-x: hidden;
    }

    #avdSidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 40px rgba(0, 0, 0, 0.25);
    }

    .avd-sidebar-toggle   { display: none !important; }
    .avd-mobile-close-btn { display: flex !important; }
    .avd-mobile-menu-btn  { display: flex !important; }

    /* Header */
    #avDriveHeader { padding: 0 12px; gap: 8px; }
    .avd-breadcrumb { display: none; }
    .avd-header-last-update { display: none; }

    /* Content */
    #avDriveContent { padding: 14px; }

    /* Search Panel */
    .search-panel { padding: 16px; }
    .search-input-wrapper { flex-direction: column; align-items: stretch; }
    #symbolInput    { width: 100%; }
    .btn-analyze    { width: 100%; justify-content: center; }
    .popular-stocks { gap: 5px; }
    .symbol-chip    { font-size: 10px; padding: 5px 10px; }
    .prediction-settings { flex-direction: column; gap: 10px; }
    .export-buttons-container { flex-direction: column; }
    .export-btn     { width: 100%; justify-content: center; }

    /* Stock Header */
    .header-content { flex-direction: column; align-items: flex-start; gap: 12px; }
    .stock-price    { text-align: left; }

    /* AI Score */
    .ai-score-container { grid-template-columns: 1fr; }

    /* AI Horizons */
    .ai-horizons-grid { grid-template-columns: 1fr; }

    /* Oscillators */
    .oscillators-grid { grid-template-columns: 1fr; }

    /* Scorecard */
    .scorecard-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

    /* Summary */
    .overview-stats-row { gap: 6px; }
    .overview-stat-chip { min-width: 70px; padding: 6px 8px; }
    .chip-value         { font-size: 11px; }
    .probability-label  { min-width: 120px; font-size: 10px; }

    /* Divergence */
    .divergence-header { flex-direction: column; align-items: flex-start; gap: 10px; }

    /* Section titles */
    .section-title      { font-size: 13px; }

    /* Modals */
    .modal-content,
    .detailed-modal-container,
    .favorites-modal-box {
        border-radius: var(--aa-radius-lg);
        max-height: 95vh;
    }

    .modal              { padding: 10px; align-items: flex-end; }
    .detailed-modal-body { padding: 16px; }
    .detailed-modal-header { padding: 16px; }
    .modal-btn          { padding: 8px 14px; font-size: 11px; }

    .indicator-content  { grid-template-columns: 1fr; }
    .regime-grid        { grid-template-columns: 1fr; }
    .indicator-tabs     { gap: 4px; }
    .indicator-tab      { font-size: 10px; padding: 5px 10px; }

    /* AI Header */
    .ai-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .ai-logo-ring { width: 44px; height: 44px; }
    .ai-logo-core { width: 32px; height: 32px; font-size: 14px; }
    .ai-title     { font-size: 13px; }

    /* News ticker */
    .news-ticker-section { height: 40px; }
    .news-ticker-label   { padding: 0 10px; font-size: 9px; }

    /* Horizon Cards */
    .horizon-stats { gap: 10px; }
    .horizon-detail-card { padding: 14px; }
}

/* ════════════════════════════════════════════════════════════
   §37. RESPONSIVE — SMALL MOBILE (≤ 480px)
════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    :root { --aa-header-h: 52px; }

    #avDriveContent { padding: 10px; }
    #avDriveHeader  { padding: 0 10px; }

    .search-panel  { padding: 12px; }
    .panel-title   { font-size: 13px; }

    /* Scorecard: 2 colonnes */
    .scorecard-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }

    /* AI score */
    .ai-score-value { font-size: 32px; }

    /* Summary probability */
    .probability-label  { min-width: 100px; font-size: 9px; }
    .probability-bar-track { display: none; }

    /* Horizon cards */
    .ai-rec-badge { font-size: 11px; padding: 6px 16px; }

    /* Symbols chips: compacts */
    .symbol-chip { padding: 4px 8px; font-size: 10px; }

    /* Signal rows: compact */
    .signal-indicator-value { display: none; }

    /* Modal full width */
    .modal-content,
    .detailed-modal-container { max-width: 100%; margin: 0; }
}

/* ════════════════════════════════════════════════════════════
   §38. LANDSCAPE MOBILE
════════════════════════════════════════════════════════════ */
@media (max-width: 768px) and (orientation: landscape) {
    #avDriveContent { padding: 10px 14px; }
    .ai-horizons-grid { grid-template-columns: repeat(3, 1fr); }
    .oscillators-grid { grid-template-columns: 1fr 1fr; }
    .chart { min-height: 250px; }
}

/* ════════════════════════════════════════════════════════════
   §39. ULTRA WIDE (≥ 1600px)
════════════════════════════════════════════════════════════ */
@media (min-width: 1600px) {
    :root { --aa-sidebar-w: 280px; }

    #avDriveContent { padding: 26px 32px; }

    .ai-horizons-grid { grid-template-columns: repeat(3, 1fr); }
    .scorecard-grid   { grid-template-columns: repeat(5, 1fr); }
    .oscillators-grid { grid-template-columns: 1fr 1fr; }
}

/* ════════════════════════════════════════════════════════════
   §40. PERFORMANCE & ACCESSIBILITY
════════════════════════════════════════════════════════════ */

/* GPU Acceleration */
#avdSidebar,
#avdMain,
.ai-horizon-card,
.oscillator-card,
.modal-content,
.detailed-modal-container {
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Focus Visible */
.btn-analyze:focus-visible,
.horizon-btn:focus-visible,
.symbol-chip:focus-visible,
.export-btn:focus-visible,
.avd-platform-link:focus-visible,
.avd-nav-item:focus-visible {
    outline: 2px solid var(--aa-primary);
    outline-offset: 2px;
}

/* iOS Zoom Prevention */
@media (max-width: 768px) {
    #symbolInput,
    .crm-form-input,
    .aa-chat-input {
        font-size: 16px;
    }

    #symbolInput:not(:focus),
    .aa-chat-input:not(:focus) {
        font-size: 13px;
    }
}

/* Reduce Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    .avd-status-dot.connected,
    .ai-logo-ring,
    #newsTickerTrack {
        animation: none !important;
    }
}

/* Safari Touch Scroll */
#avDriveContent,
.avd-sidebar-scroll,
.modal-body,
.detailed-modal-body,
.aa-chat-messages {
    -webkit-overflow-scrolling: touch;
}

/* ════════════════════════════════════════════════════════════
   §41. PRINT
════════════════════════════════════════════════════════════ */
@media print {
    #avdSidebar,
    #avDriveHeader,
    .export-buttons-container,
    .aa-chat-fab,
    .avd-sidebar-toggle,
    .news-ticker-section,
    .my-favorites-section { display: none !important; }

    #avDriveApp      { display: block; }
    #avdMain         { width: 100%; }
    #avDriveContent  { padding: 0; overflow: visible; }
    .results-panel   { gap: 12px; }
    .oscillator-card,
    .ai-horizon-card { page-break-inside: avoid; }

    body { background: #fff !important; color: #000 !important; }
}

/* ════════════════════════════════════════════════════════════
   §42. UTILITIES
════════════════════════════════════════════════════════════ */

/* Truncate */
.aa-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Visually Hidden (a11y) */
.aa-sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Drag Over State */
.aa-drag-over {
    border-color: rgba(102, 126, 234, 0.5) !important;
    background: rgba(102, 126, 234, 0.04) !important;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2) !important;
}

/* AI Spin utility */
.aa-spin { animation: aaSpin 1s linear infinite; }

/* Pulse ring for live data */
.aa-live-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--aa-green);
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.5);
    animation: aaPulse 2s ease-in-out infinite;
    flex-shrink: 0;
}

/* Modal scrollbar */
.modal-body::-webkit-scrollbar,
.detailed-modal-body::-webkit-scrollbar { width: 4px; }

.modal-body::-webkit-scrollbar-thumb,
.detailed-modal-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

body.dark-mode .modal-body::-webkit-scrollbar-thumb,
body.dark-mode .detailed-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
}

/* ════════════════════════════════════════════════════════════
   §43. LIGHT MODE HARD-FIX — Favorites / Ticker / Tab Toggle
   Empêche toute interférence externe (common.css, etc.)
════════════════════════════════════════════════════════════ */
body:not(.dark-mode) .my-favorites-section,
body:not(.dark-mode) .news-ticker-section,
body:not(.dark-mode) .aa-tab-toggle {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
}

body:not(.dark-mode) .my-favorites-header,
body:not(.dark-mode) .my-favorites-title,
body:not(.dark-mode) .fav-view-label,
body:not(.dark-mode) .news-ticker-headline,
body:not(.dark-mode) .aa-tab-btn {
    color: #1e293b !important;
}

body:not(.dark-mode) .aa-tab-btn:not(.active) {
    background: transparent !important;
    color: #64748b !important;
}

body:not(.dark-mode) .qf-section,
body:not(.dark-mode) .qf-ratio-card,
body:not(.dark-mode) .qf-factor-card,
body:not(.dark-mode) .qf-greek-card,
body:not(.dark-mode) .qf-bs-result-card,
body:not(.dark-mode) .qf-stress-card,
body:not(.dark-mode) .qf-mc-stat {
    background: #ffffff !important;
    color: #1e293b !important;
}

body:not(.dark-mode) .qf-control-group select,
body:not(.dark-mode) .qf-control-group input,
body:not(.dark-mode) .qf-input-group input,
body:not(.dark-mode) .qf-input-group select {
    background: #ffffff !important;
    color: #1e293b !important;
    border-color: rgba(102,126,234,0.22) !important;
}

/* ════════════════════════════════════════════════════════════
   §44. FAVORITES LOGO CARDS — Contour manquant (fix)
════════════════════════════════════════════════════════════ */
.fav-logos-grid > * {
    border: 1px solid var(--aa-border) !important;
    border-radius: var(--aa-radius) !important;
    background: var(--aa-surface) !important;
    transition: var(--aa-transition);
}

.fav-logos-grid > *:hover {
    border-color: var(--aa-primary) !important;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.18) !important;
    transform: translateY(-2px);
}

body.dark-mode .fav-logos-grid > * {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Si les logos sont wrappés dans une balise img/div interne, forcer aussi */
.fav-logos-grid img {
    display: block;
}

/* ══════════════════════════════════════════════════════════
   MOBILE — 2 cartes par ligne pour les sections QF/Signaux
══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* 1. Consolidated Trading Signals */
    .signals-breakdown {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    .signals-breakdown .signal-row {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 10px 12px;
        border-radius: 10px;
        background: rgba(102,126,234,0.04);
        border: 1px solid rgba(102,126,234,0.1);
    }
    body.dark-mode .signals-breakdown .signal-row {
        background: rgba(255,255,255,0.03);
        border-color: rgba(255,255,255,0.08);
    }
    .signals-breakdown .signal-indicator-name {
        font-size: 11px;
        font-weight: 700;
    }
    .signals-breakdown .signal-indicator-value {
        font-size: 11px;
        color: #64748b;
    }
    .signals-breakdown .signal-badge {
        font-size: 10px;
        padding: 2px 8px;
        align-self: flex-start;
    }

    /* 2. Risk Metrics Dashboard */
    .qf-risk-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    .qf-risk-grid .qf-metric-card {
        padding: 14px 10px;
    }
    .qf-risk-grid .qf-metric-icon {
        width: 36px; height: 36px;
        font-size: 15px;
        margin-bottom: 8px;
    }
    .qf-risk-grid .qf-metric-value { font-size: 19px; }
    .qf-risk-grid .qf-metric-label { font-size: 9.5px; }
    .qf-risk-grid .qf-metric-sub { font-size: 9.5px; }

    /* 3. Performance Ratios */
    .qf-ratios-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    .qf-ratios-grid .qf-ratio-card { padding: 14px 10px; }
    .qf-ratios-grid .qf-ratio-value { font-size: 18px; }
    .qf-ratios-grid .qf-ratio-name { font-size: 9.5px; }

    /* 4. Return Distribution Analysis — stats panel en grille 2 colonnes */
    .qf-two-col {
        grid-template-columns: 1fr !important;
    }
    .qf-stats-panel {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    .qf-stats-panel .qf-stat-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 10px 12px;
    }
    .qf-stats-panel .qf-stat-name { font-size: 10px; }
    .qf-stats-panel .qf-stat-val { font-size: 12px; }

    /* 5. Multi-Factor Profile Analysis */
    .qf-factor-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    .qf-factor-grid .qf-factor-card { padding: 14px 10px; }
    .qf-factor-grid .qf-factor-score { font-size: 28px; }
    .qf-factor-grid .qf-factor-name { font-size: 9.5px; }
}

@media (max-width: 400px) {
    /* Sur très petit écran, garder 2 colonnes mais réduire encore le padding */
    .qf-risk-grid, .qf-ratios-grid, .qf-factor-grid,
    .signals-breakdown, .qf-stats-panel {
        gap: 6px !important;
    }
    .qf-risk-grid .qf-metric-card,
    .qf-ratios-grid .qf-ratio-card,
    .qf-factor-grid .qf-factor-card {
        padding: 10px 8px;
    }
}

/* ══════════════════════════════════════════════════════════
   OVERRIDE — Risk Metrics Dashboard : même style que Performance Ratios
══════════════════════════════════════════════════════════ */
.qf-risk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 12px;
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
}
body.dark-mode .qf-risk-grid { background: transparent; }

.qf-metric-card {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 14px;
    padding: 18px 14px;
    text-align: center;
    transition: all .2s ease;
    cursor: default;
}
.qf-metric-card::before { display: none; }

.qf-metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    background: #ffffff;
}
body.dark-mode .qf-metric-card {
    background: #1e293b;
    border-color: rgba(255,255,255,0.06);
}
body.dark-mode .qf-metric-card:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    background: #1e293b;
}

.qf-metric-icon {
    width: auto; height: auto;
    margin: 0 0 8px 0;
    background: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #9ca3af;
}
body.dark-mode .qf-metric-icon { color: #6b7280; }

.qf-metric-label {
    font-size: 10.5px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 8px;
}
body.dark-mode .qf-metric-label { color: #9199a6; }

.qf-metric-value {
    font-size: 22px;
    font-weight: 900;
    color: var(--text-color, #1e293b);
    line-height: 1.1;
    margin-bottom: 6px;
}
body.dark-mode .qf-metric-value { color: #f1f5f9; }

.qf-metric-sub {
    font-size: 10.5px;
    color: #64748b;
    line-height: 1.4;
    font-weight: 600;
}
body.dark-mode .qf-metric-sub { color: #9199a6; }

/* Badge d'interprétation façon "Good / Excellent / Average" comme Performance Ratios */
.qf-metric-badge {
    display: inline-block;
    margin-top: 6px;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}
.qf-metric-badge.excellent { background: #d1fae5; color: #065f46; }
.qf-metric-badge.good      { background: #dbeafe; color: #1e40af; }
.qf-metric-badge.average   { background: #fef3c7; color: #92400e; }
.qf-metric-badge.poor      { background: #fee2e2; color: #991b1b; }

/* Neutralisation totale des anciennes classes couleur (bullish/bearish/warning/info/purple) */
.qf-metric-card.bullish,
.qf-metric-card.bearish,
.qf-metric-card.warning,
.qf-metric-card.info,
.qf-metric-card.purple {
    --qf-accent: none;
}

@media (max-width: 768px) {
    .qf-risk-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
    .qf-metric-card { padding: 14px 10px; }
    .qf-metric-value { font-size: 19px; }
}

/* ════════════════════════════════════════════════════════════
   END — advanced-analysis.css v2.0 (Part 2/2)
   © AlphaVault AI — All rights reserved
════════════════════════════════════════════════════════════ */