/* ===================================
   CSS Variables & Design System
   =================================== */
:root {
    /* ===================================
       PRO Dark Mode Palette (Optimized)
       =================================== */
    --bg-base: #121417;
    --bg-surface: #1B1F24;
    --bg-elevated: #232830;

    /* Semantic — Text (Anti-fatigue) */
    --text-primary: rgba(255, 255, 255, 0.87);
    --text-secondary: rgba(255, 255, 255, 0.60);
    --text-muted: rgba(255, 255, 255, 0.38);
    --text-disabled: rgba(255, 255, 255, 0.38);

    /* Core Colors & Status */
    --color-green: #3ECF8E;
    --color-green-hover: #2BB673;
    --color-green-soft: rgba(62, 207, 142, 0.12);

    --color-blue: #4C8DFF;
    --color-blue-soft: rgba(76, 141, 255, 0.12);

    --color-violet: #8B5CF6;
    --color-violet-gradient-start: #7C3AED;
    --color-violet-gradient-end: #A78BFA;

    --color-yellow: #F2C94C;
    --color-yellow-soft: rgba(242, 201, 76, 0.12);

    --color-red: #FF5C5C;
    --color-red-soft: rgba(255, 92, 92, 0.12);

    --color-orange: #F7931A;
    --color-orange-soft: rgba(247, 147, 26, 0.12);

    /* Chart Colors (Desaturated PRO) */
    --chart-turquoise: #2DD4BF; /* Adjusted for less neon */
    --chart-pink: #F472B6;      /* Less neon */
    --chart-blue: #60A5FA;
    --chart-purple: #A78BFA;
    --chart-orange: #FB923C;

    /* Subtle UI Elements */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --divider-color: rgba(255, 255, 255, 0.08);

    /* Icon States */
    --icon-active: rgba(255, 255, 255, 0.87);
    --icon-inactive: rgba(255, 255, 255, 0.38);

    /* Original Semantic Aliases */
    --color-accent: var(--color-blue);
    --color-accent-alt: var(--color-violet);
    --color-success: var(--color-green);
    --color-danger: var(--color-red);
    --color-warning: var(--color-orange);
    --color-info: var(--color-blue);

    --color-income: var(--color-green);
    --color-expense: var(--color-red);
    --color-savings: var(--color-yellow);
    --color-balance-pos: var(--color-green);
    --color-balance-neg: var(--color-red);

    /* Asset Type Aliases */
    --color-asset-stocks: var(--color-blue);
    --color-asset-crypto: var(--color-orange);
    --color-asset-cash: var(--chart-turquoise);
    --color-asset-bonds: var(--color-green);
    --color-asset-ons: var(--chart-blue);
    --color-asset-fund: var(--chart-pink);
    --color-asset-lecap: var(--color-yellow);
    --color-asset-pf: var(--chart-purple);

    /* User Aliases */
    --color-user-nico: var(--color-blue);
    --color-user-fabi: var(--color-orange);
    --color-user-both: var(--color-violet);

    /* ===================================
       Layout Tokens
       =================================== */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    --spacing-xs: 0.35rem;
    --spacing-sm: 0.7rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.4rem;
    --spacing-xl: 2rem;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --gradient-primary: linear-gradient(135deg, var(--color-blue) 0%, var(--color-violet) 100%);
    --gradient-cta: linear-gradient(135deg, var(--color-violet-gradient-start) 0%, var(--color-violet-gradient-end) 100%);
    --gradient-success: linear-gradient(135deg, var(--color-green) 0%, var(--color-green-hover) 100%);
    --gradient-danger: linear-gradient(135deg, var(--color-red) 0%, #CC4A4A 100%);
    --gradient-visa: linear-gradient(135deg, #4169E1 0%, #1A1F71 100%);
    --gradient-master: linear-gradient(135deg, #EB001B 0%, #FF5F00 100%);
    --gradient-mercadopago: linear-gradient(135deg, #FFF159 0%, #F0D000 100%);

    --accent-primary: var(--color-accent);
    --accent-success: var(--color-success);
    --accent-danger: var(--color-danger);
    --accent-warning: var(--color-warning);

    /* Budget Stacked Bar Reference Colors */
    --ref-red: #FF5C5C;
    --ref-dark-red: #CC3A3A;
    --ref-amber: #F2C94C;
    --ref-dark-amber: #D4A833;
    --ref-green: #3ECF8E;
    --ref-dark-green: #2BA06B;
}

/* Theme: Dark (Default) */
:root,
[data-theme="dark"] {
    --bg-primary: var(--bg-base);
    --bg-secondary: var(--bg-surface);
    --bg-card: var(--bg-surface);
    --bg-inner: rgba(0, 0, 0, 0.2);
    --border-color: var(--border-subtle);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: rgba(76, 141, 255, 0.15) 0 0 20px;

    --glass-bg: rgba(255, 255, 255, 0.02);
    --glass-border: rgba(255, 255, 255, 0.04);
    --bg-elevated: #232830;

    --screener-sticky-bg: #121417;
    --chart-bar-bg: linear-gradient(180deg, var(--color-blue) 0%, #3566C2 100%);
    --bg-inner: rgba(0, 0, 0, 0.2);
    --divider-color: rgba(255, 255, 255, 0.08); /* Re-ensure this is defined */
}


/* Theme: Light */
[data-theme="light"] {
    --bg-primary: oklch(0.88 0.03 260);
    --bg-secondary: oklch(0.93 0.02 260);
    --bg-card: rgba(255, 255, 255, 0.4);
    --bg-card-hover: rgba(255, 255, 255, 0.6);
    --bg-inner: rgba(0, 0, 0, 0.06);

    --text-primary: oklch(0.20 0.02 260);
    --text-secondary: oklch(0.40 0.05 260);
    --text-muted: oklch(0.55 0.05 260);

    /* High contrast overrides for semantic tokens in light mode */
    --color-accent: oklch(0.55 0.18 266);
    --color-success: oklch(0.55 0.18 155);
    --color-danger: oklch(0.50 0.20 25);
    --color-warning: oklch(0.60 0.18 60);

    --border-color: #e2e8f0;
    --border-light: rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-glow: rgba(99, 102, 241, 0.1);

    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --screener-sticky-bg: #FFFFFF;
    --chart-bar-bg: oklch(0.55 0.18 266); /* Solid blue matching profile icon */
}

/* Forum Light Mode Overrides */
[data-theme="light"] .forum-post-content,
[data-theme="light"] .forum-post-title,
[data-theme="light"] .forum-author-name,
[data-theme="light"] .forum-comment-content {
    color: rgba(255, 255, 255, 0.8) !important;
}

[data-theme="light"] .forum-post-card {
    background: #1B1F24 !important; /* Keep cards dark for contrast with requested white text */
}

/* Light Mode Refinements */
[data-theme="light"] #toggleHistoryBtn,
[data-theme="light"] #toggleScreenerBtn,
[data-theme="light"] .btn-invest-toggle {
    color: #000000 !important;
    background: rgba(0, 0, 0, 0.05) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* Settings Text in Light Mode (Assuming dark modal background) */
[data-theme="light"] .settings-item-title {
    color: rgba(255, 255, 255, 0.8) !important;
}

[data-theme="light"] .settings-item-desc {
    color: rgba(255, 255, 255, 0.6) !important;
}

[data-theme="light"] #profileModal h2 {
    color: rgba(255, 255, 255, 0.9) !important;
}

[data-theme="light"] .theme-switch-row span {
    color: rgba(255, 255, 255, 0.8) !important;
}

[data-theme="light"] .perf-cat-item {
    background: rgba(76, 141, 255, 0.15) !important; /* Lighter celeste/blue for pts gain cards */
    border-color: rgba(76, 141, 255, 0.3) !important;
}

[data-theme="light"] .performance-card {
    background: linear-gradient(135deg, rgba(76, 141, 255, 0.1), rgba(142, 68, 173, 0.1)) !important;
}

[data-theme="light"] .icon-white {
    filter: grayscale(1) brightness(0) !important;
    opacity: 0.8 !important;
}

[data-theme="light"] .icon-svg,
[data-theme="light"] .refresh-icon,
[data-theme="light"] .btn-currency-toggle {
    filter: grayscale(1) brightness(0) !important;
    opacity: 0.8 !important;
    color: rgba(0, 0, 0, 0.8) !important;
}

[data-theme="light"] .btn-action {
    background: rgba(0, 0, 0, 0.05) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}


/* ===================================
   Reset & Base Styles
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 20% 20%, var(--shadow-glow), transparent 50%),
        radial-gradient(circle at 80% 80%, var(--shadow-glow), transparent 50%);
    background-attachment: fixed;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ===================================
   Layout
   =================================== */
.app-container {
    width: 95%;
    /* Reduced side margins as requested */
    max-width: 1400px;
    /* Allow it to be wider on large screens */
    margin: 0 auto;
    padding: 0 0 80px 0; /* No top padding, room for bottom nav */
}

.app-header-unified {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-primary);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    margin-bottom: var(--spacing-sm);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, background-color 0.3s ease;
}
.app-header-unified.nav-hidden {
    transform: translateY(-105%);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 2;
}

#globalHeaderTitle {
    font-size: 0.9rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    white-space: nowrap;
}

.header-logo-icon {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

.header-center {
    flex: 3;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#headerUserName {
    color: var(--text-primary);
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 2;
    justify-content: flex-end;
}

.header-icon-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50% !important;
    width: 38px;
    height: 38px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: all var(--transition-normal);
    font-size: 0.9rem;
}

.btn-danger-header {
    background: oklch(0.62 0.19 25 / 0.1) !important;
    border-color: var(--color-danger) !important;
    color: var(--color-danger) !important;
}

.btn-danger-header:hover {
    background: var(--color-danger) !important;
    color: #FFFFFF !important;
    box-shadow: 0 0 10px var(--color-danger);
}

.header-icon-btn:hover {
    background: var(--border-color);
    transform: scale(1.05);
}

.header-icon-btn:active,
.header-icon-btn:focus {
    outline: none !important;
    border-radius: 50% !important;
    background: var(--divider-color) !important;
    -webkit-tap-highlight-color: transparent;
}

.subtitle {
    display: none;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    /* Reduced from xl */
}

/* ===================================
   Cards Section
   =================================== */
.cards-section {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    /* Increased from spacing-sm */
    animation: fadeInUp 0.5s ease;
    margin-top: 0.2rem;
    /* Ultra-compact spacing */
    margin-bottom: var(--spacing-md);
}

.cards-section h2,
.charts-section h2,
.add-expense-section h2,
.expenses-section h2 {
    font-size: 0.8rem;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
    text-align: center;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 350px));
    gap: var(--spacing-md);
    justify-content: center;
    margin-top: 12px;
    margin-bottom: var(--spacing-lg);
}

.credit-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
    animation: fadeInScale 0.5s ease;
    cursor: pointer;
    user-select: none;
    text-align: center;
}

.credit-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--card-gradient);
    opacity: 0.8;
    transition: height var(--transition-normal);
}

.credit-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.credit-card.active {
    border: 2px solid;
    border-color: var(--card-gradient-color);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-lg), 0 0 30px oklch(0.63 0.16 266 / 0.4);
}

.credit-card.active::before {
    height: 6px;
}

