/* ==============================================
   🎨 PORTFOLIO-OPTIMIZER.CSS
   Adapté pour AlphaVault Drive (avd-page)
   Dark-first theme | light-mode override
   Toutes les classes originales conservées
   ============================================== */

/* ============================================
   🌟 VARIABLES PERSONNALISÉES
   ============================================ */
   :root {
    --ml-primary:   #667eea;
    --ml-secondary: #764ba2;
    --ml-accent:    #f093fb;
    --ml-success:   #43e97b;
    --ml-danger:    #f5576c;
    --ml-warning:   #f6d365;
    --ml-blue:      #4A74F3;
    --ml-purple:    #8E44AD;

    --glass-bg:     rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-shadow: rgba(31, 38, 135, 0.37);

    --glow-primary: 0 0 20px rgba(102, 126, 234, 0.5);
    --glow-accent:  0 0 30px rgba(240, 147, 251, 0.6);
    --glow-blue:    0 0 25px rgba(74, 116, 243, 0.5);

    --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ============================================
   🏗 LAYOUT — Drive integration
   Assure que le contenu scrolle dans #avDriveContent
   ============================================ */
body.avd-page #avDriveContent {
    background: transparent;
}

/* ============================================
   📑 SECTION — Card Drive-style
   ============================================ */
#avDriveContent .section {
    background: var(--avd-card, rgba(30, 41, 59, 0.92));
    border: 1px solid var(--avd-border, rgba(255, 255, 255, 0.08));
    border-radius: var(--avd-radius-lg, 16px);
    padding: 28px 30px;
    margin-bottom: 20px;
    transition: var(--avd-transition, all 0.2s ease);
    position: relative;
    overflow: visible;
}

#avDriveContent .section:last-child {
    margin-bottom: 0;
}

/* ============================================
   📑 SECTION TITLE — Gradient text
   ============================================ */
.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--ml-primary), var(--ml-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    animation: fadeInDown 0.6s ease-out;
}

