/* =====================================================
   PERSONAL CASHFLOW — Design System "Obsidian Analytics"
   Direction artistique : Dark Premium SaaS
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');

/* =====================================================
   VARIABLES
   ===================================================== */
:root {
    /* Background layers */
    --bg-base:        #060D1F;
    --bg-elevated:    #0A1628;
    --bg-card:        rgba(14, 24, 52, 0.75);
    --bg-card-hover:  rgba(20, 34, 68, 0.85);
    --bg-input:       rgba(6, 13, 31, 0.8);

    /* Primary — Indigo/Violet */
    --primary:        #6366F1;
    --primary-dark:   #4F46E5;
    --primary-light:  #818CF8;
    --primary-glow:   rgba(99, 102, 241, 0.35);
    --gradient-1:     linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);

    /* Accent palette */
    --accent-cyan:    #22D3EE;
    --accent-emerald: #34D399;
    --accent-rose:    #FB7185;
    --accent-amber:   #FBBF24;
    --accent-violet:  #A78BFA;

    /* Semantic gradients */
    --gradient-cyan:    linear-gradient(135deg, #0891B2 0%, #22D3EE 100%);
    --gradient-emerald: linear-gradient(135deg, #059669 0%, #34D399 100%);
    --gradient-rose:    linear-gradient(135deg, #E11D48 0%, #FB7185 100%);
    --gradient-amber:   linear-gradient(135deg, #D97706 0%, #FBBF24 100%);
    --gradient-violet:  linear-gradient(135deg, #7C3AED 0%, #A78BFA 100%);

    /* Text */
    --text-primary:   #E2E8F0;
    --text-secondary: #8892B0;
    --text-muted:     #3D4A6B;

    /* Borders */
    --border:         rgba(99, 102, 241, 0.15);
    --border-bright:  rgba(99, 102, 241, 0.35);

    /* Shadows */
    --shadow:         0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-md:      0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-lg:      0 12px 48px rgba(0, 0, 0, 0.65);
    --shadow-xl:      0 20px 60px rgba(0, 0, 0, 0.7);
    --glow-primary:   0 0 40px rgba(99, 102, 241, 0.25);

    /* UI */
    --radius:    16px;
    --radius-sm: 10px;
    --radius-xs: 6px;

    /* Legacy compat */
    --success: #34D399;
    --danger:  #FB7185;
    --warning: #FBBF24;
}

/* =====================================================
   RESET
   ===================================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* =====================================================
   BODY & AURORA BACKGROUND
   ===================================================== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(99, 102, 241, 0.18) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 80%, rgba(139, 92, 246, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse 50% 40% at 50% 50%, rgba(34, 211, 238, 0.06) 0%, transparent 50%);
    animation: aurora 20s ease-in-out infinite alternate;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 70% 55% at 80% 20%, rgba(167, 139, 250, 0.1) 0%, transparent 55%),
        radial-gradient(ellipse 55% 45% at 10% 80%, rgba(52, 211, 153, 0.08) 0%, transparent 50%);
    animation: aurora 28s ease-in-out infinite alternate-reverse;
}

@keyframes aurora {
    0%   { transform: translate(0, 0) scale(1); }
    33%  { transform: translate(3%, 5%) scale(1.04); }
    66%  { transform: translate(-4%, -3%) scale(0.97); }
    100% { transform: translate(2%, -4%) scale(1.02); }
}

/* =====================================================
   CONTAINER
   ===================================================== */
.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px 28px 48px;
    position: relative;
    z-index: 1;
}

/* =====================================================
   HEADER
   ===================================================== */
.header {
    background: var(--bg-card);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid var(--border);
    padding: 24px 36px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg), var(--glow-primary);
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--gradient-1);
    opacity: 0.9;
}

.header::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(99,102,241,0.08) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
    opacity: 0.6;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    z-index: 1;
}

.header-icon {
    width: 44px;
    height: 44px;
    object-fit: contain;
    filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.6));
}

.header-logo-text {
    display: flex;
    flex-direction: column;
}

.header h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.header-subtitle {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-top: 2px;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    position: relative;
    z-index: 1;
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background 0.2s;
}

.btn:hover::after { background: rgba(255,255,255,0.07); }

.btn-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    flex-shrink: 0;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 4px 16px var(--primary-glow);
    border: 1px solid rgba(255,255,255,0.1);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--primary-glow);
}