.credit-card.active::after {
    content: '✓';
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    width: 32px;
    height: 32px;
    background: var(--card-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    animation: scaleIn 0.3s ease;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    height: 40px;
    /* Fixed height for better alignment with new logos */
}

.card-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-logo-img {
    object-fit: contain;
    max-width: 100%;
}

/* Make Mercado Pago logo white using filters */
.mp-logo-white {
    filter: brightness(0) invert(1);
}

.card-balance {
    background: rgba(0, 0, 0, 0.2);
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    text-align: center;
}

.balance-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: var(--spacing-xs);
}

.balance-amount {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}

/* Card specific colors */
.credit-card.visa {
    --card-gradient: var(--gradient-visa);
    --card-gradient-color: #4169E1;
}

.credit-card.master {
    --card-gradient: var(--gradient-master);
    --card-gradient-color: #EB001B;
}

.credit-card.mercadopago {
    --card-gradient: var(--gradient-mercadopago);
    --card-gradient-color: #FFF159;
}

/* ===================================
   Charts Section
   =================================== */
.charts-section {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm);
    /* Reduced from lg */
    animation: fadeInUp 0.5s ease;
}



.user-chart {
    margin-bottom: var(--spacing-lg);
}

.user-chart:last-child {
    margin-bottom: 0;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-bg);
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.user-chart-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 0;
    padding: 0;
    background: none;
}

.icon-nico {
    color: var(--color-user-nico);
    margin-right: 4px;
    font-size: 1.2rem;
}

.icon-fabi {
    color: var(--color-user-fabi);
    margin-right: 4px;
    font-size: 1.2rem;
}

.chart-toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 8px;
    transition: transform 0.3s ease;
}

.chart-toggle-btn:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

.chart-container.collapsed {
    display: none;
}

.chart-container {
    display: flex;
    align-items: stretch;
    /* Changed from flex-end to allow wrappers to fill height */
    justify-content: space-around;
    gap: var(--spacing-sm);
    min-height: 240px;
    /* Reduced by 20% from 300px */
    padding: var(--spacing-lg) var(--spacing-md);
    background: var(--bg-inner);
    border-radius: var(--radius-md);
    position: relative;
}

.chart-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    /* Align content to bottom */
    gap: var(--spacing-xs);
    flex: 1;
    max-width: 120px;
    position: relative;
}

.chart-bar {
    width: 100%;
    background: var(--chart-bar-bg);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    position: relative;
    transition: all var(--transition-normal);
    /* min-height removed for strict proportionality */
    box-shadow: 0 -2px 10px oklch(0.63 0.16 266 / 0.3);
    animation: barGrowth 0.6s ease;
}

.chart-bar:hover {
    filter: brightness(1.2);
    transform: scaleY(1.02);
}

.chart-value {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.chart-month {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.month-delete-btn {
    margin-top: var(--spacing-xs);
    padding: 4px 8px;
    background: oklch(0.62 0.19 25 / 0.1);
    color: var(--accent-danger);
    border: 1px solid oklch(0.62 0.19 25 / 0.3);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    opacity: 0.7;
}

.month-delete-btn:hover {
    opacity: 1;
    background: var(--accent-danger);
    color: white;
    transform: scale(1.05);
}

.chart-empty {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
    font-style: italic;
}

@keyframes barGrowth {
    from {
        transform: scaleY(0);
        transform-origin: bottom;
    }

    to {
        transform: scaleY(1);
        transform-origin: bottom;
    }
}

/* ===================================
   User Selector
   =================================== */
.user-selector {
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-inner);
    border-radius: var(--radius-md);
}

.user-selector label {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    text-align: center;
}

.user-buttons {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
}

.user-btn {
    flex: 1;
    max-width: 150px;
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--glass-bg);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.user-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: oklch(0.63 0.16 266 / 0.5);
    transform: translateY(-2px);
}

.user-btn.active {
    background: var(--gradient-primary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-glow);
}

/* ===================================
   Form Section
   =================================== */
.add-expense-section {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm);
    /* Reduced from lg */
    animation: fadeInUp 0.6s ease;
}



.selected-card-info {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--glass-bg);
    border: 1px solid oklch(0.63 0.16 266 / 0.3);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-md);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.expense-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px oklch(0.63 0.16 266 / 0.1);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.monthly-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background: var(--glass-bg);
    border: 1px solid oklch(0.63 0.16 266 / 0.2);
    border-radius: var(--radius-sm);
    margin-top: var(--spacing-sm);
}

.preview-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.preview-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.btn-primary {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--gradient-primary);
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

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

/* ===================================
   Expenses Section
   =================================== */
.expenses-section {
    animation: fadeInUp 0.7s ease;
}



.card-expenses {
    margin-bottom: var(--spacing-lg);
}

.card-expenses-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--divider-color);
}

.card-expenses-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.expense-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.expense-item {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all var(--transition-fast);
    animation: slideInRight 0.4s ease;
}

.expense-item:hover {
    background: var(--bg-card-hover);
    transform: translateX(4px);
}

.expense-info {
    flex: 1;
}

.expense-description {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
}

.user-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-badge.user-nico {
    background: oklch(0.63 0.16 266 / 0.2);
    color: var(--color-accent);
    border: 1px solid oklch(0.63 0.16 266 / 0.4);
}

.user-badge.user-fabi {
    background: oklch(0.72 0.14 60 / 0.2);
    color: var(--color-warning);
    border: 1px solid oklch(0.72 0.14 60 / 0.4);
}

.user-badge.user-ambos {
    background: oklch(0.52 0.17 303 / 0.2);
    color: var(--color-accent-alt);
    border: 1px solid oklch(0.52 0.17 303 / 0.4);
}

.expense-details {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.expense-amount {
    text-align: right;
    margin-right: var(--spacing-md);
}

.expense-monthly {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-primary);
    display: block;
}

.expense-total {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.btn-delete {
    padding: var(--spacing-xs) var(--spacing-sm);
    background: oklch(0.62 0.19 25 / 0.1);
    color: var(--accent-danger);
    border: 1px solid oklch(0.62 0.19 25 / 0.3);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-delete:hover {
    background: var(--accent-danger);
    color: white;
    transform: scale(1.05);
}

.empty-state {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
    font-style: italic;
}

/* ===================================
   Footer
   =================================== */
.app-footer {
    text-align: center;
    padding: var(--spacing-lg) 0;
    margin-top: var(--spacing-xl);
    border-top: 1px solid var(--divider-color);
    color: var(--text-muted);
}

/* ===================================
   Animations
   =================================== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
    .app-container {
        padding: 10px 8px;
        /* Reduced horizontal padding */
    }

    .app-header h1 {
        font-size: 1.5rem;
    }

    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
        /* Minimal gap to fit 3 in a row */
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .expense-item {
        flex-direction: row;
        /* Force row on mobile */
        align-items: center;
        gap: var(--spacing-sm);
    }

    .expense-description {
        font-size: 0.85rem;
    }

    .expense-details {
        font-size: 0.75rem;
    }

    .expense-amount {
        margin-right: 0;
        text-align: right;
        /* Keep right aligned or naturally flows in row */
        font-size: 0.9rem;
    }

    .chart-container {
        min-height: 200px;
        /* Reduced by 20% from 250px */
        padding: var(--spacing-md) var(--spacing-xs);
    }

    .chart-bar-wrapper {
        max-width: 80px;
    }

    .chart-value {
        font-size: 0.75rem;
    }

    .chart-month {
        font-size: 0.7rem;
    }

    .chart-month {
        font-size: 0.7rem;
    }

    /* Compact Cards for 3-in-row layout */
    .credit-card {
        padding: 4px;
        /* Extra compact */
        min-height: auto;
    }

    .card-header {
        margin-bottom: 4px;
        height: auto;
        flex-direction: column;
        gap: 4px;
        align-items: center;
    }

    .card-name {
        font-size: 0.7rem;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
        display: none;
        /* Hide name to save space, rely on icon/color or keep very small */
    }

    /* Option: Show name very small */
    .card-name {
        display: block;
        font-size: 0.6rem;
    }

    .card-icon svg,
    .card-icon img {
        height: 1.2rem !important;
        /* Even smaller icons to fit */
        width: auto !important;
    }

    .card-balance {
        padding: 4px;
        text-align: center;
    }

    .balance-label {
        font-size: 0.6rem;
        margin-bottom: 0;
    }

    .balance-amount {
        font-size: 0.5rem !important;
        /* Force smaller size */
        line-height: 1;
    }

    .selected-card-info {
        font-size: 0.7rem;
        padding: 4px 8px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .credit-card.active::after {
        width: 20px;
        height: 20px;
        font-size: 0.8rem;
        top: 2px;
        right: 2px;
    }
}

@media (max-width: 480px) {
    .app-header {
        margin-bottom: var(--spacing-lg);
    }

    .balance-amount {
        font-size: 1.5rem;
    }

    .monthly-preview {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: var(--spacing-sm);
    }

    .preview-label,
    .preview-amount {
        font-size: 0.9rem;
    }
}

.plus-icon {
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    margin-right: 8px;
}

/* ===================================
   Auth Overlay
   =================================== */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 20, 23, 0.98);
    backdrop-filter: blur(20px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.5s ease-in-out;
}

.auth-overlay.unlocked {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(1.1);
}

.auth-container {
    background: var(--bg-elevated);
    padding: 3rem;
    border-radius: 24px;
    text-align: center;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 90%;
    animation: fadeInUp 0.5s ease;
}

.auth-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: float 6s ease-in-out infinite;
}

.auth-container h2 {
    margin-bottom: 0.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-container p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.auth-container .input-wrapper {
    margin-bottom: 1.5rem;
    position: relative;
    display: flex;
    justify-content: center;
}

.auth-container input {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    font-size: 2rem;
    text-align: center;
    color: white;
    width: 150px;
    letter-spacing: 0.5rem;
    transition: all 0.3s ease;
}

.auth-container input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 4px oklch(0.63 0.16 266 / 0.2);
}

.btn-auth {
    width: 100%;
    padding: 1rem;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px oklch(0.63 0.16 266 / 0.4);
}

.auth-error {
    color: var(--color-danger) !important;
    margin-top: 1rem;
    margin-bottom: 0 !important;
    opacity: 0;
    transition: opacity 0.3s;
    font-weight: 600;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.shake {
    animation: shake 0.3s ease-in-out;
}

/* ===================================
   Navigation
   =================================== */
.bottom-nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 0.35rem;
    /* Reduced by ~10-20% */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: relative;
}

.nav-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
}

.nav-btn {
    background: none;
    border: none;
    padding: 0.8rem 1.5rem;
    color: var(--text-secondary);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    position: relative;
    overflow: hidden;
}

.nav-icon {
    font-size: 1.3rem;
    /* Reduced slightly */
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-label {
    font-size: 0.58rem;
    /* Reduced 10% from 0.65rem */
    font-weight: 500;
    opacity: var(--icon-inactive);
    transition: opacity 0.3s;
}

/* Hover effects */
.nav-btn:hover {
    color: var(--text-primary);
    opacity: 1;
}

.nav-btn:hover .nav-icon {
    transform: scale(1.1);
}

.nav-btn:active {
    transform: scale(0.95);
}

/* Active state */
.nav-btn.active {
    color: white;
}

.nav-btn.active::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 50%;
    opacity: 0.1;
    filter: blur(10px);
    z-index: -1;
}

.nav-btn.active .nav-icon {
    transform: translateY(-2px) scale(1.1);
    text-shadow: 0 0 15px rgba(76, 141, 255, 0.4);
    color: var(--color-blue);
}

.nav-btn.active .nav-label {
    opacity: 1;
    font-weight: 600;
    color: var(--color-blue);
}