.section-title i {
    background: linear-gradient(135deg, var(--ml-primary), var(--ml-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.3em;
    animation: floatIcon 3s ease-in-out infinite;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   ℹ INFO BOX
   ============================================ */
.info-box {
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-left: 4px solid var(--ml-primary);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.info-box h4 {
    color: var(--ml-primary);
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.info-box p {
    color: var(--avd-text-muted, #cbd5e1);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
}

body.light-mode .info-box p {
    color: #475569;
}

/* ============================================
   💎 ASSET GRID
   ============================================ */
.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
    perspective: 1500px;
}

/* ============================================
   🃏 ASSET CARD — glassmorphism
   ============================================ */
.asset-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--avd-border, rgba(255, 255, 255, 0.08));
    border-left: 4px solid var(--ml-purple);
    padding: 24px;
    border-radius: 16px;
    transition: var(--transition-smooth);
    transform-style: preserve-3d;
    will-change: transform, box-shadow;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.asset-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(142, 68, 173, 0.07) 0%, transparent 70%);
    animation: rotateBg 20s linear infinite;
    pointer-events: none;
}

.asset-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    transition: left 0.6s;
}

.asset-card:hover::after { left: 100%; }

.asset-card:hover {
    transform: translateY(-8px) rotateX(2deg);
    box-shadow:
        0 20px 48px rgba(0, 0, 0, 0.35),
        0 0 60px rgba(102, 126, 234, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border-color: rgba(102, 126, 234, 0.3);
}

/* Light mode card */
body.light-mode .asset-card {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

body.light-mode .asset-card:hover {
    box-shadow: 0 12px 36px rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.3);
}

@keyframes rotateBg {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   🎯 ASSET CARD — h4 title
   ============================================ */
.asset-card h4 {
    font-size: 1.1rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--ml-primary), var(--ml-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    position: relative;
    z-index: 1;
}

/* ============================================
   🗑 BUTTON REMOVE
   ============================================ */
.btn-remove {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 900;
    font-size: 1.2rem;
    transition: var(--transition-bounce);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    margin-left: auto;
}

.btn-remove::before {
    content: '×';
    position: absolute;
    font-size: 1.8rem;
    font-weight: 900;
    line-height: 1;
    color: white;
    z-index: 1;
}

.btn-remove::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.btn-remove:hover::after { width: 80px; height: 80px; }

.btn-remove:hover {
    transform: translateY(-3px) scale(1.1) rotate(-5deg);
    box-shadow: 0 10px 28px rgba(255, 107, 107, 0.6);
}

/* ============================================
   📝 ASSET INPUT GROUP
   ============================================ */
.asset-input-group {
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.asset-input-group label {
    display: block;
    color: var(--avd-text-muted, #cbd5e1);
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    background: linear-gradient(135deg, var(--ml-purple), var(--ml-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.asset-input-group input[type='text'],
.asset-input-group input[type='number'] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--avd-border, rgba(255, 255, 255, 0.08));
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    transition: var(--transition-smooth);
    background: var(--avd-input-bg, rgba(255, 255, 255, 0.06));
    color: var(--avd-text, #f0f4f8);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
}

.asset-input-group input:focus {
    outline: none;
    border-color: var(--ml-primary);
    background: rgba(102, 126, 234, 0.08);
    box-shadow:
        0 0 0 3px rgba(102, 126, 234, 0.15),
        inset 0 2px 6px rgba(0, 0, 0, 0.1),
        var(--glow-primary);
    transform: translateY(-1px);
}

/* Light mode inputs */
body.light-mode .asset-input-group input[type='text'],
body.light-mode .asset-input-group input[type='number'] {
    background: #f8fafc;
    color: #1e293b;
    border-color: rgba(0, 0, 0, 0.12);
}

body.light-mode .asset-input-group input:focus {
    background: rgba(102, 126, 234, 0.05);
}

/* ============================================
   ☑ CHECKBOX LABEL
   ============================================ */
.checkbox-label {
    font-weight: 700;
    background: linear-gradient(135deg, var(--ml-primary), var(--ml-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition-smooth);
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.checkbox-label:hover {
    background: rgba(102, 126, 234, 0.08);
    transform: translateX(4px);
    -webkit-text-fill-color: unset;
    background-clip: unset;
    color: var(--ml-primary);
}

.checkbox-label input[type='checkbox'] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--ml-primary);
    flex-shrink: 0;
}

/* ============================================
   ✏ ASSET NAME INPUT — inline edit
   ============================================ */
.asset-name-input {
    background: transparent;
    border: none;
    color: var(--ml-primary);
    font-weight: 800;
    font-size: 1rem;
    width: 200px;
    padding: 6px 10px;
    border-bottom: 2px solid transparent;
    transition: var(--transition-smooth);
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
}

.asset-name-input:focus {
    outline: none;
    border-bottom-color: var(--ml-primary);
    background: rgba(102, 126, 234, 0.08);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

/* ============================================
   🎯 BUTTON CONTAINER
   ============================================ */
.btn-container {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 28px;
    justify-content: center;
}

/* ============================================
   🎯 BUTTON PRIMARY — Optimize Portfolio
   ============================================ */
.btn-primary {
    flex: 1;
    min-width: 200px;
    background: linear-gradient(135deg, var(--ml-primary) 0%, var(--ml-secondary) 50%, var(--ml-accent) 100%);
    background-size: 200% 200%;
    color: white !important;
    padding: 16px 36px;
    border: none;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow:
        0 6px 20px rgba(102, 126, 234, 0.5),
        0 0 35px rgba(118, 75, 162, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: rotate(45deg);
    transition: all 0.6s;
}

.btn-primary:hover::before { left: 100%; top: 100%; }

.btn-primary:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow:
        0 14px 40px rgba(102, 126, 234, 0.65),
        0 0 70px rgba(118, 75, 162, 0.5);
}

.btn-primary:active {
    transform: translateY(-2px) scale(1.01);
}

.btn-primary i {
    margin-right: 8px;
    font-size: 1.1rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.85; transform: scale(1.08); }
}

/* ============================================
   🔄 BUTTON SECONDARY — Reset All
   ============================================ */
.btn-secondary {
    flex: 1;
    min-width: 200px;
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    background-size: 200% 200%;
    color: var(--avd-text-muted, #cbd5e1);
    padding: 16px 32px;
    border: 1px solid var(--avd-border, rgba(255, 255, 255, 0.1));
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    position: relative;
    overflow: hidden;
}

.btn-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
    transition: left 0.5s;
}

.btn-secondary:hover::before { left: 100%; }

.btn-secondary:hover {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: rgba(102, 126, 234, 0.3);
    color: var(--avd-text, #f0f4f8);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.btn-secondary i {
    margin-right: 8px;
    font-size: 1.1rem;
    animation: rotate360 3s linear infinite;
}

@keyframes rotate360 {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Light mode secondary button */
body.light-mode .btn-secondary {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #475569;
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .btn-secondary:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    color: #1e293b;
}

/* ============================================
   ➕ BUTTON ADD
   ============================================ */
.btn-add {
    background: linear-gradient(135deg, var(--ml-blue) 0%, #6C8BE0 100%);
    color: white;
    padding: 12px 28px;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(74, 116, 243, 0.4);
    transition: var(--transition-bounce);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.btn-add::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3), transparent);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.btn-add:hover::before { width: 300px; height: 300px; }

.btn-add:hover {
    transform: translateY(-4px) scale(1.04);
    box-shadow: 0 10px 30px rgba(74, 116, 243, 0.6);
}

/* ============================================
   📊 STATS BOX
   ============================================ */
.stats-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--avd-border, rgba(255, 255, 255, 0.08));
    backdrop-filter: blur(20px);
    padding: 28px;
    border-radius: 20px;
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.stats-box::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.06) 0%, transparent 70%);
    animation: rotateBg 25s linear infinite reverse;
    pointer-events: none;
}

body.light-mode .stats-box {
    background: #f8fafc;
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

/* ============================================
   📈 STATS ROW
   ============================================ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.stats-row:last-child { margin-bottom: 0; }

/* ============================================
   💎 STAT ITEM
   ============================================ */
.stat-item {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--avd-border, rgba(255, 255, 255, 0.08));
    border-radius: 14px;
    transition: var(--transition-smooth);
}

.stat-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 36px rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.3);
}

body.light-mode .stat-item {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.stat-item .label {
    font-size: 0.8rem;
    color: var(--avd-text-dim, #94a3b8);
    font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    background: linear-gradient(135deg, var(--ml-purple), var(--ml-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-item .value {
    font-size: 1.7rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--ml-primary), var(--ml-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

/* ============================================
   📑 SUBSECTION TITLE
   ============================================ */
.subsection-title {
    font-size: 1.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--ml-primary), var(--ml-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    margin-top: 36px;
}

.subsection-title:first-of-type { margin-top: 0; }

/* ============================================
   📊 CHARTS GRID
   ============================================ */
.charts-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
    gap: 28px;
    margin-top: 28px;
}

.chart {
    min-height: 400px;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--avd-border, rgba(255, 255, 255, 0.08));
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 16px;
    transition: var(--transition-smooth);
}

body.light-mode .chart {
    background: #f8fafc;
    border-color: rgba(0, 0, 0, 0.06);
}

.chart-medium {
    min-height: 420px;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--avd-border, rgba(255, 255, 255, 0.08));
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 16px;
    transition: var(--transition-smooth);
}

.chart-medium:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 36px rgba(102, 126, 234, 0.18);
}

body.light-mode .chart-medium {
    background: #f8fafc;
    border-color: rgba(0, 0, 0, 0.06);
}

/* ============================================
   📋 TABLE RESPONSIVE WRAPPER
   ============================================ */
.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-top: 24px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    scrollbar-width: thin;
    scrollbar-color: var(--ml-primary) rgba(255, 255, 255, 0.05);
}

.table-responsive-wrapper::-webkit-scrollbar { height: 6px; }
.table-responsive-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
}
.table-responsive-wrapper::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--ml-primary), var(--ml-secondary));
    border-radius: 6px;
}