.btn-secondary {
    background: rgba(30, 40, 72, 0.9);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    color: var(--text-primary);
    border-color: var(--border-bright);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: linear-gradient(135deg, #BE123C 0%, #FB7185 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(251, 113, 133, 0.3);
    border: 1px solid rgba(255,255,255,0.08);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(251, 113, 133, 0.4);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-edit {
    background: rgba(34, 211, 238, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(34, 211, 238, 0.2);
}

.btn-edit:hover {
    background: rgba(34, 211, 238, 0.18);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(34, 211, 238, 0.2);
}

.btn-delete {
    background: rgba(251, 113, 133, 0.1);
    color: var(--accent-rose);
    border: 1px solid rgba(251, 113, 133, 0.2);
}

.btn-delete:hover {
    background: rgba(251, 113, 133, 0.18);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(251, 113, 133, 0.2);
}

/* =====================================================
   NAV TABS
   ===================================================== */
.nav-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 24px;
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    padding: 8px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    letter-spacing: 0.1px;
}

.tab-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    transition: all 0.3s;
    opacity: 0.6;
    filter: brightness(0) invert(0.6);
}

.tab-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
}

.tab-btn:hover .tab-icon {
    opacity: 0.9;
    transform: scale(1.05);
    filter: brightness(0) invert(0.9);
}

.tab-btn.active {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 4px 20px var(--primary-glow);
}

.tab-btn.active .tab-icon {
    filter: brightness(0) invert(1);
    opacity: 1;
}

/* =====================================================
   TAB CONTENT
   ===================================================== */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: tabFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* =====================================================
   STATS GRID
   ===================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

@media (max-width: 1200px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px)  { .stats-grid { grid-template-columns: 1fr; } }

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    gap: 18px;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    cursor: default;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    transition: height 0.3s;
}

.stat-card:nth-child(1)::before { background: var(--gradient-1); }
.stat-card:nth-child(2)::before { background: var(--gradient-emerald); }
.stat-card:nth-child(3)::before { background: var(--gradient-rose); }
.stat-card:nth-child(4)::before { background: var(--gradient-amber); }
.stat-card:nth-child(5)::before { background: var(--gradient-cyan); }
.stat-card:nth-child(6)::before { background: var(--gradient-violet); }

.stat-card::after {
    content: '';
    position: absolute;
    bottom: -30px;
    right: -20px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    opacity: 0.06;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.stat-card:nth-child(1)::after { background: #6366F1; }
.stat-card:nth-child(2)::after { background: #34D399; }
.stat-card:nth-child(3)::after { background: #FB7185; }
.stat-card:nth-child(4)::after { background: #FBBF24; }
.stat-card:nth-child(5)::after { background: #22D3EE; }
.stat-card:nth-child(6)::after { background: #A78BFA; }

.stat-card:hover {
    transform: translateY(-6px);
    border-color: var(--border-bright);
    box-shadow: var(--shadow-xl);
    background: var(--bg-card-hover);
}

.stat-card:hover::before { height: 3px; }
.stat-card:hover::after  { opacity: 0.14; transform: scale(1.3); }

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    transition: all 0.3s;
}

.stat-card:nth-child(1) .stat-icon { background: rgba(99, 102, 241, 0.12); border: 1px solid rgba(99, 102, 241, 0.2); }
.stat-card:nth-child(2) .stat-icon { background: rgba(52, 211, 153, 0.12);  border: 1px solid rgba(52, 211, 153, 0.2); }
.stat-card:nth-child(3) .stat-icon { background: rgba(251, 113, 133, 0.12); border: 1px solid rgba(251, 113, 133, 0.2); }
.stat-card:nth-child(4) .stat-icon { background: rgba(251, 191, 36, 0.12);  border: 1px solid rgba(251, 191, 36, 0.2); }
.stat-card:nth-child(5) .stat-icon { background: rgba(34, 211, 238, 0.12);  border: 1px solid rgba(34, 211, 238, 0.2); }
.stat-card:nth-child(6) .stat-icon { background: rgba(167, 139, 250, 0.12); border: 1px solid rgba(167, 139, 250, 0.2); }

.stat-card:hover .stat-icon { transform: scale(1.08) rotate(4deg); }

.stat-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}

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

.stat-info h3 {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
}

.stat-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 6px;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    word-break: break-all;
}

.stat-card:nth-child(1) .stat-value { background: var(--gradient-1); -webkit-background-clip: text; background-clip: text; }
.stat-card:nth-child(2) .stat-value { background: var(--gradient-emerald); -webkit-background-clip: text; background-clip: text; }
.stat-card:nth-child(3) .stat-value { background: var(--gradient-rose); -webkit-background-clip: text; background-clip: text; }
.stat-card:nth-child(4) .stat-value { background: var(--gradient-amber); -webkit-background-clip: text; background-clip: text; }
.stat-card:nth-child(5) .stat-value { background: var(--gradient-cyan); -webkit-background-clip: text; background-clip: text; }
.stat-card:nth-child(6) .stat-value { background: var(--gradient-violet); -webkit-background-clip: text; background-clip: text; }

/* Dynamic overrides for cashflow card */
.stat-card.cashflow-positive .stat-value { background: var(--gradient-emerald) !important; -webkit-background-clip: text !important; background-clip: text !important; }
.stat-card.cashflow-negative .stat-value { background: var(--gradient-rose) !important; -webkit-background-clip: text !important; background-clip: text !important; }
.stat-card.savings-low     .stat-value   { background: var(--gradient-rose) !important; -webkit-background-clip: text !important; background-clip: text !important; }
.stat-card.savings-medium  .stat-value   { background: var(--gradient-amber) !important; -webkit-background-clip: text !important; background-clip: text !important; }
.stat-card.savings-high    .stat-value   { background: var(--gradient-emerald) !important; -webkit-background-clip: text !important; background-clip: text !important; }

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* =====================================================
   CHARTS GRID
   ===================================================== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

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

.chart-card {
    background: var(--bg-card);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid var(--border);
    padding: 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.chart-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
}

.charts-grid .chart-card:nth-child(1)::before { background: var(--gradient-rose); }
.charts-grid .chart-card:nth-child(2)::before { background: var(--gradient-emerald); }

.chart-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-bright);
    box-shadow: var(--shadow-xl);
}

.chart-card h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-wrapper-donut {
    position: relative;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-wrapper-bar {
    position: relative;
    height: 280px;
}

.section-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
}

/* =====================================================
   RECENT SECTION
   ===================================================== */
.recent-section {
    background: var(--bg-card);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid var(--border);
    padding: 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

.recent-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--gradient-amber);
}

.recent-section:hover {
    border-color: var(--border-bright);
    box-shadow: var(--shadow-xl);
}

.recent-section h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

/* =====================================================
   SECTION HEADER
   ===================================================== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: var(--bg-card);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid var(--border);
    padding: 20px 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    flex-wrap: wrap;
    gap: 16px;
}

.section-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--gradient-1);
}

.section-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* =====================================================
   FILTER TABS (expense filter)
   ===================================================== */
.filter-tabs {
    display: flex;
    gap: 4px;
    background: rgba(6, 13, 31, 0.6);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px;
}

.filter-pill input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.filter-pill {
    cursor: pointer;
}

.filter-pill span {
    display: block;
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    user-select: none;
}

.filter-pill input:checked + span {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 2px 12px var(--primary-glow);
}

.filter-pill:hover span {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.12);
}