/* Adjust main content to prevent overlap */
.app-container {
    padding-bottom: 110px;
    /* Space for bottom nav */
}

/* Transitions for views */
.view-section {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .bottom-nav {
        bottom: 10px;
        width: 95%;
        padding: 0.4rem;
    }

    .nav-btn {
        padding: 0.6rem;
    }
}

/* ===================================
   Investments Module
   =================================== */
.portfolio-dashboard {
    background: linear-gradient(135deg, #1B1F24 0%, #121417 100%);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg) var(--spacing-md);
    /* Reduced horizontal padding */
    border: 1px solid var(--border-subtle);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--spacing-md);
    /* Reduced gap between chart and text */
    animation: fadeInScale 0.6s ease;
}

.pie-chart-container {
    position: relative;
    width: 162px;
    /* 20% smaller than 203px */
    height: 162px;
    flex-shrink: 0;
    /* Prevent squishing */
}

.pie-chart {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: oklch(0.32 0.02 250);
    transition: background 1s ease;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pie-chart-hole {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 65%;
    height: 65%;
    background: oklch(0.22 0.02 260);
    border-radius: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.8);
}

.hole-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: holeFadeIn 0.3s ease-out;
}

.hole-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.hole-val {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 1px 0;
}

.hole-perc {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent-primary);
}

@keyframes holeFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.refresh-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(180deg);
    box-shadow: 0 0 15px var(--accent-primary);
}

.refresh-btn:active {
    transform: rotate(180deg) scale(0.95);
}

.toggle-visibility-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    outline: none;
    /* Remove focus outline */
}

.toggle-visibility-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 15px var(--accent-primary);
    transform: scale(1.05);
}

.toggle-visibility-btn:active {
    transform: scale(0.95);
}

.toggle-visibility-btn:focus {
    outline: none;
    /* Prevent stuck appearance */
}

.pie-segment:hover {
    filter: brightness(1.2) drop-shadow(0 0 5px currentColor);
}

.pie-segment,
.pie-segment-faby {
    outline: none !important;
    /* Remove blue rectangular outline */
    -webkit-tap-highlight-color: transparent !important;
    /* Remove mobile tap highlight */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.pie-segment:focus {
    outline: none !important;
    /* Remove focus outline */
}

.pie-segment:active {
    outline: none !important;
    /* Remove active outline */
}


/* Portfolio Info Section (Right Side) */
.portfolio-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 16px;
    min-width: 120px;
    /* Reduced from 180px */
}

.info-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.info-text {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    gap: 4px;
}

.info-label {
    font-size: 0.455rem;
    /* 30% smaller than 0.65rem */
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.info-amount {
    font-size: 1.4rem;
    /* 30% smaller than 2rem */
    font-weight: 800;
    color: var(--color-success);
    /* Green color for holdings */
    line-height: 1;
    margin: 4px 0;
}

.info-rate {
    font-size: 0.455rem;
    /* 30% smaller than 0.65rem */
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    opacity: 0.7;
}

.info-ars {
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
    margin-top: 2px;
    /* Reduced from 4px */
}

.refresh-icon {
    width: 18px;
    height: 18px;
    filter: brightness(0) invert(1);
    /* Make SVG white */
}

.balance-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    /* Align everything to the right */
    gap: 12px;
}

.balance-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.balance-text {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    /* Right align text */
    text-align: right;
}

.balance-details .label {
    font-size: 0.4rem;
    /* 50% smaller than 0.8rem */
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.balance-details .amount-usd {
    font-size: 1rem;
    /* 50% smaller than 2rem */
    font-weight: 700;
    color: var(--text-primary);
}

.rate-badge {
    font-size: 0.325rem;
    /* 50% smaller than 0.65rem */
    color: var(--text-secondary);
    opacity: 0.8;
    margin-top: 2px;
}

.balance-details .amount-usd {
    font-size: 1.45rem;
    /* Reduced by another ~10% from 1.7rem -> 1.53, let's keep it safe at 1.45 */
    font-weight: 800;
    color: var(--color-success);
    /* Green for USD */
    text-shadow: 0 2px 10px oklch(0.70 0.15 155 / 0.3);
    transition: all 0.3s ease;
}

.toggle-visibility-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    margin-left: 8px;
    opacity: 0.7;
    transition: opacity 0.2s;
    line-height: 1;
}

.toggle-visibility-btn:hover {
    opacity: 1;
}

.balance-details .sub-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.btn-currency-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-currency-toggle.active {
    border-color: var(--color-info);
    box-shadow: 0 0 12px oklch(0.65 0.12 240 / 0.5);
    background: oklch(0.65 0.12 240 / 0.15);
}

.btn-action {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.btn-action:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-action.active,
.btn-action:active {
    border-color: var(--color-info);
    box-shadow: 0 0 10px oklch(0.65 0.12 240 / 0.5);
    background: oklch(0.65 0.12 240 / 0.1);
}

.icon-white {
    filter: brightness(0) invert(1);
    transition: filter 0.2s ease;
}

.btn-action:hover .icon-white {
    filter: brightness(0) invert(1) drop-shadow(0 0 2px white);
}


.btn-action.btn-danger {
    border-color: var(--color-danger) !important;
}

.btn-action.btn-danger:hover {
    background: oklch(0.62 0.19 25 / 0.15) !important;
}

.btn-action.btn-danger:active {
    background: oklch(0.62 0.19 25 / 0.2) !important;
    box-shadow: 0 0 12px oklch(0.62 0.19 25 / 0.5) !important;
}

.icon-svg {
    width: 65%;
    height: 65%;
    color: white;
}

.investments-header h2 {
    display: none;
    /* Hide as requested */
}

.assets-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
}

.assets-list .expense-item {
    padding: 0.8rem;
    gap: 8px;
    margin-bottom: 4px;
}

@media (max-width: 480px) {
    .assets-list .expense-item {
        padding: 0.6rem;
        flex-wrap: wrap;
    }

    .assets-list .expense-info {
        flex: 1 1 60%;
    }

    .assets-list .expense-amount {
        flex: 1 1 30%;
        margin-right: 0;
    }
}

/* Asset Type Selector - Circular Buttons */
.asset-type-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, auto);
    justify-items: center;
    gap: 40px;
    /* Separation increased as requested */
    margin: 1.5rem auto;
    max-width: 450px;
    /* Wider to allow for separation */
    padding: 10px;
}

.asset-type-selector::-webkit-scrollbar {
    display: none;
}

.asset-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.asset-type-btn.active {
    opacity: 1;
    transform: translateY(-2px);
}

.asset-type-btn .asset-icon {
    width: 40px;
    /* Slightly smaller as requested */
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.asset-type-btn.active .asset-icon {
    border-color: currentColor;
    box-shadow: 0 0 15px currentColor;
}

.asset-type-btn .asset-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.asset-type-btn.active .asset-name {
    color: var(--text-primary);
}

/* Pie Chart Mode Toggle */
.pie-mode-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 0.75rem;
    user-select: none;
}

.pie-mode-toggle .toggle-pill {
    display: flex;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}

.pie-mode-toggle .toggle-option {
    padding: 6px 16px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
    white-space: nowrap;
    letter-spacing: 0.3px;
    border: none;
    background: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.pie-mode-toggle .toggle-option.active {
    color: #fff;
    text-shadow: 0 0 8px rgba(66, 133, 244, 0.4);
}

.pie-mode-toggle .toggle-slider {
    position: absolute;
    top: 2px;
    bottom: 2px;
    border-radius: 18px;
    background: var(--gradient-primary);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3);
}

/* Chart Legend */

.chart-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 1rem;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-percent {
    margin-left: auto;
    font-weight: bold;
    color: var(--text-primary);
}

/* Performers Section */
.performers-container {
    margin-top: 1.5rem;
}

.performers-container:empty {
    display: none;
    /* Hide when empty */
    margin: 0;
    padding: 0;
}

.performers-grid {
    display: flex;
    gap: 6px;
    /* Minimum gap */
    flex-wrap: nowrap;
    /* Force side-by-side */
    width: 100%;
}

.performer-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    /* Minimal internal gap */
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 6px;
    /* Minimal padding */
    min-width: 0;
    /* Allow shrinking to fit 50% */
    overflow: hidden;
}

.performer-column:first-child {
    border: 1px solid var(--color-success);
    /* Thinner green border */
}

.performer-column:last-child {
    border: 1px solid var(--color-danger);
    /* Thinner red border */
}

.performer-title {
    font-size: 0.6rem;
    /* Extra small */
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
    opacity: 0.7;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.performer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1px 0;
    font-size: 0.65rem;
    /* Smaller for mobile */
    white-space: nowrap;
}

.performer-ticker {
    font-weight: 600;
    color: var(--text-primary);
}

.performer-value {
    font-size: 0.85rem;
    font-weight: bold;
}

.performer-value.pos {
    color: var(--color-success);
}

.performer-value.neg {
    color: var(--color-danger) ;
}

.performer-divider {
    display: none;
    /* Hide divider, using borders instead */
}

.performer-empty {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 10px 0;
}

/* ===================================
   Budget Section Styles
   =================================== */

.budget-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    animation: fadeInUp 0.5s ease;
}

/* Summary Cards */
.budget-summary {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: var(--spacing-lg);
}

.budget-summary.vertical-stack {
    flex-direction: column;
    gap: 8px;
    flex: 1;
    display: flex;
    margin-bottom: 0;
    /* Removed margin to fix vertical centering offset */
}

.budget-summary.vertical-stack .summary-card {
    flex-direction: column;
    justify-content: center;
    padding: 10px;
    text-align: center;
    align-items: center;
    min-height: 75px;
    width: 100%;
}

.summary-card {
    flex: 1;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: all var(--transition-normal);
    align-items: center;
    text-align: center;
}

/* Savings Card Specifics */
.savings-card {
    border-left: 4px solid var(--color-savings);
    background: oklch(0.76 0.13 70 / 0.05);
}

.savings-card .summary-label {
    color: var(--color-savings);
}

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

.summary-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* Reduced font size for summary values (Requested 50% reduction) */
.summary-value {
    font-size: 1.1rem !important;
    font-weight: 700;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .summary-value {
        font-size: 1rem !important;
    }
}

/* Force Bottom Menu White Text even in Light Mode */
.nav-btn {
    color: rgba(255, 255, 255, 0.7) !important;
    /* Force light gray default */
}

.nav-btn:hover {
    color: white !important;
}

.nav-btn.active {
    color: white !important;
}

.nav-label {
    color: rgba(255, 255, 255, 0.7) !important;
}

.nav-btn.active .nav-label {
    color: white !important;
}


/* RESTORED BUDGET STYLES */

.income-card {
    border-top: 2px solid var(--color-success);
}

.expense-card {
    border-top: 2px solid var(--color-danger);
}

.balance-card {
    border-top: 2px solid var(--accent-primary);
}

/* Paid Toggle Button */
.btn-paid {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 4px;
    filter: grayscale(1);
    opacity: 0.5;
    transition: all 0.3s ease;
}

.btn-paid.is-paid {
    filter: grayscale(0);
    opacity: 1;
}

.expense-chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
}

#expenseChart {
    max-width: 100%;
    height: auto;
}


/* Two Column Layout */
.budget-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
}

.budget-column {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.income-column {
    border-left: 4px solid var(--color-success);
}

.expense-column {
    border-left: 4px solid var(--color-danger);
}

.column-header {
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color);
}

.column-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.btn-toggle-budget-form {
    align-self: flex-start;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 4px;
    margin-bottom: 8px;
    transition: all var(--transition-normal);
}