/* ============================================
   📋 ALLOCATION TABLE
   ============================================ */
.allocation-table {
    width: 100%;
    min-width: 680px;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 16px;
    overflow: hidden;
}

.allocation-table th {
    background: linear-gradient(135deg, var(--ml-primary) 0%, var(--ml-secondary) 100%);
    color: white;
    padding: 16px 18px;
    text-align: left;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.8px;
    white-space: nowrap;
}

.allocation-table td {
    padding: 15px 18px;
    border-bottom: 1px solid var(--avd-border, rgba(255, 255, 255, 0.08));
    font-weight: 600;
    background: var(--avd-card, rgba(30, 41, 59, 0.9));
    color: var(--avd-text, #f0f4f8);
    transition: var(--transition-smooth);
    white-space: nowrap;
    font-size: 0.9rem;
}

.allocation-table tr:hover td {
    background: rgba(102, 126, 234, 0.08);
}

body.light-mode .allocation-table td {
    background: #ffffff;
    color: #1e293b;
    border-color: rgba(0, 0, 0, 0.06);
}

body.light-mode .allocation-table tr:hover td {
    background: rgba(102, 126, 234, 0.04);
}

/* ============================================
   🏷 ALLOCATION BADGES
   ============================================ */
.allocation-badge {
    background: linear-gradient(135deg, var(--ml-primary) 0%, var(--ml-blue) 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-block;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
    animation: pulse 2s ease-in-out infinite;
}

.allocation-badge-secondary {
    background: linear-gradient(135deg, var(--ml-purple) 0%, var(--ml-accent) 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-block;
    box-shadow: 0 3px 10px rgba(142, 68, 173, 0.4);
}

/* ============================================
   ❓ HELP ICON
   ============================================ */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--ml-primary), var(--ml-secondary));
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-weight: 800;
    font-size: 0.85rem;
    transition: var(--transition-bounce);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
    flex-shrink: 0;
    line-height: 1;
}