/* =====================================================
   EXPENSES TOTAL BAR
   ===================================================== */
.expenses-total-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    margin-bottom: 16px;
}

.expenses-total-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.expenses-total-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 800;
    background: var(--gradient-rose);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* =====================================================
   ITEMS LIST (incomes & expenses)
   ===================================================== */
.items-list {
    display: grid;
    gap: 14px;
}

.income-item,
.expense-item {
    background: var(--bg-card);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid var(--border);
    padding: 20px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeIn 0.3s ease-out;
}

.income-item::before,
.expense-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    transition: height 0.3s;
}

/* Rotating gradient top borders */
.income-item:nth-child(6n+1)::before  { background: var(--gradient-1); }
.income-item:nth-child(6n+2)::before  { background: var(--gradient-emerald); }
.income-item:nth-child(6n+3)::before  { background: var(--gradient-cyan); }
.income-item:nth-child(6n+4)::before  { background: var(--gradient-amber); }
.income-item:nth-child(6n+5)::before  { background: var(--gradient-rose); }
.income-item:nth-child(6n+6)::before  { background: var(--gradient-violet); }

.expense-item:nth-child(6n+1)::before { background: var(--gradient-rose); }
.expense-item:nth-child(6n+2)::before { background: var(--gradient-amber); }
.expense-item:nth-child(6n+3)::before { background: var(--gradient-1); }
.expense-item:nth-child(6n+4)::before { background: var(--gradient-cyan); }
.expense-item:nth-child(6n+5)::before { background: var(--gradient-emerald); }
.expense-item:nth-child(6n+6)::before { background: var(--gradient-violet); }

.income-item:hover,
.expense-item:hover {
    transform: translateY(-4px);
    border-color: var(--border-bright);
    box-shadow: var(--shadow-xl);
    background: var(--bg-card-hover);
}

.income-item:hover::before,
.expense-item:hover::before { height: 3px; }

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.item-title-group {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    gap: 8px;
    flex-wrap: wrap;
}

.item-detail {
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
}