.btn-toggle-budget-form:hover,
.btn-toggle-budget-form.active {
    background: var(--accent-primary);
    color: white;
    transform: translateY(-1px);
}

/* Budget Forms */
.budget-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--bg-inner);
    border-radius: var(--radius-md);
}

.btn-income {
    background: var(--gradient-success);
}

.btn-expense {
    background: var(--gradient-danger);
}

.btn-centered {
    margin: 10px auto 0 auto !important;
    width: fit-content !important;
    padding: 10px 30px !important;
    display: block !important;
}

/* Budget Items List */
.items-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    max-height: 400px;
    overflow-y: auto;
    padding: var(--spacing-xs);
}

.items-list::-webkit-scrollbar {
    width: 6px;
}

.items-list::-webkit-scrollbar-track {
    background: var(--bg-inner);
    border-radius: 3px;
}

.items-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.items-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.budget-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm);
    background: var(--bg-card);
    /* UPDATED: Changed from glass-bg to bg-card */
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.budget-item:hover {
    background: var(--bg-secondary);
    transform: translateX(2px);
}

.item-info {
    flex: 1;
}

.item-description {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.item-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-both {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: bold;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-both:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.btn-edit,
.btn-delete {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    color: white;
}

.btn-edit:hover,
.btn-delete:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
}

.btn-edit:active,
.btn-delete:active {
    border-color: var(--color-info);
    box-shadow: 0 0 10px oklch(0.65 0.12 240 / 0.5);
    background: oklch(0.65 0.12 240 / 0.1);
}


.item-amount {
    font-size: 1rem;
    font-weight: 700;
    min-width: 90px;
    text-align: right;
}

.income-amount {
    color: var(--color-success);
}

.expense-amount {
    color: var(--color-danger) ;
}


.empty-state {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .budget-summary {
        grid-template-columns: 1fr;
    }

    .budget-columns {
        grid-template-columns: 1fr;
    }

    .items-list {
        max-height: 300px;
    }
}

/* ===================================
   Investment History & Buttons
   =================================== */
#toggleHistoryBtn {
    background: none !important;
    border: none !important;
    color: white !important;
    font-weight: 500;
    box-shadow: none !important;
}

#toggleHistoryBtn:hover {
    transform: scale(1.05);
    opacity: 0.8;
}

#backFromHistory {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

#backFromHistory:hover {
    background: var(--accent-primary);
    transform: scale(1.1);
    box-shadow: var(--shadow-glow);
}

.btn-close-pos {
    border-color: var(--color-danger) !important;
    background: oklch(0.62 0.19 25 / 0.05) !important;
}

.btn-close-pos:hover {
    background: oklch(0.62 0.19 25 / 0.15) !important;
    transform: scale(1.1);
}

.history-table th {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-table td {
    padding: 12px 8px;
}

/* ===================================
   Vault Module
   =================================== */
.vault-section {
    padding: var(--spacing-md);
    max-width: 600px;
    margin: 0 auto;
    animation: fadeIn 0.4s ease;
}

.vault-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: var(--spacing-lg);
}

.btn-add-vault {
    flex: 1 1 260px;
    justify-content: center;
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-xl);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-add-vault span {
    font-size: 1.4rem;
    color: white;
    font-weight: bold;
    line-height: 1;
}

.btn-add-vault:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-add-vault:active {
    transform: scale(0.95);
}

.vault-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-vault-action {
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background:
        linear-gradient(135deg, rgba(76, 141, 255, 0.14), rgba(139, 92, 246, 0.10)),
        rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), var(--shadow-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-vault-action span {
    font-size: 0.95rem;
    line-height: 1;
}

.btn-vault-action:hover {
    transform: translateY(-1px);
    border-color: rgba(76, 141, 255, 0.42);
    background:
        linear-gradient(135deg, rgba(76, 141, 255, 0.22), rgba(139, 92, 246, 0.18)),
        rgba(255, 255, 255, 0.06);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.btn-vault-action:active {
    transform: scale(0.97);
}

.btn-vault-action-lock {
    border-color: rgba(255, 255, 255, 0.10);
}

.vault-form-container {
    background: var(--bg-secondary);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    margin-bottom: var(--spacing-lg);
}

.vault-form .form-group {
    margin-bottom: var(--spacing-md);
}

.pass-input-wrapper {
    display: flex;
    gap: 8px;
}

.pass-input-wrapper input {
    flex: 1;
}

.btn-toggle-pass {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0 12px;
    border-radius: 8px;
    cursor: pointer;
}

.vault-search {
    margin-bottom: var(--spacing-lg);
}

.vault-search input {
    width: 100%;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 25px;
    color: white;
    font-size: 1rem;
}

.vault-list-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.vault-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.vault-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.vault-item-info {
    flex: 1;
}

.vault-item-info h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--accent-primary);
}

.vault-detail {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.vault-detail .label {
    color: var(--text-secondary);
    width: 45px;
    font-size: 0.8rem;
}

.vault-detail .value {
    color: var(--text-primary);
    font-family: 'Courier New', Courier, monospace;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
    white-space: nowrap;
}

.pass-blur {
    filter: blur(5px);
    user-select: none;
}

.vault-actions {
    display: flex;
    gap: 5px;
}

.btn-copy {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.btn-copy:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-copy.copied {
    background: var(--color-success);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
}

.btn-delete-vault {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.3;
    transition: opacity 0.2s;
    padding: 10px;
}

.btn-delete-vault:hover {
    opacity: 1;
    color: var(--color-danger) ;
}

@media (max-width: 480px) {
    .vault-item {
        flex-direction: row;
        align-items: flex-start;
    }

    .vault-detail .value {
        max-width: 120px;
    }
}

/* Compact Budget Container */
.budget-compact-container {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    /* Critical: allows chart to stretch to cards height */
    gap: 16px;
    margin-bottom: 2rem;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

/* Stacked Bar Section */
.stacked-bar-section {
    flex: 1.2;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    /* Reset padding to ensure perfect alignment */
}

.stacked-bar-container {
    width: 105px;
    /* 50% wider */
    height: 100%;
    /* Filled by parent stacked-bar-section which is stretched */
    background: var(--bg-inner);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    border: 2px solid var(--border-color);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

.stacked-segment {
    position: absolute;
    width: 100%;
    left: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid var(--divider-color);
    cursor: pointer;
}

.stacked-segment.highlighted {
    z-index: 10 !important;
    transform: scaleX(1.1);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    filter: brightness(1.2);
}

.stacked-bar-container.has-highlight .stacked-segment:not(.highlighted) {
    opacity: 0.4;
    filter: grayscale(0.5);
}

.segment-expenses {
    background: linear-gradient(180deg, var(--ref-red) 0%, var(--ref-dark-red) 100%);
    z-index: 3;
}

.segment-savings {
    background: linear-gradient(180deg, var(--ref-amber) 0%, var(--ref-dark-amber) 100%);
    z-index: 2;
}

.segment-balance {
    background: linear-gradient(180deg, var(--ref-green) 0%, var(--ref-dark-green) 100%);
    z-index: 1;
}

.segment-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    text-align: center;
    padding: 0 4px;
    pointer-events: none;
    white-space: nowrap;
}

/* Media Queries for Budget Compact */
@media (max-width: 480px) {
    .budget-compact-container {
        gap: 12px;
        padding: 8px;
    }

    .stacked-bar-container {
        width: 50px;
    }

    .segment-label {
        font-size: 0.55rem;
    }
}

/* Mobile Responsive Adjustments for Budget */
@media (max-width: 600px) {
    .budget-summary.horizontal-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .budget-summary.horizontal-row .summary-card {
        min-height: 60px;
    }

    .stacked-bar-section {
        min-height: 200px;
    }
}

/* Mobile Responsive Adjustments for Budget */
@media (max-width: 768px) {
    .budget-compact-container {
        flex-direction: row;
        align-items: stretch;
        gap: 12px;
        padding: 12px;
    }

    .budget-summary.vertical-stack {
        display: flex;
        flex-direction: column;
        flex: 2;
        width: auto;
        gap: 6px;
        margin: 0;
    }

    .budget-summary.vertical-stack .summary-card {
        min-height: 60px;
        padding: 6px;
    }

    .summary-label {
        font-size: 0.7rem;
    }

    .summary-value {
        font-size: 0.95rem !important;
    }

    .stacked-bar-section {
        flex: 1;
        width: auto;
    }

    .stacked-bar-container {
        width: 70px;
        height: 100%;
    }
}





/* Performance Dashboard 2026 */
.performance-card {
    background: linear-gradient(135deg, oklch(0.63 0.16 266 / 0.1), oklch(0.52 0.17 303 / 0.1));
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.performance-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.performance-info {
    display: flex;
    flex-direction: column;
}

.performance-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.performance-value {
    font-size: 2rem;
    font-weight: 800;
}

.performance-profit {
    text-align: right;
}

.profit-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
}

.profit-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.performance-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 15px;
    justify-content: center;
}

.perf-cat-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    min-width: 80px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    align-items: center;
    text-align: center;
}

.perf-cat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.perf-cat-value {
    font-size: 0.9rem;
    font-weight: 700;
}

.performance-footer {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: center;
    opacity: 0.6;
}

@media (max-width: 600px) {
    .performance-value {
        font-size: 1.6rem;
    }

    .perf-cat-item {
        flex: 1;
        min-width: 100px;
    }
}

/* White Icon utility for emojis */
.icon-white {
    filter: brightness(0) invert(1);
    opacity: var(--icon-active);
}

/* Casa Module Styles */
.casa-dashboard {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    animation: fadeInUp 0.5s ease;
}

.casa-progress-container {
    margin-bottom: var(--spacing-lg);
}

.casa-progress-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.casa-progress-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.casa-progress-percent {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.casa-progress-bar-bg {
    height: 12px;
    background: var(--bg-inner);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.casa-progress-bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    box-shadow: 0 0 15px oklch(0.63 0.16 266 / 0.4);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.casa-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: var(--spacing-md);
}

.casa-stat-card {
    background: var(--bg-inner);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease;
}

.casa-stat-card:hover {
    transform: translateY(-2px);
    background: var(--bg-secondary);
}

.casa-stat-card.highlight {
    border-color: var(--accent-primary);
    background: oklch(0.63 0.16 266 / 0.05);
}

.casa-stat-card .stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.casa-stat-card .stat-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.casa-stat-card.highlight .stat-value {
    color: var(--accent-primary);
}

/* ===================================
   Google Auth Styles
   =================================== */

/* Botón Google Sign-In */
.btn-google-signin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 24px;
    background: white;
    color: oklch(0.40 0.02 0);
    border: 1px solid #dadce0;
    border-radius: 24px;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    min-width: 240px;
}

.btn-google-signin:hover:not(:disabled) {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
    background: #f8f9fa;
}

.btn-google-signin:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Spinner dentro del botón de Google */
.google-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #dadce0;
    border-top-color: #4285F4;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

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

/* Info de usuario en el header (Barra Superior) */
.header-user-info {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 20px;
    margin-bottom: 8px;
    /* Separar del título */
    width: fit-content;
    margin-left: auto;
    /* Alinear a la derecha */
    backdrop-filter: blur(5px);
    border: 1px solid var(--border-subtle);
}

.header-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
    object-fit: cover;
}