.help-icon:hover {
    transform: scale(1.2) rotate(15deg);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6), var(--glow-primary);
}

.help-icon-small {
    width: 22px;
    height: 22px;
    font-size: 0.75rem;
}

/* ============================================
   📐 MODAL — Portfolio specific
   (distinct from avd-modal Drive)
   ============================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    z-index: 20000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal.active,
.modal[style*="flex"],
.modal[style*="block"] {
    display: flex;
}

.modal-content {
    background: #1a2235;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    max-width: 560px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.3s ease-out;
}

body.light-mode .modal-content {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.03);
}

body.light-mode .modal-header {
    border-color: rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.02);
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--avd-text, #f0f4f8);
    margin: 0;
    background: linear-gradient(135deg, var(--ml-primary), var(--ml-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.light-mode .modal-header h2 {
    color: #1e293b;
}

.close-modal {
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--avd-text-muted, #cbd5e1);
    line-height: 1;
    transition: var(--transition-smooth);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.close-modal:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
    transform: scale(1.1);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    color: var(--avd-text-muted, #cbd5e1);
    line-height: 1.7;
    font-size: 0.9rem;
}

body.light-mode .modal-body {
    color: #475569;
}

.modal-body h3 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--ml-primary);
    margin: 18px 0 10px;
}

.modal-body h3:first-child { margin-top: 0; }

.modal-body h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--avd-text, #f0f4f8);
    margin: 14px 0 6px;
}

body.light-mode .modal-body h4 { color: #1e293b; }

.modal-body p { margin: 0 0 10px; }

.modal-body ul {
    padding-left: 20px;
    margin: 6px 0;
}

.modal-body li {
    margin-bottom: 6px;
    color: var(--avd-text-muted, #cbd5e1);
}

body.light-mode .modal-body li { color: #475569; }

.modal-body strong { color: var(--avd-text, #f0f4f8); }
body.light-mode .modal-body strong { color: #1e293b; }

/* ============================================
   📦 FORMULA BOX & TIP BOX (in modals)
   ============================================ */