.item-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.item-frequency {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

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

.item-amount {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 20px;
    font-weight: 800;
    white-space: nowrap;
}

.item-amount.income-amount {
    background: var(--gradient-emerald);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.item-amount.expense-amount {
    background: var(--gradient-rose);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.item-monthly-equiv {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* =====================================================
   BADGES
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-category {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
}

/* Nature badges */
.nature-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.nature-badge.recurring {
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.25);
    color: var(--accent-emerald);
}

.nature-badge.recurring::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-emerald);
    box-shadow: 0 0 6px var(--accent-emerald);
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

.nature-badge.one-shot {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.25);
    color: var(--accent-amber);
}

.nature-badge.one-shot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-amber);
    flex-shrink: 0;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 4px currentColor; opacity: 1; }
    50%       { box-shadow: 0 0 10px currentColor; opacity: 0.7; }
}

/* Frequency badge */
.freq-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(167, 139, 250, 0.1);
    border: 1px solid rgba(167, 139, 250, 0.2);
    color: var(--accent-violet);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* =====================================================
   NATURE RADIO GROUP (modal)
   ===================================================== */
.nature-radio-group {
    display: flex;
    gap: 10px;
}

.nature-radio-label {
    cursor: pointer;
    flex: 1;
}

.nature-radio-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.nature-radio-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    border: 2px solid transparent;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.nature-recurring {
    background: rgba(52, 211, 153, 0.07);
    border-color: rgba(52, 211, 153, 0.2);
    color: var(--text-secondary);
}

.nature-oneshot {
    background: rgba(251, 191, 36, 0.07);
    border-color: rgba(251, 191, 36, 0.2);
    color: var(--text-secondary);
}

.nature-radio-label input:checked + .nature-recurring {
    background: rgba(52, 211, 153, 0.15);
    border-color: rgba(52, 211, 153, 0.5);
    color: var(--accent-emerald);
    box-shadow: 0 0 16px rgba(52, 211, 153, 0.15);
}

.nature-radio-label input:checked + .nature-oneshot {
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.5);
    color: var(--accent-amber);
    box-shadow: 0 0 16px rgba(251, 191, 36, 0.15);
}

.nature-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all 0.25s;
}

.nature-recurring .nature-dot { background: var(--accent-emerald); }
.nature-oneshot  .nature-dot  { background: var(--accent-amber); }

.nature-radio-label input:checked + .nature-recurring .nature-dot {
    box-shadow: 0 0 8px var(--accent-emerald);
    animation: pulse 2s infinite;
}

/* =====================================================
   MONTHLY PREVIEW (income modal)
   ===================================================== */
.monthly-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(99, 102, 241, 0.07);
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.monthly-preview strong {
    color: var(--primary-light);
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 15px;
}

/* =====================================================
   FORMS
   ===================================================== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 7px;
    letter-spacing: 0.2px;
}

.required {
    color: var(--accent-rose);
    margin-left: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    background: rgba(6, 13, 31, 0.7);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    transition: all 0.2s;
    outline: none;
    -webkit-appearance: none;
}

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

.form-group select option {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.06);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238892B0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px !important;
    cursor: pointer;
}

/* =====================================================
   MODAL
   ===================================================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 18, 0.75);
    backdrop-filter: blur(8px);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), var(--glow-primary);
    animation: modalSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--gradient-1);
    border-radius: var(--radius) var(--radius) 0 0;
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(-20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

.modal-header h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 300;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: all 0.2s;
    background: transparent;
    border: none;
    line-height: 1;
}

.close:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}

.modal-body {
    padding: 24px 28px;
}

.modal-footer {
    padding: 16px 28px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* =====================================================
   EMPTY STATE
   ===================================================== */
.empty-state {
    text-align: center;
    padding: 64px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.4;
    display: block;
}

.empty-state h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* =====================================================
   ANIMATIONS
   ===================================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =====================================================
   SCROLLBAR
   ===================================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99, 102, 241, 0.5); }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
    .container { padding: 16px 16px 32px; }

    .header { padding: 18px 20px; flex-direction: column; align-items: flex-start; }
    .header-actions { width: 100%; flex-wrap: wrap; }
    .header-actions .btn { flex: 1; min-width: 120px; justify-content: center; }

    .section-header { flex-direction: column; align-items: flex-start; }
    .section-header-right { width: 100%; flex-direction: column; align-items: flex-start; }
    .section-header .btn { width: 100%; justify-content: center; }
    .filter-tabs { width: 100%; justify-content: center; }

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

    .tab-btn { padding: 10px 16px; font-size: 13px; }

    .stat-value { font-size: 22px; }

    .nature-radio-group { flex-direction: column; }

    .item-header { flex-direction: column; }
    .item-actions { align-self: flex-end; }

    .item-footer { flex-direction: column; align-items: flex-start; }
    .item-amount { align-self: flex-end; }
}

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