.header-username {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Botón Sign Out */
.btn-signout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: oklch(0.62 0.19 25 / 0.1);
    color: var(--accent-danger);
    border: 1px solid oklch(0.62 0.19 25 / 0.3);
    border-radius: 50%;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.btn-signout:hover {
    background: var(--accent-danger);
    color: white;
    transform: scale(1.1);
}

/* Currency Distribution Bar */
.currency-distribution-container {
    margin: 1.5rem 0;
    padding: 0 0.5rem;
    animation: fadeInUp 0.8s ease;
}

.currency-bar-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.currency-bar {
    display: flex;
    height: 14px;
    border-radius: 7px;
    overflow: hidden;
    background: var(--bg-secondary);
    margin-bottom: 0.8rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.currency-segment {
    height: 100%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.currency-segment::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(rgba(255, 255, 255, 0.1), transparent);
}

.segment-pesos {
    background: var(--color-accent);
    box-shadow: 0 0 10px oklch(0.63 0.16 266 / 0.3);
}

.segment-crypto {
    background: var(--color-savings);
    box-shadow: 0 0 10px oklch(0.76 0.13 70 / 0.3);
}

.segment-usd {
    background: var(--color-success);
    box-shadow: 0 0 10px oklch(0.70 0.15 155 / 0.3);
}

.currency-labels {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.label-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.label-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.label-name {
    font-weight: 500;
}

.label-percent {
    font-weight: 700;
    opacity: 0.9;
}

/* ===================================
   Vault PIN Lock Screen
   =================================== */
.vault-pin-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
    text-align: center;
    animation: fadeInUp 0.4s ease;
    backdrop-filter: blur(12px);
}

.vault-pin-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    animation: fadeInScale 0.5s ease;
}

.vault-pin-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.vault-pin-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.vault-pin-input {
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1.1rem;
    text-align: center;
    letter-spacing: 0.2em;
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    display: block;
    box-sizing: border-box;
}

.vault-pin-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px oklch(0.63 0.16 266 / 0.15);
}

.vault-pin-btn {
    width: 100%;
    margin-top: 1rem;
    padding: 0.85rem;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    font-family: inherit;
}

.vault-pin-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.vault-pin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.vault-pin-error {
    color: var(--color-danger);
    font-size: 0.85rem;
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: oklch(0.62 0.19 25 / 0.1);
    border-radius: var(--radius-sm);
    border: 1px solid oklch(0.62 0.19 25 / 0.3);
}

/* ===================================
   Academia RAT — Learning Section
   =================================== */

/* Header */
.learning-header {
    margin-bottom: 1.25rem;
}

.learning-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.35rem;
}

.learning-main-title {
    font-size: 1.3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.learning-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Add Course Button */
.btn-add-course {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.35);
}

.btn-add-course:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-add-course .plus-icon {
    font-size: 1.1rem;
    font-weight: 400;
}

/* ─── Filtros Pill ─── */
.learning-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    padding-bottom: 0.25rem;
    justify-content: center;
}

.learning-filter-pill {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.22s ease;
    font-family: inherit;
}

.learning-filter-pill:hover {
    border-color: rgba(255,255,255,0.3);
    color: var(--text-primary);
    background: rgba(255,255,255,0.08);
    transform: translateY(-1px);
}

.learning-filter-pill.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

[data-theme="light"] .learning-filter-pill {
    border-color: rgba(0,0,0,0.12);
    background: rgba(0,0,0,0.04);
    color: var(--text-secondary);
}

[data-theme="light"] .learning-filter-pill:hover {
    background: rgba(0,0,0,0.08);
    color: var(--text-primary);
}

/* ─── Course Grid ─── */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.1rem;
}

@media (max-width: 600px) {
    .course-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── Course Card ─── */
.course-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    animation: fadeInUp 0.4s ease;
    display: flex;
    flex-direction: column;
}

.course-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    border-color: rgba(102, 126, 234, 0.35);
}

/* Thumbnail area */
.course-thumb {
    position: relative;
    height: 165px;
    overflow: hidden;
    flex-shrink: 0;
}

.course-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.course-card:hover .course-thumb-img {
    transform: scale(1.04);
}

.course-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

/* Category badge */
.course-cat-badge {
    position: absolute;
    bottom: 8px;
    left: 10px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    letter-spacing: 0.3px;
    backdrop-filter: blur(4px);
}

/* Admin action buttons overlay */
.course-admin-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.course-card:hover .course-admin-actions {
    opacity: 1;
}

.btn-course-edit,
.btn-course-delete {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: transform 0.15s ease, background 0.15s ease;
    backdrop-filter: blur(8px);
}

.btn-course-edit {
    background: rgba(102, 126, 234, 0.85);
    color: white;
}

.btn-course-delete {
    background: rgba(239, 68, 68, 0.85);
    color: white;
}

.btn-course-edit:hover  { transform: scale(1.12); background: rgba(102, 126, 234, 1); }
.btn-course-delete:hover { transform: scale(1.12); background: rgba(239, 68, 68, 1); }

/* Card body */
.course-card-body {
    padding: 0.9rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.45rem;
}

.course-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.course-duration {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 3px;
}

.btn-view-course {
    display: inline-block;
    margin-top: 0.6rem;
    padding: 7px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
    transition: all 0.2s ease;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

.btn-view-course:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.45);
    opacity: 0.92;
}

/* ─── Empty & Loading States ─── */
.learning-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
}

.learning-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.learning-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ─── Course Modal ─── */
.course-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(6px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

.course-modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: slideUpModal 0.3s ease;
    position: relative;
}