.formula-box {
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-left: 4px solid var(--ml-primary);
    border-radius: 12px;
    padding: 18px 20px;
    margin: 16px 0;
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--avd-text, #f0f4f8);
    font-family: 'Inter', monospace;
}

body.light-mode .formula-box {
    background: rgba(102, 126, 234, 0.05);
    color: #1e293b;
}

.tip-box {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-left: 4px solid #10b981;
    border-radius: 12px;
    padding: 16px 20px;
    margin: 16px 0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--avd-text-muted, #cbd5e1);
}

body.light-mode .tip-box {
    background: rgba(16, 185, 129, 0.04);
    color: #475569;
}

.key-term {
    color: var(--ml-primary);
    font-weight: 700;
    background: linear-gradient(135deg, var(--ml-primary), var(--ml-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   ✨ UTILITY
   ============================================ */
.hidden {
    display: none !important;
}

/* ============================================
   🎬 ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-4px); }
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50%       { background-position: 100% 50%; }
}

.asset-card,
.stats-box,
.chart-medium,
.allocation-table {
    animation: fadeInUp 0.5s ease-out backwards;
}

.asset-card:nth-child(1) { animation-delay: 0.05s; }
.asset-card:nth-child(2) { animation-delay: 0.10s; }
.asset-card:nth-child(3) { animation-delay: 0.15s; }
.asset-card:nth-child(4) { animation-delay: 0.20s; }
.asset-card:nth-child(5) { animation-delay: 0.25s; }

/* ============================================
   📱 RESPONSIVE — TABLET (≤ 1024px)
   ============================================ */
@media (max-width: 1024px) {
    .charts-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   📱 RESPONSIVE — MOBILE (≤ 768px)
   ============================================ */
@media (max-width: 768px) {
    #avDriveContent .section {
        padding: 18px 16px;
    }

    .asset-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .charts-grid-2 {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .chart-medium {
        min-height: 320px;
    }

    .btn-container {
        flex-direction: column;
        gap: 12px;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        min-width: auto;
        padding: 14px 20px;
        font-size: 0.95rem;
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .asset-card { padding: 18px; }

    .stats-box { padding: 20px 16px; }

    .subsection-title {
        font-size: 1rem;
        margin-top: 24px;
    }

    .table-responsive-wrapper {
        border-radius: 12px;
    }

    .allocation-table {
        min-width: 600px;
    }

    .allocation-table th,
    .allocation-table td {
        padding: 11px 10px;
        font-size: 0.8rem;
    }

    .allocation-badge,
    .allocation-badge-secondary {
        padding: 3px 8px;
        font-size: 0.78rem;
    }

    .modal-content {
        border-radius: 16px;
        max-height: 94vh;
    }

    .modal-header { padding: 16px 18px; }
    .modal-body   { padding: 18px; }
}

/* ============================================
   📱 RESPONSIVE — SMALL MOBILE (≤ 480px)
   ============================================ */
@media (max-width: 480px) {
    .stat-item .value  { font-size: 1.4rem; }
    .stat-item .label  { font-size: 0.75rem; }

    .btn-primary,
    .btn-secondary,
    .btn-add {
        font-size: 0.88rem;
        padding: 13px 16px;
    }

    .asset-name-input {
        width: 140px;
        font-size: 0.92rem;
    }

    .allocation-table {
        min-width: 540px;
    }

    .allocation-table th,
    .allocation-table td {
        padding: 9px 8px;
        font-size: 0.76rem;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }
}