@keyframes slideUpModal {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.course-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.course-modal-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.course-modal-close {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.course-modal-close:hover {
    background: rgba(239,68,68,0.15);
    border-color: rgba(239,68,68,0.4);
    color: #ef4444;
}

/* Thumbnail picker inside modal */
.course-form-thumbnail-area {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.1rem;
}

.thumbnail-preview {
    width: 100%;
    height: 150px;
    border-radius: 10px;
    border: 2px dashed rgba(102, 126, 234, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    background: rgba(102, 126, 234, 0.05);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.thumbnail-preview:hover {
    border-color: rgba(102, 126, 234, 0.7);
    background: rgba(102, 126, 234, 0.08);
}

.thumbnail-placeholder {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.6;
}

.thumbnail-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Course form */
.course-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.course-form .form-group textarea {
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    min-height: 70px;
    transition: border-color 0.2s ease;
}

.course-form .form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px oklch(0.63 0.16 266 / 0.1);
}

.course-form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.course-form-actions .btn-secondary {
    flex: 1;
}

.course-form-actions .btn-primary {
    flex: 2;
}

/* Light mode overrides */
[data-theme="light"] .course-modal {
    background: var(--bg-secondary);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

[data-theme="light"] .course-card {
    background: rgba(255,255,255,0.7);
    border-color: rgba(0,0,0,0.06);
}

[data-theme="light"] .course-card:hover {
    box-shadow: 0 12px 32px rgba(0,0,0,0.1);
    border-color: rgba(102, 126, 234, 0.3);
}

/* ─── Forum Entry Button ─── */
.learning-forum-entry {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.btn-forum-entry {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    background: linear-gradient(135deg, rgba(102,126,234,0.1) 0%, rgba(118,75,162,0.1) 100%);
    border: 1px solid rgba(102,126,234,0.25);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
    color: var(--text-primary);
    text-align: left;
}

.btn-forum-entry:hover {
    background: linear-gradient(135deg, rgba(102,126,234,0.18) 0%, rgba(118,75,162,0.18) 100%);
    border-color: rgba(102,126,234,0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102,126,234,0.2);
}

.forum-entry-left {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.forum-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.forum-entry-title {
    font-size: 0.95rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.forum-entry-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.forum-arrow {
    font-size: 1.8rem;
    color: rgba(102,126,234,0.6);
    font-weight: 300;
    line-height: 1;
}

/* ===================================
   Foro de la Comunidad (Reddit Style)
   =================================== */
.forum-layout {
    display: flex;
    gap: 1rem;
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    align-items: flex-start;
}

.forum-sidebar {
    width: 250px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    position: sticky;
    top: 80px;
    height: fit-content;
    display: none; /* Mobile hidden by default */
    flex-shrink: 0;
}

.forum-sidebar-divider { display: none; }

@media (min-width: 769px) {
    .forum-layout {
        display: grid;
        grid-template-columns: 265px 1px 1fr;
        gap: 0;
        max-width: 100%;
        align-items: stretch;
        transition: grid-template-columns 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .forum-sidebar { 
        display: block; 
        position: static; 
        background: var(--bg-primary); 
        border-radius: 0;
        border: none;
        padding: 1.5rem 1rem;
        transition: transform 0.4s ease, opacity 0.4s ease, width 0.4s ease, padding 0.4s ease;
        transform-origin: left;
    }
    .forum-sidebar-divider { 
        display: block;
        width: 1px;
        background: var(--divider-color);
        margin: 1.5rem 0;
        transition: opacity 0.3s;
    }
    .forum-layout.sidebar-collapsed { grid-template-columns: 0px 0px 1fr; }
    .forum-layout.sidebar-collapsed .forum-sidebar { 
        padding: 0; 
        width: 0;
        opacity: 0; 
        transform: translateX(-100%);
        pointer-events: none;
    }
    .forum-layout.sidebar-collapsed .forum-sidebar-divider { opacity: 0; width: 0; }
    .forum-sidebar-toggle { 
        display: flex !important; 
        margin: 0 !important; 
        position: absolute !important;
        top: 2.5rem;
        left: 265px;
        transform: translateX(-50%);
        z-index: 1001;
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
        background: var(--bg-surface);
        border: 1px solid var(--border-subtle);
    }
    .forum-layout.sidebar-collapsed .forum-sidebar-toggle {
        left: 0;
        transform: translateX(0);
    }
}

.forum-sidebar.mobile-open {
    display: block;
    position: absolute;
    top: 40px;
    left: 0;
    z-index: 2000;
    box-shadow: var(--shadow-lg);
    background: var(--bg-secondary);
}

.forum-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}
.forum-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--divider-color);
}
.forum-sidebar-header h3 {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.forum-category-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.forum-category-list li {
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
}

.forum-category-list li:hover {
    background: rgba(255,255,255,0.05);
}

.forum-category-list li.active {
    background: rgba(102,126,234,0.15);
    color: #667eea;
    font-weight: 600;
}

.forum-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.forum-composer {
    padding: 1rem;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: 12px;
}
.forum-composer-inner { display: flex; gap: 0.75rem; align-items: flex-start; }
.forum-composer-right { flex: 1; display: flex; flex-direction: column; gap: 0.6rem; }

.forum-composer-title-input {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    transition: border-color 0.2s;
}

.forum-composer-input {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    resize: none;
    transition: border-color 0.2s;
    line-height: 1.5;
}
.forum-composer-input:focus, .forum-composer-title-input:focus { outline: none; border-color: rgba(102,126,234,0.5); }
.forum-composer-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.35rem; }
.forum-composer-left-actions, .forum-composer-right-actions { display: flex; align-items: center; gap: 0.5rem; }
.forum-action-btn { background: none; border: none; cursor: pointer; font-size: 1.1rem; padding: 2px 4px; border-radius: 6px; transition: background 0.15s; color: var(--text-secondary); }
.forum-action-btn:hover { background: rgba(255,255,255,0.08); }
.forum-char-count { font-size: 0.75rem; color: var(--text-muted); min-width: 24px; text-align: right; }
.btn-publish {
    padding: 6px 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 20px;
    color: white;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-publish:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-publish:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.forum-feed { 
    flex: 1; 
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch; 
    padding: 1rem 0; 
    display: flex;
    flex-direction: column;
    gap: 1.5rem; /* Space between cards */
}

/* Fixed post width on desktop — stays at max 680px */
.forum-feed-container {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    transition: none;
}

/* When sidebar collapses, just center — don't expand */
.sidebar-collapsed .forum-feed-container {
    max-width: 680px;
}

.forum-post-card { 
    padding: 1.2rem; 
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 16px; 
    transition: transform 0.2s, background 0.15s, border-color 0.2s; 
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.forum-post-card:hover { 
    background: var(--bg-elevated);
    border-color: rgba(102,126,234,0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}
.forum-post-header { display: flex; align-items: flex-start; gap: 0.65rem; margin-bottom: 0.5rem; }
.forum-post-meta { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.forum-post-author { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.forum-author-name { font-weight: 700; font-size: 0.88rem; color: var(--text-primary); }
.forum-post-time-container { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.forum-post-time { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.forum-post-full-date { font-size: 0.65rem; color: var(--text-muted); opacity: 0.8; white-space: nowrap; }
.forum-post-header-actions { display: flex; align-items: center; gap: 0.3rem; flex-shrink: 0; }
.forum-post-edit { background: none; border: none; cursor: pointer; font-size: 0.8rem; opacity: 0.4; transition: opacity 0.15s; padding: 2px; border-radius: 4px; }
.forum-post-edit:hover { opacity: 1; }
.forum-post-delete { background: none; border: none; cursor: pointer; font-size: 0.8rem; opacity: 0.4; transition: opacity 0.15s; padding: 2px; border-radius: 4px; }
.forum-post-delete:hover { opacity: 1; }
.forum-avatar { border-radius: 50%; overflow: hidden; flex-shrink: 0; background: var(--accent-primary); display: flex; align-items: center; justify-content: center; font-weight: bold; color: white; }
.forum-avatar-img { width: 100%; height: 100%; object-fit: cover; }
.forum-avatar-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; font-weight: 700; }
.forum-avatar-sm  { width: 36px; height: 36px; font-size: 0.9rem; }
.forum-avatar-md  { width: 40px; height: 40px; font-size: 1rem; }
.forum-avatar-xs  { width: 28px; height: 28px; font-size: 0.75rem; }
.forum-badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 20px; font-size: 0.62rem; font-weight: 700; color: white; white-space: nowrap; }
.forum-post-title { font-size: 1.15rem; font-weight: 700; color: var(--text-primary); margin: 0.5rem 0 0.2rem 0; }
.forum-post-topic-badge { display: inline-block; background: rgba(102,126,234,0.2); color: #8c9eff; font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; border: 1px solid rgba(102,126,234,0.4); text-transform: uppercase; font-weight: 600; margin-bottom: 0.3rem;}
.forum-post-content { font-size: 0.9rem; line-height: 1.6; color: var(--text-primary); margin: 0.35rem 0 0.5rem; white-space: pre-wrap; word-break: break-word; }
.forum-post-image-wrap { margin: 0.5rem 0; border-radius: 12px; overflow: hidden; max-height: 320px; }
.forum-post-image { width: 100%; max-height: 320px; object-fit: cover; display: block; transition: transform 0.3s; }
.forum-post-image:hover { transform: scale(1.01); }
.forum-post-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; align-items: center; }

/* Reactions Bar */
.forum-reactions-bar {
    display: flex;
    gap: 0.2rem;
    padding: 2px;
    background: rgba(0,0,0,0.15);
    border-radius: 20px;
    margin-right: auto;
}
.forum-reaction-btn {
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 3px 6px;
    border-radius: 12px;
    transition: all 0.2s;
    opacity: 0.6;
    display: flex;
    align-items: center;
    gap: 3px;
    color: var(--text-primary);
}
.forum-reaction-btn:hover {
    opacity: 1;
    transform: scale(1.1);
    background: rgba(255,255,255,0.1);
}
.forum-reaction-btn.active {
    opacity: 1;
    background: rgba(102,126,234,0.3);
    border-color: rgba(102,126,234,0.5);
}
.reaction-count { font-size: 0.75rem; }

.forum-action-pill { display: flex; align-items: center; gap: 4px; padding: 4px 12px; background: rgba(255,255,255,0.04); border: 1px solid var(--border-color); border-radius: 20px; color: var(--text-secondary); font-size: 0.78rem; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.forum-action-pill:hover { background: rgba(255,255,255,0.1); border-color: rgba(102,126,234,0.4); color: var(--text-primary); }
.forum-comments-section { margin-top: 0.5rem; border-top: 1px solid var(--border-color); padding-top: 0.6rem; }
.forum-comment { padding: 0.8rem 0 0.5rem 0; border-bottom: 1px solid rgba(255,255,255,0.04); position: relative; }
.forum-comment-header { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.25rem; }
.forum-comment-content { font-size: 0.83rem; color: var(--text-primary); margin: 0.2rem 0; padding-left: 0.25rem; line-height: 1.5; word-break: break-word; }

/* Indentation and vertical lines like Reddit */
.forum-replies { 
    margin-left: 1rem; 
    border-left: 2px solid rgba(255,255,255,0.08); 
    padding-left: 0.8rem;
    margin-top: 0.5rem;
}
.forum-reply-item { 
    padding: 0.6rem 0; 
    border-bottom: 1px solid rgba(255,255,255,0.03); 
    position: relative;
}

.forum-comment.pending, .forum-reply-item.pending {
    opacity: 0.6;
    filter: grayscale(0.5);
}

.forum-del-comment { background: none; border: none; cursor: pointer; font-size: 0.72rem; opacity: 0.35; transition: opacity 0.15s; }
.forum-del-comment:hover { opacity: 1; }
.forum-reply-toggle { background: none; border: none; color: rgba(102,126,234,0.8); font-size: 0.72rem; cursor: pointer; padding: 2px 0; font-family: inherit; transition: color 0.15s; }
.forum-reply-toggle:hover { color: #667eea; }
.forum-replies { margin-left: 1.5rem; }
.forum-reply-item { padding: 0.35rem 0; border-bottom: 1px solid rgba(255,255,255,0.03); display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
.forum-reply-composer { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.forum-reply-input { flex: 1; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 20px; padding: 5px 12px; color: var(--text-primary); font-size: 0.82rem; font-family: inherit; resize: none; transition: border-color 0.2s; }
.forum-reply-input:focus { outline: none; border-color: rgba(102,126,234,0.5); }
.forum-reply-send { padding: 5px 14px; background: rgba(102,126,234,0.2); border: 1px solid rgba(102,126,234,0.3); border-radius: 20px; color: #667eea; font-size: 0.78rem; font-weight: 700; cursor: pointer; transition: all 0.15s; font-family: inherit; white-space: nowrap; }
.forum-reply-send:hover { background: rgba(102,126,234,0.3); }
.forum-empty { text-align: center; padding: 3rem 1rem; color: var(--text-secondary); display: flex; flex-direction: column; align-items: center; gap: 0.75rem; font-size: 0.9rem; }
.forum-loading { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 3rem 1rem; color: var(--text-secondary); font-size: 0.9rem; }
.forum-spinner { width: 32px; height: 32px; border: 3px solid rgba(102,126,234,0.2); border-top-color: #667eea; border-radius: 50%; animation: spin 0.8s linear infinite; }

/* ===================================
   Admin — User Cards con Badges
   =================================== */
.admin-user-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 14px; padding: 0.9rem 1rem; margin-bottom: 0.8rem; display: flex; align-items: center; gap: 0.85rem; transition: border-color 0.2s; }
.admin-user-card:hover { border-color: rgba(102,126,234,0.25); }
.admin-user-avatar { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; background: var(--accent-primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem; color: white; border: 2px solid rgba(255,255,255,0.1); flex-shrink: 0; }
.admin-user-info { flex: 1; min-width: 0; }
.admin-user-name { font-weight: 700; font-size: 0.9rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-user-email { font-size: 0.78rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-user-lastlogin { font-size: 0.68rem; color: var(--accent-primary); margin-top: 3px; }
.admin-badge-control { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.admin-badge-select { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-primary); font-size: 0.75rem; padding: 4px 8px; font-family: inherit; cursor: pointer; }
.admin-badge-select:focus { outline: none; border-color: rgba(102,126,234,0.5); }

/* ===================================
   Forum Lightbox (Visor de imágenes)
   =================================== */
.forum-lightbox {
    position: fixed;
    inset: 0;
    z-index: 4000;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 1rem;
    backdrop-filter: blur(5px);
}
.forum-lightbox img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    user-select: none;
}
.forum-lightbox-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.forum-lightbox-close:hover {
    background: rgba(255,255,255,0.25);
}
.section-header-compact { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid rgba(255,255,255,0.05); }
.btn-back-compact { background: rgba(255,255,255,0.04); border: 1px solid var(--border-color); color: var(--text-primary); width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; font-size: 1.2rem; }
.btn-back-compact:hover { background: var(--bg-secondary); border-color: var(--color-accent); transform: translateX(-2px); }
.section-title-compact { font-size: 1.2rem; font-weight: 700; margin: 0; color: var(--text-primary); }

.forum-add-cat-btn { background: var(--color-success); color: white; border: none; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 1.1rem; font-weight: bold; transition: transform 0.2s; padding: 0; line-height: 1; }
.forum-add-cat-btn:hover { transform: scale(1.1); background: oklch(0.7 0.15 155); }

/* ─── Search Bar ─── */
.forum-top-search {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: center;
}
.search-pill {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 0.6rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 600px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-pill:focus-within {
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px rgba(76, 141, 255, 0.15);
}
.search-icon { opacity: 0.5; font-size: 0.9rem; }
.search-pill input {
    background: none;
    border: none;
    color: var(--text-primary);
    width: 100%;
    font-size: 0.95rem;
    font-family: inherit;
}
.search-pill input:focus { outline: none; }

/* ─── FAB ─── */
.forum-fab {
    position: fixed;
    bottom: 5.5rem; /* Above nav bar */
    right: 1.5rem;
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 28px;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    z-index: 999;
    transition: transform 0.2s, opacity 0.2s;
}
.forum-fab:hover {
    transform: scale(1.05) translateY(-2px);
    opacity: 0.95;
}

/* ─── Modals ─── */
.forum-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}
.forum-composer-modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}
@keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.forum-modal-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--divider-color);
}
.forum-modal-header h3 { margin: 0; font-size: 1.1rem; }
.forum-modal-close { background: none; border: none; color: var(--text-secondary); font-size: 1.2rem; cursor: pointer; opacity: 0.7; }
.forum-modal-close:hover { opacity: 1; }

.forum-composer-body {
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}
.forum-composer-header { display: flex; gap: 0.8rem; align-items: center; }
.forum-content-composer-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
}
.forum-content-composer-box textarea {
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 0.75rem;
    font-size: 1rem;
    resize: none;
    min-height: 120px;
}
.forum-content-composer-box textarea:focus { outline: none; }
.composer-img-preview-box {
    padding: 10px;
    margin-top: 5px;
    background: rgba(0,0,0,0.1);
    border-radius: 8px;
}
.forum-composer-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 0.5rem;
}
.composer-footer-left {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.forum-topic-select {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: white;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.85rem;
}
.footer-actions-row { display: flex; align-items: center; gap: 10px; }
.forum-action-btn-pill {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
}
.forum-action-btn-pill:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.img-preview-status { font-size: 0.75rem; color: var(--text-secondary); }

.btn-publish-v2 {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 0.7rem 1.8rem;
    border-radius: 20px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}
.btn-publish-v2:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Screener Back Button ─── */
.btn-back-round {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
}
.btn-back-round svg {
    width: 18px;
    height: 18px;
}
.btn-back-round:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
    transform: translateX(-2px);
}

/* ─── Mobile Forum Layout ─── */
@media (max-width: 768px) {
    .forum-layout {
        display: block;
        width: 100%;
        overflow-x: hidden;
    }
    .forum-top-search {
        justify-content: flex-end;
        padding: 0.5rem 0;
    }
    .search-pill {
        width: 160px;
        padding: 0.4rem 0.8rem;
    }
    .search-pill input {
        font-size: 0.85rem;
    }
    .forum-main {
        width: 100%;
        padding: 0 2.5%;
        box-sizing: border-box;
    }
    .forum-post-content {
        font-size: 0.85rem;
    }
    .forum-feed-container {
        max-width: 100% !important;
        padding: 0;
    }
    /* Remove card-style borders to be flat Reddit mobile style but keep them slightly rounded if requested */
    .forum-post-card {
        border-radius: 12px;
        margin: 0.5rem;
        border: 1px solid var(--border-color);
        box-shadow: none;
        padding: 1rem 0.8rem;
    }
    .forum-post-card:hover {
        transform: none;
        box-shadow: none;
    }
    .forum-feed {
        gap: 0; /* No gap — posts are separated by bottom border lines */
        padding: 0;
    }

    /* Sidebar as a drawer from the left */
    .forum-sidebar-toggle {
        display: flex !important;
        position: absolute !important;
        top: 10px !important;
        left: 10px !important;
        z-index: 1001 !important;
        width: 36px !important;
        height: 36px !important;
    }
    .forum-sidebar {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        z-index: 2000 !important;
        transform: translateX(-100%) !important;
        box-shadow: 10px 0 30px rgba(0,0,0,0.5) !important;
        transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
        background: var(--bg-secondary) !important;
        border-radius: 0 !important;
        padding: 1.5rem 1rem !important;
    }
    .forum-sidebar.mobile-open {
        transform: translateX(0) !important;
        opacity: 1 !important;
        width: 260px !important;
        pointer-events: auto !important;
    }
    .forum-sidebar-divider {
        display: none !important;
    }

    /* Bottom nav: Reddit-like full-width bar on mobile */
    .bottom-nav {
        width: 100%;
        max-width: 100%;
        left: 0;
        bottom: 0;
        transform: translateY(0);
        transition: transform 0.3s ease, background 0.3s;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        border-top: 1px solid var(--border-subtle);
        padding: 0.3rem 0;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    }
    .bottom-nav.nav-hidden {
        transform: translateY(105%);
    }
    .bottom-nav .nav-container {
        justify-content: space-around;
    }
    .bottom-nav .nav-divider {
        display: none;
    }
    .bottom-nav .nav-btn {
        padding: 0.5rem 0;
    }
    .bottom-nav .nav-btn .nav-label {
        font-size: 0.55rem;
    }
    .bottom-nav .nav-btn .nav-icon {
        font-size: 1.25rem;
    }
}

.header-logo-icon {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    transition: all var(--transition-normal);
}

#toggleHistoryBtn,
#toggleScreenerBtn,
.btn-invest-toggle {
    flex: 1 !important;
    font-size: 0.72rem !important;
    padding: 8px 16px !important;
    border-radius: 50px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: var(--text-primary) !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 500 !important;
}

#toggleHistoryBtn:hover,
#toggleScreenerBtn:hover,
.btn-invest-toggle:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--accent-primary) !important;
}

/* ─── Settings Menu (Configuración) ─── */
/* Monthly Investment Tracker */
.monthly-tracker-section {
    padding: var(--spacing-md);
    max-width: 1280px;
    margin: 0 auto 5rem;
    animation: fadeIn 0.35s ease;
}

.tracker-topbar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.tracker-title-block h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.tracker-title-block p {
    margin: 0.15rem 0 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.monthly-tracker-form {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
}

.tracker-form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    gap: 0.75rem;
}

.tracker-form-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.tracker-form-grid input {
    width: 100%;
    min-height: 40px;
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 0.55rem 0.7rem;
    font-family: inherit;
    font-size: 0.86rem;
}

.tracker-form-grid input:focus {
    outline: none;
    border-color: rgba(76, 141, 255, 0.55);
    box-shadow: 0 0 0 3px rgba(76, 141, 255, 0.12);
}

.tracker-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 0.9rem;
}

.monthly-tracker-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.7rem;
    margin-bottom: 1rem;
}

.tracker-stat {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem;
}

.tracker-stat span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.72rem;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
}

.tracker-stat strong {
    color: var(--text-primary);
    font-size: 1rem;
}

.monthly-table-wrap {
    overflow: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    max-height: 58vh;
}

.monthly-tracker-table {
    width: 100%;
    min-width: 1540px;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.monthly-tracker-table th,
.monthly-tracker-table td {
    border-right: 1px solid rgba(0, 0, 0, 0.34);
    border-bottom: 1px solid rgba(0, 0, 0, 0.34);
    padding: 0.6rem 0.7rem;
    text-align: right;
    white-space: nowrap;
}

.monthly-tracker-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.68rem;
}

.monthly-tracker-table th:first-child,
.monthly-tracker-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    text-align: left;
    background: var(--bg-elevated);
}

.monthly-tracker-table th:first-child {
    z-index: 3;
}

.monthly-tracker-table tbody tr:hover td {
    background-color: rgba(255, 255, 255, 0.035);
}

.tracker-month {
    color: var(--text-primary);
    font-weight: 700;
}

.is-positive {
    color: var(--color-success) !important;
}

.is-negative {
    color: var(--color-danger) !important;
}

.tracker-row-actions {
    display: flex;
    gap: 0.35rem;
    justify-content: flex-end;
}

.tracker-row-actions button {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    cursor: pointer;
}

.tracker-row-actions button:hover {
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.1);
}

.tracker-empty,
.tracker-empty-cell {
    color: var(--text-secondary);
    text-align: center;
    padding: 1rem;
}

.monthly-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.monthly-chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.9rem;
    overflow: hidden;
}

.monthly-chart-card-wide {
    grid-column: 1 / -1;
}

.monthly-chart-card h3 {
    margin: 0 0 0.75rem;
    color: var(--text-primary);
    font-size: 1rem;
}

.monthly-chart {
    position: relative;
}

.monthly-chart svg {
    width: 100%;
    height: auto;
    display: block;
}

.chart-grid-line {
    stroke: rgba(255, 255, 255, 0.12);
    stroke-width: 1;
}

.chart-zero-line {
    stroke: rgba(255, 255, 255, 0.28);
    stroke-width: 1.5;
}

.chart-axis-label {
    fill: var(--text-secondary);
    font-size: 11px;
}

.chart-hover-layer {
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.chart-hover-layer.is-visible {
    opacity: 1;
}

.chart-hover-line {
    stroke: rgba(255, 255, 255, 0.55);
    stroke-width: 1.4;
    stroke-dasharray: 5 5;
}

.chart-hover-point {
    stroke: var(--bg-card);
    stroke-width: 2.5;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.28));
}

.chart-hover-capture {
    fill: transparent;
    cursor: crosshair;
}

.chart-tooltip {
    position: absolute;
    z-index: 4;
    min-width: 170px;
    max-width: 240px;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-sm);
    background: rgba(18, 20, 23, 0.94);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    font-size: 0.76rem;
    line-height: 1.45;
    opacity: 0;
    pointer-events: none;
    transform: translate(12px, 0);
    transition: opacity var(--transition-fast);
}

.chart-tooltip.align-right {
    transform: translate(calc(-100% - 12px), 0);
}

.chart-tooltip.is-visible {
    opacity: 1;
}

.chart-tooltip strong,
.chart-tooltip span {
    display: block;
}

.chart-tooltip strong {
    margin-bottom: 0.35rem;
}

.chart-tooltip span {
    color: var(--text-secondary);
    white-space: nowrap;
}

.chart-tooltip i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.35rem;
}

.chart-tooltip b {
    color: var(--text-primary);
}

.chart-legend-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
}

.chart-legend-inline span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.chart-legend-inline i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.chart-empty {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 760px) {
    .monthly-tracker-summary,
    .monthly-charts-grid {
        grid-template-columns: 1fr;
    }

    .tracker-form-grid {
        grid-template-columns: 1fr 1fr;
    }

    .tracker-form-actions {
        flex-direction: column-reverse;
    }

    .tracker-form-actions button {
        width: 100%;
    }
}

.settings-list {
    display: flex;
    flex-direction: column;
}

.settings-item {
    border-bottom: 1px solid var(--divider-color);
    transition: background 0.2s ease;
}

.settings-item-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.settings-item-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.settings-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-item-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-item-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.settings-chevron {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.settings-item.active .settings-chevron {
    transform: rotate(90deg);
}

.settings-item-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.settings-item.active .settings-item-content {
    display: block;
}

/* ─── Physical Light Switch Toggle ─── */
.light-switch-container {
    padding: 5px;
}

.light-switch {
    width: 60px;
    height: 34px;
    background: #222;
    border: 2px solid #111;
    border-radius: 6px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    box-shadow: 
        inset 0 2px 10px rgba(0,0,0,0.8),
        0 1px 0 rgba(255,255,255,0.05);
    overflow: hidden;
}

.switch-inner {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: 24px;
    background: linear-gradient(180deg, #444, #222);
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 
        0 2px 5px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

.switch-glow {
    position: absolute;
    inset: 0;
    background: var(--accent-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
    filter: blur(10px);
    z-index: 0;
}

/* On state (Dark Mode) - The switch is "ON" and glowing */
[data-theme="dark"] .light-switch {
    background: #111;
    border-color: var(--accent-primary);
    box-shadow: 
        inset 0 2px 10px rgba(0,0,0,0.8),
        0 0 15px rgba(var(--accent-primary-rgb, 0, 102, 255), 0.3);
}

[data-theme="dark"] .switch-inner {
    left: calc(100% - 28px);
    background: linear-gradient(180deg, var(--accent-primary), #0056b3);
    box-shadow: 0 0 10px var(--accent-primary);
}

[data-theme="dark"] .switch-glow {
    opacity: 0.2;
}

/* Off state (Light Mode) */
[data-theme="light"] .light-switch {
    background: #ddd;
    border-color: #ccc;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}

[data-theme="light"] .switch-inner {
    left: 4px;
    background: linear-gradient(180deg, #fff, #eee);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* ─── Academy / Learning (Blog 01 Orbit Style) ─── */
.learning-section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.learning-badge-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 1.5rem;
}

.learning-badge-dot {
    width: 8px;
    height: 8px;
    background: #D4FF3F;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(212, 255, 63, 0.5);
}

.learning-badge-text {
    font-size: 12px;
    color: #767676;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.learning-main-h2 {
    font-size: 42px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 14px;
}

.learning-main-p {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

.course-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 20px;
    padding: 0 10px;
}

@media (min-width: 768px) {
    .course-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.course-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 16px;
    transition: all 0.5s ease;
    cursor: pointer;
    height: 100%;
    position: relative;
}

.course-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border-color: var(--color-blue);
}

.course-thumb-container {
    position: relative;
    aspect-ratio: 380 / 270;
    overflow: hidden;
    border-radius: 14px;
    margin-bottom: 14px;
}

.course-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease;
}

.course-card:hover .course-thumb-img {
    transform: scale(1.1);
}

.course-read-more-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.course-card:hover .course-read-more-overlay {
    opacity: 1;
}

.course-read-more-btn {
    background: #D4FF3F;
    color: #121212;
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 13px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.course-card:hover .course-read-more-btn {
    transform: translateY(0);
}

.course-card-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 0 8px 8px 8px;
}

.course-card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 14px;
    min-height: 48px;
    transition: color 0.3s ease;
}

.course-card:hover .course-card-title {
    color: #D4FF3F;
}

.course-card-divider {
    width: 100%;
    border-top: 1px dotted var(--border-color);
    margin-bottom: 14px;
}

.course-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.course-author {
    display: flex;
    align-items: center;
    gap: 10px;
}

.course-author-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 0.7rem;
}

.course-author-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.course-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.course-cat-floating-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* ─── Course Detail View & Lessons ─── */
.course-detail-view {
    animation: fadeIn 0.3s ease;
}

.course-detail-top {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.course-detail-title-area { flex: 1; }

.course-detail-cat {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.6rem;
}

.course-detail-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 0.4rem 0;
    line-height: 1.2;
}

.btn-course-video {
    background: rgba(255, 0, 0, 0.15);
    border: 1px solid rgba(255, 0, 0, 0.3);
    color: #FF4444;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-course-video:hover {
    background: rgba(255, 0, 0, 0.25);
    transform: translateY(-1px);
}

.course-detail-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin: 0 0 1.2rem 0;
    line-height: 1.5;
}

.course-external-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.course-link-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.course-link-pill svg {
    width: 18px;
    height: 18px;
}

.course-link-pill.youtube {
    background: rgba(255, 0, 0, 0.1);
    color: #FF4444;
    border-color: rgba(255, 0, 0, 0.2);
}

.course-link-pill.youtube:hover {
    background: rgba(255, 0, 0, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.2);
}

.course-link-pill.podcast {
    background: rgba(30, 215, 96, 0.1);
    color: #1ED760;
    border-color: rgba(30, 215, 96, 0.2);
}

.course-link-pill.podcast:hover {
    background: rgba(30, 215, 96, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 215, 96, 0.2);
}

.course-link-pill.pdf {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.1);
}

.course-link-pill.pdf:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.course-lessons-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
}

.course-lessons-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-add-lesson {
    background: rgba(212,255,63,0.15);
    border: 1px solid rgba(212,255,63,0.3);
    color: #D4FF3F;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-add-lesson:hover {
    background: rgba(212,255,63,0.25);
    transform: translateY(-1px);
}

/* Lesson Form */
.lesson-form-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.2rem;
    margin-bottom: 1.5rem;
    animation: slideUp 0.3s ease;
}

.lesson-form { display: flex; flex-direction: column; gap: 0.8rem; }

.lesson-form .form-group label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 600;
}

.lesson-form .form-group input,
.lesson-form .form-group textarea {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.lesson-form .form-group input:focus,
.lesson-form .form-group textarea:focus {
    outline: none;
    border-color: rgba(102,126,234,0.5);
}

.lesson-form-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
    margin-top: 0.4rem;
}

/* Lessons Grid */
.lessons-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lesson-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 12px 14px;
    transition: all 0.25s ease;
    position: relative;
    cursor: pointer;
}

.lesson-card:hover {
    border-color: rgba(102,126,234,0.3);
    background: rgba(255,255,255,0.03);
    transform: translateX(4px);
}

.lesson-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(102,126,234,0.2), rgba(118,75,162,0.2));
    border: 1px solid rgba(102,126,234,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
    color: var(--text-primary);
    flex-shrink: 0;
}

.lesson-video-area {
    width: 90px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    background: rgba(0,0,0,0.3);
}

.lesson-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lesson-yt-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.lesson-yt-placeholder .yt-icon {
    width: 22px;
    height: 22px;
    color: rgba(255,255,255,0.2);
}

.lesson-yt-placeholder span {
    font-size: 0.55rem;
    color: rgba(255,255,255,0.25);
}

.has-video .lesson-yt-placeholder .yt-icon { color: #FF0000; opacity: 0.7; }

.lesson-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.35);
    opacity: 0;
    transition: opacity 0.2s;
}

.lesson-card:hover .lesson-play-overlay { opacity: 1; }

.lesson-play-overlay .yt-icon {
    width: 28px;
    height: 28px;
    color: #FF0000;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.lesson-info {
    flex: 1;
    min-width: 0;
}

.lesson-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lesson-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0 0 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lesson-card.expanded {
    align-items: flex-start;
}

.lesson-card.expanded .lesson-title,
.lesson-card.expanded .lesson-desc {
    white-space: pre-wrap;
    overflow: visible;
    text-overflow: clip;
}

.lesson-yt-link-text {
    font-size: 0.7rem;
    color: #FF4444;
    font-weight: 600;
}

.lesson-no-video-text {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}

.lesson-admin-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.btn-lesson-edit, .btn-lesson-delete {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 4px 6px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.15s;
}

.btn-lesson-edit:hover { background: rgba(102,126,234,0.2); border-color: rgba(102,126,234,0.3); }
.btn-lesson-delete:hover { background: rgba(255,68,68,0.2); border-color: rgba(255,68,68,0.3); }

/* Mobile adjustments for lessons */
@media (max-width: 768px) {
    .course-detail-title { font-size: 1.25rem; }
    .lesson-video-area { width: 72px; height: 45px; }
    .lesson-card { gap: 10px; padding: 10px; }
    .lesson-title { font-size: 0.82rem; }
}

/* ─── Notification System ─── */

/* Bell button in header */
.notif-bell-btn {
    position: relative;
    font-size: 1.1rem;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #FF4444;
    color: white;
    font-size: 0.6rem;
    font-weight: 800;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* Individual notification items */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 1.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
}

.notif-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.notif-item.unread {
    background: rgba(102, 126, 234, 0.06);
}

.notif-item.unread:hover {
    background: rgba(102, 126, 234, 0.1);
}

.notif-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
}

.notif-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.notif-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    border-radius: 50%;
}

.notif-body {
    flex: 1;
    min-width: 0;
}

.notif-text {
    font-size: 0.82rem;
    color: var(--text-primary);
    margin: 0 0 3px 0;
    line-height: 1.35;
}

.notif-text strong {
    font-weight: 700;
}

.notif-post-title {
    color: var(--accent-primary);
    font-weight: 600;
}

.notif-preview {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0 0 4px 0;
    font-style: italic;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notif-time {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.notif-unread-dot {
    position: absolute;
    top: 14px;
    right: 1.4rem;
    width: 8px;
    height: 8px;
    background: var(--color-blue);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--color-blue);
}

.notif-badge-header {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--color-red);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-primary);
}

/* Panel dropdown */
.notif-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.4);
    z-index: 5000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden;
}

.notif-panel.open {
    transform: translateX(0);
}

.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.4rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.notif-panel-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.notif-back-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 8px;
}

.notif-back-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    transform: translateX(-2px);
}

.notif-header-actions {
    display: flex;
    gap: 6px;
}

.notif-action-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.notif-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.notif-action-danger:hover {
    background: rgba(255, 68, 68, 0.15);
    border-color: rgba(255, 68, 68, 0.3);
    color: #FF6666;
}

/* Notification list */
.notif-list {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.notif-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* Individual notification items */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 1.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
}

.notif-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.notif-item.unread {
    background: rgba(102, 126, 234, 0.06);
}

.notif-item.unread:hover {
    background: rgba(102, 126, 234, 0.1);
}

.notif-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
}

.notif-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.notif-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    border-radius: 50%;
}

.notif-body {
    flex: 1;
    min-width: 0;
}

.notif-text {
    font-size: 0.82rem;
    color: var(--text-primary);
    margin: 0 0 3px 0;
    line-height: 1.35;
}

.notif-text strong {
    font-weight: 700;
}

.notif-post-title {
    color: var(--accent-primary);
    font-weight: 600;
}

.notif-preview {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0 0 4px 0;
    font-style: italic;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notif-time {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.notif-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    flex-shrink: 0;
    margin-top: 6px;
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.5);
}

/* Subscribe bell in post */
.forum-subscribe-btn {
    transition: all 0.25s ease !important;
}

.forum-subscribe-btn.subscribed {
    color: #D4FF3F !important;
    text-shadow: 0 0 8px rgba(212, 255, 63, 0.4);
}

.forum-subscribe-btn:hover {
    transform: scale(1.15);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .notif-panel {
        width: 100vw;
        border-left: none;
    }
}

/* Idea Tracking Colors */
.forum-post-card.idea-win { border: 1px solid rgba(34, 197, 94, 0.3) !important; background: rgba(34, 197, 94, 0.05) !important; }
.forum-post-card.idea-loss { border: 1px solid rgba(239, 68, 68, 0.3) !important; background: rgba(239, 68, 68, 0.05) !important; }
.forum-post-card.idea-pending { border: 1px solid rgba(234, 179, 8, 0.3) !important; background: rgba(234, 179, 8, 0.05) !important; }

.lesson-card.expanded .lesson-title, 
.lesson-card.expanded .lesson-desc, 
.lesson-card.expanded .lesson-desc-html { 
    white-space: pre-wrap; 
    overflow: visible; 
    text-overflow: clip; 
    max-height: none !important; 
} 

.lesson-card.expanded .lesson-desc-html > div[style*="position:absolute"] { 
    display: none !important; 
}

.lesson-card.expanded {
    flex-wrap: wrap;
}

.lesson-card.expanded .lesson-info {
    width: 100%;
    min-width: 100%;
    margin-top: 5px;
}

.lesson-card.expanded .lesson-desc-html {
    padding: 0 5px;
    word-break: break-word;
}

.lesson-card.expanded .lesson-admin-actions {
    position: absolute;
    top: 12px;
    right: 12px;
}

/* ===================================
   Expense Detail Modal (Chart click)
   =================================== */
.expense-detail-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 12, 16, 0.7);
    backdrop-filter: blur(12px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeIn 0.25s ease;
}

.expense-detail-modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 
                0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.expense-detail-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--divider-color);
}

.expense-detail-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.expense-detail-title-group h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.expense-detail-user-tag {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.expense-detail-user-tag.user-nico {
    background: var(--color-blue-soft);
    color: var(--color-blue);
}

.expense-detail-user-tag.user-fabi {
    background: var(--color-orange-soft);
    color: var(--color-orange);
}

.expense-detail-close {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.expense-detail-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    transform: scale(1.05);
}

.expense-detail-body {
    padding: 1.25rem 1.5rem;
    max-height: 50vh;
    overflow-y: auto;
}

.expense-detail-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.expense-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.expense-detail-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-subtle);
    transform: translateX(2px);
}

.expense-detail-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.expense-card-badge {
    width: 36px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.expense-card-badge.visa {
    background: var(--gradient-visa);
}
.expense-card-badge.master {
    background: var(--gradient-master);
}
.expense-card-badge.mercadopago {
    background: var(--gradient-mercadopago);
}

.expense-card-badge svg,
.expense-card-badge img {
    height: 16px !important;
    width: auto !important;
    max-width: 80% !important;
    max-height: 80% !important;
    object-fit: contain !important;
}

.expense-item-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.expense-item-desc {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.expense-item-installment {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.expense-detail-item-right {
    flex-shrink: 0;
    text-align: right;
}

.expense-item-amount {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
}

.expense-detail-footer {
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--divider-color);
    background: rgba(0, 0, 0, 0.15);
}

.expense-detail-footer span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.expense-detail-total {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--color-accent-alt);
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

